Infos:
- Used Zammad version: 6.1.0-58
- Used Zammad installation type: docker-compose
- Operating system: VM debian 12 - Portainer
- Browser + version:
Expected behavior:
- upgrading from 6.0.0-119 to 6.1.0-58 the container zammad-backup should run the script backup.sh` without errors
Actual behavior:
- since upgrading from from 6.0.0-119 to 6.1.0-58 I have this error in the zammad-backup container:
zammad port 5432 failed: fe_sendauth: no password supplied
It makes a loop running and trying to backup the db and files every minutes and the folderzammad-backup
is growing unexceptionally so I need stop the container `zammad-backup.
Steps to reproduce the behavior:
I have change my docker-compose.yml from
version 6.0.0-119
version: '3'
services:
zammad-backup:
command: ["zammad-backup"]
depends_on:
- zammad-railsserver
- zammad-postgresql
entrypoint: /usr/local/bin/backup.sh
environment:
- BACKUP_SLEEP=86400
- HOLD_DAYS=10
- BACKUP_TIME=23:00
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASSWORD=${POSTGRES_PASS}
- POSTGRESQL_DB=${POSTGRES_DB}
- TZ=Europe/Paris
image: postgres:${POSTGRES_VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-backup:/var/tmp/zammad
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var:ro
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/scripts/backup.sh:/usr/local/bin/backup.sh:ro
zammad-elasticsearch:
image: bitnami/elasticsearch:${ELASTICSEARCH_VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/elasticsearch-data:/bitnami/elasticsearch/data
zammad-init:
command: ["zammad-init"]
depends_on:
- zammad-postgresql
environment:
# - ELASTICSEARCH_ENABLED=false
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- RAILS_TRUSTED_PROXIES=${RAILS_TRUSTED_PROXIES} #manquait ici (dans le init)
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: on-failure
user: 0:0
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-config-nginx:/etc/nginx/sites-enabled
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var
zammad-memcached:
command: memcached -m 256M
image: memcached:${MEMCACHE_VERSION}
restart: ${RESTART}
zammad-nginx:
command: ["zammad-nginx"]
expose:
- "$NGINX_PORT"
ports:
- "${ENV_NGINX_PORT}:${NGINX_PORT}"
depends_on:
- zammad-railsserver
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- NGINX_PORT=${NGINX_PORT}
- NGINX_SERVER_SCHEME=${NGINX_SERVER_SCHEME}
- VIRTUAL_HOST=${VIRTUAL_HOST}
- NGINX_SERVER_NAME=${NGINX_SERVER_NAME}
- RAILS_TRUSTED_PROXIES=${RAILS_TRUSTED_PROXIES}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
# - /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-config-nginx:/etc/nginx/sites-avalaible:ro
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var:ro
# - /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var:ro
zammad-postgresql:
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASS}
image: postgres:${POSTGRES_VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/postgresql-data:/var/lib/postgresql/data
zammad-railsserver:
command: ["zammad-railsserver"]
depends_on:
- zammad-memcached
- zammad-postgresql
- zammad-redis
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var
extra_hosts:
- "git.numericoop.fr:10.10.10.20"
zammad-redis:
image: redis:${REDIS_VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/redis-data:/data
zammad-scheduler:
command: ["zammad-scheduler"]
depends_on:
- zammad-memcached
- zammad-railsserver
- zammad-redis
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- REDIS_URL=${REDIS_URL}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var
zammad-websocket:
command: ["zammad-websocket"]
depends_on:
- zammad-memcached
- zammad-railsserver
- zammad-redis
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- REDIS_URL=${REDIS_URL}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- ZAMMAD_WEBSOCKET_PORT=${ZAMMAD_WEBSOCKET_PORT}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var
To upgrade to
version 6.1.0-58
version: '3.8'
x-shared:
zammad-service: &zammad-service
environment: &zammad-environment
MEMCACHE_SERVERS: ${MEMCACHE_SERVERS}
POSTGRESQL_DB: ${POSTGRES_DB}
POSTGRESQL_HOST: ${POSTGRES_HOST}
POSTGRESQL_USER: ${POSTGRES_USER}
POSTGRESQL_PASS: ${POSTGRES_PASS}
POSTGRESQL_PORT: ${POSTGRES_PORT}
REDIS_URL: ${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-storage:/opt/zammad/storage
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var
depends_on:
- zammad-memcached
- zammad-postgresql
- zammad-redis
services:
zammad-backup:
command: ["zammad-backup"]
depends_on:
- zammad-railsserver
- zammad-postgresql
entrypoint: /usr/local/bin/backup.sh
environment:
<<: *zammad-environment
BACKUP_TIME: "23:00"
HOLD_DAYS: "10"
TZ: Europe/Paris
image: postgres:${POSTGRES_VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-backup:/var/tmp/zammad
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-storage:/opt/zammad/storage:ro
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var:ro
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/scripts/backup.sh:/usr/local/bin/backup.sh:ro
zammad-elasticsearch:
image: bitnami/elasticsearch:${ELASTICSEARCH_VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/elasticsearch-data:/bitnami/elasticsearch/data
zammad-init:
<<: *zammad-service
command: ["zammad-init"]
depends_on:
- zammad-postgresql
restart: on-failure
user: 0:0
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-storage:/opt/zammad/storage
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var
zammad-memcached:
command: memcached -m 256M
image: memcached:${MEMCACHE_VERSION}
restart: ${RESTART}
zammad-nginx:
<<: *zammad-service
command: ["zammad-nginx"]
expose:
- "$NGINX_PORT"
ports:
- "${ENV_NGINX_PORT}:${NGINX_PORT}"
environment:
NGINX_PORT: ${NGINX_PORT}
NGINX_SERVER_SCHEME: ${NGINX_SERVER_SCHEME}
VIRTUAL_HOST: ${VIRTUAL_HOST}
NGINX_SERVER_NAME: ${NGINX_SERVER_NAME}
RAILS_TRUSTED_PROXIES: ${RAILS_TRUSTED_PROXIES}
depends_on:
- zammad-railsserver
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/zammad-var:/opt/zammad/var:ro # required for the zammad-ready check file
zammad-postgresql:
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASS}
image: postgres:${POSTGRES_VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/postgresql-data:/var/lib/postgresql/data
zammad-railsserver:
<<: *zammad-service
command: ["zammad-railsserver"]
extra_hosts:
- "gitlab.domain.tld:10.10.10.20"
zammad-redis:
image: redis:${REDIS_VERSION}
restart: ${RESTART}
volumes:
- /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/redis-data:/data
zammad-scheduler:
<<: *zammad-service
command: ["zammad-scheduler"]
zammad-websocket:
<<: *zammad-service
command: ["zammad-websocket"]
environment:
ZAMMAD_WEBSOCKET_PORT: ${ZAMMAD_WEBSOCKET_PORT}
I have try also unmount the mountpoint - /mnt/${NAME_ENV}/${NAME_CLIENT}/${NAME_APP}/scripts/backup.sh:/usr/local/bin/backup.sh:ro
, I am not sure if it would be changed in the upgrade. But I can’t deploy/upgrade the stack doing this… I did not found where this file /usr/local/bin/backup.sh
and don’t remember if I have before copy this file there…
I have also try move the folder scripts
to see if deploy/upgrading could rebuild the folder, but it didn’t works. I think I use to create the folder scripts
and copy the file backup.sh
before but don’t remember how… To works I needed also put permissions 777 to this folder and file.
actually this one is like this
cat scripts/backup.sh
#!/bin/bash
set -e
: "${ZAMMAD_DIR:=/opt/zammad}"
: "${BACKUP_DIR:=/var/tmp/zammad}"
: "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}"
: "${ZAMMAD_RAILSSERVER_PORT:=3000}"
: "${POSTGRESQL_HOST:=zammad-postgresql}"
: "${POSTGRESQL_PORT:=5432}"
: "${POSTGRESQL_DB:=zammad_production}"
function check_railsserver_available {
until (echo > /dev/tcp/${ZAMMAD_RAILSSERVER_HOST}/${ZAMMAD_RAILSSERVER_PORT}) &> /dev/null; do
echo "waiting for railsserver to be ready..."
sleep 60
done
}
function zammad_backup {
TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
echo "${TIMESTAMP} - backuping zammad..."
# delete old backups
if [ -d "${BACKUP_DIR}" ] && [ -n "$(ls "${BACKUP_DIR}")" ]; then
find "${BACKUP_DIR}"/*_zammad_*.gz -type f -mtime +"${HOLD_DAYS}" -delete
fi
if [ "${NO_FILE_BACKUP}" != "yes" ]; then
# tar files
tar -czf "${BACKUP_DIR}"/"${TIMESTAMP}"_zammad_files.tar.gz "${ZAMMAD_DIR}"
fi
#db backup
pg_dump --dbname=postgresql://"${POSTGRESQL_USER}:${POSTGRESQL_PASSWORD}@${POSTGRESQL_HOST}:${POSTGRESQL_PORT}/${POSTGRESQL_DB}" | gzip > "${BACKUP_DIR}"/"${TIMESTAMP}"_zammad_db.psql.gz
echo "backup finished :)"
}
if [ "$1" = 'zammad-backup' ]; then
check_railsserver_available
while true; do
zammad_backup
# wait until next backup
sleep "${BACKUP_SLEEP}"
done
fi
if [ "$1" = 'zammad-backup-once' ]; then
check_railsserver_available
zammad_backup
fi
if [ "$1" = 'zammad-backup-db' ]; then
NO_FILE_BACKUP="yes"
zammad_backup
fi
Perhaps something is wrong with the owners of the volumes ? the volume for zammad-postgresql is owned by 70:70
the volume for zammad-backup
is owned by root:root
the folder scripts
is also owned by root:root
, the foder zammad-var
is owned by the user with UID=1000,GUID=1000.
I have try see also as explained in the docs here Troubleshooting Backup & Restore — Zammad System Documentation documentation
So In the container zammad-postgresql
for the pg_hba.conf
I have this
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all all scram-sha-256
But I think something is wrong with the rails database.yml
now…
I have a preprod zammad stack to do tests up and a production zammad…
In the preprod, I have try the script /opt/zammad/contrib/backup/zammad_db_user_helper.sh
from zammad-railserver, but it seems not really working…
I not sure with this file config/database.yml
in the preprod ???
production:
adapter: nulldb
database: zammad_production
pool: 50
timeout: 5000
encoding: utf8
username: postgres
password:
host: zammad-postgresql
In the production stack something unexcepted also with the config/database.yml
production:
adapter: nulldb
database: zammad_production
pool: 50
timeout: 5000
encoding: utf8
username: postgres
password: xxxxxxxx
why ?? this not the the POSTGRES_USER
and POSTGRES_PASS
I have in the environnments !
Also I don 't understand why there is 2 files with config/database/database.yml
# this is a database config sample for zammad ready to use with a postgresql db
# copy or symlink this file to config/database.yml to use it
default: &default
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 50
timeout: 5000
encoding: utf8
##### postgresql config #####
adapter: postgresql
# username: zammad
# password:
# If the database server is not on localhost, you can set hostname and port:
# host:
# port:
#### mysql config #####
# adapter: mysql2
# username: zammad
# password: <Password>
# If the database server is not on localhost, you can set hostname and port:
# host:
# port:
production:
<<: *default
database: zammad_production
development:
<<: *default
database: zammad_development
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: zammad_test
How rails will find the <<: *default
connexion ??