forked from netbox-community/netbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
125 lines (121 loc) · 4.3 KB
/
docker-compose.yml
File metadata and controls
125 lines (121 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# NetBox Plus all-in-one stack: PostgreSQL, Redis, Gunicorn (web), and RQ workers.
#
# Usage:
# cp docker/.env.example .env
# # Edit .env —> set NETBOX_SECRET_KEY (and NETBOX_IMAGE if not using the default)
# podman compose pull && podman compose up -d
#
# UI: http://localhost:8080
#
# Default image is a pre-built NetBox Plus image on Docker Hub. Override NETBOX_IMAGE in .env if needed.
# To use a local build instead, run `podman build -t netbox-plus:dev .` and set `NETBOX_IMAGE=localhost/netbox-plus:dev`.
# https://hub.docker.com/repository/docker/swissmakers/netbox-plus
#
services:
postgres:
image: docker.io/library/postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-netbox}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-netbox}
POSTGRES_DB: ${POSTGRES_DB:-netbox}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"']
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
redis:
image: docker.io/library/redis:7-alpine
restart: unless-stopped
command: ['redis-server', '--appendonly', 'yes']
volumes:
- redis-data:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
netbox:
image: ${NETBOX_IMAGE:-swissmakers/netbox-plus:latest}
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
NETBOX_CONFIGURATION: netbox.configuration_docker
NETBOX_SECRET_KEY: ${NETBOX_SECRET_KEY:?Set NETBOX_SECRET_KEY in .env}
NETBOX_ALLOWED_HOSTS: ${NETBOX_ALLOWED_HOSTS:-*}
NETBOX_DB_HOST: postgres
NETBOX_DB_NAME: ${POSTGRES_DB:-netbox}
NETBOX_DB_USER: ${POSTGRES_USER:-netbox}
NETBOX_DB_PASSWORD: ${POSTGRES_PASSWORD:-netbox}
NETBOX_DB_PORT: ${NETBOX_DB_PORT:-5432}
NETBOX_REDIS_HOST: redis
NETBOX_REDIS_PORT: ${NETBOX_REDIS_PORT:-6379}
NETBOX_REDIS_PASSWORD: ${NETBOX_REDIS_PASSWORD:-}
NETBOX_HTTP_PORT: ${NETBOX_HTTP_PORT:-8080}
NETBOX_BIND_ADDRESS: ${NETBOX_BIND_ADDRESS:-0.0.0.0}
NETBOX_DEBUG: ${NETBOX_DEBUG:-false}
NETBOX_CSRF_TRUSTED_ORIGINS: ${NETBOX_CSRF_TRUSTED_ORIGINS:-http://localhost:8080,http://127.0.0.1:8080}
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-3}
GUNICORN_THREADS: ${GUNICORN_THREADS:-3}
NETBOX_CREATE_SUPERUSER: ${NETBOX_CREATE_SUPERUSER:-0}
NETBOX_SUPERUSER_NAME: ${NETBOX_SUPERUSER_NAME:-admin}
NETBOX_SUPERUSER_EMAIL: ${NETBOX_SUPERUSER_EMAIL:-admin@example.com}
NETBOX_SUPERUSER_PASSWORD: ${NETBOX_SUPERUSER_PASSWORD:-}
volumes:
- netbox-static:/opt/netbox/app/static
- netbox-media:/opt/netbox/app/media
ports:
- "${NETBOX_PUBLISH_PORT:-8080}:8080"
command: ['web']
healthcheck:
test:
[
'CMD',
'/opt/netbox/venv/bin/python',
'-c',
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/login/', timeout=5).read(64)",
]
interval: 30s
timeout: 10s
retries: 5
start_period: 180s
netbox-worker:
image: ${NETBOX_IMAGE:-swissmakers/netbox-plus:latest}
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# Web runs migrate once; worker starts after DB schema exists and Gunicorn is up.
netbox:
condition: service_healthy
environment:
NETBOX_CONFIGURATION: netbox.configuration_docker
NETBOX_SECRET_KEY: ${NETBOX_SECRET_KEY:?Set NETBOX_SECRET_KEY in .env}
NETBOX_ALLOWED_HOSTS: ${NETBOX_ALLOWED_HOSTS:-*}
NETBOX_DB_HOST: postgres
NETBOX_DB_NAME: ${POSTGRES_DB:-netbox}
NETBOX_DB_USER: ${POSTGRES_USER:-netbox}
NETBOX_DB_PASSWORD: ${POSTGRES_PASSWORD:-netbox}
NETBOX_DB_PORT: ${NETBOX_DB_PORT:-5432}
NETBOX_REDIS_HOST: redis
NETBOX_REDIS_PORT: ${NETBOX_REDIS_PORT:-6379}
NETBOX_REDIS_PASSWORD: ${NETBOX_REDIS_PASSWORD:-}
volumes:
- netbox-static:/opt/netbox/app/static
- netbox-media:/opt/netbox/app/media
command: ['worker']
volumes:
postgres-data:
redis-data:
netbox-static:
netbox-media: