taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit 4435abcdec253ebfcd54219193a27eb7e395719d
parent 75d7b83d8bcc4f1c6f21706536764dc53b55f658
Author: MS <ms@taler.net>
Date:   Wed, 19 Oct 2022 15:50:00 +0200

log database on mounted volume

Diffstat:
Mdocker/hybrid/README | 42++++++++++++++++++++++++------------------
Mdocker/hybrid/docker-compose.yml | 8++++----
Mdocker/hybrid/images/postgres/init.sh | 11+++++++++--
3 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/docker/hybrid/README b/docker/hybrid/README @@ -6,6 +6,7 @@ This setup orchestrates the following containers: 1. Banking (libEufin) 2. Shop(s) 3. Payment service provider (Taler exchange and helpers) +4. Database Note: one stratagem was however needed to make it work. The merchant container needs to redirect requests to @@ -39,9 +40,30 @@ From this folder, run: How to run ========== +Configuration +------------- + Export the env variable TALER_DEPLOYMENT_CONFIG to an -absolute path of a host-specific configuration file. See -config/deployment.conf for an example. +absolute path of a configuration file. See config/deployment.conf +for an example. + +Volumes +------- + +The environment variable TALER_DEPLOYMENT_DATA controls +where on the host's filesystem the services' data gets stored. +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 logs get stored. It defaults +to ~/taler-logs, and contains exchange, libeufin, and postgresql +data. NOTE: Postgres needs permissions to write in +TALER_DEPLOYMENT_LOGS because it runs as the 'postgres' user +(uid=999). + +Run +--- From this folder, run: $ docker-compose up --remove-orphans --abort-on-container-exit @@ -103,19 +125,3 @@ Nginx configuration example deploys this sandbox under proxy_pass http://localhost:15000/; } } - -Below is an example of a global configuration that -sets the currency for the entire sandbox. Its file's -path must be then exported via the TALER_DEPLOYMENT_CONFIG -env variable (see "How to run" section above). - - [taler-deployment] - currency = EUR - -How to persist data on the host -=============================== - -The environment variable TALER_DEPLOYMENT_DATA controls -where on the host's filesystem the services' data gets stored. -It defaults to ~/taler-data, and contains exchange, libeufin, -and postgresql data. diff --git a/docker/hybrid/docker-compose.yml b/docker/hybrid/docker-compose.yml @@ -1,12 +1,12 @@ version: '3' # it's a constant 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 - ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf environment: @@ -21,9 +21,9 @@ services: ports: - 5555:80 volumes: - - ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf - - ${TALER_DEPLOYMENT_DATA:-~/taler-data}/exchange:/data - ${TALER_DEPLOYMENT_LOGS:-~/taler-logs}:/logs + - ${TALER_DEPLOYMENT_DATA:-~/taler-data}/exchange:/data + - ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf merchant: build: ./images/merchant @@ -33,8 +33,8 @@ services: - 5556:80 - 5559:8080 # Blog TBD. volumes: - - ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf - ${TALER_DEPLOYMENT_LOGS:-~/taler-logs}:/logs + - ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf bank: build: ./images/libeufin diff --git a/docker/hybrid/images/postgres/init.sh b/docker/hybrid/images/postgres/init.sh @@ -2,7 +2,14 @@ set -eu -# Fixme: use taler-config. -CUSTOM_PASSWORD=$(grep db-password < /config/deployment.conf | awk -F= '{print $2}' | tr -d "[:space:]") +# FIXME: use taler-config. +CUSTOM_PASSWORD=$(grep ^db-password < /config/deployment.conf | awk -F= '{print $2}' | tr -d "[:space:]") +if test -z "${CUSTOM_PASSWORD}"; then + echo ERROR: database password empty. +fi echo "ALTER ROLE root WITH PASSWORD '"${CUSTOM_PASSWORD}"';" | psql -U root createdb -U root -O root taler +echo "ALTER SYSTEM SET logging_collector TO 'true';" | psql -U root +echo "ALTER SYSTEM SET log_directory TO '/logs';" | psql -U root +echo "ALTER SYSTEM SET log_filename TO 'postgres-%Y-%m-%d';" | psql -U root +pg_ctl restart