Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scripts for Data Connect Emulator v1.2.0 #6020

Merged
merged 4 commits into from
Jun 6, 2024
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
3 changes: 2 additions & 1 deletion firebase-dataconnect/emulator/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.dataconnect/
/cli*
/cli
/*.tools.json
/firebase-debug.log
/.firebase/
/ui-debug.log
/dataconnect-debug.log
/cli_wrapper.sh.log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Set the DATACONNECT_EMULATOR_BINARY_PATH environment variable to point to this file.
# Then run: firebase emulators:start --only dataconnect

set -euo pipefail

readonly CLI_ARGS=(
./cli
-logbuflevel=-1
-logtostderr
-v=9
dev
-listen=127.0.0.1:9399
-service_location=us-central1
-config_dir=dataconnect
-local_connection_string='postgresql://postgres:postgres@localhost:5432?sslmode=disable'
readonly SELF_DIR="$(dirname "$0")"
readonly LOG_FILE="${SELF_DIR}/cli_wrapper.sh.log.txt"
readonly CLI_BINARY="${SELF_DIR}/cli"

readonly args=(
"${CLI_BINARY}"
"-logtostderr"
"$@"
)

echo "[$0] Running command: ${CLI_ARGS[*]}"
exec "${CLI_ARGS[@]}"
echo "$(date) pid=$$ ${args[*]}" >>"${LOG_FILE}"
exec "${args[@]}"
13 changes: 10 additions & 3 deletions firebase-dataconnect/emulator/emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@

set -euo pipefail

echo "[$0] PID=$$"

readonly SELF_DIR="$(dirname "$0")"
export DATACONNECT_EMULATOR_BINARY_PATH="${SELF_DIR}/cli_wrapper.sh"

readonly FIREBASE_ARGS=(
firebase emulators:exec
--only auth
firebase
--debug
emulators:start
--only auth,dataconnect
--project prjh5zbv64sv6
./emulator_noauth.sh
)

echo "[$0] Set environment variable DATACONNECT_EMULATOR_BINARY_PATH=${DATACONNECT_EMULATOR_BINARY_PATH}"
echo "[$0] Running command: ${FIREBASE_ARGS[*]}"
exec "${FIREBASE_ARGS[@]}"
5 changes: 4 additions & 1 deletion firebase-dataconnect/emulator/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"ui": {
"enabled": true
},
"singleProjectMode": true
"singleProjectMode": true,
"dataconnect": {
"port": 9399
}
}
}
30 changes: 0 additions & 30 deletions firebase-dataconnect/emulator/postgres_dbinit.sh

This file was deleted.

7 changes: 3 additions & 4 deletions firebase-dataconnect/emulator/start_postgres_pod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ podman \
--rm \
--pod dataconnect_postgres \
-e POSTGRES_HOST_AUTH_METHOD=trust \
--mount "type=bind,ro,src=${SCRIPT_DIR}/postgres_dbinit.sh,dst=/docker-entrypoint-initdb.d/postgres_dbinit.sh" \
--mount "type=volume,src=dataconnect_pgdata,dst=/var/lib/postgresql/data" \
docker.io/library/postgres:15

Expand Down Expand Up @@ -77,7 +76,7 @@ To delete the postgresql database, run
To delete the containers, run
podman pod rm --force dataconnect_postgres

When running the Firebase Data Connect emulator, specify this argument to use this postgresql
or set "localConnectionString" in .firebaserc:
-local_connection_string='postgresql://postgres:postgres@localhost:5432?sslmode=disable'
When running the Firebase Data Connect emulator, use this postgresql connection string
in .firebaserc:
postgresql://postgres:postgres@localhost:5432?sslmode=disable
EOF
Loading