feat: Docker and systemd deployment files
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
|||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY pyproject.toml .
|
||||||
|
RUN pip install --no-cache-dir -e .
|
||||||
|
|
||||||
|
COPY fablednetmon/ fablednetmon/
|
||||||
|
COPY alembic.ini .
|
||||||
|
|
||||||
|
# Runtime directories
|
||||||
|
RUN mkdir -p /data/playbook_cache /data/plugins
|
||||||
|
|
||||||
|
ENV FABLEDNETMON_CONFIG=/config/config.yaml
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
CMD ["fablednetmon", "--host", "0.0.0.0", "--port", "5000"]
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
volumes:
|
||||||
|
- ./config.yaml:/config/config.yaml:ro
|
||||||
|
- playbook_cache:/data/playbook_cache
|
||||||
|
- plugins:/data/plugins
|
||||||
|
environment:
|
||||||
|
- FABLEDNETMON_DATABASE__URL=postgresql+asyncpg://fablednetmon:fablednetmon@db/fablednetmon
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: fablednetmon
|
||||||
|
POSTGRES_PASSWORD: fablednetmon
|
||||||
|
POSTGRES_DB: fablednetmon
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U fablednetmon"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
||||||
|
playbook_cache:
|
||||||
|
plugins:
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=FabledNetMon monitoring server
|
||||||
|
After=network.target postgresql.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=fablednetmon
|
||||||
|
WorkingDirectory=/opt/fablednetmon
|
||||||
|
ExecStart=/opt/fablednetmon/.venv/bin/fablednetmon --config /etc/fablednetmon/config.yaml
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5s
|
||||||
|
Environment=PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user