docker compose updates; option not to replicate

pull/73/head
Christopher Usher 5 years ago
parent 38801ea6d3
commit 0eefdb94e0

@ -7,7 +7,7 @@
// Change these to configure the services.
// Image tag (application version) to use.
// Note: "latest" is not reccomended in production, as you can't be sure what version
// Note: "latest" is not recommended in production, as you can't be sure what version
// you're actually running, and must manually re-pull to get an updated copy.
image_tag:: "latest",
@ -33,8 +33,11 @@
// On OSX you need to change this to /private/var/lib/wubloader
segments_path:: "/var/lib/wubloader/",
// Local path to save database to. Full path must already exist. Cannot contain ':'.
database_path:: "/var/lib/wubloader_postgres/",
// Local path to save database to. Full path must already exist. Cannot
// contain ':'. If this directory is non-empty, the database will start with
// the database in this directory and not run the setup scripts to create a
// new database.
database_path:: "/private/var/lib/wubloader_postgres/",
// The host's port to expose each service on.
// Only nginx (and postgres if that is being deployed) needs to be externally accessible - the other non-database ports are routed through nginx.
@ -53,21 +56,27 @@
// You can exec into the container and telnet to this port to get a python shell.
backdoor_port:: 1234,
// Other nodes to backfill from. You should not include the local node.
// Other nodes to always backfill from. You should not include the local node.
peers:: [
"http://wubloader.codegunner.com/"
],
// Connection args for the database.
// If database is defined in this config, host and port should be postgres:5432.
db_args:: {
user: "postgres",
password: "postgres",
user: "vst",
password: "dbfh2019", // don't use default in production
host: "postgres",
port: 5432,
dbname: "wubloader",
},
// Other database arguments
db_super_user:: "postgres", // only accessible from localhost
db_super_password:: "postgres",
db_replication_user:: "replicate", // if empty, don't allow replication
db_replication_password:: "standby", // don't use default in production
db_standby:: false, // set to true to have this database replicate another server
// Path to a JSON file containing google credentials as keys
// 'client_id', 'client_secret' and 'refresh_token'.
google_creds:: "./google_creds.json",
@ -231,14 +240,22 @@
},
[if $.enabled.postgres then "postgres"]: {
image: "postgres:latest",
image: "quay.io/ekimekim/wubloader-postgres:%s" % $.image_tag,
restart: "on-failure",
[if "postgres" in $.ports then "ports"]: ["%s:5432" % $.ports.postgres],
environment: {
POSTGRES_USER: $.db_args.user,
POSTGRES_PASSWORD: $.db_args.password,
POSTGRES_USER: $.db_super_user,
POSTGRES_PASSWORD: $.db_super_password,
POSTGRES_DB: $.db_args.dbname,
PGDATA: "/mnt",
WUBLOADER_USER: $.db_args.user,
WUBLOADER_PASSWORD: $.db_args.password,
REPLICATION_USER: $.db_replication_user,
REPLICATION_PASSWORD: $.db_replication_password,
MASTER_NODE: $.db_args.host,
},
volumes: ["%s:/mnt" % $.database_path],
[if $.db_standby then "command"]: ["/standby_setup.sh"],
},
},

@ -3,17 +3,26 @@
set -e
sed -i "/host all all all/d" "$PGDATA/pg_hba.conf"
echo "host replication $REPLICATION_USER all md5" >> "$PGDATA/pg_hba.conf"
echo "host all $WUBLOADER_USER all md5" >> "$PGDATA/pg_hba.conf"
echo "Creating $WUBLOADER_USER"
psql -v ON_ERROR_STOP=1 -U postgres <<-EOSQL
CREATE USER $WUBLOADER_USER LOGIN PASSWORD '$WUBLOADER_PASSWORD';
EOSQL
if [ -n "$REPLICATION_USER" ]; then
echo "Creating $REPLICATION_USER"
echo "host replication $REPLICATION_USER all md5" >> "$PGDATA/pg_hba.conf"
psql -v ON_ERROR_STOP=1 -U postgres <<-EOSQL
CREATE USER $REPLICATION_USER LOGIN REPLICATION PASSWORD '$REPLICATION_PASSWORD';
EOSQL
cat >> ${PGDATA}/postgresql.conf <<EOF
cat >> ${PGDATA}/postgresql.conf <<EOF
wal_level = replica
archive_mode = on
@ -22,3 +31,5 @@ max_wal_senders = 8
wal_keep_segments = 8
EOF
fi

@ -11,7 +11,7 @@ if [ ! -s "$PGDATA/PG_VERSION" ]; then
standby_mode = on
primary_conninfo = 'host=$MASTER_NODE password=$REPLICATION_PASSWORD port=5432 user=$REPLICATION_USER'
trigger_file = '/tmp/touch_me_to_promote_to_me_master'
trigger_file = '/tmp/touch_to_promote_to_master'
EOF

Loading…
Cancel
Save