You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- We are always welcoming contributions. For the development notes: [Contributing](CONTRIBUTING.md)
34
34
35
-
## Installation and Running:
36
35
37
-
### **Method 1: Install via PyPI and Use Docker/Podman Compose for Backend**
36
+
### To install from PyPI:
38
37
39
-
#### **Prerequisites**
40
-
41
-
-[**Docker Compose**](https://docs.docker.com/compose/install/) or [**Podman Compose**](https://podman-desktop.io/docs/compose) installed and running on your machine. In all the follwoing steps instead of `docker-compose` you can use `podman-compose` as well.
42
-
43
-
This approach is for users who want to install the Python package separately before running the app.
With Elasticsearch running, you can now run the application:
73
-
74
-
```bash
75
-
uvicorn stac_fastapi.elasticsearch.app:app \
76
-
--host localhost \
77
-
--port 8080 \
78
-
--workers 10 \
79
-
--reload
41
+
or
42
+
```
43
+
pip install stac_fastapi.opensearch
80
44
```
81
45
82
-
and with OpenSearch running:
46
+
## Run Elasticsearch API backend on localhost:8080
47
+
48
+
You need to ensure [**Docker Compose**](https://docs.docker.com/compose/install/) or [**Podman Compose**](https://podman-desktop.io/docs/compose) installed and running on your machine. In the follwoing command instead of `docker-compose` you can use `podman-compose` as well.
83
49
84
-
```bash
85
-
uvicorn stac_fastapi.opensearch.app:app \
86
-
--host localhost \
87
-
--port 8080 \
88
-
--workers 10 \
89
-
--reload
50
+
```shell
51
+
docker-compose up elasticsearch app-elasticsearch
90
52
```
91
53
92
-
By default, Docker Compose uses Elasticsearch 8.x and OpenSearch 2.11.1. If you prefer to use different versions, create a file named `.env` in the same directory where you run Docker Compose and include the following lines:
54
+
By default, docker-compose uses Elasticsearch 8.x and OpenSearch 2.11.1.
55
+
If you wish to use a different version, put the following in a
56
+
file named `.env` in the same directory you run docker-compose from:
93
57
94
-
```env
58
+
```shell
95
59
ELASTICSEARCH_VERSION=7.17.1
96
60
OPENSEARCH_VERSION=2.11.0
97
61
```
98
-
99
-
Most recent Elasticsearch 7.x versions should also be compatible. For detailed compatibility information, please refer to the [opensearch-py documentation](https://github.com/opensearch-project/opensearch-py/blob/main/COMPATIBILITY.md).
100
-
101
-
### **Method 2: Install and run only with Docker or podman**
102
-
103
-
#### Prerequisites
104
-
105
-
-[**Docker**](https://docs.docker.com/get-started/) or [**Podman**](https://podman.io/docs) installed and running on your machine. In all the follwoing steps instead of `docker` you can use `podman` as well.
106
-
107
-
> [!IMPORTANT]
108
-
> The variables `RUN_LOCAL_ES` and `RUN_LOCAL_OS` correspond to **different Docker backend images**. By default, both are set to `0`, indicating that the backend systems are expected to run externally. In this case, you must configure the appropriate `ES_HOST` and `ES_PORT` environment variables to connect to the external Elasticsearch or OpenSearch instance. Alternatively, if you do not have an external backend and wish to run Elasticsearch or OpenSearch alongside the STAC-FastAPI within the container, set the respective variable to `1`:
109
-
> - Use `RUN_LOCAL_ES` with the `ghcr.io/stac-utils/stac-fastapi-es` image.
110
-
> - Use `RUN_LOCAL_OS` with the `ghcr.io/stac-utils/stac-fastapi-os` image.
111
-
112
-
#### **Step 1: Run the Docker Container**
113
-
114
-
-**For Elasticsearch Backend:**
115
-
116
-
-**Connecting to External Instance:**
117
-
118
-
```shell
119
-
docker run -d -p 8080:8080 -e ES_HOST=external_host -e ES_PORT=external_port ghcr.io/stac-utils/stac-fastapi-es:latest
120
-
```
121
-
122
-
- **Running Locally:**
123
-
124
-
```shell
125
-
docker run -d -p 8080:8080 -p 9200:9200 -e RUN_LOCAL_ES=1 ghcr.io/stac-utils/stac-fastapi-es:latest
126
-
```
127
-
128
-
- **For OpenSearch Backend:**
129
-
130
-
- **Connecting to External Instance:**
131
-
132
-
```shell
133
-
docker run -d -p 8080:8080 -e ES_HOST=external_host -e ES_PORT=external_port ghcr.io/stac-utils/stac-fastapi-os:latest
134
-
```
135
-
136
-
- **Running Locally:**
137
-
138
-
```shell
139
-
docker run -d -p 8080:8080 -p 9202:9202 -e RUN_LOCAL_OS=1 ghcr.io/stac-utils/stac-fastapi-os:latest
140
-
```
141
-
> [!Note]
142
-
> For external instances of both **Elasticsearch** and **OpenSearch**, configure the following
143
-
> environment variables as needed:
144
-
> - `-e ES_USE_SSL=false` — Set to `true`if SSL is enabled.
145
-
> - `-e ES_VERIFY_CERTS=false` — Set to `true` to enable SSL certificate verification.
146
-
147
-
> [!TIP]
148
-
> 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.
149
-
150
-
151
-
#### **Step 2: Verify and Access**
152
-
153
-
- **Check if the container is running:**
154
-
155
-
```shell
156
-
docker ps
157
-
```
158
-
159
-
- **Access the API:**
160
-
161
-
Visit `http://localhost:8080`in your browser or use it as the base URL for API requests.
62
+
The most recent Elasticsearch 7.x versions should also work. See the [opensearch-py docs](https://github.com/opensearch-project/opensearch-py/blob/main/COMPATIBILITY.md) for compatibility information.
162
63
163
64
#### **Configuration reference keys:**
164
65
@@ -167,10 +68,8 @@ You can customize additional settings in your `.env` file:
|`RUN_LOCAL_ES`| Enable local Elasticsearch in the container. |`0`| Optional (set to `1` to run local Elasticsearch) |
171
-
|`RUN_LOCAL_OS`| Enable local OpenSearch in the container. |`0`| Optional (set to `1` to run local OpenSearch) |
172
-
|`ES_HOST`| Hostname for external Elasticsearch/OpenSearch. |`localhost`|**Required if`RUN_LOCAL_ES=0` or `RUN_LOCAL_OS=0`**|
173
-
|`ES_PORT`| Port for Elasticsearch/OpenSearch. |`9200` (ES) / `9202` (OS)|**Required if`RUN_LOCAL_ES=0` or `RUN_LOCAL_OS=0`**|
71
+
|`ES_HOST`| Hostname for external Elasticsearch/OpenSearch. |`localhost`| Optional |
72
+
|`ES_PORT`| Port for Elasticsearch/OpenSearch. |`9200` (ES) / `9202` (OS)| Optional |
174
73
|`ES_USE_SSL`| Use SSL for connecting to Elasticsearch/OpenSearch. |`false`| Optional |
175
74
|`ES_VERIFY_CERTS`| Verify SSL certificates when connecting. |`false`| Optional |
176
75
|`STAC_FASTAPI_TITLE`| Title of the API in the documentation. |`stac-fastapi-elasticsearch` or `stac-fastapi-opensearch`| Optional |
@@ -182,11 +81,12 @@ You can customize additional settings in your `.env` file:
182
81
|`WEB_CONCURRENCY`| Number of worker processes. |`10`| Optional |
183
82
|`RELOAD`| Enable auto-reload for development. |`true`| Optional |
184
83
|`STAC_FASTAPI_RATE_LIMIT`| API rate limit per client. |`200/minute`| Optional |
185
-
84
+
|`BACKEND`| Tests-related variable |`elasticsearch` or `opensearch` based on the backend | Optional |
85
+
|`ELASTICSEARCH_VERSION`| ElasticSearch version |`7.17.1`| Optional |
86
+
|`OPENSEARCH_VERSION`| OpenSearch version |`2.11.0`| Optional |
186
87
187
88
> [!NOTE]
188
-
> 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.
189
-
89
+
> The variables `ES_HOST`, `ES_PORT`, `ES_USE_SSL`, and `ES_VERIFY_CERTS` apply to both Elasticsearch and OpenSearch backends, so there is no need to rename the key names to `OS_` even if you're using OpenSearch.
0 commit comments