File tree Expand file tree Collapse file tree 6 files changed +26
-10
lines changed Expand file tree Collapse file tree 6 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,12 @@ RUN apk add --no-cache \
62
62
libevent \
63
63
libffi \
64
64
libjpeg-turbo \
65
- openssl \
66
65
libxslt \
66
+ openssl \
67
67
postgresql-libs \
68
- python3 \
69
68
py3-pip \
69
+ python3 \
70
+ tini \
70
71
unit \
71
72
unit-python3
72
73
@@ -82,6 +83,7 @@ COPY ${NETBOX_PATH} /opt/netbox
82
83
83
84
COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
84
85
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
86
+ COPY docker/housekeeping.sh /opt/netbox/housekeeping.sh
85
87
COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh
86
88
COPY startup_scripts/ /opt/netbox/startup_scripts/
87
89
COPY initializers/ /opt/netbox/initializers/
@@ -98,9 +100,9 @@ RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
98
100
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
99
101
&& SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
100
102
101
- ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh " ]
103
+ ENTRYPOINT [ "/sbin/tini" , "-- " ]
102
104
103
- CMD [ "/opt/netbox/launch-netbox.sh" ]
105
+ CMD [ "/opt/netbox/docker-entrypoint.sh" , "/opt/netbox/ launch-netbox.sh" ]
104
106
105
107
LABEL ORIGINAL_TAG="" \
106
108
NETBOX_GIT_BRANCH="" \
Original file line number Diff line number Diff line change @@ -17,8 +17,6 @@ services:
17
17
- ./reports:/etc/netbox/reports:z,ro
18
18
- ./scripts:/etc/netbox/scripts:z,ro
19
19
- netbox-media-files:/opt/netbox/netbox/media:z
20
- ports :
21
- - 8080
22
20
postgres :
23
21
image : postgres:13-alpine
24
22
env_file : env/postgres.env
Original file line number Diff line number Diff line change @@ -20,11 +20,18 @@ services:
20
20
<< : *netbox
21
21
depends_on :
22
22
- redis
23
- entrypoint :
23
+ - postgres
24
+ command :
24
25
- /opt/netbox/venv/bin/python
25
26
- /opt/netbox/netbox/manage.py
26
- command :
27
27
- rqworker
28
+ netbox-housekeeping :
29
+ << : *netbox
30
+ depends_on :
31
+ - redis
32
+ - postgres
33
+ command :
34
+ - /opt/netbox/housekeeping.sh
28
35
29
36
# postgres
30
37
postgres :
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ SECONDS=${HOUSEKEEPING_INTERVAL:= 86400}
3
+ echo " Interval set to ${SECONDS} seconds"
4
+ while true ; do
5
+ date
6
+ /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py housekeeping
7
+ sleep " ${SECONDS} s"
8
+ done
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ EMAIL_USERNAME=netbox
14
14
# EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive, i.e. they can't both be `true`!
15
15
EMAIL_USE_SSL = false
16
16
EMAIL_USE_TLS = false
17
+ HOUSEKEEPING_INTERVAL = 86400
17
18
MAX_PAGE_SIZE = 1000
18
19
MEDIA_ROOT = /opt/netbox/netbox/media
19
20
METRICS_ENABLED = false
Original file line number Diff line number Diff line change @@ -56,13 +56,13 @@ test_setup() {
56
56
57
57
test_netbox_unit_tests () {
58
58
echo " ⏱ Running NetBox Unit Tests"
59
- SKIP_STARTUP_SCRIPTS=true $doco run --rm netbox . /manage.py test
59
+ $doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox /manage.py test
60
60
}
61
61
62
62
test_initializers () {
63
63
echo " 🏭 Testing Initializers"
64
64
export INITIALIZERS_DIR
65
- $doco run --rm netbox ./manage.py check
65
+ $doco run --rm netbox /opt/netbox/docker-entrypoint.sh ./manage.py check
66
66
}
67
67
68
68
test_cleanup () {
You can’t perform that action at this time.
0 commit comments