Docker Compose installation

Currently trying to start up the docker compose version.

Sadly it fails when starting up the passbolt container declaring
“Exception: There was a problem connecting to the database: SQLSTATE[HY000] [2006] MySQL server has gone away in [/var/www/passbolt/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php, line 127]”

This is literally a fresh version of passbolt (2.11 pb db 10.3).

Currently not sure how to resolve this:

db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Using Linux native AIO
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Uses event mutexes
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Number of pools: 1
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Using SSE2 crc32 instructions
passbolt_1  | wait-for.sh: waiting 15 seconds for db:3306
passbolt_1  | wait-for.sh: db:3306 is available after 0 seconds
passbolt_1  | gpg: directory '/home/www-data/.gnupg' created
passbolt_1  | gpg: keybox '/home/www-data/.gnupg/pubring.kbx' created
passbolt_1  | gpg: /home/www-data/.gnupg/trustdb.gpg: trustdb created
passbolt_1  | gpg: key B25645F68E67FDD0: public key "Passbolt default user <passbolt@yourdomain.com>" imported
passbolt_1  | gpg: Total number processed: 1
passbolt_1  | gpg:               imported: 1
passbolt_1  | gpg: key B25645F68E67FDD0: "Passbolt default user <passbolt@yourdomain.com>" not changed
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
passbolt_1  | gpg: key B25645F68E67FDD0: secret key imported
passbolt_1  | gpg: Total number processed: 1
passbolt_1  | gpg:              unchanged: 1
passbolt_1  | gpg:       secret keys read: 1
passbolt_1  | gpg:   secret keys imported: 1
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Completed initialization of buffer pool
db_1        | 2019-09-24 12:49:30 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        | 2019-09-24 12:49:30 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Waiting for purge to start
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: 10.3.18 started; log sequence number 10563611; transaction id 9125
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1        | 2019-09-24 12:49:30 0 [Note] Plugin 'FEEDBACK' is disabled.
db_1        | 2019-09-24 12:49:30 0 [Note] Server socket created on IP: '::'.
db_1        | 2019-09-24 12:49:30 0 [Warning] 'user' entry 'root@40e0d9d08697' ignored in --skip-name-resolve mode.
db_1        | 2019-09-24 12:49:30 0 [Warning] 'user' entry '@40e0d9d08697' ignored in --skip-name-resolve mode.
db_1        | 2019-09-24 12:49:30 0 [Warning] 'proxies_priv' entry '@% root@40e0d9d08697' ignored in --skip-name-resolve mode.
db_1        | 2019-09-24 12:49:30 0 [Note] Reading of all Master_info entries succeeded
db_1        | 2019-09-24 12:49:30 0 [Note] Added new Master_info '' to hash table
db_1        | 2019-09-24 12:49:30 0 [Note] mysqld: ready for connections.
db_1        | Version: '10.3.18-MariaDB-1:10.3.18+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
db_1        | 2019-09-24 12:49:30 0 [Note] InnoDB: Buffer pool(s) load completed at 190924 12:49:30
passbolt_1  | Generating a RSA private key
passbolt_1  | ..........................................................................................++++
passbolt_1  | ............................................................++++
passbolt_1  | writing new private key to '/etc/ssl/certs/certificate.key'
passbolt_1  | -----
passbolt_1  | 
passbolt_1  |      ____                  __          ____  
passbolt_1  |     / __ \____  _____ ____/ /_  ____  / / /_ 
passbolt_1  |    / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/ 
passbolt_1  |   / ____/ /_/ (__  |__  ) /_/ / /_/ / / /    
passbolt_1  |  /_/    \__,_/____/____/_.___/\____/_/\__/   
passbolt_1  | 
passbolt_1  |  Open source password manager for teams
passbolt_1  | ---------------------------------------------------------------
passbolt_1  | 
passbolt_1  | Running baseline checks, please wait...
passbolt_1  | Exception: SQLSTATE[HY000] [2006] MySQL server has gone away in [/var/www/passbolt/vendor/cakephp/cakephp/src/Database/Driver.php, line 92]
passbolt_1  | 
passbolt_1  |      ____                  __          ____  
passbolt_1  |     / __ \____  _____ ____/ /_  ____  / / /_ 
passbolt_1  |    / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/ 
passbolt_1  |   / ____/ /_/ (__  |__  ) /_/ / /_/ / / /    
passbolt_1  |  /_/    \__,_/____/____/_.___/\____/_/\__/   
passbolt_1  | 
passbolt_1  |  Open source password manager for teams
passbolt_1  | ---------------------------------------------------------------
passbolt_1  |  Running migration scripts.
passbolt_1  | ---------------------------------------------------------------
passbolt_1  | using migration paths 
passbolt_1  |  - /var/www/passbolt/config/Migrations
passbolt_1  | using seed paths 
passbolt_1  |  - /var/www/passbolt/config/Seeds
passbolt_1  | Exception: There was a problem connecting to the database: SQLSTATE[HY000] [2006] MySQL server has gone away in [/var/www/passbolt/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php, line 127]
passbolt_docker_passbolt_1 exited with code 1

Obviously it’s to do with the DB, but as all I have installed is rng-tools and run the docker compose file I expected it to just work

@diego is having a look. Will revert in a bit.

Brill thanks @remy @diego. Hopefully this will resolve my problems.

Hi Nick!

Could you prune the volumes and the mariadb/passbolt images?

docker-compose down
docker-compose rm
docker volume prune
docker images | grep mariadb | awk '{print $3}' | xargs docker rmi
docker images | grep passbolt | awk '{print $3}' | xargs docker rmi

You might need to refine the last 2 commands in case there is some tag of mariadb or passbolt you want to keep.

Then docker-compose up

Let me know if it is still happening after pruning all these objects as I can’t reproduce it.

Hi @diego done a complete systems clean. Removed the repo did a fresh pull, did a full systems prune (docker system prune -af) and removed all volumes. So have a completely clean docker system now. Still get the same problem, also just to note do have instaled rng-tools.

Running on: 18.04.3 LTS Ubuntu

Full docker log below:

Creating network "passbolt_docker_default" with the default driver
Creating volume "passbolt_docker_database_volume" with default driver
Creating volume "passbolt_docker_gpg_volume" with default driver
Creating volume "passbolt_docker_images_volume" with default driver
Pulling db (mariadb:10.3)...
10.3: Pulling from library/mariadb
5667fdb72017: Pull complete
d83811f270d5: Pull complete
ee671aafb583: Pull complete
7fc152dfb3a6: Pull complete
9f669c535a8b: Pull complete
a6de1092ee4e: Pull complete
ee37a2c88dd9: Pull complete
d927a3dd356c: Pull complete
d83c9d39c64f: Pull complete
1b0644883413: Pull complete
dc9f06d5fe30: Pull complete
2c0b65692be7: Pull complete
2643377bb0e1: Pull complete
0a628bd38198: Pull complete
Digest: sha256:fbd0431ea2eb80e0291f92334ff0870e1230bd8d2a6b6bd40fe2a74e53091635
Status: Downloaded newer image for mariadb:10.3
Pulling passbolt (passbolt/passbolt:2.11.0-debian)...
2.11.0-debian: Pulling from passbolt/passbolt
b8f262c62ec6: Pull complete
a98660e7def6: Pull complete
4d75689ceb37: Pull complete
639eb0368afa: Pull complete
73a67b6a0a18: Pull complete
cb2edaf4f884: Pull complete
2ac188244ae5: Pull complete
1081d271f884: Pull complete
4cb4b224cc2d: Pull complete
d49c24e2532f: Pull complete
af416fb5cf03: Pull complete
d59af7f7f610: Pull complete
d707f4579d30: Pull complete
3d1adf61c7c5: Pull complete
d2662f3a9153: Pull complete
5de3f1b8ef7c: Pull complete
dc2306567320: Pull complete
Digest: sha256:9a82cc389f6615b3ce90bc00f2592fd42d2b4f68439a3b16cacf65ed2c75e39b
Status: Downloaded newer image for passbolt/passbolt:2.11.0-debian
Creating passbolt_docker_db_1 ... done
Creating passbolt_docker_passbolt_1 ... done
Attaching to passbolt_docker_db_1, passbolt_docker_passbolt_1
passbolt_1  | wait-for.sh: waiting 15 seconds for db:3306
db_1        | Initializing database
db_1        | 
db_1        | 
db_1        | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
db_1        | To do so, start the server, then issue the following commands:
db_1        | 
db_1        | '/usr/bin/mysqladmin' -u root password 'new-password'
db_1        | '/usr/bin/mysqladmin' -u root -h  password 'new-password'
db_1        | 
db_1        | Alternatively you can run:
db_1        | '/usr/bin/mysql_secure_installation'
db_1        | 
db_1        | which will also give you the option of removing the test
db_1        | databases and anonymous user created by default.  This is
db_1        | strongly recommended for production servers.
db_1        | 
db_1        | See the MariaDB Knowledgebase at http://mariadb.com/kb or the
db_1        | MySQL manual for more instructions.
db_1        | 
db_1        | Please report any problems at http://mariadb.org/jira
db_1        | 
db_1        | The latest information about MariaDB is available at http://mariadb.org/.
db_1        | You can find additional information about the MySQL part at:
db_1        | http://dev.mysql.com
db_1        | Consider joining MariaDB's strong and vibrant community:
db_1        | https://mariadb.org/get-involved/
db_1        | 
db_1        | Database initialized
db_1        | MySQL init process in progress...
db_1        | 2019-09-24 13:48:21 0 [Note] mysqld (mysqld 10.3.18-MariaDB-1:10.3.18+maria~bionic) starting as process 109 ...
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Using Linux native AIO
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Uses event mutexes
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Number of pools: 1
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Using SSE2 crc32 instructions
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Completed initialization of buffer pool
db_1        | 2019-09-24 13:48:21 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        | 2019-09-24 13:48:21 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Waiting for purge to start
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: 10.3.18 started; log sequence number 1630815; transaction id 21
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1        | 2019-09-24 13:48:21 0 [Note] Plugin 'FEEDBACK' is disabled.
db_1        | 2019-09-24 13:48:21 0 [Warning] 'user' entry 'root@461e792c02e0' ignored in --skip-name-resolve mode.
db_1        | 2019-09-24 13:48:21 0 [Warning] 'user' entry '@461e792c02e0' ignored in --skip-name-resolve mode.
db_1        | 2019-09-24 13:48:21 0 [Warning] 'proxies_priv' entry '@% root@461e792c02e0' ignored in --skip-name-resolve mode.
db_1        | 2019-09-24 13:48:21 0 [Note] InnoDB: Buffer pool(s) load completed at 190924 13:48:21
db_1        | 2019-09-24 13:48:21 0 [Note] Reading of all Master_info entries succeeded
db_1        | 2019-09-24 13:48:21 0 [Note] Added new Master_info '' to hash table
db_1        | 2019-09-24 13:48:21 0 [Note] mysqld: ready for connections.
db_1        | Version: '10.3.18-MariaDB-1:10.3.18+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
passbolt_1  | wait-for.sh: timeout occurred after waiting 15 seconds for db:3306
passbolt_1  | gpg: directory '/home/www-data/.gnupg' created
passbolt_1  | gpg: keybox '/home/www-data/.gnupg/pubring.kbx' created
passbolt_1  | gpg: /home/www-data/.gnupg/trustdb.gpg: trustdb created
passbolt_1  | gpg: key FC02AEA4C616377E marked as ultimately trusted
passbolt_1  | gpg: directory '/home/www-data/.gnupg/openpgp-revocs.d' created
passbolt_1  | gpg: revocation certificate stored as '/home/www-data/.gnupg/openpgp-revocs.d/CB69EF974B0C798B1D10E732FC02AEA4C616377E.rev'
passbolt_1  | gpg: key FC02AEA4C616377E: "Passbolt default user <passbolt@yourdomain.com>" not changed
passbolt_1  | gpg: Total number processed: 1
passbolt_1  | gpg:              unchanged: 1
passbolt_1  | gpg: key FC02AEA4C616377E: "Passbolt default user <passbolt@yourdomain.com>" not changed
passbolt_1  | gpg: key FC02AEA4C616377E: secret key imported
passbolt_1  | gpg: Total number processed: 1
passbolt_1  | gpg:              unchanged: 1
passbolt_1  | gpg:       secret keys read: 1
passbolt_1  | gpg:  secret keys unchanged: 1
passbolt_1  | Generating a RSA private key
passbolt_1  | ..................++++
passbolt_1  | ...................................................................................++++
passbolt_1  | writing new private key to '/etc/ssl/certs/certificate.key'
passbolt_1  | -----
passbolt_1  | gpg: checking the trustdb
passbolt_1  | gpg: marginals needed: 3  completes needed: 1  trust model: pgp
passbolt_1  | gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
passbolt_1  | 
passbolt_1  |      ____                  __          ____  
passbolt_1  |     / __ \____  _____ ____/ /_  ____  / / /_ 
passbolt_1  |    / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/ 
passbolt_1  |   / ____/ /_/ (__  |__  ) /_/ / /_/ / / /    
passbolt_1  |  /_/    \__,_/____/____/_.___/\____/_/\__/   
passbolt_1  | 
passbolt_1  |  Open source password manager for teams
passbolt_1  | ---------------------------------------------------------------
passbolt_1  | 
passbolt_1  | Running baseline checks, please wait...
db_1        | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
passbolt_1  | Exception: SQLSTATE[HY000] [2002] Connection refused in [/var/www/passbolt/vendor/cakephp/cakephp/src/Database/Driver.php, line 92]
passbolt_1  | 
passbolt_1  |      ____                  __          ____  
passbolt_1  |     / __ \____  _____ ____/ /_  ____  / / /_ 
passbolt_1  |    / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/ 
passbolt_1  |   / ____/ /_/ (__  |__  ) /_/ / /_/ / / /    
passbolt_1  |  /_/    \__,_/____/____/_.___/\____/_/\__/   
passbolt_1  | 
passbolt_1  |  Open source password manager for teams
passbolt_1  | ---------------------------------------------------------------
passbolt_1  |  Running migration scripts.
passbolt_1  | ---------------------------------------------------------------
passbolt_1  | using migration paths 
passbolt_1  |  - /var/www/passbolt/config/Migrations
passbolt_1  | using seed paths 
passbolt_1  |  - /var/www/passbolt/config/Seeds
passbolt_1  | Exception: There was a problem connecting to the database: SQLSTATE[HY000] [2002] Connection refused in [/var/www/passbolt/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php, line 127]
passbolt_docker_passbolt_1 exited with code 1
^CGracefully stopping... (press Ctrl+C again to force)
Stopping passbolt_docker_db_1       ... done

I have been able to reproduce it after pruning everything.

Looks like a race condition with wait-for.sh. passbolt container tries to contact mariadb before it has finished the setup.

If I run the setup first time I get your error, then ctrl+c, relaunch again and it works. Don’t know if that is the same for you.

Could you try overriding the command on docker-compose.sh:

    command:
      - /bin/bash
      - -c
      - |
        sleep 30
        /docker-entrypoint.sh

Still able to reproduce it using “docker system prune -af --volume”. However if I also add restart: always, it does now get into the right state (same as you said earlier, first time it fails second time it works).

This wasn’t the case previously but for a temporary measure this works, going to mess with the sleep time see if I can get it building first time.

Let me know if you require any further information.

restart: always works on my side, it fails contacting the db but it restarts and works.

Looks to me that all this is boiling down to wait-for not identifying correctly that mariadb is ready.
This has been a discussion in the docker github repo https://github.com/passbolt/passbolt_docker/pull/123
As mentioned on the PR I kind of like more the approach of letting the containers to fail and restart until the system reaches a ready state. Considering that one of the first checks the passbolt container does is trying to connect with the DB seems reasonable for me.

Last check:

add restart: always to passbolt container on docker-compose.yml and remove command: section from passbolt container

Yea works currently with “restart: always” just the same as you, fails to find the db, then recovers.

Personally much prefer it to not fail at all, but know the fun of trying to have a db ready can be a pain. Either way thanks for helping to get it rolling.

No problem!

I think this would qualify as a enhancement to say the least on the passbolt_docker repo. Would you mind to create an issue so I can tackle it when there is some bandwidth?
At least this way users could come to this thread and find some solutions on the meantime.

Sure thing @diego I’ll add that as soon as I can.

Would be nice also to able to use the installation wizard inside the container as makes my life easier rather than using having to remember to have env vars set.

For others finding this post use the below compose file to get passbolt to work with docker compose:

version: '3.4'
services:
  db:
    image: mariadb:10.3
    env_file:
      - env/mysql.env
    volumes:
      - database_volume:/var/lib/mysql
    ports:
      - "127.0.0.1:3306:3306"

  passbolt:
    image: passbolt/passbolt:2.11.0-debian
    tty: true
    depends_on:
      - db
    env_file:
      - env/passbolt.env
    volumes:
      - gpg_volume:/var/www/passbolt/config/gpg
      - images_volume:/var/www/passbolt/webroot/img/public
    tmpfs:
      - /run
    command: ["/docker-entrypoint.sh"]
    ports:
      - 80:80
      - 443:443
    restart:
        always

volumes:
  database_volume:
  gpg_volume:
  images_volume:
1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.