commit
226d8438de
|
@ -46,7 +46,6 @@ jobs:
|
||||||
- ./build.sh develop
|
- ./build.sh develop
|
||||||
docker_from:
|
docker_from:
|
||||||
- '' # use the default of the build script
|
- '' # use the default of the build script
|
||||||
- alpine:edge
|
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Builds new NetBox Docker Images
|
name: Builds new NetBox Docker Images
|
||||||
|
|
|
@ -97,7 +97,7 @@ WORKDIR /opt/netbox/netbox
|
||||||
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
|
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
|
||||||
&& chown -R unit:root media /opt/unit/ \
|
&& chown -R unit:root media /opt/unit/ \
|
||||||
&& chmod -R g+w media /opt/unit/ \
|
&& chmod -R g+w media /opt/unit/ \
|
||||||
&& cd /opt/netbox/ && /opt/netbox/venv/bin/python -m mkdocs build \
|
&& cd /opt/netbox/ && SECRET_KEY="dummy" /opt/netbox/venv/bin/python -m mkdocs build \
|
||||||
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
|
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
|
||||||
&& SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
&& SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
||||||
|
|
||||||
|
|
10
README.md
10
README.md
|
@ -7,7 +7,7 @@
|
||||||
![Docker Pulls](https://img.shields.io/docker/pulls/netboxcommunity/netbox)
|
![Docker Pulls](https://img.shields.io/docker/pulls/netboxcommunity/netbox)
|
||||||
[![GitHub license](https://img.shields.io/github/license/netbox-community/netbox-docker)][netbox-docker-license]
|
[![GitHub license](https://img.shields.io/github/license/netbox-community/netbox-docker)][netbox-docker-license]
|
||||||
|
|
||||||
[The Github repository](netbox-docker-github) houses the components needed to build NetBox as a container.
|
[The GitHub repository](netbox-docker-github) houses the components needed to build NetBox as a container.
|
||||||
Images are built regularly using the code in that repository and are pushed to [Docker Hub][netbox-dockerhub], [Quay.io][netbox-quayio] and [GitHub Container Registry][netbox-ghcr].
|
Images are built regularly using the code in that repository and are pushed to [Docker Hub][netbox-dockerhub], [Quay.io][netbox-quayio] and [GitHub Container Registry][netbox-ghcr].
|
||||||
|
|
||||||
Do you have any questions?
|
Do you have any questions?
|
||||||
|
@ -19,7 +19,7 @@ please join [our Slack][netbox-docker-slack] and ask for help in the [`#netbox-d
|
||||||
[netbox-docker-microbadger]: https://microbadger.com/images/netboxcommunity/netbox
|
[netbox-docker-microbadger]: https://microbadger.com/images/netboxcommunity/netbox
|
||||||
[netbox-dockerhub]: https://hub.docker.com/r/netboxcommunity/netbox/
|
[netbox-dockerhub]: https://hub.docker.com/r/netboxcommunity/netbox/
|
||||||
[netbox-quayio]: https://quay.io/repository/netboxcommunity/netbox
|
[netbox-quayio]: https://quay.io/repository/netboxcommunity/netbox
|
||||||
[netbox-ghcr]: https://ghcr.io/netbox-community/netbox/
|
[netbox-ghcr]: https://github.com/netbox-community/netbox-docker/pkgs/container/netbox
|
||||||
[netbox-docker-github]: https://github.com/netbox-community/netbox-docker/
|
[netbox-docker-github]: https://github.com/netbox-community/netbox-docker/
|
||||||
[netbox-docker-slack]: https://join.slack.com/t/netdev-community/shared_invite/zt-mtts8g0n-Sm6Wutn62q_M4OdsaIycrQ
|
[netbox-docker-slack]: https://join.slack.com/t/netdev-community/shared_invite/zt-mtts8g0n-Sm6Wutn62q_M4OdsaIycrQ
|
||||||
[netbox-docker-slack-channel]: https://netdev-community.slack.com/archives/C01P0GEVBU7
|
[netbox-docker-slack-channel]: https://netdev-community.slack.com/archives/C01P0GEVBU7
|
||||||
|
@ -75,7 +75,7 @@ New container images are built and published automatically every ~24h.
|
||||||
You must use _NetBox Docker version_ `a.b.c` to guarantee the compatibility.
|
You must use _NetBox Docker version_ `a.b.c` to guarantee the compatibility.
|
||||||
These images are automatically built from [the `master` branch of NetBox][netbox-master].
|
These images are automatically built from [the `master` branch of NetBox][netbox-master].
|
||||||
* `snapshot-a.b.c`:
|
* `snapshot-a.b.c`:
|
||||||
These are pre-release builds.
|
These are prerelease builds.
|
||||||
They contain the support files of _NetBox Docker version_ `a.b.c`.
|
They contain the support files of _NetBox Docker version_ `a.b.c`.
|
||||||
You must use _NetBox Docker version_ `a.b.c` to guarantee the compatibility.
|
You must use _NetBox Docker version_ `a.b.c` to guarantee the compatibility.
|
||||||
These images are automatically built from the [`develop` branch of NetBox][netbox-develop].
|
These images are automatically built from the [`develop` branch of NetBox][netbox-develop].
|
||||||
|
@ -106,7 +106,7 @@ Then there is currently one extra tags for each of the above tags:
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
Please refer [to our wiki on Github][netbox-docker-wiki] for further information on how to use the NetBox Docker image properly.
|
Please refer [to our wiki on GitHub][netbox-docker-wiki] for further information on how to use the NetBox Docker image properly.
|
||||||
The wiki covers advanced topics such as using files for secrets, configuring TLS, deployment to Kubernetes, monitoring and configuring NAPALM and LDAP.
|
The wiki covers advanced topics such as using files for secrets, configuring TLS, deployment to Kubernetes, monitoring and configuring NAPALM and LDAP.
|
||||||
|
|
||||||
Our wiki is a community effort.
|
Our wiki is a community effort.
|
||||||
|
@ -116,7 +116,7 @@ Feel free to correct errors, update outdated information or provide additional g
|
||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|
||||||
Feel free to ask questions in our [Github Community][netbox-community]
|
Feel free to ask questions in our [GitHub Community][netbox-community]
|
||||||
or [join our Slack][netbox-docker-slack] and ask [in our channel `#netbox-docker`][netbox-docker-slack-channel],
|
or [join our Slack][netbox-docker-slack] and ask [in our channel `#netbox-docker`][netbox-docker-slack-channel],
|
||||||
which is free to use and where there are almost always people online that can help you in the Slack channel.
|
which is free to use and where there are almost always people online that can help you in the Slack channel.
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,9 @@ ENFORCE_GLOBAL_UNIQUE = environ.get('ENFORCE_GLOBAL_UNIQUE', 'False').lower() ==
|
||||||
# by anonymous users. List models in the form `<app>.<model>`. Add '*' to this list to exempt all models.
|
# by anonymous users. List models in the form `<app>.<model>`. Add '*' to this list to exempt all models.
|
||||||
EXEMPT_VIEW_PERMISSIONS = list(filter(None, environ.get('EXEMPT_VIEW_PERMISSIONS', '').split(' ')))
|
EXEMPT_VIEW_PERMISSIONS = list(filter(None, environ.get('EXEMPT_VIEW_PERMISSIONS', '').split(' ')))
|
||||||
|
|
||||||
|
# Enable GraphQL API.
|
||||||
|
GRAPHQL_ENABLED = environ.get('GRAPHQL_ENABLED', 'True').lower() == 'true'
|
||||||
|
|
||||||
# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
|
# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
|
||||||
# https://docs.djangoproject.com/en/stable/topics/logging/
|
# https://docs.djangoproject.com/en/stable/topics/logging/
|
||||||
LOGGING = {}
|
LOGGING = {}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
version: '3.4'
|
version: '3.4'
|
||||||
services:
|
services:
|
||||||
netbox: &netbox
|
netbox: &netbox
|
||||||
image: netboxcommunity/netbox:${VERSION-v3.1-1.5.1}
|
image: netboxcommunity/netbox:${VERSION-v3.1-1.6.0}
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
- redis
|
- redis
|
||||||
|
|
|
@ -14,6 +14,7 @@ EMAIL_USERNAME=netbox
|
||||||
# EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive, i.e. they can't both be `true`!
|
# EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive, i.e. they can't both be `true`!
|
||||||
EMAIL_USE_SSL=false
|
EMAIL_USE_SSL=false
|
||||||
EMAIL_USE_TLS=false
|
EMAIL_USE_TLS=false
|
||||||
|
GRAPHQL_ENABLED=true
|
||||||
HOUSEKEEPING_INTERVAL=86400
|
HOUSEKEEPING_INTERVAL=86400
|
||||||
MAX_PAGE_SIZE=1000
|
MAX_PAGE_SIZE=1000
|
||||||
MEDIA_ROOT=/opt/netbox/netbox/media
|
MEDIA_ROOT=/opt/netbox/netbox/media
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# - asn: 1
|
||||||
|
# rir: RFC1918
|
||||||
|
# tenant: tenant1
|
||||||
|
# - asn: 2
|
||||||
|
# rir: RFC4193 ULA
|
||||||
|
# - asn: 3
|
||||||
|
# rir: RFC3849
|
|
@ -3,7 +3,6 @@
|
||||||
# region: Downtown
|
# region: Downtown
|
||||||
# status: active
|
# status: active
|
||||||
# facility: Amsterdam 1
|
# facility: Amsterdam 1
|
||||||
# asn: 12345
|
|
||||||
# custom_field_data:
|
# custom_field_data:
|
||||||
# text_field: Description for AMS1
|
# text_field: Description for AMS1
|
||||||
# - name: AMS 2
|
# - name: AMS 2
|
||||||
|
@ -11,7 +10,6 @@
|
||||||
# region: Downtown
|
# region: Downtown
|
||||||
# status: active
|
# status: active
|
||||||
# facility: Amsterdam 2
|
# facility: Amsterdam 2
|
||||||
# asn: 54321
|
|
||||||
# custom_field_data:
|
# custom_field_data:
|
||||||
# text_field: Description for AMS2
|
# text_field: Description for AMS2
|
||||||
# - name: AMS 3
|
# - name: AMS 3
|
||||||
|
@ -19,7 +17,6 @@
|
||||||
# region: Suburbs
|
# region: Suburbs
|
||||||
# status: active
|
# status: active
|
||||||
# facility: Amsterdam 3
|
# facility: Amsterdam 3
|
||||||
# asn: 67890
|
|
||||||
# tenant: tenant1
|
# tenant: tenant1
|
||||||
# custom_field_data:
|
# custom_field_data:
|
||||||
# text_field: Description for AMS3
|
# text_field: Description for AMS3
|
||||||
|
@ -28,7 +25,6 @@
|
||||||
# region: Singapore
|
# region: Singapore
|
||||||
# status: active
|
# status: active
|
||||||
# facility: Singapore 1
|
# facility: Singapore 1
|
||||||
# asn: 09876
|
|
||||||
# tenant: tenant2
|
# tenant: tenant2
|
||||||
# custom_field_data:
|
# custom_field_data:
|
||||||
# text_field: Description for SING1
|
# text_field: Description for SING1
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
napalm==3.3.1
|
django-auth-ldap==4.0.0
|
||||||
ruamel.yaml==0.17.17
|
|
||||||
django-auth-ldap==3.0.0
|
|
||||||
google-crc32c==1.3.0
|
|
||||||
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.12.3
|
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.12.3
|
||||||
|
google-crc32c==1.3.0
|
||||||
|
napalm==3.3.1
|
||||||
|
ruamel.yaml==0.17.21
|
||||||
|
tzdata==2021.5
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
import sys
|
|
||||||
|
|
||||||
from dcim.models import Site
|
|
||||||
from startup_script_utils import load_yaml, pop_custom_fields, set_custom_fields_values
|
|
||||||
from tenancy.models import Tenant
|
|
||||||
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
|
||||||
|
|
||||||
clusters = load_yaml("/opt/netbox/initializers/clusters.yml")
|
|
||||||
|
|
||||||
if clusters is None:
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
required_assocs = {"type": (ClusterType, "name")}
|
|
||||||
|
|
||||||
optional_assocs = {
|
|
||||||
"site": (Site, "name"),
|
|
||||||
"group": (ClusterGroup, "name"),
|
|
||||||
"tenant": (Tenant, "name"),
|
|
||||||
}
|
|
||||||
|
|
||||||
for params in clusters:
|
|
||||||
custom_field_data = pop_custom_fields(params)
|
|
||||||
|
|
||||||
for assoc, details in required_assocs.items():
|
|
||||||
model, field = details
|
|
||||||
query = {field: params.pop(assoc)}
|
|
||||||
|
|
||||||
params[assoc] = model.objects.get(**query)
|
|
||||||
|
|
||||||
for assoc, details in optional_assocs.items():
|
|
||||||
if assoc in params:
|
|
||||||
model, field = details
|
|
||||||
query = {field: params.pop(assoc)}
|
|
||||||
|
|
||||||
params[assoc] = model.objects.get(**query)
|
|
||||||
|
|
||||||
cluster, created = Cluster.objects.get_or_create(**params)
|
|
||||||
|
|
||||||
if created:
|
|
||||||
set_custom_fields_values(cluster, custom_field_data)
|
|
||||||
|
|
||||||
print("🗄️ Created cluster", cluster.name)
|
|
|
@ -1,15 +0,0 @@
|
||||||
import sys
|
|
||||||
|
|
||||||
from startup_script_utils import load_yaml
|
|
||||||
from virtualization.models import ClusterGroup
|
|
||||||
|
|
||||||
cluster_groups = load_yaml("/opt/netbox/initializers/cluster_groups.yml")
|
|
||||||
|
|
||||||
if cluster_groups is None:
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
for params in cluster_groups:
|
|
||||||
cluster_group, created = ClusterGroup.objects.get_or_create(**params)
|
|
||||||
|
|
||||||
if created:
|
|
||||||
print("🗄️ Created Cluster Group", cluster_group.name)
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from ipam.models import ASN, RIR
|
||||||
|
from startup_script_utils import load_yaml
|
||||||
|
from tenancy.models import Tenant
|
||||||
|
|
||||||
|
asns = load_yaml("/opt/netbox/initializers/asns.yml")
|
||||||
|
|
||||||
|
if asns is None:
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
required_assocs = {"rir": (RIR, "name")}
|
||||||
|
|
||||||
|
optional_assocs = {"tenant": (Tenant, "name")}
|
||||||
|
|
||||||
|
for params in asns:
|
||||||
|
for assoc, details in required_assocs.items():
|
||||||
|
model, field = details
|
||||||
|
query = {field: params.pop(assoc)}
|
||||||
|
|
||||||
|
params[assoc] = model.objects.get(**query)
|
||||||
|
|
||||||
|
for assoc, details in optional_assocs.items():
|
||||||
|
if assoc in params:
|
||||||
|
model, field = details
|
||||||
|
query = {field: params.pop(assoc)}
|
||||||
|
|
||||||
|
params[assoc] = model.objects.get(**query)
|
||||||
|
|
||||||
|
asn, created = ASN.objects.get_or_create(**params)
|
||||||
|
|
||||||
|
if created:
|
||||||
|
print(f"🔡 Created ASN {asn.asn}")
|
|
@ -52,6 +52,7 @@ for params in ip_addresses:
|
||||||
params["assigned_object_id"] = Interface.objects.get(**query).id
|
params["assigned_object_id"] = Interface.objects.get(**query).id
|
||||||
else:
|
else:
|
||||||
query = {field: params.pop(assoc)}
|
query = {field: params.pop(assoc)}
|
||||||
|
|
||||||
params[assoc] = model.objects.get(**query)
|
params[assoc] = model.objects.get(**query)
|
||||||
|
|
||||||
ip_address, created = IPAddress.objects.get_or_create(**params)
|
ip_address, created = IPAddress.objects.get_or_create(**params)
|
Loading…
Reference in New Issue