docker_compose: Add a local postgres instance as an optional service

The node hosting the database can then easily run it as part of the stack.
pull/57/head
Mike Lang 6 years ago
parent 63eb324ba5
commit 6071a2f18d

@ -12,14 +12,15 @@
image_tag:: "latest", image_tag:: "latest",
// For each service, whether to deploy that service. // For each service, whether to deploy that service.
enabled: { enabled:: {
downloader: true, downloader: true,
restreamer: true, restreamer: true,
backfiller: true, backfiller: true,
cutter: false, cutter: true,
sheetsync: false, sheetsync: true,
thrimshim: false, thrimshim: true,
nginx: true, nginx: true,
postgres: true,
}, },
// Twitch channel to capture // Twitch channel to capture
@ -32,6 +33,9 @@
// On OSX you need to change this to /private/var/lib/wubloader // On OSX you need to change this to /private/var/lib/wubloader
segments_path:: "/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/",
// The host's port to expose each service on. // The host's port to expose each service on.
// Only the restreamer needs to be externally accessible - the others are just for monitoring. // Only the restreamer needs to be externally accessible - the others are just for monitoring.
ports:: { ports:: {
@ -42,6 +46,7 @@
cutter: 8003, cutter: 8003,
sheetsync: 8005, sheetsync: 8005,
nginx: 80, nginx: 80,
postgres: 5432,
}, },
// The local port within each container to bind the backdoor server on. // The local port within each container to bind the backdoor server on.
@ -53,11 +58,12 @@
"http://wubloader.codegunner.com/" "http://wubloader.codegunner.com/"
], ],
// Connection args for the database // Connection args for the database.
// If database is defined in this config, host and port should be postgres:5432.
db_args:: { db_args:: {
user: "postgres", user: "postgres",
password: "postgres", password: "postgres",
host: "localhost", host: "postgres",
port: 5432, port: 5432,
dbname: "wubloader", dbname: "wubloader",
}, },
@ -202,11 +208,22 @@
}, },
[if $.enabled.nginx then "nginx"]: { [if $.enabled.nginx then "nginx"]: {
image: "quay.io/ekimekim/wubloader-nginx:%s" % image_tag, image: "quay.io/ekimekim/wubloader-nginx:%s" % $.image_tag,
restart: "on-failure", restart: "on-failure",
[if "nginx" in $.ports then "ports"]: ["%s:80" % $.ports.nginx], [if "nginx" in $.ports then "ports"]: ["%s:80" % $.ports.nginx],
}, },
[if $.enabled.postgres then "postgres"]: {
image: "postgres:latest",
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_DB: $.db_args.dbname,
},
},
}, },
} }

Loading…
Cancel
Save