Skip to content

Commit 72cab05

Browse files
gadomskimoradology
authored andcommitted
feat: add nginx proxy in own docker-compose file
Includes a Makefile rule to run it, and some documentation in README.md. Also adds a markdownlint silencer and one or two touchups to the whitespace.
1 parent 8844929 commit 72cab05

File tree

4 files changed

+41
-14
lines changed

4 files changed

+41
-14
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ docker-run-sqlalchemy: image
3030
docker-run-pgstac: image
3131
$(run_pgstac)
3232

33+
.PHONY: docker-run-nginx-proxy
34+
docker-run-nginx-proxy:
35+
docker-compose -f docker-compose.yml -f docker-compose.nginx.yml up
36+
3337
.PHONY: docker-shell-sqlalchemy
3438
docker-shell-sqlalchemy:
3539
$(run_sqlalchemy) /bin/bash

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<!-- markdownlint-disable MD033 MD041 -->
2+
13
<p align="center">
24
<img src="https://github.com/radiantearth/stac-site/raw/master/images/logo/stac-030-long.png" width=400>
35
<p align="center">FastAPI implemention of the STAC API spec.</p>
@@ -101,7 +103,23 @@ The application will be started on <http://localhost:8080>.
101103
By default, the apps are run with uvicorn hot-reloading enabled. This can be turned off by changing the value
102104
of the `RELOAD` env var in docker-compose.yml to `false`.
103105

104-
#### Note to Docker for Windows users
106+
### nginx proxy
107+
108+
This repo includes an example nginx proxy service.
109+
To start:
110+
111+
```shell
112+
make docker-run-nginx-proxy
113+
```
114+
115+
The proxy will be started on <http://localhost>, with the pgstac app available at <http://localhost/api/v1/pgstac/> and the sqlalchemy app at <http://localhost/api/v1/sqlalchemy/>.
116+
If you need to customize the proxy port, use the `STAC_FASTAPI_NGINX_PORT` environment variable:
117+
118+
```shell
119+
STAC_FASTAPI_NGINX_PORT=7822 make docker-run-nginx-proxy
120+
```
121+
122+
### Note to Docker for Windows users
105123

106124
You'll need to enable experimental features on Docker for Windows in order to run the docker-compose,
107125
due to the "--platform" flag that is required to allow the project to run on some Apple architectures.

docker-compose.nginx.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3'
2+
services:
3+
nginx:
4+
image: nginx
5+
ports:
6+
- ${STAC_FASTAPI_NGINX_PORT:-80}:80
7+
volumes:
8+
- ./nginx.conf:/etc/nginx/nginx.conf
9+
depends_on:
10+
- app-pgstac
11+
- app-sqlalchemy
12+
command: [ "nginx-debug", "-g", "daemon off;" ]
13+
app-pgstac:
14+
environment:
15+
- UVICORN_ROOT_PATH=/api/v1/pgstac
16+
app-sqlalchemy:
17+
environment:
18+
- UVICORN_ROOT_PATH=/api/v1/sqlalchemy

docker-compose.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
version: '3'
22
services:
3-
nginx:
4-
image: nginx
5-
ports:
6-
- ${STAC_FASTAPI_NGINX_PORT:-80}:80
7-
volumes:
8-
- ./nginx.conf:/etc/nginx/nginx.conf
9-
depends_on:
10-
- app-pgstac
11-
- app-sqlalchemy
12-
command: ["nginx-debug", "-g", "daemon off;"]
13-
143
app-sqlalchemy:
154
container_name: stac-fastapi-sqlalchemy
165
image: stac-utils/stac-fastapi
@@ -30,7 +19,6 @@ services:
3019
- POSTGRES_HOST_WRITER=database
3120
- POSTGRES_PORT=5432
3221
- WEB_CONCURRENCY=10
33-
- UVICORN_ROOT_PATH=/api/v1/sqlalchemy
3422
ports:
3523
- "8081:8081"
3624
volumes:
@@ -62,7 +50,6 @@ services:
6250
- DB_MIN_CONN_SIZE=1
6351
- DB_MAX_CONN_SIZE=1
6452
- USE_API_HYDRATE=${USE_API_HYDRATE:-false}
65-
- UVICORN_ROOT_PATH=/api/v1/pgstac
6653
ports:
6754
- "8082:8082"
6855
volumes:

0 commit comments

Comments
 (0)