Open EHRETic opened 7 months ago
I faced similar problem as well... and the installation docs looks weird to me: https://doc.wallabag.org/en/developer/docker
For example, the step 2: Edit app/config/parameters.yml to replace database_* properties with commented ones (with values prefixed by env.)
. I checked and found I can't follow this step as there isn't any app/config/
folder existed.
I am working to self-host it with Docker and traefik reverse proxy.
If you ran into the same problem as me, you would see this as the first log entry:
WARN: Postgres database is already configured. Remove the environment variable with root password.
The issue is that the entrypoint only runs the database setup if it's the creator of the database. See https://github.com/wallabag/docker/blob/41430135535d5ee5a7fc1fbbda90323331827eb5/root/entrypoint.sh#L78
However it doesn't grant the necessary permissions, and the setup code is a bit ... Well it could be better.
There's a flag POPULATE_DATABASE
which we can disable, then we can go back to giving wallabag a role which has privileges on a database.
So my environment looks like this now:
- POPULATE_DATABASE=false
- SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
- SYMFONY__ENV__DATABASE_HOST=postgresql
- SYMFONY__ENV__DATABASE_PORT=5432
- SYMFONY__ENV__DATABASE_NAME=wallabag
- SYMFONY__ENV__DATABASE_USER=wallabag
- SYMFONY__ENV__DATABASE_PASSWORD=wallabag
Then we start the container and wait for it to finish starting up, afterwards jump into a shell:
docker exec -it wallabag sh
Now we can run the install script ourselves
php bin/console wallabag:install --env=prod -n
Since we ran that as root, we have to fix the permissions (otherwise you will get some nasty session errors)
chown -R nobody:nobody /var/www/wallabag
Then you should be able to hit your containers url or whatever you mapped it to and see
My database wouldn't close the hanging connections, to force drop it the syntax is as follows:
DROP DATABASE dbName WITH (FORCE)
If you're using a version of Postgres after 15, you will get the following error:
ERROR: permission denied for schema public
.
To fix it, you need to grant permissions to the public
schema, connect to your wallabag database with your root user and execute the following command:
GRANT ALL ON SCHEMA public TO wallabag
Thanks for the pointers. I don't know why, but for me this doesn't really work. I believe the docker example assumes creation of that user etc. before, implicitly. I kinda expected it will just work.
I am running inside a VM and connect to the docker-compose local postgres instance, therefore I don't mind the thing running under a super user, so do it like this:
services:
wallabag:
image: wallabag/wallabag
restart: unless-stopped
environment:
- SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
- SYMFONY__ENV__DATABASE_HOST=db
- SYMFONY__ENV__DATABASE_PORT=5432
- SYMFONY__ENV__DATABASE_NAME=postgres
- SYMFONY__ENV__DATABASE_USER=postgres
- SYMFONY__ENV__DATABASE_PASSWORD=postgres
- 'SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"'
- 'SYMFONY__ENV__MAILER_DSN=smtp://127.0.0.1'
- SYMFONY__ENV__FROM_EMAIL=wallabag@example.com
- 'SYMFONY__ENV__DOMAIN_NAME=https://...'
- 'SYMFONY__ENV__SERVER_NAME="Wallabag"'
- SYMFONY__ENV__REDIS_HOST=redis
expose:
- 80
volumes:
- './data/images:/var/www/wallabag/web/assets/images'
healthcheck:
test:
- CMD
- wget
- '--no-verbose'
- '--tries=1'
- '--spider'
- 'http://localhost/api/info'
interval: 1m
timeout: 3s
depends_on:
- db
- redis
db:
image: 'postgres:17-alpine'
volumes:
- './data/postgresql/pg_data:/var/lib/postgresql/data'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
healthcheck:
test:
- CMD-SHELL
- 'pg_isready -U postgres'
interval: 5s
timeout: 5s
retries: 5
redis:
image: 'redis:alpine'
restart: unless-stopped
healthcheck:
test:
- CMD
- redis-cli
- ping
interval: 20s
timeout: 3s
however, this doesn't work out of the box either, initial migration doesn't spin up - tables are not being created, and after a fresh start, I see things like this int he DB:
2024-10-30T09:09:32.302923300Z 2024-10-30 09:09:32.302 UTC [151] ERROR: relation "wallabag_internal_setting" does not exist at character 77
2024-10-30T09:09:32.302947185Z 2024-10-30 09:09:32.302 UTC [151] STATEMENT: SELECT t0.value AS value_1, t0.name AS name_2, t0.section AS section_3 FROM "wallabag_internal_setting" t0 WHERE t0.name = $1 LIMIT 1
I had to exec the initialization inside wallabag container via docker exec -ti {your-wallabag-container-id} php bin/console wallabag:install --env=prod -n
and voila, it works.
I was able to also get it working via creating the wallabag user, database, granting permissions etc., but it was more hassle for me.
Hi there,
I've some difficulties installing Wallbag on my docker host. After "deployment", I get an error 500 by trying to connect to the URL.
Docker compose:
ENV file:
Logs when database already exists:
Logs when database doesn't exists:
Thing is, I have no tables in my database, despite wallbag user is owner of the database and I think "of course", this will result in the 500 error. api is available tough with the mentionned URL.
One thing: if I create the database after the initial start without, the logs will be exactly the same as above, so the DB is found. Remove root credentials doesn't help either.
Any clue where to start? Thx in advance! 😉