You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.8 KiB
65 lines
1.8 KiB
#!/bin/bash |
|
# Run on 10.100.1.24 as root — installs Zammad docker stack. |
|
# Prerequisites: geonet-console .env with OSS keys, nginx ssl.conf, DNS zammad.gisportal.id |
|
set -euo pipefail |
|
STACK=/opt/stacks/zammad |
|
mkdir -p "$STACK/config" |
|
cd "$STACK" |
|
|
|
if [ ! -f docker-compose.yml ]; then |
|
git clone https://github.com/zammad/zammad-docker-compose.git /tmp/zammad-clone |
|
cp -a /tmp/zammad-clone/. "$STACK/" |
|
rm -rf /tmp/zammad-clone |
|
fi |
|
|
|
# Bind internal nginx to localhost only (port 8080 is used by host nginx/jira) |
|
python3 - <<'PY' |
|
from pathlib import Path |
|
p = Path('docker-compose.yml') |
|
text = p.read_text() |
|
text = text.replace( |
|
' - "${NGINX_EXPOSE_PORT:-8080}:${NGINX_PORT:-8080}"', |
|
' - "127.0.0.1:8093:${NGINX_PORT:-8080}"', |
|
) |
|
p.write_text(text) |
|
PY |
|
|
|
source /opt/stacks/geonet-console/.env |
|
|
|
cat > .env <<ENV |
|
VERSION=7.1.1-0012 |
|
RESTART=always |
|
TZ=Asia/Jakarta |
|
POSTGRES_DB=zammad_production |
|
POSTGRES_USER=zammad |
|
POSTGRES_PASS=zammad_local_pg_secret |
|
POSTGRES_HOST=zammad-postgresql |
|
POSTGRES_PORT=5432 |
|
NGINX_PORT=8080 |
|
ZAMMAD_FQDN=zammad.gisportal.id |
|
ZAMMAD_HTTP_TYPE=https |
|
NGINX_SERVER_SCHEME=https |
|
NGINX_SERVER_NAME=zammad.gisportal.id |
|
RAILS_TRUSTED_PROXIES=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 |
|
ELASTICSEARCH_ENABLED=false |
|
ENV |
|
chmod 600 .env |
|
|
|
cat > config/storage.yml <<YAML |
|
s3: |
|
access_key_id: '${OSS_ACCESS_KEY_ID}' |
|
secret_access_key: '${OSS_SECRET_ACCESS_KEY}' |
|
region: '${OSS_REGION:-us-east-1}' |
|
endpoint: '${OSS_ENDPOINT:-http://10.100.1.10:8010}' |
|
bucket: 'zammad-attachments' |
|
force_path_style: true |
|
request_checksum_calculation: when_required |
|
response_checksum_validation: when_required |
|
YAML |
|
chmod 644 config/storage.yml |
|
|
|
cp -f docker-compose.override.yml "$STACK/" 2>/dev/null || true |
|
|
|
docker compose pull |
|
docker compose up -d |
|
echo "Zammad stack started. Verify: curl -sI http://127.0.0.1:8093/"
|
|
|