Files
public/Docker/NetBox/docker-compose.yaml
T
thesabear 08f705ffd7 Add sanitized compose for caddy-vm and automation-vm stacks
Caddy (+ a truncated/sanitized example Caddyfile showing the mTLS +
Authentik forward-auth pattern without the real subdomain list),
Hawser, Gitea (private instance only, dropped the public-mirror
service - that's already its own public thing), Kestra (genericized
the ansible-repo/SSH-key bind mounts), Mosquitto, n8n, NetBox,
Node-RED.
2026-07-06 02:25:54 +03:00

113 lines
2.9 KiB
YAML

services:
postgres:
image: postgres:17-alpine
container_name: netbox-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- /path/to/netbox/postgres_data:/var/lib/postgresql/data
healthcheck:
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER
start_period: 20s
timeout: 30s
interval: 10s
retries: 5
networks:
- netbox-net
redis:
image: valkey/valkey:9.0-alpine
container_name: netbox-redis
restart: unless-stopped
command:
- sh
- -c
- valkey-server --appendonly yes --requirepass $$REDIS_PASSWORD
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD}
volumes:
- /path/to/netbox/redis_data:/data
networks:
- netbox-net
redis-cache:
image: valkey/valkey:9.0-alpine
container_name: netbox-redis-cache
restart: unless-stopped
command:
- sh
- -c
- valkey-server --requirepass $$REDIS_PASSWORD
environment:
REDIS_PASSWORD: ${REDIS_CACHE_PASSWORD}
volumes:
- /path/to/netbox/redis_cache:/data
networks:
- netbox-net
netbox: &netbox
image: netboxcommunity/netbox:latest
container_name: netbox
user: "netbox:root"
restart: unless-stopped
depends_on:
- postgres
- redis
- redis-cache
env_file: .env
ports:
- ${HTTP_PORT}:8080
environment:
SECRET_KEY: ${NETBOX_SECRET_KEY}
DB_NAME: ${POSTGRES_DB}
DB_USER: ${POSTGRES_USER}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_HOST: postgres
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD}
REDIS_DATABASE: 0
REDIS_CACHE_HOST: redis-cache
REDIS_CACHE_PORT: 6379
REDIS_CACHE_PASSWORD: ${REDIS_CACHE_PASSWORD}
REDIS_CACHE_DATABASE: 1
SUPERUSER_NAME: ${SUPERUSER_NAME}
SUPERUSER_PASSWORD: ${SUPERUSER_PASSWORD}
SUPERUSER_EMAIL: ${SUPERUSER_EMAIL}
volumes:
- /path/to/netbox/netbox_media:/opt/netbox/netbox/media
- /path/to/netbox/netbox_reports:/opt/netbox/netbox/reports
- /path/to/netbox/netbox_scripts:/opt/netbox/netbox/scripts
- ./configuration/extra.py:/etc/netbox/config/extra.py:ro
healthcheck:
test: curl -f http://localhost:8080/login/ || exit 1
start_period: 90s
timeout: 3s
interval: 15s
networks:
- netbox-net
netbox-worker:
<<: *netbox
container_name: netbox-worker
ports: []
depends_on:
netbox:
condition: service_healthy
command:
- /opt/netbox/venv/bin/python
- /opt/netbox/netbox/manage.py
- rqworker
healthcheck:
test: ps -aux | grep -v grep | grep -q rqworker || exit 1
start_period: 20s
timeout: 3s
interval: 15s
networks:
netbox-net:
external: true