wallabag / docker

Official docker-composer for wallabag.
600 stars 150 forks source link

Wallabag container never actually successfully starts up again after the initial run and installation. #286

Open GlassedSilver opened 2 years ago

GlassedSilver commented 2 years ago

Basically it never survived the reboot.

I got one run and that was one hell to setup.

I'm using docker compose with Postgres and redis.

My Wallabag container basically just cycles through this over and over again:

[WARNING]: Found both group and host with same name: localhost

[WARNING]: Platform linux on host localhost is using the discovered Python

interpreter at /usr/bin/python3, but future installation of another Python

interpreter could change this. See https://docs.ansible.com/ansible/2.9/referen

ce_appendices/interpreter_discovery.html for more information.

Starting provisioner...

[WARNING]: Found both group and host with same name: localhost

[WARNING]: Platform linux on host localhost is using the discovered Python

interpreter at /usr/bin/python3, but future installation of another Python

interpreter could change this. See https://docs.ansible.com/ansible/2.9/referen

ce_appendices/interpreter_discovery.html for more information.

Starting provisioner...

[WARNING]: Found both group and host with same name: localhost

[WARNING]: Platform linux on host localhost is using the discovered Python

interpreter at /usr/bin/python3, but future installation of another Python

interpreter could change this. See https://docs.ansible.com/ansible/2.9/referen

ce_appendices/interpreter_discovery.html for more information.

etc...

This is my docker-compose.yml:

# Wallabag is a self hostable application for saving web pages. Unlike other services, wallabag is free (as in freedom) and open source.
#
# Default user/password
# User: wallabag
# Password: wallabag

version: "3.4"
services:
  wallabag:
    image: wallabag/wallabag
    restart: unless-stopped
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=<REDACTED>
      - SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
      - SYMFONY__ENV__DATABASE_HOST=wallabag-db
      - SYMFONY__ENV__DATABASE_PORT=5432
      - SYMFONY__ENV__DATABASE_NAME=wallabag
      - SYMFONY__ENV__DATABASE_USER=wallabag
      # We don't need the database password, since Postgres is set up to trust
      # - SYMFONY__ENV__DATABASE_PASSWORD=<REDACTED>
      - SYMFONY__ENV__DATABASE_CHARSET=utf8
      - SYMFONY__ENV__DOMAIN_NAME=<REDACTED>
      - SYMFONY__ENV__SERVER_NAME=<REDACTED>
      - SYMFONY__ENV__MAILER_HOST=127.0.0.1
      - SYMFONY__ENV__MAILER_USER=~
      - SYMFONY__ENV__MAILER_PASSWORD=~
      - SYMFONY__ENV__FROM_EMAIL=wallabag@example.com
      - POPULATE_DATABASE=False
    ports:
      - "55771:80"
    volumes:
      - "/etc/localtime:/etc/localtime:ro"   # Use Host time
      - "wallabag-images:/var/www/wallabag/web/assets/images"
    healthcheck:
      test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost"]
      interval: 1m
      timeout: 3s
    depends_on:
      - redis
      - wallabag-db
    links:
      - "wallabag-db:wallabag-db" # resolve the hostname "wallabag-db" with the ip of the wallabag-db container

  wallabag-db:
    image: postgres:11-alpine
    restart: unless-stopped
    hostname: wallabag-db
    environment:
      - PGUSER=postgres
      - POSTGRES_USER=wallabag
      - POSTGRES_PASSWORD=<REDACTED>
      - POSTGRES_DB=wallabag
      - POSTGRES_HOST_AUTH_METHOD=trust
    volumes:
      - "/etc/localtime:/etc/localtime:ro"   # Use Host time
      - "wallabag-data:/var/lib/postgresql/data"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -q || exit 1"]
      interval: 10s
      timeout: 3s
      retries: 3

  redis:
    image: redis:alpine
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 20s
      timeout: 3s

volumes:
  wallabag-data:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: "<REDACTED>"
  wallabag-images:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: "<REDACTED>"

I am absolutely at the end of my wisdom, I have never had a deployment this hard to get done and most importantly:

It did run, but after a restart of the container: NADA.

What the hell?

GlassedSilver commented 2 years ago

Btw, I did clear the cache, I did try the migrate commands and I did also run docker exec -t wallabag_wallabag_1 php /var/www/wallabag/bin/console wallabag:install --env=prod -n.

The cache cleared successfully, the migrations return No migrations to execute. and the installation fails:

In AbstractPostgreSQLDriver.php line 70:

  An exception occurred while executing 'INSERT INTO "wallabag_user" [...]

SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "uniq_<REDACTED>"
  DETAIL:  Key (username_canonical)=(wallabag) already exists.

So uh...

I also tried pretty much any of what I could find in the other issues, at least I think I did. To no avail.

I can only reiterate how baffled I am how hard this application is to get setup and keep running. I have spent several dozens of hours with this already II have to admit, and I think I've really done as much research as was possible, I don't like asking for help too easily, but it seems like I'm good company so... screw it. Help me, please if you don't mind. :/

GlassedSilver commented 2 years ago

i have similar problem

Starting provisioner...
[WARNING]: Found both group and host with same name: localhost
[WARNING]: Platform linux on host localhost is using the discovered Python
interpreter at /usr/bin/python3.9, but future installation of another Python
interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-
core/2.11/reference_appendices/interpreter_discovery.html for more information.
PLAY [localhost] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var TASK [Gathering Facts] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var ok: [localhost] TASK [needed dirs] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var ok: [localhost] => (item=/var/www/wallabag/app) ok: [localhost] => (item=/var/www/wallabag/app/config) ok: [localhost] => (item=/var/www/wallabag/data) changed: [localhost] => (item=/var/www/wallabag/data/assets) ok: [localhost] => (item=/var/www/wallabag/data/db) TASK [write parameters.yml] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var changed: [localhost] TASK [stat] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var skipping: [localhost] TASK [notify install for sqlite] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var skipping: [localhost] TASK [wait for db container] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var ok: [localhost] TASK [add mariadb db] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var fatal: [localhost]: FAILED! => {"changed": false, "msg": "unable to find /root/.my.cnf. Exception message: (1045, \"Access denied for user 'root'@'192.168.144.3' (using password: YES)\")"} RUNNING HANDLER [chown dir] bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var PLAY RECAP bin dev entrypoint.sh etc home lib media mnt opt proc root run sbin srv sys tmp usr var localhost : ok=4 changed=2 unreachable=0 failed=1 skipped=2 rescued=0 ignored=0
Provisioner finished.
127.0.0.1 - - [30/May/2022:17:42:51 +0000] "GET / HTTP/1.1" 302 346 "-" "Wget"
2022/05/30 17:42:52 [error] 184#184: *3 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1 no such table: wallabag_internal_setting in /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:82
�
Stack trace:
#0 /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(82): PDO->prepare('SELECT t0.value...', Array)
#1 /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1301): Doctrine\DBAL\Driver\PDOConnection->prepare('SELECT t0.value...')
#2 /var/www/wallabag/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(726): Doctrine\DBAL\Connection->executeQuery('SELECT t0.value...', Array, Array)
#3 /var/www/wallabag/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(193): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->load(Array, NULL, NULL, Array, NULL, 1, NULL)
#4 /var/www/wallabag/vendor/craue/config-bundle/Util/Config.php(73): Doctrine\ORM\EntityRepository->findOneBy(Array)
#5 /var/www/wallaba" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /login HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
127.0.0.1 - - [30/May/2022:17:42:52 +0000] "GET /login HTTP/1.1" 500 5 "-" "Wget"
127.0.0.1 - - [30/May/2022:17:43:52 +0000] "GET / HTTP/1.1" 302 346 "-" "Wget"
2022/05/30 17:43:52 [error] 184#184: *7 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1 no such table: wallabag_internal_setting in /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:82
�
Stack trace:
#0 /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(82): PDO->prepare('SELECT t0.value...', Array)
#1 /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1301): Doctrine\DBAL\Driver\PDOConnection->prepare('SELECT t0.value...')
#2 /var/www/wallabag/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(726): Doctrine\DBAL\Connection->executeQuery('SELECT t0.value...', Array, Array)
#3 /var/www/wallabag/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(193): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->load(Array, NULL, NULL, Array, NULL, 1, NULL)
#4 /var/www/wallabag/vendor/craue/config-bundle/Util/Config.php(73): Doctrine\ORM\EntityRepository->findOneBy(Array)
#5 /var/www/wallaba" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /login HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
127.0.0.1 - - [30/May/2022:17:43:52 +0000] "GET /login HTTP/1.1" 500 5 "-" "Wget"

Your issue seems unrelated, since you get a completely different log readout.

Did you run the wallabag:install command? In any case, maybe consider creating a separate issue or check out other tickets with the error "no such table": https://github.com/wallabag/docker/issues?q=no+such+table

Monirzadeh commented 2 years ago

sorry i create a new issue if it possible please remove your comment to keep issue clean just one question where shroud i enter wallabag:install command?

GlassedSilver commented 2 years ago

sorry i create a new issue if it possible please remove your comment to keep issue clean just one question where shroud i enter wallabag:install command?

Answered to your question in your issue :)

DySprozin commented 1 year ago

Well, I got it)

  1. docker-compose down
  2. Create empty db (if db exists, drop db and recreate)
  3. docker-compose up -d
  4. Run migrations:
    docker exec -t wallabag_wallabag_1  /var/www/wallabag/bin/console doctrine:migrations:migrate --env=prod --no-interaction
  5. Run install
    docker exec -t wallabag_wallabag_1 php /var/www/wallabag/bin/console wallabag:install --env=prod -n
  6. Enjoy!)
thomas-mc-work commented 5 months ago

Black magic, thank you very much!

Here for docker compose users:

docker compose exec wallabag /var/www/wallabag/bin/console doctrine:migrations:migrate --env=prod --no-interaction
docker compose exec wallabag php /var/www/wallabag/bin/console wallabag:install --env=prod -n
GlassedSilver commented 5 months ago

Yeah I don't know how I figured it out eventually and if I did the same things (probably yes?), but docs were severely lacking in this regard when I tried and quite honestly if I give all info in the docker compose config the entire stack should figure out itself.

I know of no software that combines complicated, undocumented on-boarding with "works once, stops working after a reboot" with overall lots of additional steps like this.

Once you have it got to work Wallabag is nice, but boy if I had to spin up a second instance today without a backup and knowing what this issue documents I'd shudder and probably just consider Shiori, although there were some aspects to Wallabag over Shiori that had me stop considering it as alternative which is why I was willing to go through this much pain. If I wasn't so pedantic and picky I wouldn't have invested a fraction of the time I did to get into Wallabag.