94 lines
2.3 KiB
YAML
94 lines
2.3 KiB
YAML
version: '3'
|
|
|
|
services:
|
|
|
|
huginn:
|
|
deploy:
|
|
placement:
|
|
constraints: [node.labels.com.sigyl.git-stack == yes]
|
|
replicas: 1
|
|
restart_policy:
|
|
condition: any
|
|
image: huginn/huginn
|
|
environment:
|
|
# For huginn/huginn - essential
|
|
- SMTP_DOMAIN=your-domain-here.com
|
|
- SMTP_USER_NAME=you@gmail.com
|
|
- SMTP_PASSWORD=somepassword
|
|
- SMTP_SERVER=your-mailserver-here.com
|
|
- SMTP_PORT=587
|
|
- SMTP_AUTHENTICATION=plain
|
|
- SMTP_ENABLE_STARTTLS_AUTO=true
|
|
- INVITATION_CODE=<set an invitation code here>
|
|
- POSTGRES_PORT_5432_TCP_ADDR=db
|
|
- POSTGRES_PORT_5432_TCP_PORT=5432
|
|
- DATABASE_USERNAME=huginn
|
|
- DATABASE_PASSWORD=<database password>
|
|
- DATABASE_ADAPTER=postgresql
|
|
volumes:
|
|
- /etc/localtime:/etc/localtime:ro
|
|
networks:
|
|
- appnet
|
|
- externalnet
|
|
|
|
db:
|
|
deploy:
|
|
placement:
|
|
constraints: [node.labels.com.sigyl.git-stack-data == yes]
|
|
replicas: 1
|
|
restart_policy:
|
|
condition: any
|
|
environment:
|
|
- POSTGRES_USER=huginn
|
|
- POSTGRES_PASSWORD=<database password>
|
|
- BACKUP_NUM_KEEP=7
|
|
- BACKUP_FREQUENCY=1d
|
|
image: postgres:latest
|
|
volumes:
|
|
- db:/var/lib/postgresql/data
|
|
- /etc/localtime:/etc/localtime:ro
|
|
networks:
|
|
- appnet
|
|
- externalnet
|
|
|
|
db-backup:
|
|
deploy:
|
|
placement:
|
|
constraints: [node.labels.com.sigyl.git-stack-data == yes]
|
|
replicas: 1
|
|
restart_policy:
|
|
condition: any
|
|
image: postgres:latest
|
|
environment:
|
|
- POSTGRES_USER=huginn
|
|
- POSTGRES_PASSWORD=<database password>
|
|
- BACKUP_NUM_KEEP=7
|
|
- BACKUP_FREQUENCY=1d
|
|
volumes:
|
|
- db-dump:/dump
|
|
- /etc/localtime:/etc/localtime:ro
|
|
entrypoint: |
|
|
bash -c 'bash -s <<EOF
|
|
trap "break;exit" SIGHUP SIGINT SIGTERM
|
|
sleep 2m
|
|
while /bin/true; do
|
|
pg_dump -Fc > /dump/dump_\`date +%d-%m-%Y"_"%H_%M_%S\`.psql
|
|
(ls -t /dump/dump*.psql|head -n $$BACKUP_NUM_KEEP;ls /dump/dump*.psql)|sort|uniq -u|xargs rm -- {}
|
|
sleep $$BACKUP_FREQUENCY
|
|
done
|
|
EOF'
|
|
networks:
|
|
- appnet
|
|
- externalnet
|
|
|
|
volumes:
|
|
db:
|
|
db-dump:
|
|
|
|
networks:
|
|
externalnet:
|
|
external: true
|
|
driver: overlay
|
|
appnet:
|
|
driver: overlay
|