Docker Image for Akaunting
Go to file
Mohammed Al-Mahdawi e357aa07ce Remove trustedproxy.php 2021-12-24 14:13:01 +03:00
.github/workflows New Akaunting with Supervisor image 2021-06-18 18:29:24 +03:00
env closes #36; Update DB_HOST comment 2021-05-28 14:32:05 +03:00
files Remove trustedproxy.php 2021-12-24 14:13:01 +03:00
nginx Add new ways to explore containerized Akaunting! 2021-03-22 10:11:25 +03:00
.gitignore Consolidate nginx + php to single PHP/Apache container. 2021-01-26 19:27:26 -05:00
Dockerfile Consolidate nginx + php to single PHP/Apache container. 2021-01-26 19:27:26 -05:00
LICENSE.txt fixed #15 2021-01-29 11:19:02 +03:00
README.md New Akaunting with Supervisor image 2021-06-18 18:29:24 +03:00
docker-compose.yml Add container_name to compose files 2021-05-18 21:11:35 +03:00
fpm-alpine-docker-compose.yml Add new ways to explore containerized Akaunting! 2021-03-22 10:11:25 +03:00
fpm-alpine-nginx-composer-docker-compose.yml Add image that has npm and composer 2021-03-22 16:15:39 +03:00
fpm-alpine-nginx-composer-supervisor-docker-compose.yml New Akaunting with Supervisor image 2021-06-18 18:29:24 +03:00
fpm-alpine-nginx-composer-supervisor.Dockerfile New Akaunting with Supervisor image 2021-06-18 18:29:24 +03:00
fpm-alpine-nginx-composer.Dockerfile Clear npm proxy in fpm-alpine-nginx-composer image 2021-06-14 15:34:23 +03:00
fpm-alpine-nginx-docker-compose.yml New Akaunting with Supervisor image 2021-06-18 18:29:24 +03:00
fpm-alpine-nginx.Dockerfile Add new ways to explore containerized Akaunting! 2021-03-22 10:11:25 +03:00
fpm-alpine.Dockerfile Add new ways to explore containerized Akaunting! 2021-03-22 10:11:25 +03:00
fpm-docker-compose.yml Add container_name to compose files 2021-05-18 21:11:35 +03:00
fpm.Dockerfile Add new ways to explore containerized Akaunting! 2021-03-22 10:11:25 +03:00

README.md

Akaunting Docker Image

You can pull the latest image with docker pull docker.io/akaunting/akaunting:latest

Description

This repository defines how the official Akaunting images are built for Docker Hub.

Akaunting is online, open source and free accounting software built with modern technologies. Track your income and expenses with ease. For more information on Akaunting, please visit the website.

Prerequisites

  1. docker-compose, or the knowhow to use docker or podman to run these images.
  2. You'll need to use some other reverse proxy for TLS termination. HAProxy, Nginx, or Apache work fine and have integrations with Let'sEncrypt that let you request wildcard certificates. See Reverse proxying for TLS termination for more information. Reverse proxies are all trusted in these images to support use cases like Kubernetes Ingress.
  3. Your own cache, if you need to scale to lots of users. Memcached and Redis are popular choices. See the configuration for cache and redis if necessary. You can provide the variables for configuration via run.env.

Usage

git clone https://github.com/akaunting/docker
cd docker
cp env/db.env.example env/db.env
vi env/db.env # and set things
cp env/run.env.example env/run.env
vi env/run.env # and set things

AKAUNTING_SETUP=true docker-compose up -d

Then head to HTTP at port 8080 on the docker-compose host and finish configuring your Akaunting company through the interactive wizard.

After setup is complete, bring the containers down before bringing them back up without the setup variable.

docker-compose down
docker-compose up -d

Included is a watchtower container. This will automatically pull updates for the MariaDB and Akaunting images daily, restarting the containers with the new images when there has been an update.

Backup and restore

You could use something like the following commands to make backups for your deployment:

mkdir -p ~/backups
for volume in akaunting-data akaunting-modules akaunting-db; do
    docker run --rm -v $volume:/volume -v ~/backups:/backups alpine tar cvzf /backups/$volume-$(date +%Y-%m-%d).tgz -C /volume ./
done

In order to restore those backups, you would run something like:

backup=2021-01-26 # you should select the backup you want to restore here
for volume in akaunting-data akaunting-modules akaunting-db; do
    docker run --rm -v $volume:/volume -v ~/backups:/backups alpine sh -c "rm -rf /volume/* /volume/..?* /volume/.[!.]* ; tar xvzf /backups/$volume-$backup.tgz -C /volume"
done

A note on upgrades

The upgrade between 2.0.26 and 2.1.0 broke some things in existing deployments due to a Laravel version migration in Akaunting. In order to fix this, you could have run something like the following:

docker exec -it akaunting bash

Then, inside the container, the following:

php artisan view:clear

Future version migrations might require something like:

php artisan migrate --force

Application upgrade/migration logic is not baked into this application image. An upgrade between versions that requires intervention would best be encapsulated in something like a Kubernetes Operator, rather than adding to the complexity of the application image.

If you use these images in production, it is recommended to have a testing environment that draws automatic updates and exists so that you can validate the steps required to migrate between versions. Your production deployment should use pinned version tags, which are tagged based on the Akaunting release. Migrating your production version would then require manual intervention and enable you to take the manual steps necessary to complete the migration.

Reverse proxying for TLS termination

No configuration has been provided for TLS termination. The "right" TLS termination strategy and load balancing setup is highly subjective and depends very much on the rest of your environment. The container image accepts connections from any proxy, and recognizes the host from HTTP requests via the APP_URL environment variable.

Googling "letsencrypt haproxy" returns with a number of articles with decent instructions on how to set up HAProxy and certbot to automatically renew certificates served. Some extra keywords, like wildcard, give enough extra information to layer that into your configuration. If nginx makes more sense for your environment, an nginx configuration that stitches together the elements of load balancing, reverse proxying, and Let'sEncrypt can meet the same need. So can Apache, or a number of other webservers. The world is your oyster.

A robust TLS termination and load-balancing setup should outperform, and be easier to maintain than, many little nginx containers running with their own certificate lifecycles, even if they're automated. Running Akaunting in a container makes the most sense if you're running lots of services on fewer hosts, and for that use case a load-balancing reverse proxy for TLS termination might make more sense. Or it might not. Now you get to choose.

Languages

Right now, the only built language is US English. If you would like more supported locales to be built into the container image, please open an issue.

Extra ways to explore containerized Akaunting!

This repository contains extra compose and other files that allows you to run Akaunting in different setups like using FPM and NGINX and here is the most important commands that you may need:

# Run Akaunting with FPM on Debian and use Nginx as external proxy
AKAUNTING_SETUP=true docker-compose -f fpm-docker-compose.yml up --build

# Run Akaunting using FPM on Alpine and using Nginx as external proxy
AKAUNTING_SETUP=true docker-compose -f fpm-docker-compose.yml -f fpm-alpine-docker-compose.yml up --build

# Run Akaunting using FPM on Alpine and using Nginx as internal proxy
AKAUNTING_SETUP=true docker-compose -f fpm-alpine-nginx-docker-compose.yml up --build

# Download Akaunting using git and install composer and npm and run Akaunting using FPM on Alpine and using Nginx as internal proxy
AKAUNTING_SETUP=true docker-compose -f fpm-alpine-nginx-docker-compose.yml -f fpm-alpine-nginx-composer-docker-compose.yml up --build

# Download Akaunting using git and install composer and npm and run Akaunting using FPM on Alpine and using Nginx as internal proxy and supervisor to manage the queues
AKAUNTING_SETUP=true docker-compose -f fpm-alpine-nginx-docker-compose.yml -f fpm-alpine-nginx-composer-supervisor-docker-compose.yml up --build

License

Akaunting is released under the GPLv3 license.