File tree 7 files changed +43
-13
lines changed
docker-images/valkey/valkey-entrypoint
7 files changed +43
-13
lines changed Original file line number Diff line number Diff line change 25
25
with :
26
26
image : valkey
27
27
context : docker-images/valkey
28
+
29
+ lint :
30
+ runs-on : ubuntu-latest
31
+ steps :
32
+ - uses : actions/checkout@v4
33
+ - uses : luizm/action-sh-checker@master
34
+ env :
35
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36
+ SHFMT_OPTS : -i 4
37
+ with :
38
+ sh_checker_comment : true
Original file line number Diff line number Diff line change 2
2
set -eu
3
3
4
4
# source the functions
5
+ # shellcheck source=/dev/null
5
6
. /opt/valkey/entrypoint/functions
6
7
7
8
wait_for_valkey
@@ -19,7 +20,7 @@ trap handle_sigterm SIGTERM
19
20
while $running ; do
20
21
21
22
# Ensure that a SIGTERM causes a fast exit of this process
22
- for _ in $( seq 1 $ RELOAD_INTERVAL) ; do
23
+ for _ in $( seq 1 " ${ RELOAD_INTERVAL} " ) ; do
23
24
if ! $running ; then
24
25
exit 0
25
26
fi
@@ -28,5 +29,6 @@ while $running; do
28
29
echo " Reloading TLS certificates"
29
30
30
31
# We can connect to the local redis instance to reload the cert as this run on each valkey instance
32
+ # shellcheck disable=SC2086,SC2154
31
33
valkey-cli $common_args --raw CONFIG GET tls-key-file | tail -n1 | head -c -1 | valkey-cli $common_args -x CONFIG SET tls-key-file
32
34
done
Original file line number Diff line number Diff line change 2
2
set -euo pipefail
3
3
4
4
# source the functions
5
+ # shellcheck source=/dev/null
5
6
. /opt/valkey/entrypoint/functions
6
7
7
8
wait_for_valkey
8
9
9
10
echo " Waiting for Valkey Sentinel to be ready"
10
11
wait_for_sentinel " valkey-sentinel" " 26379"
11
12
12
- SENTINEL_QUORUM=$( get_sentinel_quorum ${VALKEY_REQUIRED_SENTINELS} )
13
+ SENTINEL_QUORUM=$( get_sentinel_quorum " ${VALKEY_REQUIRED_SENTINELS} " )
13
14
14
15
echo " Discovering Valkey Master via Sentinel"
15
16
MASTER=$( get_master_addr_by_name " valkey-sentinel" " ${VALKEY_NAME} " )
@@ -30,6 +31,7 @@ if [[ "${MASTER}" == "null" ]]; then
30
31
fi
31
32
done
32
33
34
+ # shellcheck disable=SC2086,SC2154
33
35
valkey-cli $common_args -p 6379 REPLICAOF no one
34
36
echo " Notifying all Sentinels"
35
37
64
66
65
67
echo " Master found: ${MASTER_ADDR} :${MASTER_PORT} "
66
68
echo " Sending 'REPLICAOF ${MASTER_ADDR} ${MASTER_PORT} ' to local Valkey"
67
- valkey-cli $common_args -p 6379 REPLICAOF ${MASTER_ADDR} ${MASTER_PORT}
69
+ # shellcheck disable=SC2086
70
+ valkey-cli $common_args -p 6379 REPLICAOF " ${MASTER_ADDR} " " ${MASTER_PORT} "
68
71
fi
69
72
70
73
touch /opt/valkey/etc/ready
Original file line number Diff line number Diff line change 1
- #! /bin/sh
2
-
1
+ #! /usr/bin/env bash
3
2
set -eu
4
3
5
4
apk add --no-cache redis
6
5
7
6
# Note: using REDIS_URL works because we know there's a single replica.
8
7
# If we ever introduce read replicas, we'd need to connect to each one to force cert reload.
9
- redis_args=" -e --tls -u $ REDIS_URL"
8
+ redis_args=( -e --tls -u " ${ REDIS_URL} " )
10
9
11
10
if [ -e /srv/redis-ca-bundle/ca-certs.crt ]; then
12
- redis_args=" $ redis_args --cacert /srv/redis-ca-bundle/ca-certs.crt"
11
+ redis_args=( " ${ redis_args[@]} " --cacert /srv/redis-ca-bundle/ca-certs.crt)
13
12
fi
14
13
15
- redis-cli $redis_args --raw CONFIG GET tls-key-file | tail -n1 | head -c -1 | redis-cli $redis_args -x CONFIG SET tls-key-file
14
+ redis-cli " ${redis_args[@]} " --raw CONFIG GET tls-key-file |
15
+ tail -n1 |
16
+ head -c -1 |
17
+ redis-cli " ${redis_args[@]} " -x CONFIG SET tls-key-file
Original file line number Diff line number Diff line change 1
- #! /bin/sh
2
-
1
+ #! /usr/bin/env bash
3
2
set -eu
4
3
5
4
apk add --no-cache redis
6
5
7
6
# Note: using REDIS_URL works because we know there's a single replica.
8
7
# If we ever introduce read replicas, we'd need to connect to each one to force cert reload.
9
- redis_args=" -e --tls -u $ REDIS_URL"
8
+ redis_args=( -e --tls -u " ${ REDIS_URL} " )
10
9
11
10
if [ -e /srv/redis-ca-bundle/ca-certs.crt ]; then
12
- redis_args=" $ redis_args --cacert /srv/redis-ca-bundle/ca-certs.crt"
11
+ redis_args=( " ${ redis_args[@]} " --cacert /srv/redis-ca-bundle/ca-certs.crt)
13
12
fi
14
13
15
- redis-cli $redis_args --raw CONFIG GET tls-key-file | tail -n1 | head -c -1 | redis-cli $redis_args -x CONFIG SET tls-key-file
14
+ redis-cli " ${redis_args[@]} " --raw CONFIG GET tls-key-file |
15
+ tail -n1 |
16
+ head -c -1 |
17
+ redis-cli " ${redis_args[@]} " -x CONFIG SET tls-key-file
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ cd " $( git rev-parse --show-toplevel) "
5
+ shfmt -f . | xargs shfmt -i 4 -w
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ cd " $( git rev-parse --show-toplevel) "
5
+ shfmt -f . | xargs shellcheck
You can’t perform that action at this time.
0 commit comments