run-container-koopa.sh (1423B)
1 #!/bin/bash 2 # Recreate taler-hacktivism-exchange-ansible with systemd (regional-currency style). 3 # Image: Containerfile (debian + systemd + ssh). Port: only 9011. 4 # Ansible: ansible_connection=podman → systemctl inside container. 5 set -euo pipefail 6 7 NAME=taler-hacktivism-exchange-ansible 8 IMAGE=localhost/taler-hacktivism-exchange-ansible:base 9 ROOT="$(cd "$(dirname "$0")" && pwd)" 10 11 cd "$ROOT" 12 podman build -f Containerfile -t "$IMAGE" 13 14 echo "Stopping/removing existing $NAME (if any)..." 15 podman rm -f "$NAME" 2>/dev/null || true 16 17 podman run -d \ 18 --name "$NAME" \ 19 --hostname "$NAME" \ 20 --network pasta \ 21 --systemd=always \ 22 -p 9011:9011 \ 23 --label org.hacktivism.service=taler-exchange \ 24 --label org.hacktivism.host_port=9011 \ 25 --label org.hacktivism.site=exchange.hacktivism.ch \ 26 --label org.hacktivism.currency=GOA \ 27 --label org.hacktivism.managed_by=ansible-taler-exchange \ 28 --label org.hacktivism.init=systemd \ 29 "$IMAGE" \ 30 /usr/sbin/init 31 32 echo "waiting for systemd..." 33 for i in $(seq 1 30); do 34 if podman exec "$NAME" systemctl is-system-running 2>/dev/null | grep -Eq 'running|degraded'; then 35 break 36 fi 37 sleep 1 38 done 39 40 podman ps --filter "name=$NAME" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}\t{{.Image}}" 41 echo -n "PID1: " 42 podman exec "$NAME" cat /proc/1/comm 43 echo -n "systemd: " 44 podman exec "$NAME" systemctl is-system-running || true 45 echo "Next: ./deploy-hacktivism-goa.sh"