I have setup Invoice ninja with docker-compose behind a nginx reverse proxy, which also manages the TLS certificate.
As far as I can see from the logs, everything initializes correct, but when I navigate to the site, I can only see a 500 Server error.
I provided my docker-compose and the logs until the first 500 error below.
Thanks in advance!
docker-compose.yml
version: '3.7'
services:
server:
image: caddy:alpine
restart: always
environment:
- APP_URL=http://ninja.example.de
volumes:
# Vhost configuration
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
- ./public:/var/www/app/public
- ./storage:/var/www/app/storage
depends_on:
- app
# Run webserver nginx on port 80
# Feel free to modify depending what port is already occupied
ports:
- "127.0.0.1:4301:80"
# - "443:443"
networks:
- invoiceninja
app:
image: invoiceninja/invoiceninja:5
restart: always
environment:
- APP_URL=ninja.example.de
- APP_KEY=base64:mykeyxzy
- MULTI_DB_ENABLED=false
- DB_HOST1=db
volumes:
- ./public:/var/www/app/public
- ./storage:/var/www/app/storage
depends_on:
- db
networks:
- invoiceninja
db:
image: mysql:5
restart: always
environment:
- MYSQL_ROOT_PASSWORD=mypassword
- MYSQL_USER=ninja
- MYSQL_PASSWORD=ninja
- MYSQL_DATABASE=db-ninja-01
volumes:
- ./mysql/data:/var/lib/mysql
networks:
- invoiceninja
# cron:
# cron is commented out by me
volumes:
mysql-data:
public:
storage:
networks:
invoiceninja:
docker log
server_1 | {"level":"info","ts":1590774949.786359,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
server_1 | {"level":"info","ts":1590774949.7946017,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
server_1 | {"level":"info","ts":1590774949.7968726,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
server_1 | 2020/05/29 17:55:49 [INFO][cache:0xc00075e0a0] Started certificate maintenance routine
server_1 | {"level":"info","ts":1590774949.7995124,"logger":"tls","msg":"cleaned up storage units"}
server_1 | {"level":"info","ts":1590774949.799886,"msg":"autosaved config","file":"/config/caddy/autosave.json"}
server_1 | {"level":"info","ts":1590774949.799923,"msg":"serving initial configuration"}
app_1 | Configuration cache cleared!
app_1 | Configuration cached successfully!
app_1 | Route cache cleared!
app_1 | Routes cached successfully!
app_1 | Files cached successfully!
app_1 | [29-May-2020 17:55:49] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
app_1 | [29-May-2020 17:55:49] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
app_1 | [29-May-2020 17:55:49] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
app_1 | [29-May-2020 17:55:49] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
app_1 | [29-May-2020 17:55:49] NOTICE: fpm is running, pid 1
app_1 | [29-May-2020 17:55:49] NOTICE: ready to handle connections
db_1 | 2020-05-29 17:55:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
db_1 | 2020-05-29 17:55:48+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1 | 2020-05-29 17:55:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
db_1 | 2020-05-29T17:55:48.703457Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1 | 2020-05-29T17:55:48.708189Z 0 [Note] mysqld (mysqld 5.7.30) starting as process 1 ...
db_1 | 2020-05-29T17:55:48.714931Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1 | 2020-05-29T17:55:48.714988Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1 | 2020-05-29T17:55:48.714995Z 0 [Note] InnoDB: Uses event mutexes
db_1 | 2020-05-29T17:55:48.714999Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1 | 2020-05-29T17:55:48.715002Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1 | 2020-05-29T17:55:48.715011Z 0 [Note] InnoDB: Using Linux native AIO
db_1 | 2020-05-29T17:55:48.715701Z 0 [Note] InnoDB: Number of pools: 1
db_1 | 2020-05-29T17:55:48.716017Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1 | 2020-05-29T17:55:48.722484Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1 | 2020-05-29T17:55:48.741778Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1 | 2020-05-29T17:55:48.747111Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1 | 2020-05-29T17:55:48.763090Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1 | 2020-05-29T17:55:48.798980Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1 | 2020-05-29T17:55:48.799233Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1 | 2020-05-29T17:55:48.832312Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1 | 2020-05-29T17:55:48.834307Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1 | 2020-05-29T17:55:48.834434Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1 | 2020-05-29T17:55:48.835099Z 0 [Note] InnoDB: Waiting for purge to start
db_1 | 2020-05-29T17:55:48.885461Z 0 [Note] InnoDB: 5.7.30 started; log sequence number 12488420
db_1 | 2020-05-29T17:55:48.886497Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1 | 2020-05-29T17:55:48.897039Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1 | 2020-05-29T17:55:48.906339Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
db_1 | 2020-05-29T17:55:48.906387Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
db_1 | 2020-05-29T17:55:48.907291Z 0 [Warning] CA certificate ca.pem is self signed.
db_1 | 2020-05-29T17:55:48.907356Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
db_1 | 2020-05-29T17:55:48.908141Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200529 17:55:48
db_1 | 2020-05-29T17:55:48.909168Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1 | 2020-05-29T17:55:48.909863Z 0 [Note] IPv6 is available.
db_1 | 2020-05-29T17:55:48.909911Z 0 [Note] - '::' resolves to '::';
db_1 | 2020-05-29T17:55:48.909952Z 0 [Note] Server socket created on IP: '::'.
db_1 | 2020-05-29T17:55:48.914971Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1 | 2020-05-29T17:55:48.932266Z 0 [Note] Event Scheduler: Loaded 0 events
db_1 | 2020-05-29T17:55:48.932616Z 0 [Note] mysqld: ready for connections.
db_1 | Version: '5.7.30' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
app_1 | 192.168.48.5 - 29/May/2020:17:59:07 +0000 "GET /index.php" 500
This errors occurs dues to the facts that the application cannot correctly determine the passed application key
APP_KEY
. It seems the application cache is a bit reluctant to be refreshed - this is only a problem in the docker containers and not for the self-host option w/o docker.I pushed an update to the for the
latest
and5
tags. So first, please update your images. This fixes some permission to get proper write permissions to some cache folders.Then after your docker-compose setup started please run
a couple of times and refresh your page. It takes some time and a couple of calls till the cache is refreshed. The error message then changes to
SQLSTATE[42S02]: Base table or view not found:
this is a know problem but can be fixed (for now) by navigation to/setup
which then will run the proper migrations.