ecos-microservices-postgresql-app
Purpose
Image built on the official postgresql 12.x image with an added database and user initialization script
Tags:
nexus.citeck.ru/postrgesql:msvc-latest - built on the postgres:12 base image, used in compose projects; configuration files are placed in the image
nexus.citeck.ru/postrgesql:12 - base postgres:12 image, hosted in our docker registry, used in k8s objects; configuration files and deployment script are configured via configmap
Base images
postgres:12
Docker Compose service template:
ecos-microservices-postgresql-app:
container_name: ecos-microservices-postgresql-app
hostname: ecos-microservices-postgresql-app
restart: unless-stopped
image: nexus.citeck.ru/postgresql:msvc-latest
stop_grace_period: 1m
command: ["postgres", "-c", "config_file=/var/lib/postgresql/conf/postgresql.conf"]
expose:
- 5432/tcp
env_file:
- ./env_dir/ecos-microservices-postgresql-app.env
volumes:
- /opt/ecos-microservices-postgresql:/var/lib/postgresql/data
networks:
- app_network
Used variables:
ECOS_APPS_APP_DATASOURCE_DATABASE - database for the ecos-apps-app microservice
ECOS_APPS_APP_DATASOURCE_USERNAME - user for the ecos-apps-app microservice
ECOS_APPS_APP_DATASOURCE_PASSWORD - password for the ecos-apps-app microservice
ECOS_GATEWAY_APP_DATASOURCE_DATABASE - database for the ecos-gateway-app microservice
ECOS_GATEWAY_APP_DATASOURCE_USERNAME - user for the ecos-gateway-app microservice
ECOS_GATEWAY_APP_DATASOURCE_PASSWORD - password for the ecos-gateway-app microservice
ECOS_UISERV_APP_DATASOURCE_DATABASE - database for the ecos-uiserv-app microservice
ECOS_UISERV_APP_DATASOURCE_USERNAME - user for the ecos-uiserv-app microservice
ECOS_UISERV_APP_DATASOURCE_PASSWORD - password for the ecos-uiserv-app microservice
ECOS_INTEGRATIONS_APP_DATASOURCE_DATABASE - database for the ecos-integrations-app microservice
ECOS_INTEGRATIONS_APP_DATASOURCE_USERNAME - user for the ecos-integrations-app microservice
ECOS_INTEGRATIONS_APP_DATASOURCE_PASSWORD - password for the ecos-integrations-app microservice
ECOS_MODEL_APP_DATASOURCE_DATABASE - database for the ecos-model-app microservice
ECOS_MODEL_APP_DATASOURCE_USERNAME - user for the ecos-model-app microservice
ECOS_MODEL_APP_DATASOURCE_PASSWORD - password for the ecos-model-app microservice
ECOS_NOTIFICATIONS_APP_DATASOURCE_DATABASE - database for the ecos-notifications-app microservice
ECOS_NOTIFICATIONS_APP_DATASOURCE_USERNAME - user for the ecos-notifications-app microservice
ECOS_NOTIFICATIONS_APP_DATASOURCE_PASSWORD - password for the ecos-notifications-app microservice
ECOS_HISTORY_APP_DATASOURCE_DATABASE - database for the ecos-history-app microservice
ECOS_HISTORY_APP_DATASOURCE_USERNAME - user for the ecos-history-app microservice
ECOS_HISTORY_APP_DATASOURCE_PASSWORD - password for the ecos-history-app microservice
POSTGRES_PASSWORD - mandatory parameter except when POSTGRES_HOST_AUTH_METHOD=trust, password for the privileged postgres user
POSTGRES_USER - override of the default postgres user
POSTGRES_DB - override of the default database
POSTGRES_INITDB_ARGS - additional parameters for cluster initialization
POSTGRES_INITDB_WALDIR - override of the default transaction log storage directory
POSTGRES_HOST_AUTH_METHOD - authentication method for host connections for all databases, users, and addresses in pg_hba.conf. Default value md5
PGDATA - override of the default file storage directory of the initialized cluster
Typical settings acceptance log output:
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... sh: locale: not found
2020-04-28 08:59:20.042 UTC [30] WARNING: no usable system locales were found
ok
syncing data to disk ... initdb: 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.
ok
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data -l logfile start
waiting for server to start....2020-04-28 08:59:20.503 UTC [35] LOG: starting PostgreSQL 12.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.2.0) 9.2.0, 64-bit
2020-04-28 08:59:20.506 UTC [35] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-04-28 08:59:20.555 UTC [36] LOG: database system was shut down at 2020-04-28 08:59:20 UTC
2020-04-28 08:59:20.563 UTC [35] LOG: database system is ready to accept connections
done
server started
/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/init-db.sh
CREATE ROLE
CREATE DATABASE
GRANT
CREATE ROLE
CREATE DATABASE
GRANT
CREATE ROLE
CREATE DATABASE
GRANT
CREATE ROLE
CREATE DATABASE
GRANT
CREATE ROLE
CREATE DATABASE
GRANT
CREATE ROLE
CREATE DATABASE
GRANT
CREATE ROLE
CREATE DATABASE
GRANT
waiting for server to shut down....2020-04-28 08:59:21.371 UTC [35] LOG: received fast shutdown request
2020-04-28 08:59:21.374 UTC [35] LOG: aborting any active transactions
2020-04-28 08:59:21.376 UTC [35] LOG: background worker "logical replication launcher" (PID 42) exited with exit code 1
2020-04-28 08:59:21.376 UTC [37] LOG: shutting down
2020-04-28 08:59:21.409 UTC [35] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2020-04-28 08:59:21.494 UTC [1] LOG: starting PostgreSQL 12.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.2.0) 9.2.0, 64-bit
2020-04-28 08:59:21.494 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-04-28 08:59:21.494 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-04-28 08:59:21.502 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-04-28 08:59:21.538 UTC [46] LOG: database system was shut down at 2020-04-28 08:59:21 UTC
2020-04-28 08:59:21.542 UTC [1] LOG: database system is ready to accept connections