1
1
Fork 0

netbox: fix container permissions

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2024-10-06 18:52:28 -05:00
parent b4d9513b1f
commit a5428f1d2e
Signed by: myned
GPG key ID: C7224454F7881A34
4 changed files with 24 additions and 14 deletions

View file

@ -1,5 +1,12 @@
# TODO: Upgrade to v4.1 when supported by netbox-acls # TODO: Upgrade to v4.1 when supported by netbox-acls
FROM docker.io/netboxcommunity/netbox:v4.0.11 FROM docker.io/netboxcommunity/netbox:v4.0.11
# Install extra configuration
COPY ./extra.py /etc/netbox/config/
# Install plugin modules
COPY ./plugin_requirements.txt /opt/netbox/ COPY ./plugin_requirements.txt /opt/netbox/
RUN /opt/netbox/venv/bin/pip install --no-warn-script-location -r /opt/netbox/plugin_requirements.txt RUN /opt/netbox/venv/bin/pip install --no-warn-script-location -r /opt/netbox/plugin_requirements.txt
# Install plugin static files
RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input

View file

@ -33,19 +33,21 @@ in {
container_name = "netbox"; container_name = "netbox";
depends_on = ["cache" "db"]; depends_on = ["cache" "db"];
env_file = [config.age.secrets."${config.custom.profile}/netbox/.env".path]; env_file = [config.age.secrets."${config.custom.profile}/netbox/.env".path];
image = "localhost/netbox"; # Built image
restart = "unless-stopped"; restart = "unless-stopped";
volumes = ["${./extra.py}:/etc/netbox/config/extra.py"]; user = "unit:root";
volumes = ["${config.custom.containers.directory}/netbox/media:/opt/netbox/netbox/media"];
# https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins
#!! Context modifications require a rebuild
#?? arion-netbox build
build.context = "${./.}";
}; };
in { in {
netbox.service = netbox.service =
netbox netbox
// { // {
ports = ["8585:8080"]; ports = ["8585:8080"];
# https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins
#!! Context modifications require a rebuild
#?? arion-netbox build --no-cache
build.context = "${./.}";
}; };
housekeeping.service = housekeeping.service =
@ -77,12 +79,12 @@ in {
env_file = [config.age.secrets."${config.custom.profile}/netbox/db.env".path]; env_file = [config.age.secrets."${config.custom.profile}/netbox/db.env".path];
image = "docker.io/postgres:16"; image = "docker.io/postgres:16";
restart = "unless-stopped"; restart = "unless-stopped";
volumes = ["${config.custom.containers.directory}/netbox/db:/var/lib/postgresql/data"];
volumes = [
"${config.custom.containers.directory}/netbox/db:/var/lib/postgresql/data"
];
}; };
}; };
}; };
#!! Required for correct volume permissions
systemd.tmpfiles.rules = ["z ${config.custom.containers.directory}/netbox/media 0770 999 root"]; # unit:root
}; };
} }

View file

@ -8,11 +8,12 @@ LOGIN_PERSISTENCE = True
# https://github.com/netbox-community/pynetbox/pull/641 # https://github.com/netbox-community/pynetbox/pull/641
LOGIN_REQUIRED = True LOGIN_REQUIRED = True
MEDIA_ROOT = "/opt/netbox/netbox/media" # Default /opt/netbox/media
TIME_ZONE = "America/Chicago" TIME_ZONE = "America/Chicago"
PLUGINS = [ PLUGINS = [
"netbox_acls", "netbox_acls",
"netbox_attachments", # // "netbox_attachments",
"netbox_dns", "netbox_dns",
"netbox_interface_synchronization", "netbox_interface_synchronization",
"netbox_lists", "netbox_lists",
@ -21,7 +22,7 @@ PLUGINS = [
# // "netbox_routing", # // "netbox_routing",
"netbox_secrets", "netbox_secrets",
"netbox_topology_views", "netbox_topology_views",
"slurpit_netbox", # // "slurpit_netbox",
] ]
PLUGINS_CONFIG = { PLUGINS_CONFIG = {

View file

@ -1,5 +1,5 @@
netbox-acls == 1.6.* # https://github.com/netbox-community/netbox-acls netbox-acls == 1.6.* # https://github.com/netbox-community/netbox-acls
netbox-attachments == 5.1.* # https://github.com/Kani999/netbox-attachments #// netbox-attachments == 5.1.* # https://github.com/Kani999/netbox-attachments
netbox-interface-synchronization == 4.0.* # https://github.com/NetTech2001/netbox-interface-synchronization netbox-interface-synchronization == 4.0.* # https://github.com/NetTech2001/netbox-interface-synchronization
netbox-lists == 4.0.* # https://github.com/devon-mar/netbox-lists netbox-lists == 4.0.* # https://github.com/devon-mar/netbox-lists
netbox-otp-plugin == 1.3.* # https://github.com/k1nky/netbox-otp-plugin netbox-otp-plugin == 1.3.* # https://github.com/k1nky/netbox-otp-plugin
@ -8,4 +8,4 @@ netbox-reorder-rack == 1.1.* # https://github.com/netbox-community/netbox-reorde
#// netbox-routing # https://github.com/DanSheps/netbox-routing #// netbox-routing # https://github.com/DanSheps/netbox-routing
netbox-secrets == 2.0.* # https://github.com/Onemind-Services-LLC/netbox-secrets netbox-secrets == 2.0.* # https://github.com/Onemind-Services-LLC/netbox-secrets
netbox-topology-views == 4.0.* # https://github.com/netbox-community/netbox-topology-views netbox-topology-views == 4.0.* # https://github.com/netbox-community/netbox-topology-views
slurpit_netbox == 0.9.* # https://gitlab.com/slurpit.io/slurpit-netbox #// slurpit_netbox == 0.9.* # https://gitlab.com/slurpit.io/slurpit-netbox