new file: .env

new file:   Containerfile
new file:   README.md
new file:   compose.yml
new file:   configuration.py
new file:   entrypoint.sh
new file:   local_requirements.txt
new file:   named.conf
new file:   nginx.conf
new file:   rndc.key
This commit is contained in:
Sven Luethi authored and Sven Luthi committed 2026-07-20 12:26:51 +02:00
commit 136ee48052
10 files changed
+593

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
#!/usr/bin/env bash
# ============================================================
# /entrypoint.sh – NetBox container entrypoint
# ============================================================
set -euo pipefail
NETBOX_ROOT=/opt/netbox/netbox
MANAGE="${NETBOX_ROOT}/manage.py"
#RETRIES=10
wait_for_db() {
#until python "${MANAGE}" migrate --check &>/dev/null; do
until python "${MANAGE}" check --database default &>/dev/null; do
echo "[entrypoint] Waiting for database …"
# if (( RETRIES == 0 )); then
# echo "[entrypoint] Database did not become ready."
# exit 1
# fi
# ((RETRIES--))
sleep 2
done
echo "[entrypoint] Database is ready."
}
run_migrations() {
echo "[entrypoint] Applying database migrations …"
python "${MANAGE}" migrate --no-input
}
run_collectstatic() {
echo "[entrypoint] Collecting static files …"
python "${MANAGE}" collectstatic --no-input --clear
}
case "${1:-gunicorn}" in
gunicorn)
wait_for_db
run_migrations
run_collectstatic
echo "[entrypoint] Starting Gunicorn …"
cd $NETBOX_ROOT
exec gunicorn \
--bind "${GUNICORN_BIND:-localhost:8080}" \
--workers "${GUNICORN_WORKERS:-4}" \
--worker-class "${GUNICORN_WORKER_CLASS:-gthread}" \
--threads "${GUNICORN_THREADS:-3}" \
--timeout "${GUNICORN_TIMEOUT:-120}" \
--max-requests "${GUNICORN_MAX_REQUESTS:-5000}" \
--max-requests-jitter "${GUNICORN_MAX_REQUESTS_JITTER:-500}" \
--log-level "${GUNICORN_LOG_LEVEL:-info}" \
--access-logfile - \
--error-logfile - \
netbox.wsgi
;;
worker)
wait_for_db
echo "[entrypoint] Starting RQ worker …"
exec python "${MANAGE}" rqworker \
high default low
;;
dns-transfer-endpoint)
wait_for_db
echo "[entrypoint] Starting DNS Transfer Endpoint …"
exec python "${MANAGE}" dns-transfer-endpoint --address ::1
;;
housekeeping)
wait_for_db
echo "[entrypoint] Running housekeeping …"
exec python "${MANAGE}" housekeeping
;;
shell)
exec python "${MANAGE}" shell
;;
*)
# Pass-through for arbitrary commands (e.g. manage.py subcommands)
exec python "${MANAGE}" "$@"
;;
esac