Skip to content

Commit

Permalink
Maintenance: Automate creation of redis service on sles in postinstal…
Browse files Browse the repository at this point in the history
…l.sh
  • Loading branch information
t-shehab committed Oct 10, 2024
1 parent dc787b6 commit 6b2e23e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
6 changes: 0 additions & 6 deletions .gitlab/packager.io/scenarios/internal-services/sles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

set -eu

# special handling for Redis on SuSE
zypper install -y redis7
cp /etc/redis/default.conf.example /etc/redis/zammad.conf
chown root:redis /etc/redis/zammad.conf
systemctl start [email protected]

zypper install -y zammad

curl --retry 30 --retry-delay 1 --retry-connrefused http://localhost:3000 | grep "Zammad Helpdesk"
Expand Down
1 change: 1 addition & 0 deletions .pkgr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ targets:
- libImlib2-1
- imlib2
- shared-mime-info
- redis7
# We need the fuser binary from the psmisc package to detect the running redis systemd service.
# Because on SUSE systems, this service is arbitrarily named (e.g.) [email protected]
# So we cannot hardcode the service name as we do for other supported distros.
Expand Down
12 changes: 5 additions & 7 deletions contrib/packager.io/functions
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,11 @@ function enforce_redis () {
elif [ "${OS}" == "SUSE" ]; then
REDIS_PID=$(fuser 6379/tcp 2> /dev/null)
if [ -z "${REDIS_PID}" ]; then
echo -e "ERROR - SUSE Linux detected but no running redis-instance listening on port 6379 or REDIS_URL set.\n"
echo "SUSE Linux uses a systemd template for its redis package."
echo "If redis was installed via zypper, please make sure an instance of its template-service is running (e.g. [email protected]) and it is listening on port 6379."
echo "Alternatively, you can set the REDIS_URL environment variable with the following command."
echo -e "zammad config:set REDIS_URL=redis://your.redis.server:6379\n"
echo "Please fix these issues, then run the package installation again."
exit 1
echo -e "# No running instance of Redis detected.\n# Creating systemd-service: [email protected]."
[[ -f '/etc/redis/zammad.conf' ]] || cp /etc/redis/default.conf.example /etc/redis/zammad.conf
echo "# Ensuring correct file permissions for /etc/redis/zammad.conf."
[[ $(stat -c "%U %G" /etc/redis/zammad.conf) == "root redis" ]] || chown root:redis /etc/redis/zammad.conf
[email protected]
else
REDIS_SERVICE_NAME=$(ps -p $REDIS_PID -o unit=)
echo "# Redis service ${REDIS_SERVICE_NAME} detected."
Expand Down

0 comments on commit 6b2e23e

Please sign in to comment.