Initial commit
This commit is contained in:
commit
4ff9eac274
45 files changed
+2911
No files matched your search
@@ -0,0 +1 @@
|
||||
FROM docker.io/netboxcommunity/netbox:v4.6.5
|
||||
@@ -0,0 +1,46 @@
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
SECRET_KEY = "services-dev-secret-key-change-in-production-0123456789"
|
||||
DEBUG = True
|
||||
DEVELOPER = True
|
||||
|
||||
DATABASE = {
|
||||
"NAME": "netbox",
|
||||
"USER": "netbox",
|
||||
"PASSWORD": "netbox",
|
||||
"HOST": "nb-services-postgres",
|
||||
"PORT": 5432,
|
||||
"CONN_MAX_AGE": 300,
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
}
|
||||
|
||||
REDIS = {
|
||||
"tasks": {
|
||||
"HOST": "nb-services-redis",
|
||||
"PORT": 6379,
|
||||
"DB": 0,
|
||||
"SSL": False,
|
||||
},
|
||||
"caching": {
|
||||
"HOST": "nb-services-redis",
|
||||
"PORT": 6379,
|
||||
"DB": 1,
|
||||
"SSL": False,
|
||||
},
|
||||
}
|
||||
|
||||
PLUGINS = ["netbox_services"]
|
||||
PLUGINS_CONFIG = {
|
||||
"netbox_services": {},
|
||||
}
|
||||
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
"handlers": {
|
||||
"console": {"class": "logging.StreamHandler"},
|
||||
},
|
||||
"loggers": {
|
||||
"django": {"handlers": ["console"], "level": "INFO"},
|
||||
"netbox_services": {"handlers": ["console"], "level": "DEBUG"},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: docker.io/library/postgres:16-alpine
|
||||
container_name: nb-services-postgres
|
||||
environment:
|
||||
POSTGRES_DB: netbox
|
||||
POSTGRES_USER: netbox
|
||||
POSTGRES_PASSWORD: netbox
|
||||
volumes:
|
||||
- nb-services-pgdata:/var/lib/postgresql/data
|
||||
networks:
|
||||
- nb-services
|
||||
|
||||
redis:
|
||||
image: docker.io/library/redis:7-alpine
|
||||
container_name: nb-services-redis
|
||||
networks:
|
||||
- nb-services
|
||||
|
||||
netbox:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: dev/Dockerfile
|
||||
container_name: nb-services-netbox
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
volumes:
|
||||
- ..:/opt/netbox-plugin-services
|
||||
- ./configuration.py:/etc/netbox/config/configuration.py:Z
|
||||
- ./entrypoint.sh:/opt/netbox-plugin-services/dev/entrypoint.sh:Z
|
||||
ports:
|
||||
- "8001:8000"
|
||||
entrypoint: ["/bin/bash", "/opt/netbox-plugin-services/dev/entrypoint.sh"]
|
||||
networks:
|
||||
- nb-services
|
||||
|
||||
volumes:
|
||||
nb-services-pgdata:
|
||||
|
||||
networks:
|
||||
nb-services:
|
||||
driver: bridge
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "=== Installing local plugin (editable) ==="
|
||||
uv pip install -e /opt/netbox-plugin-services
|
||||
|
||||
echo "=== Running migrations ==="
|
||||
python manage.py migrate --no-input
|
||||
|
||||
echo "=== Collecting static files ==="
|
||||
python manage.py collectstatic --no-input
|
||||
|
||||
echo "=== Creating superuser ==="
|
||||
python manage.py shell -c "
|
||||
from django.contrib.auth import get_user_model
|
||||
User = get_user_model()
|
||||
if not User.objects.filter(username='admin').exists():
|
||||
User.objects.create_superuser('admin', 'admin@example.com', 'admin')
|
||||
print('Superuser admin created (password: admin)')
|
||||
else:
|
||||
print('Superuser admin already exists')
|
||||
"
|
||||
|
||||
echo "=== Starting dev server ==="
|
||||
python manage.py runserver 0.0.0.0:8000
|
||||
Reference in new issue
Block a user