@ wrote... (7 years, 2 months ago)

It took a bit of doing but I was able to install Webzash in a Docker container behind a nginx web server. Here's how I did it.

Plus some notes on database permissions.

Note: I'm installing Webzash v2.6.1.

The general steps are:

  1. build the docker container
  2. prepare host environment
  3. start the container
  4. configure nginx

GitHub

You can find all these files on GitHub

Prep work

  • clone my git repo
  • download Webzash from here and put in the webzash-docker directory

Build the container

Create the following Dockerfile. By default the container listens on port 8030 but feel free to change the LISTEN_SOCKET environment variable.

Dockerfile

FROM fedora:21
MAINTAINER Kurt Neufeld <kneufeld@burgundywall.com>

RUN yum makecache
RUN yum -y install uwsgi uwsgi-plugin-php
RUN yum -y install php-pdo php-pgsql php-bcmath php-mysqlnd

RUN mkdir -p /opt
ADD webzash-v2.6.tar.gz /opt/
RUN chown -R uwsgi /opt/webzash

ENV LISTEN_SOCKET :8030
CMD uwsgi --uwsgi-socket $LISTEN_SOCKET --ini /opt/config/webzash.ini

create the image

Create the docker image with:

docker build -t webzash webzash
# or if you're using my Makefile, `make build`

Prepare the host

You could use a volume but I just created directory /etc/webzash and put two files in it.

empty database

Extract the configuration database out of the tarball with:

tar xvfz webzash-v2.6.tar.gz webzash/app/Plugin/Webzash/Database/webzash.sqlite
cp webzash/app/Plugin/Webzash/Database/webzash.sqlite /etc/webzash

Webzash is actually kind of interesting in how it works. The webzash.sqlite database just contains configuration and settings data, but in particular it holds the configuration to the real sql database. Note: webzash does not work with Postgresql 9.2.5 (and is marked as beta when you're configuring a connection).

Unfortunately each company and/or fiscal year requires it's own database or table prefix. This no doubt makes everything significantly simpler on the programming side but it's far from ideal. But then again, maybe there's some sort of fiduciary compliance bullshit in doing it this way. I don't know, I hate this crap.

Anyhow, back to our regular scheduled programming…

copy the uwsgi.ini file

I'm using uwsgi to actually serve the php application. There's probably better ways to do this but I don't care, this application needs to serve exactly one person, me.

cp uwsgi.ini /etc/webzash/

Start the container

docker run -d --name webzash -p 8030:8030 --net=host \
-v /etc/webzash/uwsgi.ini:/opt/config/webzash.ini \
-v /etc/webzash/webzash.sqlite:/opt/webzash/app/Plugin/Webzash/Database/webzash.sqlite \
webzash
# or `make cmd`

nginx

Figuring this out took the longest but it's real easy when you know how. Here's how.

location ~ ^/webzash {
    rewrite ^ /webzash/app/webroot/index.php break;

    include uwsgi_params;
    uwsgi_modifier1 14;
    uwsgi_pass <your docker host>:8030;
}

So now if you take your browser to https://your_website.com/webzash you should get the setup wizard.

Database Permissions

I ran into a huge roadblock trying to make another account (aka database) at the end of my fiscal year. Unfortunately the code that creates all the tables doesn't create the database, you have to do that yourself. Then you have to make sure that your database user has been granted all permissions on that database. Only then can you attempt to make a new account.

You get a very helpful error along the lines of Oh snap, there was a problem.

If all else fails then create the account via a database administrator account, just be aware that the database password is in plain text in the sqlite database.

Accounting

Just because you can now run some accounting software it sure as hell doesn't make you some fancy pants book keeper. I still haven't found a good explanation about how all this stuff works but I think I've got the basics figured out. I'll post a (probably wrong) explanation on how double entry book keeping works in a different post and link to it here. And here it is.

Category: tech, Tags: accounting, linux, nginx
Comments: 1
Comments
1.
Sasha Bemotoff @ April 25, 2020 wrote... (3 years, 1 month ago)

Great article!! Thank you so much!!!

Click here to add a comment