dataconnect(dev): add docker-compose.yml to replace bespoke bash scripts#7918
dataconnect(dev): add docker-compose.yml to replace bespoke bash scripts#7918
Conversation
…pts to launch a postgresql database for the dataconnect emulator for local sdk development
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a great improvement, replacing bespoke bash scripts with a docker-compose.yml file to manage the local development database setup. This simplifies the process and makes it more declarative.
I've added a few suggestions to the docker-compose.yml file to enhance security and maintainability. These include setting a password for PostgreSQL instead of allowing trust-based authentication, avoiding hardcoded credentials for pgAdmin, and pinning the pgAdmin image version for reproducible builds.
One important point not covered in the diff: the firebase-dataconnect/emulator/README.md file still contains instructions for the old, now-deleted scripts. Please update the README to reflect the new podman compose workflow.
diff --git a/firebase-dataconnect/emulator/docker-compose.yml b/firebase-dataconnect/emulator/docker-compose.yml index 40861c0..860f98b 100644 --- a/firebase-dataconnect/emulator/docker-compose.yml +++ b/firebase-dataconnect/emulator/docker-compose.yml @@ -1,6 +1,7 @@ services: postgres: - image: docker.io/library/postgres:15 + # https://hub.docker.com/layers/library/postgres/15/images/sha256-087b60e4987f313e00220957009a1ad57c76b26ed6d6919e5d9b047d5048a757 + image: docker.io/library/postgres@sha256:f30e3de0ac9cc938dac627ef2231099867c694b5f949fadb924c8c977428c399 environment: - POSTGRES_HOST_AUTH_METHOD=trust ports: @@ -9,7 +10,8 @@ services: - dataconnect_pgdata:/var/lib/postgresql/data pgadmin: - image: docker.io/dpage/pgadmin4 + # https://hub.docker.com/layers/dpage/pgadmin4/9.13.0/images/sha256-30caa6f4dac04d25eaa99a920c3095eea5f1d96d919a93994182e57442b4900a + image: docker.io/dpage/pgadmin4@sha256:d243a4bcc02d2ee6b447c601692813531d2d0fbca18b583d9f7f9658da835d81 environment: - PGADMIN_DEFAULT_EMAIL=admin@google.com - PGADMIN_DEFAULT_PASSWORD=password
…nment variables [skip actions]
This PR replaces custom data connect bash scripts used for sdk development and CI tests with a standard
docker-compose.ymlconfiguration.Highlights
docker-compose.ymlfile to manage the PostgreSQL and pgAdmin containers, replacing the bespokestart_postgres_pod.shandwipe_postgres_db.shscripts.emulator.shto usepodman composefor starting, stopping, and wiping the database containers. Added a robust health check loop to wait for the database to be ready.dataconnect.yml) to start the PostgreSQL server usingdocker composerather than GitHub Actions services, and added an explicit health check step.README.mdto provide updated instructions on usingpodman composefor managing the database containers during local development.Changelog
postgresservice definition from the job configuration.docker compose up -dand wait for it to be healthy.FIREBASE_DATACONNECT_POSTGRESQL_STRINGenvironment variable.podman compose up -dandpodman compose downinstead of the old bash scripts.postgresandpgadminservices, including volume mapping and health checks.wipe_postgres_db.shandstart_postgres_pod.shwithpodman compose down -vandpodman compose up -d.