Skip to content

Commit e8d6fc4

Browse files
committed
made README well documented
1 parent feb24d2 commit e8d6fc4

File tree

1 file changed

+91
-76
lines changed

1 file changed

+91
-76
lines changed

README.md

Lines changed: 91 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -32,129 +32,144 @@
3232
- For changes, see the [Changelog](CHANGELOG.md)
3333
- We are always welcoming contributions. For the development notes: [Contributing](CONTRIBUTING.md)
3434

35+
## Installation and Running:
3536

36-
### Installing STAC-FastAPI from PyPI
37+
### **Method 1: Install via PyPI and Run with Docker Compose or Podman Compose**
3738

38-
To install STAC-FastAPI with Elasticsearch or OpenSearch backend support, run the following command:
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+
#### **Step 1: Install STAC-FastAPI**
44+
45+
To install STAC-FastAPI with Elasticsearch or OpenSearch backend support, execute the following commands:
46+
47+
- **For Elasticsearch backend:**
48+
49+
```bash
50+
pip install stac_fastapi.elasticsearch
51+
```
52+
53+
- **For OpenSearch backend:**
54+
55+
```bash
56+
pip install stac_fastapi.opensearch
57+
```
58+
59+
#### **Step 2: Build the Elasticsearch API Backend**
60+
61+
Start the Elasticsearch service and build the STAC-FastAPI application image:
3962

40-
For Elasticsearch:
4163
```bash
42-
pip install stac_fastapi.elasticsearch
64+
docker-compose up -d elasticsearch
65+
docker-compose build app-elasticsearch
4366
```
4467

45-
For OpenSearch:
68+
#### **Step 3: Run the Elasticsearch API on `localhost:8080`**
69+
70+
Launch the STAC-FastAPI application connected to Elasticsearch:
71+
4672
```bash
47-
pip install stac_fastapi.opensearch
73+
docker-compose up -d app-elasticsearch
4874
```
4975

50-
## Running STAC-FastAPI Elasticsearch or OpenSearch API
76+
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:
77+
78+
```env
79+
ELASTICSEARCH_VERSION=7.17.1
80+
OPENSEARCH_VERSION=2.11.0
81+
```
5182

52-
### Prerequisites
83+
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).
5384

54-
- [**Docker**](https://docs.docker.com/get-started/) or [**Podman**](https://podman.io/docs) installed and running on your machine.
85+
### **Method 2: Install and run only with Docker or podman**
5586

56-
### Step 1: Set Up the Environment Variables
57-
Create a `.env` file to configure your setup. Depending on your preference, you can either connect to an external Elasticsearch/OpenSearch instance or run one locally within the same container.
87+
#### Prerequisites
5888

59-
#### Option A: Connect to an External Elasticsearch/OpenSearch Instance
89+
- [**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.
6090

61-
1. Open your `.env` file.
62-
2. Set the following variables to point to your external Elasticsearch or OpenSearch server:
91+
#### **Step 1: Create a `.env` File**
6392

64-
```env
65-
ES_HOST=your_external_host
66-
ES_PORT=your_external_port
67-
ES_USE_SSL=false # Set to 'true' if your server uses SSL
68-
ES_VERIFY_CERTS=false # Set to 'true' to verify SSL certificates
69-
```
93+
Configure your environment variables in a `.env` file. You can choose to connect to an external Elasticsearch/OpenSearch instance or run one locally within the container.
7094

71-
#### Option B: Run Elasticsearch/OpenSearch Locally
95+
- **Option A: Connect to an External Instance**
7296

73-
1. Open your `.env` file.
74-
2. Enable one of the following to run the service locally within the container:
97+
```env
98+
ES_HOST=your_external_host
99+
ES_PORT=your_external_port
100+
ES_USE_SSL=false # Set to 'true' if SSL is used
101+
ES_VERIFY_CERTS=false # Set to 'true' to verify SSL certificates
102+
```
75103

76-
```env
77-
# For Elasticsearch
78-
RUN_LOCAL_ES=1
104+
- **Option B: Running Locally Within the Container**
79105

80-
# For OpenSearch
81-
RUN_LOCAL_OS=1
82-
```
106+
- **For Elasticsearch:**
107+
108+
```env
109+
RUN_LOCAL_ES=1
110+
```
111+
112+
- **For OpenSearch:**
113+
114+
```env
115+
RUN_LOCAL_OS=1
116+
```
83117
84118
> [!IMPORTANT]
85119
> The variables `RUN_LOCAL_ES` and `RUN_LOCAL_OS` correspond to **different Docker images**:
86120
> - Use `RUN_LOCAL_ES` with the `ghcr.io/stac-utils/stac-fastapi-es` image.
87121
> - Use `RUN_LOCAL_OS` with the `ghcr.io/stac-utils/stac-fastapi-os` image.
88122
89-
### Step 2: Run the STAC-FastAPI Container
123+
#### **Step 2: Run the Docker Container**
90124
91-
#### Option A: Using an External Instance
125+
- **For Elasticsearch Backend:**
92126
93-
- **For Elasticsearch:**
127+
- **Connecting to External Instance:**
94128
95-
```bash
96-
docker run -d \
97-
-p 8080:8080 \
98-
--env-file .env \
99-
ghcr.io/stac-utils/stac-fastapi-es:latest
100-
```
129+
```shell
130+
docker run -d -p 8080:8080 --env-file .env ghcr.io/stac-utils/stac-fastapi-es:latest
131+
```
101132
102-
- **For OpenSearch:**
133+
- **Running Locally:**
103134
104-
```bash
105-
docker run -d \
106-
-p 8080:8080 \
107-
--env-file .env \
108-
ghcr.io/stac-utils/stac-fastapi-os:latest
109-
```
135+
```shell
136+
docker run -d -p 8080:8080 -p 9200:9200 --env-file .env ghcr.io/stac-utils/stac-fastapi-es:latest
137+
```
110138
111-
#### Option B: Running Locally in the Same Container as APP
139+
- **For OpenSearch Backend:**
112140
113-
- **For Elasticsearch:**
141+
- **Connecting to External Instance:**
114142
115-
```bash
116-
docker run -d \
117-
-p 8080:8080 \
118-
-p 9200:9200 \
119-
--env-file .env \
120-
ghcr.io/stac-utils/stac-fastapi-es:latest
121-
```
143+
```shell
144+
docker run -d -p 8080:8080 --env-file .env ghcr.io/stac-utils/stac-fastapi-os:latest
145+
```
122146
123-
- **For OpenSearch:**
147+
- **Running Locally:**
124148
125-
```bash
126-
docker run -d \
127-
-p 8080:8080 \
128-
-p 9202:9202 \
129-
--env-file .env \
130-
ghcr.io/stac-utils/stac-fastapi-os:latest
131-
```
149+
```shell
150+
docker run -d -p 8080:8080 -p 9202:9202 --env-file .env ghcr.io/stac-utils/stac-fastapi-os:latest
151+
```
132152
133153
> [!TIP]
134154
> 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.
135155
136-
### Step 3: Verify the Service is Running
137156
138-
Run the following command to check if your container is up and running:
139-
140-
```bash
141-
docker ps # "podman ps" if you are running via podman
142-
```
157+
#### **Step 3: Verify and Access**
143158
144-
You should see the STAC-FastAPI container listed.
159+
- **Check if the container is running:**
145160
146-
## Accessing the API
161+
```shell
162+
docker ps # "podman ps" if you are running via podman
163+
```
147164

148-
Once the container is up and running, access the API at:
165+
- **Access the API:**
149166

150-
```
151-
http://localhost:8080
152-
```
167+
Visit `http://localhost:8080` in your browser or use it as the base URL for API requests.
153168

154-
## Additional Configuration (Optional)
169+
##### **Configuration reference keys:**
155170

156171
You can customize additional settings in your `.env` file:
157-
### Key variables to configure:
172+
###### Key variables to configure:
158173

159174
| Variable | Description | Default | Required |
160175
|------------------------------|--------------------------------------------------------------------------------------|--------------------------|---------------------------------------------------------------------------------------------|

0 commit comments

Comments
 (0)