NetBox: Difference between revisions
imported>Vater |
imported>Vater No edit summary |
||
| Line 1: | Line 1: | ||
[https://netbox.dev/ {{PAGENAME}}] (<s>[[wikipedia:en:{{PAGENAME}}]]</s>) is available as a [[module]]. | [https://netbox.dev/ {{PAGENAME}}] (<s>[[wikipedia:en:{{PAGENAME}}]]</s>) is available as a [[module]]. | ||
== configuration examples == | == configuration examples == | ||
==== minimal configuration ==== | ==== minimal configuration ==== | ||
<syntaxhighlight lang="bash">mkdir -p /var/lib/netbox/</syntaxhighlight> | |||
<syntaxhighlight lang="bash">$EDITOR /var/lib/netbox/passwordFile</syntaxhighlight> | |||
<syntaxhighlight lang="bash">cat /var/lib/netbox/passwordFile</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
this-is-an-initial-password-for-netbox | |||
</syntaxhighlight> | |||
<!-- | <!-- | ||
| Line 12: | Line 18: | ||
services.netbox.enable = true; | services.netbox.enable = true; | ||
services.netbox.secretKeyFile = "/var/lib/netbox/passwordFile"; | |||
networking.firewall.allowedTCPPorts = [ 8001 ]; | networking.firewall.allowedTCPPorts = [ 8001 ]; | ||
| Line 23: | Line 30: | ||
!--> | !--> | ||
==== basic configuration ==== | ==== basic configuration ==== | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 34: | Line 40: | ||
services.netbox.enable = true; | services.netbox.enable = true; | ||
services.netbox.secretKeyFile = "/var/lib/netbox/passwordFile"; | |||
services.nginx.enable = true; | services.nginx.enable = true; | ||
| Line 41: | Line 48: | ||
# services.nginx.recommendedProxySettings = true; | # services.nginx.recommendedProxySettings = true; | ||
services.nginx.virtualHosts."${config.networking.fqdn}" = { | services.nginx.virtualHosts."${config.networking.fqdn}" = { | ||
locations | locations = { | ||
# | "/" = { | ||
# extraConfig = '' | |||
## proxy_pass http://127.0.0.1:8001; | |||
# proxy_pass http://[::1]:8001; | |||
# proxy_set_header X-Forwarded-Host $http_host; | |||
# proxy_set_header X-Real-IP $remote_addr; | |||
# proxy_set_header X-Forwarded-Proto $scheme; | |||
# ''; | |||
# proxyPass = "http://127.0.0.1:8001"; | |||
proxyPass = "http://[::1]:8001"; | |||
#### proxyPass = "http://${config.services.netbox.listenAddress}:${config.services.netbox.port}"; | |||
}; | |||
"/static/" = { | |||
# extraConfig = '' | |||
# alias /var/lib/netbox/static/; | |||
# ''; | |||
# alias = "/var/lib/netbox/static/"; | |||
alias = "${config.services.netbox.dataDir}/static/"; | |||
}; | |||
}; | }; | ||
forceSSL = true; | forceSSL = true; | ||
enableACME = true; | enableACME = true; | ||
}; | }; | ||
services.nginx.user = "netbox"; | |||
# services.nginx.recommendedTlsSettings = true; | # services.nginx.recommendedTlsSettings = true; | ||
security.acme.defaults.email = "acme@${config.networking.domain}"; | security.acme.defaults.email = "acme@${config.networking.domain}"; | ||
| Line 60: | Line 85: | ||
https://netbox.domain.tld | https://netbox.domain.tld | ||
<!-- | <!-- | ||