diff --git a/tools/cloud-setup.sh b/tools/cloud-setup.sh index 89f4eaa31..e573e9739 100755 --- a/tools/cloud-setup.sh +++ b/tools/cloud-setup.sh @@ -47,6 +47,25 @@ go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@$PROTOC_GEN_GO_GRPC_VE curl -fsSL https://raw.githubusercontent.com/gastownhall/beads/main/scripts/install.sh | bash (cd "$HOME" && bd setup claude --global) +# PostgreSQL 18 for running full checks against the real stack +# (deployments/dev.toml). Never for tests: they use fakes. +if [ ! -x /usr/lib/postgresql/18/bin/postgres ]; then + $SUDO apt-get install -y --no-install-recommends postgresql-common + $SUDO /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y + $SUDO apt-get install -y --no-install-recommends postgresql-18 +fi +for v in $(pg_lsclusters -h | awk '$1 != 18 {print $1}'); do + $SUDO pg_ctlcluster "$v" main stop || true + $SUDO pg_dropcluster "$v" main +done +pg_lsclusters -h | grep -q '^18 main' || $SUDO pg_createcluster 18 main --port 5432 +$SUDO pg_ctlcluster 18 main start || true +as_pg() { $SUDO runuser -u postgres -- "$@"; } +as_pg psql -qtc "SELECT 1 FROM pg_roles WHERE rolname = 'archie'" | grep -q 1 || + as_pg psql -qc "CREATE USER archie WITH PASSWORD 'archie' SUPERUSER" +as_pg psql -qtc "SELECT 1 FROM pg_database WHERE datname = 'archie'" | grep -q 1 || + as_pg createdb -O archie archie + # Commit and PR attribution stays off, matching local settings. mkdir -p "$HOME/.claude" settings="$HOME/.claude/settings.json"