Skip to content

Commit 1691a19

Browse files
committed
make redis port configurable
Signed-off-by: Simon L. <[email protected]>
1 parent cd8158c commit 1691a19

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

Containers/nextcloud/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ RUN set -ex; \
138138
\
139139
{ \
140140
echo 'session.save_handler = redis'; \
141-
echo 'session.save_path = "tcp://${REDIS_HOST}:6379?database=${REDIS_DB_INDEX}${REDIS_USER_AUTH}&auth[]=${REDIS_HOST_PASSWORD}"'; \
141+
echo 'session.save_path = "tcp://${REDIS_HOST}:${REDIS_PORT}?database=${REDIS_DB_INDEX}${REDIS_USER_AUTH}&auth[]=${REDIS_HOST_PASSWORD}"'; \
142142
echo 'redis.session.locking_enabled = 1'; \
143143
echo 'redis.session.lock_retries = -1'; \
144144
echo 'redis.session.lock_wait_time = 10000'; \

Containers/nextcloud/config/redis.config.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
),
1010
);
1111

12-
if (getenv('REDIS_HOST_PORT')) {
13-
$CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
14-
} elseif (getenv('REDIS_HOST')[0] != '/') {
15-
$CONFIG['redis']['port'] = 6379;
12+
if (getenv('REDIS_PORT')) {
13+
$CONFIG['redis']['port'] = (int) getenv('REDIS_PORT');
1614
}
1715

1816
if (getenv('REDIS_DB_INDEX')) {

Containers/nextcloud/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fi
2727

2828
# Only start container if Redis is accessible
2929
# shellcheck disable=SC2153
30-
while ! nc -z "$REDIS_HOST" "6379"; do
30+
while ! nc -z "$REDIS_HOST" "$REDIS_PORT"; do
3131
echo "Waiting for Redis to start..."
3232
sleep 5
3333
done

Containers/notify-push/start.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ fi
5252
if [ -z "$REDIS_DB_INDEX" ]; then
5353
REDIS_DB_INDEX=0
5454
fi
55+
# Set a default value for REDIS_PORT
56+
if [ -z "$REDIS_PORT" ]; then
57+
REDIS_PORT=6379
58+
fi
5559
# Set a default for db type
5660
if [ -z "$DATABASE_TYPE" ]; then
5761
DATABASE_TYPE=postgres
@@ -76,7 +80,7 @@ fi
7680

7781
# Set sensitive values as env
7882
export DATABASE_URL="$DATABASE_TYPE://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB$CERT_OPTIONS"
79-
export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX"
83+
export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST:$REDIS_PORT/$REDIS_DB_INDEX"
8084

8185
# Run it
8286
/nextcloud/custom_apps/notify_push/bin/"$CPU_ARCH"/notify_push \
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

3-
nc -z "$REDIS_HOST" 6379 || exit 0
3+
nc -z "$REDIS_HOST" "$REDIS_PORT" || exit 0
44
nc -z 127.0.0.1 3002 || exit 1

Containers/whiteboard/start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Only start container if nextcloud is accessible
4-
while ! nc -z "$REDIS_HOST" 6379; do
4+
while ! nc -z "$REDIS_HOST" "$REDIS_PORT"; do
55
echo "Waiting for redis to start..."
66
sleep 5
77
done
@@ -11,7 +11,7 @@ if [ -z "$REDIS_DB_INDEX" ]; then
1111
REDIS_DB_INDEX=0
1212
fi
1313

14-
export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST/$REDIS_DB_INDEX"
14+
export REDIS_URL="redis://$REDIS_USER:$REDIS_HOST_PASSWORD@$REDIS_HOST:$REDIS_PORT/$REDIS_DB_INDEX"
1515

1616
# Run it
1717
exec npm --prefix /app run server:start

php/containers.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
"POSTGRES_DB=nextcloud_database",
205205
"POSTGRES_USER=nextcloud",
206206
"REDIS_HOST=nextcloud-aio-redis",
207+
"REDIS_PORT=6379",
207208
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%",
208209
"APACHE_HOST=nextcloud-aio-apache",
209210
"APACHE_PORT=%APACHE_PORT%",
@@ -305,6 +306,7 @@
305306
"NEXTCLOUD_HOST=nextcloud-aio-nextcloud",
306307
"TZ=%TIMEZONE%",
307308
"REDIS_HOST=nextcloud-aio-redis",
309+
"REDIS_PORT=6379",
308310
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%",
309311
"POSTGRES_HOST=nextcloud-aio-database",
310312
"POSTGRES_PORT=5432",
@@ -875,6 +877,7 @@
875877
"JWT_SECRET_KEY=%WHITEBOARD_SECRET%",
876878
"STORAGE_STRATEGY=redis",
877879
"REDIS_HOST=nextcloud-aio-redis",
880+
"REDIS_PORT=6379",
878881
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%",
879882
"BACKUP_DIR=/tmp"
880883
],

0 commit comments

Comments
 (0)