Skip to content
Merged
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
19 changes: 9 additions & 10 deletions firebase-dataconnect/emulator/start_postgres_pod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
# server is already running (it will just be a no-op).

set -euo pipefail
set -xv

function run_command {
echo "$*"
"$@"
}

# Determine the absolute path of the directory containing this file.
readonly SCRIPT_DIR="$(readlink -f $(dirname "$0"))"
Expand All @@ -28,11 +32,11 @@ readonly SCRIPT_DIR="$(readlink -f $(dirname "$0"))"
# Bind the PostgreSQL server to port 5432 on the host, so that the host can connect to it.
# Bind the pgadmin server to port 8888 on the host, so that the host can connect to it.
if ! podman pod exists dataconnect_postgres ; then
podman pod create -p 5432:5432 -p 8888:80 dataconnect_postgres
run_command podman pod create -p 5432:5432 -p 8888:80 dataconnect_postgres
fi

# Start the PostgreSQL server.
podman \
run_command podman \
run \
-dt \
--rm \
Expand All @@ -44,7 +48,7 @@ podman \
# Start the pgadmin4 server.
readonly PGADMIN_EMAIL="[email protected]"
readonly PGADMIN_PASSWORD="password"
podman \
run_command podman \
run \
-dt \
--rm \
Expand All @@ -55,13 +59,9 @@ podman \
--mount "type=volume,src=dataconnect_pgadmin_data,dst=/var/lib/pgadmin" \
docker.io/dpage/pgadmin4

# Turn off verbose logging so that the epilogue below is not littered with bash statements.
set +xv
echo

cat <<EOF
SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

PostegreSQL server running on port 5432
The pgAdmin web UI can be viewed at http://localhost:8888
The pgAdmin login credentails are: username "${PGADMIN_EMAIL}" and password "${PGADMIN_PASSWORD}"
Expand All @@ -76,7 +76,6 @@ To delete the postgresql database, run
To delete the containers, run
podman pod rm --force dataconnect_postgres

When running the Firebase Data Connect emulator, use this postgresql connection string
in .firebaserc:
When running the Firebase Data Connect emulator, use this postgresql connection string:
postgresql://postgres:postgres@localhost:5432?sslmode=disable
EOF
10 changes: 7 additions & 3 deletions firebase-dataconnect/emulator/wipe_postgres_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
# server is already running (it will just be a no-op).

set -euo pipefail
set -xv

function run_command {
echo "$*"
"$@"
}

# Shut down the pod, if it's running
podman pod stop dataconnect_postgres
run_command podman pod stop dataconnect_postgres

# Delete the postgresql database
podman volume rm --force dataconnect_pgdata
run_command podman volume rm --force dataconnect_pgdata