mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Fix some tests and made some optimizations in redis tests
This commit is contained in:
parent
cebcf5734e
commit
9cce27228d
3 changed files with 24 additions and 77 deletions
|
|
@ -119,7 +119,7 @@ services:
|
|||
deploy:
|
||||
replicas: 2
|
||||
|
||||
bw-redis-sentinel-1:
|
||||
bw-redis-sentinel:
|
||||
image: bitnami/redis-sentinel:7.2
|
||||
command: /opt/bitnami/scripts/redis-sentinel/run.sh --aclfile /acl/sentinel.acl
|
||||
volumes:
|
||||
|
|
@ -127,59 +127,7 @@ services:
|
|||
- ./tls:/tls
|
||||
environment:
|
||||
REDIS_SENTINEL_PORT_NUMBER: "26379"
|
||||
REDIS_SENTINEL_TLS_PORT_NUMBER: "26379"
|
||||
REDIS_SENTINEL_TLS_ENABLED: "no"
|
||||
REDIS_SENTINEL_TLS_CERT_FILE: "/tls/sentinel.pem"
|
||||
REDIS_SENTINEL_TLS_KEY_FILE: "/tls/sentinel.key"
|
||||
REDIS_SENTINEL_TLS_CA_FILE: "/tls/sentinel_ca.crt"
|
||||
REDIS_SENTINEL_TLS_AUTH_CLIENTS: "no"
|
||||
REDIS_MASTER_HOST: "bw-redis"
|
||||
REDIS_MASTER_SET: "bw-master"
|
||||
REDIS_MASTER_PORT_NUMBER: "6379"
|
||||
REDIS_MASTER_PASSWORD: ""
|
||||
ALLOW_EMPTY_PASSWORD: "yes"
|
||||
depends_on:
|
||||
- bw-redis
|
||||
- bw-redis-slave
|
||||
networks:
|
||||
- bw-services
|
||||
|
||||
bw-redis-sentinel-2:
|
||||
image: bitnami/redis-sentinel:7.2
|
||||
command: /opt/bitnami/scripts/redis-sentinel/run.sh --aclfile /acl/sentinel.acl
|
||||
volumes:
|
||||
- ./acl:/acl
|
||||
- ./tls:/tls
|
||||
environment:
|
||||
REDIS_SENTINEL_PORT_NUMBER: "26379"
|
||||
REDIS_SENTINEL_TLS_PORT_NUMBER: "26379"
|
||||
REDIS_SENTINEL_ACLFILE: "/acl/sentinel.acl"
|
||||
REDIS_SENTINEL_TLS_ENABLED: "no"
|
||||
REDIS_SENTINEL_TLS_CERT_FILE: "/tls/sentinel.pem"
|
||||
REDIS_SENTINEL_TLS_KEY_FILE: "/tls/sentinel.key"
|
||||
REDIS_SENTINEL_TLS_CA_FILE: "/tls/sentinel_ca.crt"
|
||||
REDIS_SENTINEL_TLS_AUTH_CLIENTS: "no"
|
||||
REDIS_MASTER_HOST: "bw-redis"
|
||||
REDIS_MASTER_SET: "bw-master"
|
||||
REDIS_MASTER_PORT_NUMBER: "6379"
|
||||
REDIS_MASTER_PASSWORD: ""
|
||||
ALLOW_EMPTY_PASSWORD: "yes"
|
||||
depends_on:
|
||||
- bw-redis
|
||||
- bw-redis-slave
|
||||
networks:
|
||||
- bw-services
|
||||
|
||||
bw-redis-sentinel-3:
|
||||
image: bitnami/redis-sentinel:7.2
|
||||
command: /opt/bitnami/scripts/redis-sentinel/run.sh --aclfile /acl/sentinel.acl
|
||||
volumes:
|
||||
- ./acl:/acl
|
||||
- ./tls:/tls
|
||||
environment:
|
||||
REDIS_SENTINEL_PORT_NUMBER: "26379"
|
||||
REDIS_SENTINEL_TLS_PORT_NUMBER: "26379"
|
||||
REDIS_SENTINEL_ACLFILE: "/acl/sentinel.acl"
|
||||
REDIS_SENTINEL_TLS_PORT_NUMBER: "0"
|
||||
REDIS_SENTINEL_TLS_ENABLED: "no"
|
||||
REDIS_SENTINEL_TLS_CERT_FILE: "/tls/sentinel.pem"
|
||||
REDIS_SENTINEL_TLS_KEY_FILE: "/tls/sentinel.key"
|
||||
|
|
@ -195,6 +143,8 @@ services:
|
|||
- bw-redis-slave
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
replicas: 3
|
||||
|
||||
networks:
|
||||
bw-universe:
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@ try:
|
|||
f"ℹ️ Trying to connect to Redis Sentinel with the following parameters:\nhosts: {sentinel_hosts}\nmaster: {sentinel_master}\nssl: {redis_ssl}\nusername: {sentinel_username}\npassword: {sentinel_password}",
|
||||
flush=True,
|
||||
)
|
||||
sentinel = Sentinel(sentinel_hosts, username=sentinel_username, password=sentinel_password, ssl=redis_ssl, socket_timeout=1)
|
||||
sentinel.discover_slaves(sentinel_master)
|
||||
sentinel = Sentinel(sentinel_hosts, username=sentinel_username, password=sentinel_password, ssl=redis_ssl, socket_timeout=1, ssl_cert_reqs="none")
|
||||
|
||||
print(
|
||||
f"ℹ️ Trying to get a Redis Sentinel slave for master {sentinel_master} with the following parameters:\n"
|
||||
|
|
@ -89,7 +88,6 @@ try:
|
|||
db=redis_db,
|
||||
username=getenv("REDIS_USERNAME", None) or None,
|
||||
password=getenv("REDIS_PASSWORD", None) or None,
|
||||
socket_timeout=1,
|
||||
)
|
||||
else:
|
||||
print(
|
||||
|
|
@ -106,7 +104,6 @@ try:
|
|||
password=getenv("REDIS_PASSWORD", None) or None,
|
||||
ssl=redis_ssl,
|
||||
socket_timeout=1,
|
||||
ssl_cert_reqs="none",
|
||||
)
|
||||
|
||||
if not redis_client.ping():
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ cleanup_stack () {
|
|||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_ENABLED: "yes"@REDIS_TLS_ENABLED: "no"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_TLS_ENABLED: "yes"@REDIS_SENTINEL_TLS_ENABLED: "no"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_PORT_NUMBER: "[0-9]*"@REDIS_TLS_PORT_NUMBER: "6379"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_TLS_PORT_NUMBER: "[0-9]*"@REDIS_SENTINEL_TLS_PORT_NUMBER: "26379"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_AUTH_CLIENTS: "no"@REDIS_TLS_AUTH_CLIENTS: "yes"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_PASSWORD: ".*"@REDIS_PASSWORD: ""@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_PASSWORD: ".*"@REDIS_SENTINEL_PASSWORD: ""@' {} \;
|
||||
|
|
@ -304,7 +303,7 @@ do
|
|||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_PORT_NUMBER: "[0-9]*"@REDIS_TLS_PORT_NUMBER: "6379"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_AUTH_CLIENTS: "no"@REDIS_TLS_AUTH_CLIENTS: "yes"@' {} \;
|
||||
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_HOSTS: ".*"@REDIS_SENTINEL_HOSTS: "bw-redis-sentinel-1:26379 bw-redis-sentinel-2:26379 bw-redis-sentinel-3:26379"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_HOSTS: ".*"@REDIS_SENTINEL_HOSTS: "redis-bw-redis-sentinel-1:26379 redis-bw-redis-sentinel-2:26379 redis-bw-redis-sentinel-3:26379"@' {} \;
|
||||
elif [ "$test" = "sentinel_tweaked" ] ; then
|
||||
echo "🧰 Running tests with redis' in sentinel mode with tweaked settings ..."
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_PORT: "[0-9]*"@REDIS_PORT: "6380"@' {} \;
|
||||
|
|
@ -316,24 +315,25 @@ do
|
|||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_PASSWORD: ".*"@REDIS_SENTINEL_PASSWORD: "sentinel_secret"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_USERNAME: ".*"@REDIS_USERNAME: "bunkerweb"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_USERNAME: ".*"@REDIS_SENTINEL_USERNAME: "bunkerweb_sentinel"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_HOSTS: ".*"@REDIS_SENTINEL_HOSTS: "bw-redis-sentinel-1:26380 bw-redis-sentinel-2:26380 bw-redis-sentinel-3:26380"@' {} \;
|
||||
# elif [ "$test" = "sentinel_ssl" ] ; then # TODO
|
||||
# echo "🧰 Running tests with redis' in sentinel mode with ssl activated ..."
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_PORT: "[0-9]*"@REDIS_PORT: "6379"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_PORT_NUMBER: "[0-9]*"@REDIS_PORT_NUMBER: "6379"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_MASTER_PORT_NUMBER: "[0-9]*"@REDIS_MASTER_PORT_NUMBER: "6379"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SSL: "no"@REDIS_SSL: "yes"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_DATABASE: "1"@REDIS_DATABASE: "0"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_PASSWORD: ".*"@REDIS_PASSWORD: ""@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_USERNAME: ".*"@REDIS_USERNAME: ""@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_HOSTS: ".*"@REDIS_SENTINEL_HOSTS: "redis-bw-redis-sentinel-1:26380 redis-bw-redis-sentinel-2:26380 redis-bw-redis-sentinel-3:26380"@' {} \;
|
||||
elif [ "$test" = "sentinel_ssl" ] ; then
|
||||
echo "🧰 Running tests with redis' in sentinel mode with ssl activated ..."
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_PORT: "[0-9]*"@REDIS_PORT: "6379"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_PORT_NUMBER: "[0-9]*"@REDIS_PORT_NUMBER: "6379"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_MASTER_PORT_NUMBER: "[0-9]*"@REDIS_MASTER_PORT_NUMBER: "6379"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SSL: "no"@REDIS_SSL: "yes"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_DATABASE: "1"@REDIS_DATABASE: "0"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_PASSWORD: ".*"@REDIS_PASSWORD: ""@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_USERNAME: ".*"@REDIS_USERNAME: ""@' {} \;
|
||||
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SSL: "no"@REDIS_SSL: "yes"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_ENABLED: "no"@REDIS_TLS_ENABLED: "yes"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_TLS_ENABLED: "no"@REDIS_SENTINEL_TLS_ENABLED: "yes"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_PORT_NUMBER: "[0-9]*"@REDIS_TLS_PORT_NUMBER: "6380"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_TLS_PORT_NUMBER: "[0-9]*"@REDIS_SENTINEL_TLS_PORT_NUMBER: "26380"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_AUTH_CLIENTS: "yes"@REDIS_TLS_AUTH_CLIENTS: "no"@' {} \;
|
||||
# find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_TLS_AUTH_CLIENTS: "yes"@REDIS_SENTINEL_TLS_AUTH_CLIENTS: "no"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SSL: "no"@REDIS_SSL: "yes"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_ENABLED: "no"@REDIS_TLS_ENABLED: "yes"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_PORT_NUMBER: "[0-9]*"@REDIS_TLS_PORT_NUMBER: "6380"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_TLS_ENABLED: "no"@REDIS_SENTINEL_TLS_ENABLED: "yes"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_PORT_NUMBER: "[0-9]*"@REDIS_SENTINEL_PORT_NUMBER: "26379"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_TLS_AUTH_CLIENTS: "yes"@REDIS_TLS_AUTH_CLIENTS: "no"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_TLS_AUTH_CLIENTS: "yes"@REDIS_SENTINEL_TLS_AUTH_CLIENTS: "no"@' {} \;
|
||||
find . -type f -name 'docker-compose.*' -exec sed -i 's@REDIS_SENTINEL_HOSTS: ".*"@REDIS_SENTINEL_HOSTS: "redis-bw-redis-sentinel-1:26379 redis-bw-redis-sentinel-2:26379 redis-bw-redis-sentinel-3:26379"@' {} \;
|
||||
fi
|
||||
|
||||
echo "🧰 Starting stack ..."
|
||||
|
|
|
|||
Loading…
Reference in a new issue