1 Commits

Author SHA1 Message Date
b4c262a6fb customize css 2024-09-03 18:28:49 +02:00
8 changed files with 77 additions and 115 deletions

View File

@ -32,7 +32,7 @@ steps:
from_secret: drone_abra-bot_token
fork: true
repositories:
- toolshed/auto-recipes-catalogue-json
- coop-cloud/auto-recipes-catalogue-json
trigger:
event: tag

View File

@ -2,13 +2,11 @@ TYPE=zammad
DOMAIN=zammad.example.com
TIMEOUT=600
ENABLE_BACKUPS=true
## Domain aliases
#EXTRA_DOMAINS=', `www.zammad.example.com`'
LETS_ENCRYPT_ENV=production
COMPOSE_FILE="compose.yml"
SECRET_DB_PASSWORD_VERSION=v1
SECRET_SMTP_PASSWORD_VERSION=v1
@ -20,6 +18,10 @@ PRODUCT_NAME="Support"
ORGANIZATION="Test Org"
# TIMEZONE="Europe/Berlin"
LOCALE="de-de"
#TEXT_MUTED="#7e7e7e"
#MENU_TEXT="#7e7e7e"
#BACKGROUND_1="#7e7e7e"
#BACKGROUND_2="#7e7e7e"
ADMIN_EMAIL=admin@example.com
SMTP_HOST=mail.example.com
@ -29,10 +31,4 @@ 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://zammad.example.com/auth/saml/slo
## Zammad internal backups
# COMPOSE_FILE="$COMPOSE_FILE:compose.backup.yml"
# BACKUP_TIME=03:00"
# HOLD_DAYS=10
#IDP_SLO_SERVICE_URL=https://authentik.example.com/application/saml/zammad/slo/binding/redirect/

14
abra.sh
View File

@ -1,6 +1,6 @@
export ENTRYPOINT_VERSION=v2
export AUTO_WIZARD_VERSION=v2
export PG_BACKUP_VERSION=v2
export AUTO_WIZARD_VERSION=v1
export CUSTOM_STYLE_VERSION=v1
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))'"
@ -36,7 +36,7 @@ enable_authentik_sso() {
'idp_cert_fingerprint'=>'',
'name_identifier_format'=>'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'})
"
abra app cmd -T $DOMAIN zammad-railsserver rails_run "$(printf "%q " $COMMAND )"
abra app cmd -T -C support.dev.local-it.cloud zammad-railsserver rails_run "$(printf "%q " $COMMAND )"
}
set_logo() {
@ -49,5 +49,11 @@ set_logo() {
logo_timestamp = Service::SystemAssets::ProductLogo.store(logo_content);
Setting.set('product_logo', logo_timestamp);
"
abra app cmd -T $DOMAIN zammad-railsserver rails_run "$(printf "%q " $COMMAND )"
abra app cmd -T -C support.dev.local-it.cloud zammad-railsserver rails_run "$(printf "%q " $COMMAND )"
}
customize(){
apt update
apt install nodejs npm
/custom-entrypoint.sh "rails assets:precompile"
}

View File

@ -46,6 +46,10 @@
"name": "organization",
"value": "{{ env "ORGANIZATION" }}"
},
{
"name": "product_logo",
"value": "{{ env "LOGO_URL" }}"
},
{
"name": "timezone_default",
"value": "{{ env "TZ" }}"

View File

@ -1,36 +0,0 @@
version: "3.8"
services:
zammad-backup:
image: ghcr.io/zammad/zammad:6.5.0-34
command: ["zammad-backup"]
volumes:
- zammad-backup:/var/tmp/zammad
- zammad-storage:/opt/zammad/storage:ro
user: 0:0
deploy:
labels:
backupbot.backup.volumes.zammad-backup: "false"
restart_policy:
condition: on-failure
environment:
POSTGRESQL_DB: zammad_production
POSTGRESQL_HOST: zammad-postgresql
POSTGRESQL_USER: zammad
POSTGRESQL_PASS_FILE: /run/secrets/db_password
POSTGRESQL_PORT: 5432
# Backup settings
BACKUP_DIR: "/var/tmp/zammad"
BACKUP_TIME: "${BACKUP_TIME:-03:00}"
#BACKUP_SLEEP: 86400
HOLD_DAYS: 10
DOMAIN:
entrypoint: /custom-entrypoint.sh
configs:
- source: entrypoint
target: /custom-entrypoint.sh
mode: 0555
secrets:
- db_password
volumes:
zammad-backup:

View File

@ -13,6 +13,11 @@ x-shared:
POSTGRESQL_OPTIONS: ?pool=50
POSTGRESQL_DB_CREATE:
REDIS_URL: redis://zammad-redis:6379
# Backup settings
BACKUP_DIR: "/var/tmp/zammad"
BACKUP_TIME: "${BACKUP_TIME:-03:00}"
#BACKUP_SLEEP: 86400
HOLD_DAYS: 10
TZ: "${TZ:-Europe/Berlin}"
# Allow passing in these variables via .env:
AUTOWIZARD_JSON:
@ -32,6 +37,10 @@ x-shared:
ZAMMAD_SESSION_JOBS:
ZAMMAD_PROCESS_SCHEDULED:
ZAMMAD_PROCESS_DELAYED_JOBS_WORKERS:
TEXT_MUTED: "${TEXT_MUTED:-hsl(213, 3%, 64%)}"
MENU_TEXT: "${MENU_TEXT:-hsl(0, 0%, 74%)}"
BACKGROUND_1: "${BACKGROUND_1:-hsl(231, 9%, 16%)}"
BACKGROUND_2: "${BACKGROUND_2:-hsl(233, 9%, 19%)}"
PRODUCT_NAME:
ORGANIZATION:
LOCALE:
@ -43,12 +52,13 @@ x-shared:
SSO_PROVIDER_DOMAIN:
IDP_SSO_TARGET_URL:
IDP_SLO_SERVICE_URL:
image: ghcr.io/zammad/zammad:6.5.0-34
image: ghcr.io/zammad/zammad:6.3.1-95
deploy:
restart_policy:
condition: on-failure
volumes:
- zammad-storage:/opt/zammad/storage
#old: - zammad-data:/opt/zammad
depends_on:
- zammad-memcached
- zammad-postgresql
@ -60,22 +70,32 @@ x-shared:
mode: 0555
- source: auto_wizard
target: /opt/zammad/contrib/auto_wizard.json
- source: custom_style
target: /opt/zammad/app/assets/stylesheets/custom/custom_style.css
secrets:
- db_password
- smtp_password
- admin_password
services:
zammad-backup:
<<: *zammad-service
command: ["zammad-backup"]
volumes:
- zammad-backup:/var/tmp/zammad
- zammad-storage:/opt/zammad/storage:ro
#old: - zammad-data:/opt/zammad
user: 0:0
deploy:
labels:
- "backupbot.backup=true"
- "backupbot.backup.path=/var/tmp/zammad"
zammad-elasticsearch:
image: bitnami/elasticsearch:8.18.0
image: bitnami/elasticsearch:8.14.3
deploy:
restart_policy:
condition: on-failure
resources:
limits:
memory: 4G
reservations:
memory: 2G
volumes:
- elasticsearch-data:/bitnami/elasticsearch/data
environment:
@ -86,6 +106,12 @@ services:
timeout: 10s
retries: 10
start_period: 5m
deploy:
resources:
limits:
memory: 4G
reservations:
memory: 2G
zammad-init:
<<: *zammad-service
@ -96,7 +122,7 @@ services:
zammad-memcached:
command: memcached -m 256M
image: memcached:1.6.38-alpine
image: memcached:1.6.29-alpine
healthcheck:
test: 'echo "version" | nc -vn -w 1 127.0.0.1 11211'
interval: 30s
@ -130,7 +156,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=2.1.0+6.5.0-34"
- "coop-cloud.${STACK_NAME}.version=1.0.2+6.3.1-95"
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
@ -148,19 +174,10 @@ services:
deploy:
restart_policy:
condition: on-failure
labels:
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: "/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
# Backup Restore
#- zammad-backup:/var/tmp/zammad:ro
secrets:
- db_password
healthcheck:
@ -180,8 +197,9 @@ services:
retries: 10
start_period: 5m
zammad-redis:
image: redis:7.4.3-alpine
image: redis:7.2.5-alpine
deploy:
restart_policy:
condition: on-failure
@ -198,7 +216,7 @@ services:
<<: *zammad-service
command: ["zammad-scheduler"]
healthcheck:
test: 'grep -a "background-worker.rb" -r /proc/[0-9]*/cmdline'
test: 'ps x | grep "[b]ackground-worker.rb"'
interval: 30s
timeout: 10s
retries: 10
@ -218,6 +236,7 @@ volumes:
elasticsearch-data:
postgresql-data:
redis-data:
zammad-backup:
zammad-storage:
networks:
@ -233,9 +252,10 @@ 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
custom_style:
name: ${STACK_NAME}_custom_style_${CUSTOM_STYLE_VERSION}
file: custom_style.css.tmpl
template_driver: golang
secrets:
db_password:

6
custom_style.css.tmpl Normal file
View File

@ -0,0 +1,6 @@
:root {
--text-muted: {{ env "TEXT_MUTED" }};
--menu-text: {{ env "MENU_TEXT" }};
--background-quaternary: {{ env "BACKGROUND_1" }};
--background-tertiary: {{ env "BACKGROUND_2" }};
}

View File

@ -1,34 +0,0 @@
#!/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
}
$@