Skip to content

Commit d54cf3f

Browse files
committed
feat: add PostgreSQL SSL support and /health
1 parent ab20f79 commit d54cf3f

6 files changed

Lines changed: 2871 additions & 24 deletions

File tree

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@ RUN \
4848
# Update CA Certs
4949
RUN update-ca-certificates
5050

51+
# Copy AWS RDS certificate bundle for psql SSL connections
52+
COPY global-bundle.pem /etc/ssl/certs/aws-global-bundle.pem
53+
RUN chmod 644 /etc/ssl/certs/aws-global-bundle.pem
54+
55+
# Configure SSL for postgres user to use the AWS CA bundle
56+
# This creates the .postgresql directory for the postgres user and sets up SSL config
57+
RUN mkdir -p /var/lib/postgresql/.postgresql && \
58+
ln -s /etc/ssl/certs/aws-global-bundle.pem /var/lib/postgresql/.postgresql/root.crt && \
59+
chown -R postgres:postgres /var/lib/postgresql/.postgresql && \
60+
chmod 700 /var/lib/postgresql/.postgresql && \
61+
chmod 644 /var/lib/postgresql/.postgresql/root.crt
62+
63+
# Also set up for root user
64+
RUN mkdir -p /root/.postgresql && \
65+
ln -s /etc/ssl/certs/aws-global-bundle.pem /root/.postgresql/root.crt && \
66+
chmod 700 /root/.postgresql && \
67+
chmod 644 /root/.postgresql/root.crt
68+
69+
# Set default PostgreSQL client SSL mode to require (not require client certs)
70+
ENV PGSSLMODE=require
71+
ENV PGSSLROOTCERT=/etc/ssl/certs/aws-global-bundle.pem
72+
5173
# Configure postgres.
5274
RUN true \
5375
&& echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/16/main/pg_hba.conf \
@@ -85,6 +107,7 @@ COPY conf.d/postgres-tuning.conf /etc/postgresql/16/main/conf.d/
85107
COPY config.sh /app/config.sh
86108
COPY init.sh /app/init.sh
87109
COPY start.sh /app/start.sh
110+
COPY server.py /app/server.py
88111

89112
# Collapse image to single layer.
90113
FROM scratch

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ docker run -it \
2020

2121
After the import is complete, you can access the Nominatim API at `http://localhost:8080/search?q=avenue%20pasteur`.
2222

23+
## Health Check Endpoint
24+
25+
The service includes a health check endpoint at `/health` that always returns HTTP 200 with service status:
26+
27+
```sh
28+
curl http://localhost:8080/health
29+
```
30+
31+
Response:
32+
```json
33+
{"status":"online","service":"nominatim"}
34+
```
35+
2336
## Accessing Different Versions
2437

2538
You can pull specific versions of the Nominatim Docker image by specifying the tag. For example, to use Nominatim version `5.2`:

0 commit comments

Comments
 (0)