fix: let wallabag entrypoint provision the database so the install runs

The template deployed but returned a persistent HTTP 500: MARIADB_DATABASE
pre-created the wallabag database, so the image entrypoint detected an
existing database, skipped bin/console wallabag:install and left an empty
schema. Only MARIADB_ROOT_PASSWORD is set now, letting the entrypoint
create the database/user and run the installer on first boot (matching the
official wallabag docker-compose).

Also:
- build SYMFONY__ENV__DOMAIN_NAME from the generated domain with the http
  scheme so assets/redirects match how the domain is served
- point SYMFONY__ENV__REDIS_HOST at the wallabag-redis service (default is
  'redis', which does not resolve here)
- randomize SYMFONY__ENV__SECRET instead of relying on the image's
  hardcoded default

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mauricio Siu
2026-07-08 01:37:02 -06:00
parent d7d426c968
commit 65a9a0a5a5
2 changed files with 9 additions and 4 deletions

View File

@@ -25,6 +25,8 @@ services:
- SYMFONY__ENV__FROM_EMAIL=${SYMFONY__ENV__FROM_EMAIL}
- SYMFONY__ENV__DOMAIN_NAME=${SYMFONY__ENV__DOMAIN_NAME}
- SYMFONY__ENV__SERVER_NAME=${SYMFONY__ENV__SERVER_NAME}
- SYMFONY__ENV__SECRET=${SYMFONY__ENV__SECRET}
- SYMFONY__ENV__REDIS_HOST=wallabag-redis
volumes:
- wallabag-images:/var/www/wallabag/web/assets/images
@@ -32,10 +34,11 @@ services:
image: mariadb:11.4
restart: unless-stopped
environment:
# Only the root password is set on purpose: the wallabag entrypoint
# creates the database and user and runs `wallabag:install` itself.
# Pre-creating the database (MARIADB_DATABASE) makes the entrypoint
# skip the install, leaving an empty schema and a persistent HTTP 500.
- MARIADB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MARIADB_DATABASE=wallabag
- MARIADB_USER=wallabag
- MARIADB_PASSWORD=${SYMFONY__ENV__DATABASE_PASSWORD}
volumes:
- wallabag-db-data:/var/lib/mysql
healthcheck:

View File

@@ -2,6 +2,7 @@
main_domain = "${domain}"
db_root_password = "${password:32}"
db_password = "${password:32}"
app_secret = "${password:32}"
from_email = "wallabag@example.com"
[config]
@@ -13,6 +14,7 @@ host = "${main_domain}"
[config.env]
MYSQL_ROOT_PASSWORD = "${db_root_password}"
SYMFONY__ENV__DATABASE_PASSWORD = "${db_password}"
SYMFONY__ENV__DOMAIN_NAME = "https://${main_domain}"
SYMFONY__ENV__DOMAIN_NAME = "http://${main_domain}"
SYMFONY__ENV__FROM_EMAIL = "${from_email}"
SYMFONY__ENV__SERVER_NAME = "wallabag"
SYMFONY__ENV__SECRET = "${app_secret}"