diff --git a/script/bootstrap b/script/bootstrap index 3466ca2..64b9737 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -7,6 +7,9 @@ set -e cd "$(dirname "$0")/.." if command -v podman &> /dev/null; then + echo "podman is installed" +else + echo "update repositories and install podman" sudo apt-get update &> /dev/null sudo apt-get install podman fi diff --git a/script/setup b/script/setup index 5b929d1..fee5157 100755 --- a/script/setup +++ b/script/setup @@ -11,12 +11,47 @@ 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 8900:8080 \ --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 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 \ + 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 + diff --git a/script/update b/script/update index dcab1d2..26cfdec 100755 --- a/script/update +++ b/script/update @@ -6,3 +6,12 @@ set -e cd "$(dirname "$0")/.." +echo "==> Stopping and removing pod kontor" +if podman pod exists kontor; then + podman pod stop kontor + podman pod rm kontor + podman rm postgres + podman rm adminer +fi + +script/setup