feat(desktop): add redis gui foundation baseline
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
35
scripts/redis-fixture/start.sh
Executable file
35
scripts/redis-fixture/start.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
container_name="${REDIS_FIXTURE_CONTAINER:-redis-gui-smoke}"
|
||||
host_port="${REDIS_FIXTURE_PORT:-6380}"
|
||||
image="${REDIS_FIXTURE_IMAGE:-redis:7.4-alpine}"
|
||||
|
||||
if docker container inspect "$container_name" >/dev/null 2>&1; then
|
||||
running="$(docker inspect -f '{{.State.Running}}' "$container_name")"
|
||||
if [ "$running" = "true" ]; then
|
||||
echo "Redis fixture already running: $container_name on 127.0.0.1:$host_port"
|
||||
else
|
||||
docker start "$container_name" >/dev/null
|
||||
echo "Redis fixture started: $container_name on 127.0.0.1:$host_port"
|
||||
fi
|
||||
else
|
||||
docker run -d \
|
||||
--name "$container_name" \
|
||||
-p "${host_port}:6379" \
|
||||
"$image" \
|
||||
redis-server --save '' --appendonly no >/dev/null
|
||||
echo "Redis fixture created: $container_name on 127.0.0.1:$host_port"
|
||||
fi
|
||||
|
||||
attempt=0
|
||||
until docker exec "$container_name" redis-cli ping 2>/dev/null | grep -q '^PONG$'; do
|
||||
attempt=$((attempt + 1))
|
||||
if [ "$attempt" -ge 20 ]; then
|
||||
echo "Redis fixture did not become ready within 20 seconds." >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Redis fixture is ready."
|
||||
Reference in New Issue
Block a user