fix(airflow): fresh Docker setup — Postgres SCRAM, Shapely/GEOS, image bump#428
Open
lprzychodzien wants to merge 1 commit intomainfrom
Open
fix(airflow): fresh Docker setup — Postgres SCRAM, Shapely/GEOS, image bump#428lprzychodzien wants to merge 1 commit intomainfrom
lprzychodzien wants to merge 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves a clean clone / first
docker compose upexperience for the Airflow image: fixes Postgres SCRAM authentication by pinning a modernpsycopg2-binary, adds GEOS for Shapely (pulled in via Google/BigQuery stack), and bumps the tagged Airflow image version so rebuilds pick up the Dockerfile changes. Simplifies the postgres service compose definition by removing an unusedbuildblock while keepingshm_size.Motivation / problem
libpq/psycopg2in the base Airflow 2.5 image).google-cloud-bigquerybrings in Shapely; wheels can still needlibgeos_cat runtime without the system library installed.docker-compose.ymlshould increment whenairflow/requirements.txtor the Dockerfile changes so people don’t reuse a stale cached image.Changes
airflow/Dockerfile: run as root toapt-get installlibgeos-c1v5, thenUSER airflow;COPYrequirements with correct ownership;pip uninstallpsycopg2/psycopg2-binarybeforepip install -r requirements.txtto avoid messy force-reinstall and large temp disk use.airflow/requirements.txt: addpsycopg2-binary>=2.9.9,<3(comment in file already ties this to bumping the compose image version).docker-compose.yml: bumpsagerx_airflowimage tagv0.0.2718→v0.0.2721; postgres: dropbuild: context: ., keepshm_size: "4gb".How we tested
Use language that matches what you actually did; this is the minimal honest checklist for this PR:
Clean rebuild (forces new image tag + Dockerfile)
From repo root, with Docker running:
docker compose build --no-cache airflow-initdocker compose build --no-cachefor all buildable servicesConfirm the build completes without apt/pip errors.
Init + stack
docker compose up airflow-initdocker compose up(orup -d)Confirm airflow-init exits successfully (DB upgrade / user creation) and airflow-webserver / airflow-scheduler stay healthy.
Postgres connectivity from Airflow
http://localhost:8001,airflow/airflow).postgres_default(or equivalent) connection, or check logs for noSCRAM,password authentication failed, orpsycopg2/libpqerrors on scheduler/webserver startup.Optional: Shapely / BigQuery path
If you have a task that imports
shapelyor uses BigQuery client code in the worker image, run that path once and confirm noImportError/libgeos_cmissing-library errors.Postgres service still has shared memory
docker compose configand verifypostgresstill hasshm_size: "4gb"under the service definition.If you did not run a full clean rebuild, say instead: “Verified on existing machine with
docker compose build airflow-initanddocker compose up” so reviewers know the scope.Risk / rollout notes
buildis safe only if nothing relied on a custom postgres image from.; the diff assumes that build was redundant (image is stillpostgres:14-alpine).