Skip to content

Commit 0ca0188

Browse files
committed
init commit
0 parents  commit 0ca0188

3 files changed

Lines changed: 234 additions & 0 deletions

File tree

.github/workflows/actions.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build mddo-clab-docker image
2+
3+
on: push
4+
5+
jobs:
6+
build_and_push:
7+
runs-on: ubuntu-latest
8+
env:
9+
IMAGE_NAME: mddo-netbox
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- name: checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v1
19+
20+
- name: Login to GitHub Container Registry
21+
uses: docker/login-action@v1
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.repository_owner }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Build and Push
28+
uses: docker/build-push-action@v2
29+
with:
30+
context: .
31+
push: true
32+
tags: |
33+
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM netboxcommunity/netbox:v4.2-3.1.1
2+
RUN pip3 install netbox-bgp
3+
COPY ./configuration.py /etc/netbox/config/configuration.py
4+
ENTRYPOINT [ "/usr/bin/tini", "--" ]
5+
CMD [ "/opt/netbox/docker-entrypoint.sh", "/opt/netbox/launch-netbox.sh" ]

configration.py

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
"""NetBox configuration file."""
2+
import os
3+
4+
# For reference see http://netbox.readthedocs.io/en/latest/configuration/mandatory-settings/
5+
# Based on https://github.com/digitalocean/netbox/blob/develop/netbox/netbox/configuration.example.py
6+
7+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
8+
9+
#########################
10+
# #
11+
# Required settings #
12+
# #
13+
#########################
14+
15+
# This is a list of valid fully-qualified domain names (FQDNs) for the NetBox server. NetBox will not permit write
16+
# access to the server via any other hostnames. The first FQDN in the list will be treated as the preferred name.
17+
#
18+
# Example: ALLOWED_HOSTS = ['netbox.example.com', 'netbox.internal.local']
19+
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "").split(" ")
20+
21+
# PostgreSQL database configuration.
22+
DATABASE = {
23+
"NAME": os.environ.get("DB_NAME", "netbox"), # Database name
24+
"USER": os.environ.get("DB_USER", ""), # PostgreSQL username
25+
"PASSWORD": os.environ.get("DB_PASSWORD", ""),
26+
# PostgreSQL password
27+
"HOST": os.environ.get("DB_HOST", "localhost"), # Database server
28+
"PORT": os.environ.get("DB_PORT", ""), # Database port (leave blank for default)
29+
}
30+
31+
# This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file.
32+
# For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and
33+
# symbols. NetBox will not run without this defined. For more information, see
34+
# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SECRET_KEY
35+
SECRET_KEY = os.environ.get("SECRET_KEY", "")
36+
37+
# Redis database settings. The Redis database is used for caching and background processing such as webhooks
38+
# Seperate sections for webhooks and caching allow for connecting to seperate Redis instances/datbases if desired.
39+
# Full connection details are required in both sections, even if they are the same.
40+
REDIS = {
41+
"caching": {
42+
"HOST": os.environ.get("REDIS_HOST", "redis"),
43+
"PORT": int(os.environ.get("REDIS_PORT", 6379)),
44+
"PASSWORD": os.environ.get("REDIS_PASSWORD", ""),
45+
"DATABASE": 1,
46+
"SSL": bool(os.environ.get("REDIS_SSL", False)),
47+
},
48+
"tasks": {
49+
"HOST": os.environ.get("REDIS_HOST", "redis"),
50+
"PORT": int(os.environ.get("REDIS_PORT", 6379)),
51+
"PASSWORD": os.environ.get("REDIS_PASSWORD", ""),
52+
"DATABASE": 0,
53+
"SSL": bool(os.environ.get("REDIS_SSL", False)),
54+
},
55+
}
56+
57+
58+
#########################
59+
# #
60+
# Optional settings #
61+
# #
62+
#########################
63+
64+
# Specify one or more name and email address tuples representing NetBox administrators. These people will be notified of
65+
# application errors (assuming correct email settings are provided).
66+
ADMINS = [
67+
# ['John Doe', 'jdoe@example.com'],
68+
]
69+
70+
# Optionally display a persistent banner at the top and/or bottom of every page. HTML is allowed. To display the same
71+
# content in both banners, define BANNER_TOP and set BANNER_BOTTOM = BANNER_TOP.
72+
BANNER_TOP = os.environ.get("BANNER_TOP", None)
73+
BANNER_BOTTOM = os.environ.get("BANNER_BOTTOM", None)
74+
75+
# Text to include on the login page above the login form. HTML is allowed.
76+
BANNER_LOGIN = os.environ.get("BANNER_LOGIN", "")
77+
78+
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set:
79+
# BASE_PATH = 'netbox/'
80+
BASE_PATH = os.environ.get("BASE_PATH", "")
81+
82+
# Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90)
83+
CHANGELOG_RETENTION = int(os.environ.get("CHANGELOG_RETENTION", 0))
84+
85+
# API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be
86+
# allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or
87+
# CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers
88+
CORS_ORIGIN_ALLOW_ALL = True
89+
CORS_ORIGIN_WHITELIST = []
90+
CORS_ORIGIN_REGEX_WHITELIST = []
91+
92+
# Set to True to enable server debugging. WARNING: Debugging introduces a substantial performance penalty and may reveal
93+
# sensitive information about your installation. Only enable debugging while performing testing. Never enable debugging
94+
# on a production system.
95+
DEBUG = True
96+
DEVELOPER = True
97+
98+
# Email settings
99+
EMAIL = {
100+
"SERVER": "localhost",
101+
"PORT": 25,
102+
"USERNAME": "",
103+
"PASSWORD": "",
104+
"TIMEOUT": 10,
105+
"FROM_EMAIL": "",
106+
}
107+
108+
# Enforcement of unique IP space can be toggled on a per-VRF basis.
109+
# To enforce unique IP space within the global table (all prefixes and IP addresses not assigned to a VRF),
110+
# set ENFORCE_GLOBAL_UNIQUE to True.
111+
ENFORCE_GLOBAL_UNIQUE = False
112+
113+
# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
114+
# https://docs.djangoproject.com/en/1.11/topics/logging/
115+
LOGGING = {}
116+
117+
# Setting this to True will permit only authenticated users to access any part of NetBox. By default, anonymous users
118+
# are permitted to access most data in NetBox (excluding secrets) but not make any changes.
119+
LOGIN_REQUIRED = False
120+
121+
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set:
122+
# BASE_PATH = 'netbox/'
123+
BASE_PATH = os.environ.get("BASE_PATH", "")
124+
125+
# Setting this to True will display a "maintenance mode" banner at the top of every page.
126+
MAINTENANCE_MODE = os.environ.get("MAINTENANCE_MODE", False)
127+
128+
# An API consumer can request an arbitrary number of objects =by appending the "limit" parameter to the URL (e.g.
129+
# "?limit=1000"). This setting defines the maximum limit. Setting it to 0 or None will allow an API consumer to request
130+
# all objects by specifying "?limit=0".
131+
MAX_PAGE_SIZE = int(os.environ.get("MAX_PAGE_SIZE", 1000))
132+
133+
# The file path where uploaded media such as image attachments are stored. A trailing slash is not needed. Note that
134+
# the default value of this setting is derived from the installed location.
135+
MEDIA_ROOT = os.environ.get("MEDIA_ROOT", os.path.join(BASE_DIR, "media"))
136+
137+
NAPALM_USERNAME = os.environ.get("NAPALM_USERNAME", "")
138+
NAPALM_PASSWORD = os.environ.get("NAPALM_PASSWORD", "")
139+
140+
# NAPALM timeout (in seconds). (Default: 30)
141+
NAPALM_TIMEOUT = os.environ.get("NAPALM_TIMEOUT", 30)
142+
143+
# NAPALM optional arguments (see http://napalm.readthedocs.io/en/latest/support/#optional-arguments). Arguments must
144+
# be provided as a dictionary.
145+
NAPALM_ARGS = {
146+
"secret": NAPALM_PASSWORD,
147+
# Include any additional args here
148+
}
149+
150+
# Determine how many objects to display per page within a list. (Default: 50)
151+
PAGINATE_COUNT = os.environ.get("PAGINATE_COUNT", 50)
152+
153+
# Enable installed plugins. Add the name of each plugin to the list.
154+
PLUGINS = ["netbox_bgp"]
155+
156+
# Plugins configuration settings. These settings are used by various plugins that the user may have installed.
157+
# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings.
158+
# PLUGINS_CONFIG = {}
159+
160+
# When determining the primary IP address for a device, IPv6 is preferred over IPv4 by default. Set this to True to
161+
# prefer IPv4 instead.
162+
PREFER_IPV4 = os.environ.get("PREFER_IPV4", False)
163+
164+
# Remote authentication support
165+
REMOTE_AUTH_ENABLED = False
166+
REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend'
167+
REMOTE_AUTH_HEADER = "HTTP_REMOTE_USER"
168+
REMOTE_AUTH_AUTO_CREATE_USER = True
169+
REMOTE_AUTH_DEFAULT_GROUPS = []
170+
REMOTE_AUTH_DEFAULT_PERMISSIONS = {}
171+
172+
# This determines how often the GitHub API is called to check the latest release of NetBox. Must be at least 1 hour.
173+
# RELEASE_CHECK_TIMEOUT = 24 * 3600
174+
175+
# This repository is used to check whether there is a new release of NetBox available. Set to None to disable the
176+
# version check or use the URL below to check for release in the official NetBox repository.
177+
RELEASE_CHECK_URL = None
178+
# RELEASE_CHECK_URL = 'https://api.github.com/repos/netbox-community/netbox/releases'
179+
180+
SESSION_FILE_PATH = None
181+
182+
# The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of
183+
# this setting is derived from the installed location.
184+
REPORTS_ROOT = os.environ.get("REPORTS_ROOT", os.path.join(BASE_DIR, "reports"))
185+
186+
# Time zone (default: UTC)
187+
TIME_ZONE = os.environ.get("TIME_ZONE", "UTC")
188+
189+
# Date/time formatting. See the following link for supported formats:
190+
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
191+
DATE_FORMAT = os.environ.get("DATE_FORMAT", "N j, Y")
192+
SHORT_DATE_FORMAT = os.environ.get("SHORT_DATE_FORMAT", "Y-m-d")
193+
TIME_FORMAT = os.environ.get("TIME_FORMAT", "g:i a")
194+
SHORT_TIME_FORMAT = os.environ.get("SHORT_TIME_FORMAT", "H:i:s")
195+
DATETIME_FORMAT = os.environ.get("DATETIME_FORMAT", "N j, Y g:i a")
196+
SHORT_DATETIME_FORMAT = os.environ.get("SHORT_DATETIME_FORMAT", "Y-m-d H:i")

0 commit comments

Comments
 (0)