Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions scripts/run/engine-postgres.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"

if ! command -v nc >/dev/null 2>&1; then
echo "error: required command 'nc' not found."
exit 1
fi

if ! nc -z localhost 5432 >/dev/null 2>&1; then
echo "Postgres is not reachable at localhost:5432."
echo "Hint: run scripts/dev/run-postgres.sh to start the local Postgres container."
exit 1
fi

cd "${REPO_ROOT}"

RIVET__POSTGRES__URL=postgres://postgres:postgres@localhost:5432/postgres \
RUST_LOG=debug \
cargo run --bin rivet-engine -- start "$@"
21 changes: 21 additions & 0 deletions scripts/run/postgres.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

CONTAINER_NAME="rivet-engine-postgres"
POSTGRES_IMAGE="postgres:17"

if docker ps --all --format '{{.Names}}' | grep -qw "${CONTAINER_NAME}"; then
if docker ps --format '{{.Names}}' | grep -qw "${CONTAINER_NAME}"; then
docker stop "${CONTAINER_NAME}" >/dev/null 2>&1 || true
fi
docker rm "${CONTAINER_NAME}" >/dev/null 2>&1 || true
fi

docker run \
--detach \
--name "${CONTAINER_NAME}" \
--publish 5432:5432 \
--env POSTGRES_PASSWORD=postgres \
--env POSTGRES_USER=postgres \
--env POSTGRES_DB=postgres \
"${POSTGRES_IMAGE}"
Loading