Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.1+ Posgres (container) - can't run migration #49

Closed
nsteinmetz opened this issue Feb 1, 2017 · 4 comments
Closed

2.2.1+ Posgres (container) - can't run migration #49

nsteinmetz opened this issue Feb 1, 2017 · 4 comments

Comments

@nsteinmetz
Copy link
Contributor

Hi,

I read #48 but I have from outside or within container when migration from 2.1.6 to 2.2.1

My Postgres is also a container (postgres:9.6-alpine)

/var/www/wallabag # bin/console doctrine:migrations:migrate --env=prod --no-interaction
                                                              
                    Application Migrations                    
                                                              

Migrating up to 20170127093841 from 0

  ++ migrating 20160410190541

Migration 20160410190541 failed during Execution. Error There is no table with name '/var/www/wallabag/app/..wallabag_entry' in the schema.

                                                                                       
  [Doctrine\DBAL\Schema\SchemaException]                                               
  There is no table with name '/var/www/wallabag/app/..wallabag_entry' in the schema.  
                                                                                       

doctrine:migrations:migrate [--write-sql] [--dry-run] [--query-time] [--allow-no-migration] [--configuration [CONFIGURATION]] [--db-configuration [DB-CONFIGURATION]] [--db DB] [--em EM] [--shard SHARD] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<version>]

/var/www/wallabag # find . -name wallabag_entry
/var/www/wallabag # 

I did not try yet the other command to manage migration.

Let me know if you need more details

@nsteinmetz
Copy link
Contributor Author

In docker-compose logs returns:

redis_1     | 1:C 01 Feb 14:12:35.795 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1     |                 _._                                                  
redis_1     |            _.-``__ ''-._                                             
wallabag_1  | 
redis_1     |       _.-``    `.  `_.  ''-._           Redis 3.2.7 (00000000/0) 64 bit
wallabag_1  | PLAY [localhost] ***************************************************************
redis_1     |   .-`` .-```.  ```\/    _.,_ ''-._                                   
redis_1     |  (    '      ,       .-`  | `,    )     Running in standalone mode
wallabag_1  | 
redis_1     |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
wallabag_1  | TASK [setup] *******************************************************************
redis_1     |  |    `-._   `._    /     _.-'    |     PID: 1
db_1        | LOG:  database system was shut down at 2017-02-01 14:11:01 UTC
wallabag_1  | ok: [localhost]
redis_1     |   `-._    `-._  `-./  _.-'    _.-'                                   
wallabag_1  | 
db_1        | LOG:  MultiXact member wraparound protections are now enabled
redis_1     |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
wallabag_1  | TASK [needed dirs] *************************************************************
db_1        | LOG:  database system is ready to accept connections
redis_1     |  |    `-._`-._        _.-'_.-'    |           http://redis.io        
wallabag_1  | ok: [localhost] => (item=/var/www/wallabag/app)
wallabag_1  | ok: [localhost] => (item=/var/www/wallabag/app/config)
redis_1     |   `-._    `-._`-.__.-'_.-'    _.-'                                   
db_1        | LOG:  autovacuum launcher started
wallabag_1  | ok: [localhost] => (item=/var/www/wallabag/data)
redis_1     |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
db_1        | LOG:  incomplete startup packet
wallabag_1  | changed: [localhost] => (item=/var/www/wallabag/data/assets)
redis_1     |  |    `-._`-._        _.-'_.-'    |                                  
redis_1     |   `-._    `-._`-.__.-'_.-'    _.-'                                   
redis_1     |       `-._    `-.__.-'    _.-'                                       
wallabag_1  | ok: [localhost] => (item=/var/www/wallabag/data/db)
wallabag_1  | 
redis_1     |           `-._        _.-'                                           
db_1        | FATAL:  password authentication failed for user "root"
redis_1     |               `-.__.-'                                               
wallabag_1  | TASK [write parameters.yml] ****************************************************
wallabag_1  | changed: [localhost]
wallabag_1  | 
redis_1     | 
redis_1     | 1:M 01 Feb 14:12:35.808 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
db_1        | DETAIL:  Role "root" does not exist.
db_1        | 	Connection matched pg_hba.conf line 95: "host all all all md5"
redis_1     | 1:M 01 Feb 14:12:35.808 # Server started, Redis version 3.2.7
wallabag_1  | TASK [stat] ********************************************************************
redis_1     | 1:M 01 Feb 14:12:35.808 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1     | 1:M 01 Feb 14:12:35.809 * The server is now ready to accept connections on port 6379
wallabag_1  | skipping: [localhost]
wallabag_1  | 
wallabag_1  | TASK [notify install for sqlite] ***********************************************
wallabag_1  | skipping: [localhost]
wallabag_1  | 
wallabag_1  | TASK [wait for db container] ***************************************************
wallabag_1  | ok: [localhost]
wallabag_1  | 
wallabag_1  | TASK [add mariadb db] **********************************************************
wallabag_1  | skipping: [localhost]
wallabag_1  | 
wallabag_1  | TASK [add mariadb user] ********************************************************
wallabag_1  | skipping: [localhost]
wallabag_1  | 
wallabag_1  | TASK [postgresql db] ***********************************************************
wallabag_1  | fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "unable to connect to database: FATAL:  password authentication failed for user \"root\"\n"}
wallabag_1  | 
wallabag_1  | RUNNING HANDLER [chown dir] ****************************************************
wallabag_1  | 	to retry, use: --limit @/etc/ansible/entrypoint.retry
wallabag_1  | 
wallabag_1  | PLAY RECAP *********************************************************************
wallabag_1  | localhost                  : ok=4    changed=2    unreachable=0    failed=1   
wallabag_1  | 
wallabag_1  | ::ffff:172.28.0.5 - - [01/Feb/2017:14:44:50 +0000] "GET /nsteinmetz/i9ymd0bebg5h9v2/unread.xml HTTP/1.1" 500 118 "-" "okhttp/3.5.0"
wallabag_1  | ::ffff:172.28.0.5 - - [01/Feb/2017:16:51:59 +0000] "GET / HTTP/1.1" 302 205 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
wallabag_1  | 2017/02/01 16:52:00 [error] 221#221: *3 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1 no such table: wallabag_craue_config_setting in /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:77
wallabag_1  | Stack trace:
wallabag_1  | #0 /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(77): PDO->prepare('SELECT t0.name ...', Array)
wallabag_1  | #1 /var/www/wallabag/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(844): Doctrine\DBAL\Driver\PDOConnection->prepare('SELECT t0.name ...')
wallabag_1  | #2 /var/www/wallabag/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(712): Doctrine\DBAL\Connection->executeQuery('SELECT t0.name ...', Array, Array)
wallabag_1  | #3 /var/www/wallabag/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(196): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->load(Array, NULL, NULL, Array, NULL, 1, NULL)
wallabag_1  | #4 /var/www/wallabag/vendor/craue/config-bundle/Util/Config.php(38): Doctrine\ORM\EntityRepository->findOneBy(Array)
wallabag_1  | #5 /var/www/wallabag/ven" while reading response header from upstream, client: ::ffff:172.28.0.5, server: _, request: "GET /login HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "w.steinmetz.fr"
wallabag_1  | ::ffff:172.28.0.5 - - [01/Feb/2017:16:52:00 +0000] "GET /login HTTP/1.1" 500 31 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
wallabag_1  | ::ffff:172.28.0.5 - - [01/Feb/2017:16:52:00 +0000] "GET /favicon.ico HTTP/1.1" 200 34494 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"

and particularly:

wallabag_1  | TASK [postgresql db] ***********************************************************
wallabag_1  | fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "unable to connect to database: FATAL:  password authentication failed for user \"root\"\n"}

My docker-compose.yml is:

version: '2'
services:
  wallabag:
    image: wallabag/wallabag
    environment:
      - POSTGRES_PASSWORD=XXXXX
      - SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
      - SYMFONY__ENV__DATABASE_HOST=db
      - SYMFONY__ENV__DATABASE_PORT=5432
      - SYMFONY__ENV__DATABASE_NAME=wallabag
      - SYMFONY__ENV__DATABASE_USER=XXXXXX
      - SYMFONY__ENV__DATABASE_PASSWORD=XXXXXX
    labels:
      - "traefik.backend=steinmetz-wallabag"
      - "traefik.frontend.rule=Host:w.steinmetz.fr"
      - "traefik.port=80"
      - "traefik.protocol=http"
      - "traefik.frontend.entryPoints=https"
  db:
    image: postgres:9.6-alpine
    environment:
      - POSTGRES_PASSWORD=XXXXXX
    volumes:
      - /srv/www/steinmetz.fr/w/db:/var/lib/postgresql/data
    labels:
      - "traefik.enable=false"
  redis:
    image: redis:alpine
    labels:
      - "traefik.enable=false"

@xsteadfastx
Copy link
Contributor

And if you spin the docker-compose up it works with the db connection? Just a wild guess... Db link not right. What about trying the migrate command in the docker compose file?

@nsteinmetz
Copy link
Contributor Author

Ok found the point, I added POSTGRES_USER=postgres and POPULATE_DATABASE=False in my docker-compose.yml file and it works. The postgres db task is no longer exectued.

I could run the migrate task as expected and everything is fine now :)

Thanks,
Nicolas

@xsteadfastx
Copy link
Contributor

That is nice to hear 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants