Skip to content

Commit

Permalink
Merge pull request #36 from winds-mobi/feature/improve-compose-env-vars
Browse files Browse the repository at this point in the history
Improved docker compose environment variables usage and updated the doc
  • Loading branch information
ysavary authored Aug 30, 2023
2 parents 77cf277 + 66c55cf commit c44e2f7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .env.localhost.template
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
MONGODB_URL=mongodb://localhost:8011/winds
ROOT_PATH=/
OPENAPI_PREFIX=/
3 changes: 2 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
MONGODB_URL=mongodb://mongodb:27017/winds
OPENAPI_PREFIX=/api/2.3
ROOT_PATH=/
OPENAPI_PREFIX=/
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ Create an `.env` file from `.env.template` read by docker compose:

Then start the api:
- `docker compose up --build`
- stations list api endpoint: http://localhost:8001/stations/
- OpenAPI client: http://localhost:8001/doc

## Run the project locally on macOS
## Run the project locally
### Dependencies
- Python 3.11
- [Poetry](https://python-poetry.org)

Create an `.env.localhost` file from `.env.localhost.template` read by `dotenv` for our local commands:
- `cp .env.localhost.template .env.localhost`

### Create the python virtual environment and install dependencies
### Create python virtual environment and install dependencies
- `poetry install`

### Activate the python virtual environment
### Activate python virtual environment
- `poetry shell`

### Run the server
- `dotenv -f .env.localhost run uvicorn --proxy-headers --root-path /api/2.3 --port 8001 winds_mobi_api.main:app`
- stations list api endpoint: http://localhost:8001/stations/
- `dotenv -f .env.localhost run uvicorn --proxy-headers --root-path "${ROOT_PATH}" --port 8001 winds_mobi_api.main:app`
- OpenAPI client: http://localhost:8001/doc

## Licensing
winds.mobi is licensed under the AGPL License, Version 3.0. See [LICENSE.txt](LICENSE.txt)
6 changes: 3 additions & 3 deletions compose.telemetry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ services:
volumes:
- ./opentelemetry/collector.yaml:/config.yaml
environment:
ENVIRONMENT: local
SENTRY_URL: ${SENTRY_URL}
UPTRACE_URL: ${UPTRACE_URL}
- ENVIRONMENT=local
- SENTRY_URL
- UPTRACE_URL
command: "--config /config.yaml"
networks:
default:
Expand Down
11 changes: 6 additions & 5 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ services:
ports:
- "8001:8000"
environment:
PORT: 8000
MONGODB_URL: ${MONGODB_URL}
OPENAPI_PREFIX: ${OPENAPI_PREFIX}
OTEL_EXPORTER_OTLP_ENDPOINT: http://opentelemetry-collector:4317
OTEL_SERVICE_NAME: winds-mobi-api
- PORT=8000
- MONGODB_URL
- ROOT_PATH
- OPENAPI_PREFIX
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_SERVICE_NAME
networks:
default:
name: winds-mobi

0 comments on commit c44e2f7

Please sign in to comment.