Open tamis-laan opened 8 months ago
Hi there a little input here and hope that can help you.
If your are looking for a docker run way there is already your "compact w/external database": This is documented on official Invoiceninja DockerHub: https://hub.docker.com/r/invoiceninja/invoiceninja
Create your key
docker run --rm -it invoiceninja/invoiceninja php artisan key:generate --show
Run with your env-variables customized
docker run -d \
-v /var/invoiceninja/public:/var/app/public \
-v /var/invoiceninja/storage:/var/app/storage \
-e APP_ENV='production' \
-e APP_DEBUG=0 \
-e APP_URL='http://ninja.dev' \
-e APP_KEY='<INSERT THE GENERATED APPLICATION KEY HERE>' \
-e APP_CIPHER='AES-256-CBC' \
-e DB_TYPE='mysql' \
-e DB_STRICT='false' \
-e DB_HOST='localhost' \
-e DB_DATABASE='ninja' \
-e DB_USERNAME='ninja' \
-e DB_PASSWORD='ninja' \
-p '80:80' \
invoiceninja/invoiceninja
You can change the need of volume bind and use docker volume by just customizing the following:
-v /var/invoiceninja/public:/var/app/public \
-v /var/invoiceninja/storage:/var/app/storage \
into the following:
-v public:/var/app/public \
-v storage:/var/app/storage \
Then having reached a truly one-liner docker run without full CLI / bash access to the server.
If a database is needed within the service then the right way is as it is done today with a compose, there is no reason for IN devs to use time for maintaining a MySQL with the images. Here I have been running InvoiceNinja with docker volumes from a Portainer/Dockage and plain vanilla docker-compose CLI with the need of git clone/pull into my server with existing:
The simple compose requirement:
volumes/binds for config and a persistent storages (volume / bind)
and for files that are required (pre-created config)
Here the docker-compose.yml can bee changes to include internal MySQL service or without and then point to external MySQL server, here is an example on how I'm running with docker-compose CLI without the pull (yes I needed to touch and copy config of the "in-vhost.conf" and then the "hosts" files that I have in volume bind on the host).
version: '3.7'
services:
server:
image: nginx
restart: always
env_file: stack.env
volumes:
- ./in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
- public:/var/www/app/public:ro
depends_on:
- app
ports:
- "80:80"
- "443:443"
networks:
- invoiceninja
- ingress
extra_hosts:
- "in5.localhost:192.168.0.124 " #host and ip
app:
image: invoiceninja/invoiceninja:5
env_file: stack.env
restart: always
volumes:
- ./hosts:/etc/hosts:ro
- public:/var/www/app/public:rw,delegated
- storage:/var/www/app/storage:rw,delegated
networks:
- invoiceninja
extra_hosts:
- "in5.localhost:192.168.0.124 " #host and ip
networks:
invoiceninja:
ingress:
external: true
volumes:
storage:
public:
volumes: storage: public:
Is the nugget which needs adding to the docs. Seems (for reasons I don't quite get) when running compose.. declare the volumes and networks to the stack they get instantiated by compose.. and referenced them in the app container.. this got my stack up and running.. none of the permissions hacks worked for me. So thanks @mwa85
@TomTinking thanks for your comment!
@turbo124 @lwj5 any suggestions to make this clearer/easier for people?
I'll add a usecase.
I'm trying to evaluate Invoice Ninja by installing it to my Raspberry Pi. My plan was:
However, (perhaps due to my lack of docker-compose knowledge), I can't seem to be able to do this.
I suspect that I am trying to do something the wrong way. For example, I want to be able to just go to http://10.1.1.123:8003 or http://raspberrypi.local:8003 in my laptop browser (the IP of the Pi on the LAN, and the configured port), and have it work. But this doesn't seem to be a supported mode of operation with the docker-compose file from this repository.
My docker-compose.yml
:
When I run podman-compose up -d
, everything appears to launch correctly with no errors.
But if I curl localhost:8003
from the remote machine, I just get the default nginx welcome page.
And if I load http://raspberrypi.local:8003 in my laptop browser, I get an nginx 403 forbidden page.
I have commented out the extra_hosts
sections because I just want to directly connect via IP address or avahi network name.
But perhaps that's what I'm doing wrong?
Just my 2 cents as an IT-service-provider and single-person-business-man:
You are well consulted to ask an IT-specialist in your area for help with Docker (Compose) and Invoice Ninja – exspecially if you decide to expose your installation online. Otherwise consider using the clouded version if it wouldn't violate local laws.
I host Invoice Ninja by myself using Docker-compose and I think that the Docker-Compose-way is the best combination of the Docker-way to containerize software on Linux. And I'm glad that there's a lot of help here by the involved people within the forum and the github-pages!
However, it's a feature of Docker not to put all the services into a one and only container/image. If you prefer that, I would advise you to set up a virtual host as a dedicated server based on the recommended OS (Ubuntu 20.04 for now). But it all require you as a versed user who has some experiences in server-computing. If you are not, I repeat: You are well consulted by looking for an experienced IT-sepcialist who has some experience with Linux, Docker (Compose) and hopefully with Invoice Ninja, too.
But perhaps that's what I'm doing wrong?
If you see the default "Welcome to nginx!", even though you get the INFO success: scheduler entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
, showing in the logs, then make sure you updated the config/hosts file to something like localhost invoice.test
, then try accessing the http(s)://invoice.test on your pc.
That part is easy to miss in the doc (I know I did..)
I'm looking into invoice ninja and I was really impressed watching some video tutorials on youtube.
However when trying to self host IN I feel like it's to complex and I'm just afraid of the maintenance issues that will arise in the future. I understand the design choices as it allows for redundancy, scaling and flexibility. But as a single person business it's problematic.
What would really work for me is a single container that incorporates everything, something like
invoiceninja/invoiceninja-compact
. It would contain the database, invoiceninja itself and the fastcgi reverse proxy with maybe the option to use an external mysql database.This would allow me to incorporate IN in my existing docker compose stack without trying to hack a separate git repo into it.