Docker compose without nginx and db

Hi Guys,

Is there a docker compose config file or setup that we could use to deploy IN on an environment that already has a nginx and a DB Server? We basically want to use our own DB and proxy server, instead of having new ones deployed by IN on install.

I i’ve tried the steps here and tried removing the DB and proxy lines but nothing work, or i am missing something.

Thanks

2 Likes

Hi,

@david can you please advise?

I’m not an expert in Docker. but if you want to use your own nginx frontend, you’ll need to still somehow forward the requests from nginx to the Invoice Ninja container PHP process, and I can’t think of a way to do this without using nginx inside the invoice ninja container to reverse proxy those requests to the PHP process.

Any updates on this topic. I want to use my existing nginx proxy manager too.

1 Like

@LuKaS0473 @teds

nginx config example is provided here - https://github.com/invoiceninja/dockerfiles/blob/master/config/nginx/in-vhost.conf

as for db
use

QUEUE_CONNECTION=database

# DB connection
DB_HOST=db
DB_PORT=3306
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=ninja

in your env file to provide access to a compatible db instance you are already have

env source - https://github.com/invoiceninja/dockerfiles/blob/master/env
all env variables - Free Source Available Invoicing, Expenses & Time-Tracking | Invoice Ninja

1 Like

Hello, I found a solution for this for anyone like me who already have nginx / mysql running for other apps and don’t want to bother manual install with php configuration etc…

Create a network in docker (ninja for example) and find the ip something like 172.24.0.1 the container ip will be 172.24.0.2.

Create a docker container with this https://hub.docker.com/r/invoiceninja/invoiceninja
I’m using portainer but it’s the same as command line, be sure to map volume correctly and on your host set permissions to the folders to user 1500.
Assign it to ninja network.
Add extra host
host.docker.internal:host-gateway

Complete all .env and in mysql IP use host.docker.internal

In nginx on your host create a website and for the php configuration use this (replace CONTAINER_IP with yours, in my case it was 172.24.0.2)

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass CONTAINER_IP:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME /var/www/app/public$fastcgi_script_name;
    fastcgi_param DOCUMENT_ROOT /var/www/app/public; 
    fastcgi_intercept_errors off;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
}

Enjoy !

1 Like