13 lines
782 B
Bash
13 lines
782 B
Bash
# Services several peers share: one Postgres (each peer gets its own database) and one Redis (each its own db number).
|
|||
|
|
shared_postgres_up() {
|
||
|
|
podman container exists pasture-postgres && return 0
|
||
|
|
podman run -d --replace --name pasture-postgres --network $net --network-alias postgres \
|
||
|
|
-e POSTGRES_USER=pasture -e POSTGRES_PASSWORD=pasture -e POSTGRES_DB=pasture docker.io/library/postgres:17-alpine >/dev/null
|
||
|
|
for _ in $(seq 1 60); do podman exec pasture-postgres pg_isready -U pasture >/dev/null 2>&1 && return 0; sleep 1; done
|
||
|
|
echo "postgres did not start" >&2; return 1
|
||
|
|
}
|
||
|
|
|
||
|
|
shared_redis_up() {
|
||
|
|
podman container exists pasture-redis && return 0
|
||
|
|
podman run -d --replace --name pasture-redis --network $net --network-alias redis docker.io/library/redis:7-alpine >/dev/null
|
||
|
|
}
|