Skip to the content.

Invoice Ninja

Preparation

Note: The original invoiceninja/latest image can be run on Dokku. It includes only php-fpm as the base image though. Because this image lacks a web server, the default Dokku Nginx reverse proxy configuration does not work. To make it work on Dokku, it is necessary to either modify the Dokku reverse proxy to pass requests to php-fpm by fastcgi_pass or to create an image containing both the Invoiceninja app and an Nginx web server (with fastcgi_pass as well). The image dockerfiles/invoiceninja follows the seconds approach and combines the IN image with an Nginx web server.

Services

In the instructions for IN, you can find the docker run command to start a container. You can see the following:

Install the required plugins and create the services:

dokku mysql:create invoiceninja-mysql
dokku postgres:link invoiceninja-mysql invoiceninja

To get persistent storage volumes, mount the folders:

dokku storage:mount sentry /var/lib/dokku/data/storage/invoiceninja/public:/var/invoiceninja/public
dokku storage:mount sentry /var/lib/dokku/data/storage/invoiceninja/storage:/var/invoiceninja/storage

According to the docs, those folders must be owned by the correct user, since the user inside the container is not root:

chown -R 1000:82 /var/lib/dokku/data/storage/invoiceninja/public
chown -R 1000:82 /var/lib/dokku/data/storage/invoiceninja/storage

Config

To continue, you need to check out the documentation of the image you want to deploy to see what configuration or env variables need to be set. For IN, the following env variables are required:

There are additional optional variables you can set to configure emails and other external services.

Add proxy settings

dokku proxy:ports-add invoiceninja http:80:9000

Deploy

Run dokku git:from-image invoiceninja codefabrikgmbh/invoiceninja:latest

Migrate database

Run bash inside the container (i.e. with lazydocker) and run the following command: php artisan migrate