commit 6c0c47eec71b5f572c81f39233fd9d22bdfd0bfb
parent 5a5a702165761a33f28398900ffa327c54d3e2e6
Author: MS <ms@taler.net>
Date: Thu, 20 Oct 2022 23:37:09 +0200
Switch to named volumes.
Diffstat:
3 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/docker/hybrid/README b/docker/hybrid/README
@@ -50,17 +50,7 @@ for an example.
Volumes
-------
-The environment variable TALER_DEPLOYMENT_DATA controls
-where on the host's filesystem the services store data.
-It defaults to ~/taler-data, and contains exchange, libeufin,
-and postgresql data.
-
-The environment variable TALER_DEPLOYMENT_LOGS controls
-where on the host's filesystem the services store log files.
-It defaults to ~/taler-logs and will be created by Docker -
-owned by "root:root" - if it's not found. NOTE: the 'postgres'
-user (uid=999) needs write access to TALER_DEPLOYMENT_LOGS,
-in order to log from the database container.
+TBD: write how to export data.
Run
---
diff --git a/docker/hybrid/docker-compose.yml b/docker/hybrid/docker-compose.yml
@@ -1,18 +1,31 @@
version: '3' # it's a constant
+volumes:
+ talerdata:
+ talerlogs:
+
services:
talerdb:
build: ./images/postgres
ports:
- 8888:5432
volumes:
- - ${TALER_DEPLOYMENT_LOGS:-~/taler-logs}:/logs
- - ${TALER_DEPLOYMENT_DATA:-~/taler-data}/postgresql:/var/lib/postgresql/data
+ - talerlogs:/logs
+ - talerdata:/var/lib/postgresql/data/
- ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf
environment:
+ # the only 'role' existing in the DBMS. That
+ # matches the role used by other containers when
+ # they connect here.
POSTGRES_USER: root
- POSTGRES_PASSWORD: nonce # changed during init.
+ # this changes to the password used by other
+ # containers to connect here. This definition
+ # only makes the init logic happy.
+ POSTGRES_PASSWORD: nonce
POSTGRES_HOST_AUTH_METHOD: scram-sha-256
+ # the final "/postgresql" is used to create
+ # a "postgresql" subfolder in the data volume.
+ PGDATA: /var/lib/postgresql/data/postgresql
exchange:
build: ./images/exchange
@@ -21,8 +34,8 @@ services:
ports:
- 5555:80
volumes:
- - ${TALER_DEPLOYMENT_LOGS:-~/taler-logs}:/logs
- - ${TALER_DEPLOYMENT_DATA:-~/taler-data}/exchange:/data
+ - talerlogs:/logs
+ - talerdata:/data
- ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf
merchant:
@@ -33,7 +46,7 @@ services:
- 5556:80
- 5559:8080 # Blog TBD.
volumes:
- - ${TALER_DEPLOYMENT_LOGS:-~/taler-logs}:/logs
+ - talerlogs:/logs
- ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf
bank:
@@ -42,6 +55,6 @@ services:
- 15000:15000 # Sandbox
- 15001:15001 # Nexus
volumes:
+ - talerlogs:/logs
+ - talerdata:/data
- ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf
- - ${TALER_DEPLOYMENT_DATA:-~/taler-data}/libeufin:/data
- - ${TALER_DEPLOYMENT_LOGS:-~/taler-logs}:/logs
diff --git a/docker/hybrid/images/postgres/Dockerfile b/docker/hybrid/images/postgres/Dockerfile
@@ -1,4 +1,9 @@
FROM docker.io/postgres
+# Default "${PGDATA}/log" directory was problematic
+# when mounted in a volume.
+RUN mkdir /logs
+RUN chown postgres:postgres /logs
+
COPY init.sh /docker-entrypoint-initdb.d/init.sh
RUN chmod +x /docker-entrypoint-initdb.d/init.sh