Docker App Config Help for InvoiceNinja

OK all,

I’m trying to get another container working here. I want to explore InvoiceNinja for possible use in my business. I’ve got the container and its supporting apps up and running but I can’t access it. I’ve asked for help on the InvoiceNinja forum and they have told me all they know…Still isn’t working. They suggested I ask here. So maybe some of your Compose wizards can help me figure out what I am doing wrong…

Here is my compose file:

services:
  app:
    build:
      context: .
    image: invoiceninja/invoiceninja-debian:latest
    restart: unless-stopped
    env_file:
      - /share/Container/invoiceninja/.env
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Chicago
    volumes:
      # - ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
      # - ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
      # - ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
      - /share/Container/invoiceninja/public:/var/www/html/public
      - /share/Container/invoiceninja/storage:/var/www/html/storage
    depends_on:
      mysql:
        condition: service_healthy
      redis:
        condition: service_healthy

  nginx:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - "8012:80"
    volumes:
      - ./share/Container/invoiceninja/nginx:/etc/nginx/conf.d:ro
      - /share/Container/invoiceninja/public:/var/www/html/public:ro
      - /share/Container/invoiceninja/storage:/var/www/html/storage:ro
    depends_on:
      app:
        condition: service_healthy

  mysql:
    image: mysql:8
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
    volumes:
      - /share/Container/invoiceninja/mysql_data:/var/lib/mysql
    healthcheck:
      test:
        [
          "CMD",
          "mysqladmin",
          "ping",
          "-h",
          "localhost",
          "-u${MYSQL_USER}",
          "-p${MYSQL_PASSWORD}",
        ]

  redis:
    image: redis:alpine
    restart: unless-stopped
    volumes:
      - /share/Container/invoiceninja/redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]

And since the app uses a .env file, here is that file with redactions:

# IN application vars
APP_URL=http://192.168.0.3:8012
APP_KEY=base64:7some_key_code
APP_ENV=production
APP_DEBUG=true
REQUIRE_HTTPS=false
PHANTOMJS_PDF_GENERATION=false
PDF_GENERATOR=snappdf
TRUSTED_PROXIES='*'


CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis

REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

FILESYSTEM_DISK=debian_docker

# DB connection
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=*******
DB_ROOT_PASSWORD=********
DB_CONNECTION=mysql

# Create initial user
# Default to these values if empty
IN_USER_EMAIL=admin@example.com
IN_PASSWORD=changeme!
# IN_USER_EMAIL=
# IN_PASSWORD=

# Mail options
MAIL_MAILER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS='user@example.com'
MAIL_FROM_NAME='Self Hosted User'

# MySQL
MYSQL_ROOT_PASSWORD=*****
MYSQL_USER=ninja
MYSQL_PASSWORD=*****
MYSQL_DATABASE=ninja

# GoCardless/Nordigen API key for banking integration
NORDIGEN_SECRET_ID=
NORDIGEN_SECRET_KEY=

IS_DOCKER=true
SCOUT_DRIVER=null
#SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable

So it starts up but like I said - I can’t access the website. Won’t come up. On the InvoiceNinja forum the user helping me said the following:

3. Check the Nginx Config
You have a volume mapping for Nginx: - ./nginx:/etc/nginx/conf.d:ro.

  • Ensure that the configuration file inside that folder is correctly pointing to the app service on the internal port (usually 9000 if using FPM, or 8000 if using the web-server variant).
  • If you are using the standard Invoice Ninja docker-compose example, ensure the fastcgi_pass is set to app:9000.

So I remapped ./nginx:/etc/nginx/conf.d:ro to ./share/Container/invoiceninja/nginx:/etc/nginx/conf.d:ro

However, that folder is not being created and if I go in and inspect the Nginx container, I see that etc/nginx/conf.d is instead being mapped to /share/ZFS530_DATA/.qpkg/container-station/data/application/invoiceninja/share/Container/invoiceninja/nginx

Why is QNAP not following my instructions and mapping the container to the storage location I requested? I don’t know if that will solve my issue but I’d like to take a look at that config file and have more control over it.

And when I do go to that directory from an SSH shell, there is nothing there. So Nginx has no configuration…

Does anyone else see any possible issue that I have here?

Why did you use the relative and other times the absolute path for some volume mounts?

Huh? I used /share/Container/invoiceninja for everything. Where did I not do that?

Isn’t that an absolute path?

And, yes, I should watch that video…

volumes:
   - ./share/Container/invoiceninja/nginx:/etc/nginx/conf.d:ro
   - /share/Container/invoiceninja/public:/var/www/html/public:ro
   - /share/Container/invoiceninja/storage:/var/www/html/storage:ro

one with a “dot” two without

Oh and the see the video how ZFSxx is in the pathname for the volume, a plain share/xxx is only valid for QTS

Yep. I just saw that myself. That is a typo…

Did not mean to have the dot there.

just added the note to the ZFS pathname and QuTS above

So first, the original YAML file had the dot and I replaced the path name and didn’t see it:

    volumes:
      - ./nginx:/etc/nginx/conf.d:ro
      - app_public:/var/www/html/public:ro
      - app_storage:/var/www/html/storage:ro

Using /share/Container/.... absolutely works in QuTS. I use it for all my container…

Now, I do have the /share/Container/nginx folder but nothing is in there…

Huh, I always had to put ZFSxx_DATA in my pathnames or it wouldn’t work.

but the code above is now missing any pathname for the volumes, is that right?

Instead of creating discrete volumes like that, I just added the full path names instead.

But yeah, you can always go:

/share/SharedFolderName in QuTS.

Works for everything…

And I don’t know what’s going on because after the latest attempt to rebuild/restart the app, now it won’t run at all.

Grr…

i would try to put your environment variables directly into the compose file. CS doesnt realy support a .env file and that might be causing you issues.

Any docker that had a .env, i always just put the details in the compose and it worked for me that way.

I was wondering about that. It’s kind of strange as the .env file has to be there for the Compose file to meet the “smell” test, but it seems like what CS reads from that file is inconsistent at best…

OK, I’ll try adding everything to the Compose file then…