Skip to content

Commit 3b321b7

Browse files
authored
fix/pyingest-pgsql-mount: Fix Postgres volume mount and healthcheck for postgres:18-alpine+ (#176)
* Fix volume mount from `/var/lib/postgresql/data` to `/var/lib/postgresql` to avoid breakage due to PGDATA change in postgres:18-alpine+ * Use `$$POSTGRES_USER` env var in healthcheck instead of hardcoded username * Pin default image tag to `postgres:18-alpine` floating tag * Renames tlc-db to nyc-tlc-db - (updates service/container_name/volume) * Updates running instructions on README This addresses a breaking change introduced in [docker-library/postgres#1394](docker-library/postgres#1394).
1 parent adfbd87 commit 3b321b7

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

module1-data-ingestion/python-ingest/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ FROM python:3.14-slim AS runner
1616
WORKDIR /ntlcli/
1717

1818
COPY --from=builder /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
19-
COPY --from=builder /usr/local/bin /usr/local/bin
19+
COPY --from=builder /usr/local/bin/tlc /usr/local/bin/tlc
2020
COPY --from=builder /app /ntlcli/
2121
COPY datasets.yaml ./
2222

2323
ENV PYTHONPATH=/ntlcli \
2424
PYTHONUNBUFFERED=1
2525

26-
CMD ["tlc", "ingest", "-zygf", "--use-polars"]
26+
CMD ["tlc", "ingest", "-zygf", "--use-polars"]

module1-data-ingestion/python-ingest/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pre-commit install
3131

3232
**3.** Spin-up the nyc-tlc-db:
3333
```shell
34-
docker compose up -d tlc-db
34+
docker compose up -d nyc-tlc-db
3535
```
3636

3737
**4.** Export ENV VARS to connect to DB:
@@ -69,7 +69,7 @@ You can use any combination of options above to fetch more than dataset group at
6969

7070
**1.** Build the Docker Image with:
7171
```shell
72-
docker build -t iobruno/tlc-cli:latest . --no-cache
72+
docker build -t nyc-tlc-cli:latest . --no-cache
7373
```
7474

7575
**2.** Start a container with it:
@@ -92,4 +92,3 @@ docker run -d --rm \
9292
- [x] Re-Implement the pipeline with Polars
9393
- [x] Containerize it and run app on `Docker`
9494
- [x] Fix Dockerfile to add support for `Podman`
95-
- [x] Code format/lint with `ruff`
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1-
x-postgres-image: &postgres-image postgres:${POSTGRES_VERSION:-18.1-alpine}
1+
x-postgres-image: &postgres-image postgres:${POSTGRES_VERSION:-18-alpine}
22

33
services:
4-
tlc-db:
4+
nyc-tlc-db:
55
image: *postgres-image
6-
container_name: tlc-db
6+
container_name: nyc-tlc-db
77
environment:
88
POSTGRES_USER: 'postgres'
99
POSTGRES_PASSWORD: 'postgres'
1010
POSTGRES_DB: 'nyc_tlc'
1111
ports:
1212
- '5432:5432'
1313
volumes:
14-
- vol-tlc-db:/var/lib/postgresql/data
14+
- vol-nyc-tlc-db:/var/lib/postgresql
1515
healthcheck:
16-
test: ["CMD-SHELL", "pg_isready -U postgres"]
16+
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER"]
1717
interval: 5s
1818
timeout: 5s
1919
retries: 5
2020
restart: on-failure
2121

22-
tlc-cli:
23-
image: iobruno/tlc-cli:latest
24-
container_name: tlc-cli
25-
pull_policy: build
22+
nyc-tlc-cli:
23+
image: nyc-tlc-cli:latest
24+
container_name: nyc-tlc-cli
2625
build:
27-
dockerfile: ./Dockerfile
26+
context: .
27+
dockerfile: Dockerfile
28+
pull_policy: build
2829
environment:
29-
DB_HOST: 'tlc-db'
30-
DB_NAME: 'nyc_tlc'
30+
DB_HOST: 'nyc-tlc-db'
3131
DB_USERNAME: 'postgres'
3232
DB_PASSWORD: 'postgres'
33+
DB_NAME: 'nyc_tlc'
3334
volumes:
3435
- ./datasets.yml:/app/datasets.yml
3536
depends_on:
36-
tlc-db:
37+
nyc-tlc-db:
3738
condition: service_healthy
3839

3940
volumes:
40-
vol-tlc-db:
41-
name: vol-tlc-db
41+
vol-nyc-tlc-db:
42+
name: vol-nyc-tlc-db

0 commit comments

Comments
 (0)