Skip to content

Commit 51569c5

Browse files
authored
dataconnect: make stdout of helper postgres podman scripts less verbose (#7134)
1 parent 117c086 commit 51569c5

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

firebase-dataconnect/emulator/start_postgres_pod.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
# server is already running (it will just be a no-op).
2020

2121
set -euo pipefail
22-
set -xv
22+
23+
function run_command {
24+
echo "$*"
25+
"$@"
26+
}
2327

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

3438
# Start the PostgreSQL server.
35-
podman \
39+
run_command podman \
3640
run \
3741
-dt \
3842
--rm \
@@ -44,7 +48,7 @@ podman \
4448
# Start the pgadmin4 server.
4549
readonly PGADMIN_EMAIL="[email protected]"
4650
readonly PGADMIN_PASSWORD="password"
47-
podman \
51+
run_command podman \
4852
run \
4953
-dt \
5054
--rm \
@@ -55,13 +59,9 @@ podman \
5559
--mount "type=volume,src=dataconnect_pgadmin_data,dst=/var/lib/pgadmin" \
5660
docker.io/dpage/pgadmin4
5761

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

6264
cat <<EOF
63-
SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
64-
6565
PostegreSQL server running on port 5432
6666
The pgAdmin web UI can be viewed at http://localhost:8888
6767
The pgAdmin login credentails are: username "${PGADMIN_EMAIL}" and password "${PGADMIN_PASSWORD}"
@@ -76,7 +76,6 @@ To delete the postgresql database, run
7676
To delete the containers, run
7777
podman pod rm --force dataconnect_postgres
7878
79-
When running the Firebase Data Connect emulator, use this postgresql connection string
80-
in .firebaserc:
79+
When running the Firebase Data Connect emulator, use this postgresql connection string:
8180
postgresql://postgres:postgres@localhost:5432?sslmode=disable
8281
EOF

firebase-dataconnect/emulator/wipe_postgres_db.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@
1919
# server is already running (it will just be a no-op).
2020

2121
set -euo pipefail
22-
set -xv
22+
23+
function run_command {
24+
echo "$*"
25+
"$@"
26+
}
2327

2428
# Shut down the pod, if it's running
25-
podman pod stop dataconnect_postgres
29+
run_command podman pod stop dataconnect_postgres
2630

2731
# Delete the postgresql database
28-
podman volume rm --force dataconnect_pgdata
32+
run_command podman volume rm --force dataconnect_pgdata

0 commit comments

Comments
 (0)