This commit is contained in:
2025-11-06 13:46:19 +01:00
parent e76cb3dc21
commit b7efae61c4
6 changed files with 128 additions and 16 deletions

View File

@@ -20,7 +20,7 @@ poetry run uvicorn apps.api.main:app --reload
### Production Mode
```bash
poetry run uvicorn apps.api.main:app --host 0.0.0.0 --port 8000
poetry run uvicorn apps.api.main:app --host 0.0.0.0 --port 8001
```
### Using Python directly
@@ -29,6 +29,39 @@ poetry run uvicorn apps.api.main:app --host 0.0.0.0 --port 8000
poetry run python -m apps.api.main
```
### Docker Container
#### Build Image
```bash
docker build -t api:dev -f apps/api/Dockerfile .
```
#### Run Container
```bash
docker run --rm -p 8001:8001 \
-v $(pwd)/config:/app/config:ro \
-e MQTT_BROKER=172.16.2.16 \
-e MQTT_PORT=1883 \
-e REDIS_HOST=172.23.1.116 \
-e REDIS_PORT=6379 \
-e REDIS_DB=8 \
-e REDIS_CHANNEL=ui:updates \
api:dev
```
#### Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `MQTT_BROKER` | `172.16.2.16` | MQTT broker hostname/IP |
| `MQTT_PORT` | `1883` | MQTT broker port |
| `REDIS_HOST` | `localhost` | Redis server hostname/IP |
| `REDIS_PORT` | `6379` | Redis server port |
| `REDIS_DB` | `0` | Redis database number |
| `REDIS_CHANNEL` | `ui:updates` | Redis pub/sub channel |
## API Endpoints
### `GET /health`