Trouble with docker-compose nginx webpage

Hi All,

I am having trouble with the nginx web server when I access the web page, it puts up the following error:

invoiceplane-nginx     | 192.168.178.72 - - [18/Jul/2023:20:30:11 +0000] "GET / HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
invoiceplane-nginx     | 2023/07/18 20:30:11 [error] 31#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Class 'Dotenv\Dotenv' not found in /app/index.php:19
invoiceplane-nginx     | Stack trace:
invoiceplane-nginx     | #0 {main}
invoiceplane-nginx     |   thrown in /app/index.php on line 19" while reading response header from upstream, client: 192.168.178.72, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://172.30.0.4:9000", host: "casaos.local:8085"

My docker-compose.yml file looks like: (I added the composer install section at the top, don’t know if necessary) and I don’t know where the /app is meant to be

version: "3"

services:
  composer_installation:
    container_name: composer_installation
    image: composer
    volumes:
      - ./:/app
    command: composer install --ignore-platform-reqs

  # --- MariaDB 10.3
  db:
    container_name: "invoiceplane-db"
    image: bitnami/mariadb:10.3
    environment:
      - MARIADB_ROOT_PASSWORD=ipdevdb
      - MARIADB_USER=ipdevdb
      - MARIADB_PASSWORD=PASS
      - MARIADB_DATABASE=ipdevdb
    ports:
      - "127.0.0.1:3306:3306"
    volumes:
      - /DATA_OLD/AppData/invoiceplane-db:/bitnami

  # --- PHP 7.3
  php:
    container_name: "invoiceplane-php"
    image: bitnami/php-fpm:7.3
    depends_on:
      - db
    volumes:
      - .:/app:delegated
      - ./application/docker/php/php-dev.ini:/opt/bitnami/php/etc/conf.d/php.ini:ro

  # --- nginx 1.16
  nginx:
    container_name: "invoiceplane-nginx"
    image: bitnami/nginx:1.16
    ports:
      - "8085:8085"
    depends_on:
      - php
    volumes:
      - .:/app:delegated
      - ./application/docker/nginx/site.conf:/opt/bitnami/nginx/conf/vhosts/site.conf:ro

volumes:
  invoiceplane-db:
    driver: local

@UnderDog Any idea’s, I know you are an expert in containers …

Also, in index.php I got an error with vendor/autoload.php, so commented it out …

/*require('vendor/autoload.php');*/
$dotenv = new \Dotenv\Dotenv(__DIR__, 'ipconfig.php');
$dotenv->load();

Update: I had better success by using the latest official version from the main web site.
I did a docker-compose up and after a long compile time all the containers came up and I managed to log into:

http://casaos.local:8085/index.php/setup/language

I see the language page, I set English and ok, but then I get a 404 page and the address bar looks weird like this:

http://casaos.local:8085/index.php/setup/localhost/index.php/setup/language

Any idea’s ? My ipconfig.php looks like this:

# <?php exit('No direct script access allowed'); ?>
# InvoicePlane Configuration File

### START HERE
# Set your URL without trailing slash here, e.g. http://your-domain.com
# If you use a subdomain, use http://subdomain.your-domain.com
# If you use a subfolder, use http://your-domain.com/subfolder
IP_URL=localhost

# Having problems? Enable debug by changing the value to 'true' to enable advanced logging
ENABLE_DEBUG=false

# Set this setting to 'true' if you want to disable the setup for security purposes
DISABLE_SETUP=false

# To remove index.php from the URL, set this setting to 'true'.
# Please notice the additional instructions in the htaccess file!
REMOVE_INDEXPHP=false

# These database settings are set during the initial setup
DB_HOSTNAME=ipdevdb
DB_USERNAME=ipdevdb
DB_PASSWORD=ipdevdb
DB_DATABASE=invoiceplane_db
DB_PORT=3306

# If you want to be logged out after closing your browser window, set this setting to 0 (ZERO).
# The number represents the amount of minutes after that IP will automatically log out users,
# the default is 10 days.
SESS_EXPIRATION=864000

# Enable the deletion of invoices
ENABLE_INVOICE_DELETION=false

# Disable the read-only mode for invoices
DISABLE_READ_ONLY=false

##
## DO NOT CHANGE ANY CONFIGURATION VALUES BELOW THIS LINE!
## =======================================================
##

# This key is automatically set after the first setup. Do not change it manually!
ENCRYPTION_KEY=
ENCRYPTION_CIPHER=AES-256

# Set to true after the initial setup
SETUP_COMPLETED=false

NOTE: I set the DB_HOSTNAME etc fields as per the docker-compose.yml file, I am not sure if I should have left them empty or not …
@UnderDog Some help please … I am struggling here …

On another issue, the database startup is failing:

 ✔ Network ip_invoiceplane         Created                                                                                                                                                                   0.2s 
 ✔ Container invoiceplane-db       Created                                                                                                                                                                   0.2s 
 ✔ Container invoiceplane-dbadmin  Created                                                                                                                                                                   0.1s 
 ✔ Container invoiceplane-php      Created                                                                                                                                                                   0.1s 
 ✔ Container invoiceplane-nginx    Created                                                                                                                                                                   0.1s 
Attaching to invoiceplane-db, invoiceplane-dbadmin, invoiceplane-nginx, invoiceplane-php
invoiceplane-db       | 2023-07-19 01:49:52+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.0.2+maria~ubu2204 started.
invoiceplane-db       | 2023-07-19 01:49:52+00:00 [ERROR] [Entrypoint]: mariadbd failed while attempting to check config
invoiceplane-db       | 	command was: mysqld --verbose --help
invoiceplane-db       | 	/usr/local/bin/docker-entrypoint.sh: line 105: mysqld: command not found
invoiceplane-db exited with code 1
invoiceplane-dbadmin  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.16. Set the 'ServerName' directive globally to suppress this message
invoiceplane-php      | [19-Jul-2023 01:49:53] NOTICE: fpm is running, pid 1
invoiceplane-php      | [19-Jul-2023 01:49:53] NOTICE: ready to handle connections
invoiceplane-dbadmin  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.16. Set the 'ServerName' directive globally to suppress this message
invoiceplane-dbadmin  | [Wed Jul 19 01:49:54.034729 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.57 (Debian) PHP/8.2.8 configured -- resuming normal operations
invoiceplane-dbadmin  | [Wed Jul 19 01:49:54.034847 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
invoiceplane-nginx    | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
invoiceplane-nginx    | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
invoiceplane-nginx    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
invoiceplane-nginx    | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
invoiceplane-nginx    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
invoiceplane-nginx    | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
invoiceplane-nginx    | /docker-entrypoint.sh: Configuration complete; ready for start up

Ahhh, solved it myself… I had to change the hostname to:
IP_URL=http://casaos.local:8085 in ipconfig.php

However: I still need help with the above database error on startup … thanks
I can’t complete the setup without fixing that …

1 Like

Glad that it’s almost resolved.
Regarding your database issues: in resources/docker/mariadb/Dockerfile
Change FROM mariadb:latest to FROM mariadb:10.11

@UnderDog Thanks for the reply. I will do as you say.
I notice than when I set DB_xxxx to nothing in ipconfig.php it get’s set to

# These database settings are set during the initial setup
DB_HOSTNAME='localhost'
DB_USERNAME='ipdevdb'
DB_PASSWORD='ipdevdb'
DB_DATABASE='invoiceplane_db'
DB_PORT=3306

when I start setup … should DB_HOSTNAME be ‘db’?

Cheers

All fixed. I needed db in the hostname and I had to do a docker-compose up --build after I did as you said with the database version …

Thanks for the help.

PS: Why does it not work with latest?

PS: Why does it not work with latest?
latest is MariaDB version 11.
They changed something in their image creation that messes everything up.
So we fall back to the last version of MariaDB version 10.
No big deal.

@UnderDog By the way, can I get rid of the phpadmin container? as I am not going to use it I feel, and it is taking up a lot of space …

Yes, go ahead.
There are 2 ways:

  • edit docker-compose.yml and remove that piece
  • during docker-compose up you can say which ‘services’ you want up: docker-compose up nginx db php-fpm, that way you avoid bringing phpmyadmin up.

Removing phpmyadmin from docker-compose.yml does not remove it from your hard drive, the image was already built, taking up that space.