modified: .env
modified: README.md modified: compose.yml modified: configuration.py new file: haproxy.cfg new file: init-patroni-users.sql renamed: entrypoint.sh -> netbox-entrypoint.sh renamed: Containerfile -> netbox.Containerfile modified: nginx.conf new file: patroni-entrypoint.sh new file: patroni.Containerfile new file: patroni.yml
This commit is contained in:
1 parent
136ee48052
commit
e7b53b6965
12 files changed
+404
-41
No files matched your search
+98
-31
@@ -2,24 +2,100 @@ name: netbox
|
||||
|
||||
services:
|
||||
|
||||
# __ PostgreSQL ______________________________________________
|
||||
postgres:
|
||||
image: git.luethi.co/sven/netbox-stack/postgres:16-alpine
|
||||
# __ etcd (DCS for Patroni) __________________________________
|
||||
etcd:
|
||||
image: quay.io/coreos/etcd:${ETCD_VERSION}
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
environment:
|
||||
POSTGRES_DB: netbox
|
||||
POSTGRES_USER: netbox
|
||||
POSTGRES_PASSWORD: netbox
|
||||
command: >
|
||||
etcd
|
||||
--data-dir /etcd-data
|
||||
--listen-client-urls http://0.0.0.0:2379
|
||||
--advertise-client-urls http://127.0.0.1:2379
|
||||
--listen-peer-urls http://0.0.0.0:2380
|
||||
--initial-advertise-peer-urls http://127.0.0.1:2380
|
||||
--initial-cluster default=http://127.0.0.1:2380
|
||||
--initial-cluster-token netbox-etcd
|
||||
--initial-cluster-state new
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data:U
|
||||
- etcd_data:/etcd-data
|
||||
|
||||
# __ Patroni node 1 (leader candidate, existing data) ________
|
||||
patroni1:
|
||||
image: git.luethi.co/sven/netbox-stack/patroni-postgres:${POSTGRES_VERSION}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: patroni.Containerfile
|
||||
network: host
|
||||
args:
|
||||
POSTGRES_VERSION: ${POSTGRES_VERSION}
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
depends_on:
|
||||
- etcd
|
||||
environment:
|
||||
PATRONI_NAME: postgresql0
|
||||
PATRONI_POSTGRESQL_LISTEN: 0.0.0.0:5432
|
||||
PATRONI_POSTGRESQL_CONNECT_ADDRESS: localhost:5432
|
||||
PATRONI_POSTGRESQL_DATA_DIR: /var/lib/postgresql/data
|
||||
PATRONI_RESTAPI_LISTEN: 0.0.0.0:8008
|
||||
PATRONI_RESTAPI_CONNECT_ADDRESS: localhost:8008
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U netbox"]
|
||||
test: ["CMD-SHELL", "curl -sf http://localhost:8008/health || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
|
||||
# __ Redis ___________________________________________________
|
||||
# __ Patroni node 2 (replica) ________________________________
|
||||
patroni2:
|
||||
image: git.luethi.co/sven/netbox-stack/patroni-postgres:${POSTGRES_VERSION}
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
depends_on:
|
||||
patroni1:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
PATRONI_NAME: postgresql1
|
||||
PATRONI_POSTGRESQL_LISTEN: 0.0.0.0:5433
|
||||
PATRONI_POSTGRESQL_CONNECT_ADDRESS: localhost:5433
|
||||
PATRONI_POSTGRESQL_DATA_DIR: /var/lib/postgresql/data
|
||||
PATRONI_RESTAPI_LISTEN: 0.0.0.0:8009
|
||||
PATRONI_RESTAPI_CONNECT_ADDRESS: localhost:8009
|
||||
volumes:
|
||||
- postgres_data2:/var/lib/postgresql/data
|
||||
|
||||
# __ Patroni node 3 (replica) ________________________________
|
||||
patroni3:
|
||||
image: git.luethi.co/sven/netbox-stack/patroni-postgres:${POSTGRES_VERSION}
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
depends_on:
|
||||
patroni1:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
PATRONI_NAME: postgresql2
|
||||
PATRONI_POSTGRESQL_LISTEN: 0.0.0.0:5434
|
||||
PATRONI_POSTGRESQL_CONNECT_ADDRESS: localhost:5434
|
||||
PATRONI_POSTGRESQL_DATA_DIR: /var/lib/postgresql/data
|
||||
PATRONI_RESTAPI_LISTEN: 0.0.0.0:8010
|
||||
PATRONI_RESTAPI_CONNECT_ADDRESS: localhost:8010
|
||||
volumes:
|
||||
- postgres_data3:/var/lib/postgresql/data
|
||||
|
||||
# __ HAProxy (routes writes to leader) ________________________
|
||||
haproxy:
|
||||
image: git.luethi.co/sven/netbox-stack/haproxy:alpine
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
depends_on:
|
||||
- patroni1
|
||||
volumes:
|
||||
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
|
||||
# __ Redis _____________________________________________________
|
||||
redis:
|
||||
image: git.luethi.co/sven/netbox-stack/redis:7-alpine
|
||||
restart: unless-stopped
|
||||
@@ -27,18 +103,13 @@ services:
|
||||
command: redis-server --save 60 1
|
||||
volumes:
|
||||
- redis_data:/data:U
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
# __ NetBox web (Gunicorn) ___________________________________
|
||||
# __ NetBox web (Gunicorn) _____________________________________
|
||||
netbox:
|
||||
image: git.luethi.co/sven/netbox-stack/netbox:${NETBOX_VERSION}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Containerfile
|
||||
dockerfile: netbox.Containerfile
|
||||
network: host
|
||||
args:
|
||||
NETBOX_VERSION: ${NETBOX_VERSION}
|
||||
@@ -49,10 +120,8 @@ services:
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
- haproxy
|
||||
- redis
|
||||
volumes:
|
||||
- ./configuration.py:/opt/netbox/netbox/netbox/configuration.py:ro
|
||||
- netbox_custom_scripts:/opt/netbox/netbox/scripts:ro
|
||||
@@ -66,14 +135,9 @@ services:
|
||||
GUNICORN_MAX_REQUESTS: 5000
|
||||
GUNICORN_MAX_REQUESTS_JITTER: 500
|
||||
command: gunicorn
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "/opt/netbox/netbox/manage.py", "check"]
|
||||
interval: 60s
|
||||
timeout: 30s
|
||||
retries: 5
|
||||
|
||||
|
||||
# __ NetBox RQ worker ________________________________________
|
||||
# __ NetBox RQ worker __________________________________________
|
||||
netbox-worker:
|
||||
image: git.luethi.co/sven/netbox-stack/netbox:${NETBOX_VERSION}
|
||||
restart: unless-stopped
|
||||
@@ -87,7 +151,7 @@ services:
|
||||
- netbox_static:/opt/netbox/netbox/static:U
|
||||
command: worker
|
||||
|
||||
# __ NetBox DNS transfer endpoint ____________________________
|
||||
# __ NetBox DNS transfer endpoint ______________________________
|
||||
netbox-dns-transfer-endpoint:
|
||||
image: git.luethi.co/sven/netbox-stack/netbox:${NETBOX_VERSION}
|
||||
restart: unless-stopped
|
||||
@@ -98,7 +162,7 @@ services:
|
||||
- ./configuration.py:/opt/netbox/netbox/netbox/configuration.py:ro
|
||||
command: dns-transfer-endpoint
|
||||
|
||||
# __ NGINX reverse proxy _____________________________________
|
||||
# __ NGINX reverse proxy _______________________________________
|
||||
nginx:
|
||||
image: git.luethi.co/sven/netbox-stack/nginx:alpine
|
||||
restart: unless-stopped
|
||||
@@ -109,7 +173,7 @@ services:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- netbox_static:/static:ro
|
||||
|
||||
# __ BIND9 ___________________________________________________
|
||||
# __ BIND9 _____________________________________________________
|
||||
bind9:
|
||||
image: git.luethi.co/sven/netbox-stack/bind9:9.20
|
||||
restart: unless-stopped
|
||||
@@ -122,6 +186,9 @@ services:
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
postgres_data2:
|
||||
postgres_data3:
|
||||
etcd_data:
|
||||
redis_data:
|
||||
netbox_media:
|
||||
netbox_static:
|
||||
|
||||
Reference in new issue
Block a user