docs
This commit is contained in:
@@ -22,7 +22,6 @@ WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apk add --no-cache \
|
||||
curl \
|
||||
gcc \
|
||||
musl-dev \
|
||||
linux-headers
|
||||
@@ -42,10 +41,6 @@ RUN chown -R app:app /app
|
||||
# Switch to non-root user
|
||||
USER app
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8001/health || exit 1
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8001
|
||||
|
||||
|
||||
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user