Compare commits
8 Commits
1.0.4+6.3.
...
master
Author | SHA1 | Date | |
---|---|---|---|
b6b52b6e9c
|
|||
d7dbf76a53 | |||
f80f630304 | |||
73e9f7bfcc | |||
3a940d845f | |||
d7b3c1e18e | |||
3af308645e | |||
cb85124b06 |
@ -32,7 +32,7 @@ steps:
|
||||
from_secret: drone_abra-bot_token
|
||||
fork: true
|
||||
repositories:
|
||||
- coop-cloud/auto-recipes-catalogue-json
|
||||
- toolshed/auto-recipes-catalogue-json
|
||||
|
||||
trigger:
|
||||
event: tag
|
||||
|
@ -2,6 +2,7 @@ TYPE=zammad
|
||||
|
||||
DOMAIN=zammad.example.com
|
||||
TIMEOUT=600
|
||||
ENABLE_BACKUPS=true
|
||||
|
||||
## Domain aliases
|
||||
#EXTRA_DOMAINS=', `www.zammad.example.com`'
|
||||
@ -28,7 +29,7 @@ SMTP_PORT=465
|
||||
## SAML SSO ##
|
||||
#SSO_PROVIDER_DOMAIN=authentik.example.com
|
||||
#IDP_SSO_TARGET_URL=https://authentik.example.com/application/saml/zammad/sso/binding/init/
|
||||
#IDP_SLO_SERVICE_URL=https://authentik.example.com/application/saml/zammad/slo/binding/redirect/
|
||||
#IDP_SLO_SERVICE_URL=https://zammad.example.com/auth/saml/slo
|
||||
|
||||
|
||||
## Zammad internal backups
|
||||
|
1
abra.sh
1
abra.sh
@ -1,5 +1,6 @@
|
||||
export ENTRYPOINT_VERSION=v2
|
||||
export AUTO_WIZARD_VERSION=v2
|
||||
export PG_BACKUP_VERSION=v2
|
||||
|
||||
get_setting_changes() {
|
||||
/custom-entrypoint.sh "rails r 'puts JSON.pretty_generate(JSON.parse(Setting.all.select{ |setting| setting.state_current != setting.state_initial }.map { |setting| {name: setting.name, value: setting.state_current[\""value\""]} } .to_json))'"
|
||||
|
@ -1,7 +1,7 @@
|
||||
version: "3.8"
|
||||
services:
|
||||
zammad-backup:
|
||||
image: ghcr.io/zammad/zammad:6.3.1-95
|
||||
image: ghcr.io/zammad/zammad:6.5.0-34
|
||||
command: ["zammad-backup"]
|
||||
volumes:
|
||||
- zammad-backup:/var/tmp/zammad
|
||||
|
38
compose.yml
38
compose.yml
@ -43,7 +43,7 @@ x-shared:
|
||||
SSO_PROVIDER_DOMAIN:
|
||||
IDP_SSO_TARGET_URL:
|
||||
IDP_SLO_SERVICE_URL:
|
||||
image: ghcr.io/zammad/zammad:6.3.1-95
|
||||
image: ghcr.io/zammad/zammad:6.5.0-34
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@ -55,11 +55,11 @@ x-shared:
|
||||
- zammad-redis
|
||||
entrypoint: /custom-entrypoint.sh
|
||||
configs:
|
||||
- source: entrypoint
|
||||
target: /custom-entrypoint.sh
|
||||
mode: 0555
|
||||
- source: auto_wizard
|
||||
target: /opt/zammad/contrib/auto_wizard.json
|
||||
- source: entrypoint
|
||||
target: /custom-entrypoint.sh
|
||||
mode: 0555
|
||||
- source: auto_wizard
|
||||
target: /opt/zammad/contrib/auto_wizard.json
|
||||
secrets:
|
||||
- db_password
|
||||
- smtp_password
|
||||
@ -67,7 +67,7 @@ x-shared:
|
||||
|
||||
services:
|
||||
zammad-elasticsearch:
|
||||
image: bitnami/elasticsearch:8.14.3
|
||||
image: bitnami/elasticsearch:8.18.0
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@ -86,7 +86,7 @@ services:
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 5m
|
||||
|
||||
|
||||
zammad-init:
|
||||
<<: *zammad-service
|
||||
command: ["zammad-init"]
|
||||
@ -96,7 +96,7 @@ services:
|
||||
|
||||
zammad-memcached:
|
||||
command: memcached -m 256M
|
||||
image: memcached:1.6.29-alpine
|
||||
image: memcached:1.6.38-alpine
|
||||
healthcheck:
|
||||
test: 'echo "version" | nc -vn -w 1 127.0.0.1 11211'
|
||||
interval: 30s
|
||||
@ -130,7 +130,7 @@ services:
|
||||
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
||||
- "coop-cloud.${STACK_NAME}.version=1.0.4+6.3.1-95"
|
||||
- "coop-cloud.${STACK_NAME}.version=2.1.0+6.5.0-34"
|
||||
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080"]
|
||||
@ -149,14 +149,18 @@ services:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
backupbot.backup: "true"
|
||||
backupbot.backup.pre-hook: "PGPASSWORD=$$(cat /run/secrets/db_password) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /var/lib/postgresql/data/backup.sql"
|
||||
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
||||
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
||||
backupbot.backup.volumes.postgresql-data.path: "backup.sql"
|
||||
backupbot.restore.post-hook: 'psql -U $${POSTGRES_USER} -d postgres -c "DROP DATABASE $${POSTGRES_DB} WITH (FORCE);" && createdb -U $${POSTGRES_USER} $${POSTGRES_DB} && psql -U $${POSTGRES_USER} -d $${POSTGRES_DB} -f /var/lib/postgresql/data/backup.sql'
|
||||
backupbot.restore.post-hook: "/pg_backup.sh restore"
|
||||
backupbot.backup.volumes.elasticsearch-data: "false"
|
||||
backupbot.backup.volumes.redis-data: "false"
|
||||
volumes:
|
||||
- postgresql-data:/var/lib/postgresql/data
|
||||
configs:
|
||||
- source: pg_backup
|
||||
target: /pg_backup.sh
|
||||
mode: 0555
|
||||
secrets:
|
||||
- db_password
|
||||
healthcheck:
|
||||
@ -176,9 +180,8 @@ services:
|
||||
retries: 10
|
||||
start_period: 5m
|
||||
|
||||
|
||||
zammad-redis:
|
||||
image: redis:7.2.5-alpine
|
||||
image: redis:7.4.3-alpine
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@ -195,7 +198,7 @@ services:
|
||||
<<: *zammad-service
|
||||
command: ["zammad-scheduler"]
|
||||
healthcheck:
|
||||
test: 'ps x | grep "[b]ackground-worker.rb"'
|
||||
test: 'grep -a "background-worker.rb" -r /proc/[0-9]*/cmdline'
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
@ -230,6 +233,9 @@ configs:
|
||||
name: ${STACK_NAME}_auto_wizard_${AUTO_WIZARD_VERSION}
|
||||
file: auto_wizard.json.tmpl
|
||||
template_driver: golang
|
||||
pg_backup:
|
||||
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||
file: pg_backup.sh
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
|
34
pg_backup.sh
Normal file
34
pg_backup.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
BACKUP_FILE='/var/lib/postgresql/data/backup.sql'
|
||||
|
||||
function backup {
|
||||
export PGPASSWORD=$(cat /run/secrets/db_password)
|
||||
pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} > $BACKUP_FILE
|
||||
}
|
||||
|
||||
function restore {
|
||||
cd /var/lib/postgresql/data/
|
||||
restore_config(){
|
||||
# Restore allowed connections
|
||||
cat pg_hba.conf.bak > pg_hba.conf
|
||||
su postgres -c 'pg_ctl reload'
|
||||
}
|
||||
# Don't allow any other connections than local
|
||||
cp pg_hba.conf pg_hba.conf.bak
|
||||
echo "local all all trust" > pg_hba.conf
|
||||
su postgres -c 'pg_ctl reload'
|
||||
trap restore_config EXIT INT TERM
|
||||
|
||||
# Recreate Database
|
||||
psql -U ${POSTGRES_USER} -d postgres -c "DROP DATABASE ${POSTGRES_DB} WITH (FORCE);"
|
||||
createdb -U ${POSTGRES_USER} ${POSTGRES_DB}
|
||||
psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -1 -f $BACKUP_FILE
|
||||
|
||||
trap - EXIT INT TERM
|
||||
restore_config
|
||||
}
|
||||
|
||||
$@
|
Reference in New Issue
Block a user