Skip to content

Commit 795fa87

Browse files
committed
added default values and removed the unnecessary env vars from docker files since they already got defualt vals
1 parent 710b8f4 commit 795fa87

File tree

4 files changed

+22
-77
lines changed

4 files changed

+22
-77
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ jobs:
107107
- name: Test Elasticsearch image
108108
run: |
109109
docker run -d --name stac-es \
110-
-e APP_HOST=0.0.0.0 \
111-
-e APP_PORT=8080 \
112-
-e ES_HOST=localhost \
113-
-e ES_PORT=9200 \
114110
stac-fastapi-es:test
115111
116112
timeout=120
@@ -169,10 +165,6 @@ jobs:
169165
- name: Test OpenSearch image
170166
run: |
171167
docker run -d --name stac-os \
172-
-e APP_HOST=0.0.0.0 \
173-
-e APP_PORT=8080 \
174-
-e OS_HOST=localhost \
175-
-e OS_PORT=9200 \
176168
stac-fastapi-os:test
177169
178170
timeout=120

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,68 +51,67 @@ pip install stac_fastapi.opensearch
5151

5252
Before starting, [Docker](https://docs.docker.com/get-started/) or [Podman](https://podman.io/docs) has to be installed and running on your machine.
5353

54-
### Step 1: Configure the `.env` File
54+
### Step 1: Configure the `.env` File (Optional)
5555

56-
You need to provide a `.env` file to configure the environment variables. Here's a list of variables you can configure:
56+
If you need to modify the default configuration, provide a `.env` file with your environment variables. Here's a list of configurable variables. If you're comfortable with the defaults, you can run the Docker container without any environment configuration.
5757

5858
- `STAC_FASTAPI_TITLE`: Title of the API shown in the documentation (default: `stac-fastapi-elasticsearch` or `stac-fastapi-opensearch`)
5959
- `STAC_FASTAPI_DESCRIPTION`: Description of the API in the documentation
6060
- `STAC_FASTAPI_VERSION`: API version (default: `2.1`)
6161
- `APP_HOST`: Host to bind the server (default: `0.0.0.0`)
6262
- `APP_PORT`: Port to bind the server (default: `8080`)
63-
- `RELOAD`: Enable auto-reload for development (default: `true`)
6463
- `ENVIRONMENT`: Runtime environment (default: `local`)
65-
- `WEB_CONCURRENCY`: Number of worker processes (default: `10`)
64+
- `WEB_CONCURRENCY`: Number of worker processes if more workers are needed (default: `10`)
65+
- `RELOAD`: Enable auto-reload for development (default: `true`)
6666
- `ES_HOST`: Elasticsearch or OpenSearch host (default: `localhost`)
6767
- `ES_PORT`: Elasticsearch port (default: `9200` for Elasticsearch, `9202` for OpenSearch)
6868
- `ES_USE_SSL`: Enable SSL for Elasticsearch (default: `false`)
6969
- `ES_VERIFY_CERTS`: Verify SSL certificates (default: `false`)
70-
- `BACKEND`: Backend type (`elasticsearch` or `opensearch`)
7170
- `STAC_FASTAPI_RATE_LIMIT`: API rate limit per client (default: `200/minute`)
7271

7372
> [!NOTE]
74-
> The variables `ES_HOST`, `ES_PORT`, `ES_USE_SSL`, and `ES_VERIFY_CERTS` apply to both Elasticsearch and OpenSearch, so there is no need to rename the key names to `OS_` even if you're using OpenSearch.
73+
> The variables `ES_HOST`, `ES_PORT`, `ES_USE_SSL`, and `ES_VERIFY_CERTS` apply to both Elasticsearch and OpenSearch, so there is no need to rename the key names to `OS_` even if you're using OpenSearch.
7574
76-
### Step 2: Running the Backend with Elasticsearch
75+
### Step 2.1: Running the Backend with Elasticsearch
7776

7877
To run the backend with Elasticsearch, use the following command:
7978

8079
```bash
8180
docker run -d \
82-
--env-file .env \
8381
-p 9200:9200 \
8482
-p 8080:8080 \
8583
ghcr.io/stac-utils/stac-fastapi-es:latest
8684
```
8785
or
8886
```bash
8987
podman run -d \
90-
--env-file .env \
9188
-p 9200:9200 \
9289
-p 8080:8080 \
9390
ghcr.io/stac-utils/stac-fastapi-es:latest
9491
```
9592

96-
### Step 3: Running the Backend with OpenSearch
93+
### Step 2.2: Running the Backend with OpenSearch
9794

9895
To run the backend with OpenSearch, use the following command:
9996

10097
```bash
10198
docker run -d \
102-
--env-file .env \
10399
-p 9202:9202 \
104100
-p 8080:8080 \
105101
ghcr.io/stac-utils/stac-fastapi-os:latest
106102
```
107103
or
108104
```bash
109105
podman run -d \
110-
--env-file .env \
111106
-p 9202:9202 \
112107
-p 8080:8080 \
113108
ghcr.io/stac-utils/stac-fastapi-os:latest
114109
```
115-
### Step 4: Verifying the Backend is Running
110+
111+
> [!TIP]
112+
> If you need to mount a volume, use the [`-v`](https://docs.docker.com/engine/storage/volumes/#choose-the--v-or---mount-flag) flag. To specify an environment file, use the [`--env-file`](https://docs.docker.com/reference/cli/docker/container/run/#env) flag.
113+
114+
### Step 3: Verifying the Backend is Running
116115

117116
To check if the container is running, use the following command depending on whether you're using Docker or Podman:
118117

dockerfiles/Dockerfile.ci.es

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
11
FROM debian:bookworm-slim AS base
22

3-
ARG STAC_FASTAPI_TITLE
4-
ARG STAC_FASTAPI_DESCRIPTION
5-
ARG STAC_FASTAPI_VERSION
6-
ARG APP_HOST
7-
ARG APP_PORT
8-
ARG RELOAD
9-
ARG ENVIRONMENT
10-
ARG WEB_CONCURRENCY
11-
ARG ES_HOST
12-
ARG ES_PORT
13-
ARG ES_USE_SSL
14-
ARG ES_VERIFY_CERTS
15-
ARG BACKEND
16-
17-
ENV STAC_FASTAPI_TITLE=${STAC_FASTAPI_TITLE}
18-
ENV STAC_FASTAPI_DESCRIPTION=${STAC_FASTAPI_DESCRIPTION}
19-
ENV STAC_FASTAPI_VERSION=${STAC_FASTAPI_VERSION}
20-
ENV APP_HOST=${APP_HOST}
21-
ENV APP_PORT=${APP_PORT}
22-
ENV RELOAD=${RELOAD}
23-
ENV ENVIRONMENT=${ENVIRONMENT}
24-
ENV WEB_CONCURRENCY=${WEB_CONCURRENCY}
25-
ENV ES_HOST=${ES_HOST}
26-
ENV ES_PORT=${ES_PORT}
27-
ENV ES_USE_SSL=${ES_USE_SSL}
28-
ENV ES_VERIFY_CERTS=${ES_VERIFY_CERTS}
29-
ENV BACKEND=${BACKEND}
3+
ENV ENVIRONMENT="local"
4+
ENV WEB_CONCURRENCY=10
5+
ENV ES_USE_SSL=false
6+
ENV ES_VERIFY_CERTS=false
7+
ENV STAC_FASTAPI_RATE_LIMIT="200/minute"
308

319
RUN apt-get update && \
3210
apt-get install -y --no-install-recommends \

dockerfiles/Dockerfile.ci.os

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,10 @@
11
FROM debian:bookworm-slim AS base
22

3-
ARG STAC_FASTAPI_TITLE
4-
ARG STAC_FASTAPI_DESCRIPTION
5-
ARG STAC_FASTAPI_VERSION
6-
ARG APP_HOST
7-
ARG APP_PORT
8-
ARG RELOAD
9-
ARG ENVIRONMENT
10-
ARG WEB_CONCURRENCY
11-
ARG ES_HOST
12-
ARG ES_PORT
13-
ARG ES_USE_SSL
14-
ARG ES_VERIFY_CERTS
15-
ARG BACKEND
16-
ARG STAC_FASTAPI_RATE_LIMIT
17-
18-
ENV STAC_FASTAPI_TITLE=${STAC_FASTAPI_TITLE}
19-
ENV STAC_FASTAPI_DESCRIPTION=${STAC_FASTAPI_DESCRIPTION}
20-
ENV STAC_FASTAPI_VERSION=${STAC_FASTAPI_VERSION}
21-
ENV APP_HOST=${APP_HOST}
22-
ENV APP_PORT=${APP_PORT}
23-
ENV RELOAD=${RELOAD}
24-
ENV ENVIRONMENT=${ENVIRONMENT}
25-
ENV WEB_CONCURRENCY=${WEB_CONCURRENCY}
26-
ENV ES_HOST=${ES_HOST}
27-
ENV ES_PORT=${ES_PORT}
28-
ENV ES_USE_SSL=${ES_USE_SSL}
29-
ENV ES_VERIFY_CERTS=${ES_VERIFY_CERTS}
30-
ENV BACKEND=${BACKEND}
31-
ENV STAC_FASTAPI_RATE_LIMIT=${STAC_FASTAPI_RATE_LIMIT}
3+
ENV ENVIRONMENT="local"
4+
ENV WEB_CONCURRENCY=10
5+
ENV ES_USE_SSL=false
6+
ENV ES_VERIFY_CERTS=false
7+
ENV STAC_FASTAPI_RATE_LIMIT="200/minute"
328

339
RUN apt-get update && \
3410
apt-get install -y --no-install-recommends \

0 commit comments

Comments
 (0)