b2ce2172a2
(cherry picked from commit 1a92c63ef6d60e9dcba513ebf60cbd9f18a142e8)
136 lines
3.7 KiB
Bash
Executable File
136 lines
3.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# script/setup: Set up container for the first time after cloning
|
|
|
|
set -e
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
script/bootstrap
|
|
|
|
echo "==> Setting up pod kontor"
|
|
if podman pod exists kontor; then
|
|
echo " => pod kontor exists"
|
|
if podman pod ps --filter "name=kontor" --filter "status=running"; then
|
|
echo " => pod kontor is running"
|
|
else
|
|
podman pod start kontor
|
|
fi
|
|
else
|
|
podman pod create --name kontor \
|
|
--infra \
|
|
-p 5432:5432 \
|
|
-p 8100:8100 \
|
|
-p 8200:8200 \
|
|
-p 8300:8300 \
|
|
-p 8900:8080 \
|
|
-p 61616:61616 \
|
|
-p 8161:8161 \
|
|
-p 5672:5672 \
|
|
--network bridge
|
|
fi
|
|
|
|
echo "==> Setting up volume kontor-db"
|
|
if podman volume exists kontor-db; then
|
|
echo " => volume kontor-db exists"
|
|
else
|
|
podman volume create kontor-db
|
|
fi
|
|
|
|
echo "==> Setting up volume activemq-data"
|
|
if podman volume exists activemq-data; then
|
|
echo " => volume kontor-db exists"
|
|
else
|
|
podman volume create activemq-data
|
|
fi
|
|
|
|
echo "==> Setting up container postgres"
|
|
if podman container exists postgres; then
|
|
if podman ps -q --filter "name=postgres"; then
|
|
echo " => postgres is running"
|
|
fi
|
|
else
|
|
podman run -d --replace --pod kontor --name postgres \
|
|
-e POSTGRES_PASSWORD=kontor \
|
|
-e POSTGRES_DB=kontor \
|
|
-e POSTGRES_USER=kontor \
|
|
-v kontor-db:/var/lib/postgresql/data \
|
|
--health-cmd='pg_isready -U kontor || exit 1' \
|
|
--health-interval=1s \
|
|
--health-timeout=5s \
|
|
--health-retries=10 \
|
|
postgres:17
|
|
fi
|
|
|
|
echo "==> Setting up container adminer"
|
|
if podman container exists adminer; then
|
|
if podman ps -q --filter "name=adminer"; then
|
|
echo " => adminer is running"
|
|
fi
|
|
else
|
|
podman run -d --replace --pod kontor --name adminer adminer
|
|
fi
|
|
|
|
echo "==> Setting up container activemq"
|
|
if podman container exists activemq; then
|
|
if podman ps -q --filter "name=activemq"; then
|
|
echo " => adminer is running"
|
|
fi
|
|
else
|
|
podman run -d --replace --pod kontor --name activemq \
|
|
-v activemq-data:/var/lib/artemis-instance \
|
|
docker.io/apache/activemq-artemis:latest-alpine
|
|
fi
|
|
|
|
echo "==> Setting up container kontor-spring"
|
|
if podman container exists kontor-spring; then
|
|
if podman ps -q --filter "name=kontor-spring"; then
|
|
echo " => kontor-spring is running"
|
|
fi
|
|
else
|
|
podman run -d \
|
|
--replace \
|
|
--pod kontor \
|
|
--name kontor-spring \
|
|
--label "io.containers.autoupdate=local" \
|
|
localhost/kontor-spring:0.3.0
|
|
fi
|
|
|
|
echo "==> Setting up container kontor-api"
|
|
if podman container exists kontor-api; then
|
|
if podman ps -q --filter "name=kontor-api"; then
|
|
echo " => kontor-api is running"
|
|
fi
|
|
else
|
|
podman run -d \
|
|
--replace \
|
|
--pod kontor \
|
|
--name kontor-api \
|
|
--label "io.containers.autoupdate=local" \
|
|
--label "PODMAN_SYSTEMD_UNIT=container-kontor-api.service" \
|
|
--health-cmd='curl -f http://kontor-api:8200/health || exit 1' \
|
|
--health-interval=1s \
|
|
--health-timeout=5s \
|
|
--health-retries=10 \
|
|
localhost/kontor-api:0.3.0
|
|
fi
|
|
|
|
echo "==> Setting up container kontor-quarkus"
|
|
if podman container exists kontor-quarkus; then
|
|
if podman ps -q --filter "name=kontor-quarkus"; then
|
|
echo " => kontor-quarkus is running"
|
|
fi
|
|
else
|
|
podman run -d \
|
|
--replace \
|
|
--pod kontor \
|
|
--name kontor-quarkus \
|
|
--label "io.containers.autoupdate=local" \
|
|
--label "PODMAN_SYSTEMD_UNIT=container-kontor-quarkus.service" \
|
|
--health-cmd='curl -f http://kontor-api:8300/q/health || exit 1' \
|
|
--health-interval=1s \
|
|
--health-timeout=5s \
|
|
--health-retries=10 \
|
|
localhost/kontor-quarkus:0.3.0
|
|
fi
|