itmicus/cmdbuild_docker

problems with POSTGRES_PASSWORD in docker-compose

Opened this issue · 0 comments

Hi,

For version 3.4, if you init docker-compose normaly, you can see in the logs of cmdbuild_db the next error:

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

****************************************************
WARNING: No password has been set for the database.
         This will allow anyone with access to the
         Postgres port to access your database. In
         Docker's default configuration, this is
         effectively any other container on the same
         system.

         Use "-e POSTGRES_PASSWORD=password" to set
         it in "docker run".
****************************************************
waiting for server to start....2023-10-31 12:35:15.684 UTC [44] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-10-31 12:35:15.715 UTC [45] LOG:  database system was shut down at 2023-10-31 12:35:15 UTC
2023-10-31 12:35:15.722 UTC [44] LOG:  database system is ready to accept connections
 done
server started

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

2023-10-31 12:35:15.763 UTC [44] LOG:  received fast shutdown request
waiting for server to shut down....2023-10-31 12:35:15.767 UTC [44] LOG:  aborting any active transactions
2023-10-31 12:35:15.770 UTC [44] LOG:  worker process: logical replication launcher (PID 51) exited with exit code 1
2023-10-31 12:35:15.777 UTC [46] LOG:  shutting down
2023-10-31 12:35:15.801 UTC [44] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2023-10-31 12:35:15.879 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-10-31 12:35:15.879 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-10-31 12:35:15.886 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-10-31 12:35:15.911 UTC [53] LOG:  database system was shut down at 2023-10-31 12:35:15 UTC
2023-10-31 12:35:15.919 UTC [1] LOG:  database system is ready to accept connections
2023-10-31 12:35:16.956 UTC [60] LOG:  incomplete startup packet
2023-10-31 12:35:19.036 UTC [61] FATAL:  role "cmdbuild" does not exist
2023-10-31 12:36:27.918 UTC [1471] LOG:  incomplete startup packet

To solved it, i need to add the POSTGRES_PASSWORD in docker-compose.yml for the cmdbuild_db

    cmdbuild_db:
        image: itmicus/cmdbuild:db-3.0
        container_name: cmdbuild_db
        volumes:
            - cmdbuild-db:/var/lib/postgresql
        ports:
            - 5432:5432
        environment:
            - POSTGRES_USER=postgres
            - POSTGRES_PASS=postgres
            - POSTGRES_PASSWORD=postgres
        restart: always
        networks:
            cmdbuildnet:

if i do that, all init OK.

root@ip-172-31-19-114:/home/ubuntu# docker logs cmdbuild_db
2023-10-31 12:38:02.129 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-10-31 12:38:02.129 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-10-31 12:38:02.136 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-10-31 12:38:02.164 UTC [24] LOG:  database system was interrupted; last known up at 2023-10-31 12:35:19 UTC
2023-10-31 12:38:02.231 UTC [24] LOG:  database system was not properly shut down; automatic recovery in progress
2023-10-31 12:38:02.236 UTC [24] LOG:  redo starts at 0/16341E8
2023-10-31 12:38:02.739 UTC [24] LOG:  invalid record length at 0/275F748: wanted 24, got 0
2023-10-31 12:38:02.739 UTC [24] LOG:  redo done at 0/275F720
2023-10-31 12:38:02.739 UTC [24] LOG:  last completed transaction was at log time 2023-10-31 12:37:50.018698+00
2023-10-31 12:38:03.077 UTC [1] LOG:  database system is ready to accept connections

Can you fix or i am doing something wrong?

Thank you very much!! :)