diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e11e37f..f386e8c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us improve +about: Create a report about a malfunction of the Docker setup title: '' labels: '' assignees: '' @@ -9,39 +9,49 @@ assignees: '' ## Current Behavior -... + + ## Expected Behavior -... + + ## Debug Information - + + The output of `docker-compose version`: `XXXXX` The output of `docker version`: `XXXXX` The output of `git rev-parse HEAD`: `XXXXX` @@ -59,7 +69,16 @@ The output of `docker inspect netboxcommunity/netbox:latest --format "{{json .Co The output of `docker-compose logs netbox`: + +```text +LOG LOG LOG +``` + +The output of `cat docker-compose.override.yml`: + ```text diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index fe9f090..a584cc2 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,7 +5,7 @@ contact_links: about: The Github Discussions are the right place to ask questions about how to use or do certain things with NetBox Docker. - name: Chat - url: http://slack.networktocode.com/ + url: https://join.slack.com/t/netdev-community/shared_invite/zt-mtts8g0n-Sm6Wutn62q_M4OdsaIycrQ about: 'Usually the quickest way to seek help with small issues is to join our #netbox-docker Slack channel.' - name: Community Wiki diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index c9acfcf..38bba42 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -9,39 +9,52 @@ assignees: '' ## Desired Behavior -... + + ## Contrast to Current Behavior -... + + ## Changes Required -... + + ## Discussion: Benefits and Drawbacks @@ -51,4 +64,5 @@ Please make your case here: - What are the drawbacks of this change? Is it backwards-compatible? - Anything else that you think is relevant to the discussion of this feature/change request. --> -... + + diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 43c6482..3ea6214 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -14,6 +14,9 @@ jobs: name: Checks syntax of our code steps: - uses: actions/checkout@v2 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 - uses: actions/setup-python@v2 - name: Lint Code Base uses: github/super-linter@v3 diff --git a/README.md b/README.md index 8458fea..6cfdd95 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,17 @@ Images are built using this code and are released to [Docker Hub][netbox-dockerhub] and [Quay.io][netbox-quayio] once a day. Do you have any questions? -Before opening an issue on Github, please join the [Network To Code][ntc-slack] Slack and ask for help in our [`#netbox-docker`][netbox-docker-slack] channel. +Before opening an issue on Github, +please join the [our Slack][netbox-docker-slack] and ask for help in the [`#netbox-docker`][netbox-docker-slack-channel] channel. [github-stargazers]: https://github.com/netbox-community/netbox-docker/stargazers [github-release]: https://github.com/netbox-community/netbox-docker/releases [netbox-docker-microbadger]: https://microbadger.com/images/netboxcommunity/netbox [netbox-dockerhub]: https://hub.docker.com/r/netboxcommunity/netbox/ [netbox-docker-github]: https://github.com/netbox-community/netbox-docker/ -[ntc-slack]: http://slack.networktocode.com/ -[netbox-docker-slack]: https://slack.com/app_redirect?channel=netbox-docker&team=T09LQ7E9E +[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-slack-channel]: https://netdev-community.slack.com/archives/C01P0FRSXRV [netbox-docker-license]: https://github.com/netbox-community/netbox-docker/blob/release/LICENSE [netbox-quayio]: https://quay.io/repository/netboxcommunity/netbox @@ -84,10 +86,12 @@ It covers advanced topics such as using files for secrets, deployment to Kuberne ## Getting Help -Feel free to ask questions in our [Github Community][netbox-community] or join [our Slack channel `#netbox-docker`][netbox-docker-slack] on the [Network To Code Slack][ntc-slack], +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], which is free to use and where there are almost always people online that can help you in the Slack channel. -If you need help with using NetBox or developing for it or against it's API you may find the `#netbox` channel on the same Slack instance very helpful. +If you need help with using NetBox or developing for it or against it's API +you may find [the `#netbox` channel][netbox-slack-channel] on the same Slack instance very helpful. [netbox-community]: https://github.com/netbox-community/netbox-docker/discussions @@ -130,8 +134,7 @@ It runs NetBox's own unit tests and ensures that all initializers work: IMAGE=netboxcommunity/netbox:latest ./test.sh ``` -## About +## Support -This repository is currently maintained and funded by [nxt][nxt]. - -[nxt]: https://nxt.engineering/en/ +This repository is currently maintained by the community. +Please consider sponsoring the maintainers of this project. diff --git a/VERSION b/VERSION index 6d7de6e..26aaba0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.2 +1.2.0 diff --git a/docker-compose.override.yml.example b/docker-compose.override.yml.example new file mode 100644 index 0000000..f08d6c0 --- /dev/null +++ b/docker-compose.override.yml.example @@ -0,0 +1,5 @@ +version: '3.4' +services: + netbox: + ports: + - 8000:8080 diff --git a/docker-compose.yml b/docker-compose.yml index 4b0fda3..7bec177 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,8 +16,6 @@ services: - ./reports:/etc/netbox/reports:z,ro - ./scripts:/etc/netbox/scripts:z,ro - netbox-media-files:/opt/netbox/netbox/media:z - ports: - - "8080" netbox-worker: <<: *netbox depends_on: diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index c795d6a..c39453d 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -68,6 +68,4 @@ echo "βœ… Initialisation is done." # Launch whatever is passed by docker # (i.e. the RUN instruction in the Dockerfile) -# -# shellcheck disable=SC2068 -exec $@ +exec "$@" diff --git a/initializers/custom_links.yml b/initializers/custom_links.yml index f1b275c..eb733ca 100644 --- a/initializers/custom_links.yml +++ b/initializers/custom_links.yml @@ -10,12 +10,12 @@ ## Examples: # - name: link_to_repo -# text: 'Link to Netbox Docker' -# url: 'https://github.com/netbox-community/netbox-docker' +# link_text: 'Link to Netbox Docker' +# link_url: 'https://github.com/netbox-community/netbox-docker' # new_window: False # content_type: device # - name: link_to_localhost -# text: 'Link to localhost' -# url: 'http://localhost' +# link_text: 'Link to localhost' +# link_url: 'http://localhost' # new_window: True # content_type: device diff --git a/initializers/devices.yml b/initializers/devices.yml index 0de0504..8324c36 100644 --- a/initializers/devices.yml +++ b/initializers/devices.yml @@ -42,3 +42,12 @@ # position: 3 # custom_field_data: # text_field: Description +# - name: server04 +# device_role: server +# device_type: Other +# site: SING 1 +# location: cage 101 +# face: front +# position: 3 +# custom_field_data: +# text_field: Description diff --git a/initializers/rack_groups.yml b/initializers/locations.yml similarity index 100% rename from initializers/rack_groups.yml rename to initializers/locations.yml diff --git a/initializers/power_panels.yml b/initializers/power_panels.yml index 1205851..a670ba7 100644 --- a/initializers/power_panels.yml +++ b/initializers/power_panels.yml @@ -2,4 +2,4 @@ # site: AMS 1 # - name: power panel SING 1 # site: SING 1 -# rack_group: cage 101 +# location: cage 101 diff --git a/initializers/racks.yml b/initializers/racks.yml index 379553d..9071e19 100644 --- a/initializers/racks.yml +++ b/initializers/racks.yml @@ -32,7 +32,7 @@ # text_field: Description # - site: SING 1 # name: rack-03 -# group: cage 101 +# location: cage 101 # role: Role 3 # type: 4-post-cabinet # width: 19 diff --git a/initializers/vlan_groups.yml b/initializers/vlan_groups.yml index 3e0bb00..facd34f 100644 --- a/initializers/vlan_groups.yml +++ b/initializers/vlan_groups.yml @@ -1,6 +1,24 @@ # - name: VLAN group 1 -# site: AMS 1 +# scope_type: dcim.region +# scope: Amsterdam # slug: vlan-group-1 # - name: VLAN group 2 -# site: AMS 1 +# scope_type: dcim.site +# scope: AMS 1 # slug: vlan-group-2 +# - name: VLAN group 3 +# scope_type: dcim.location +# scope: cage 101 +# slug: vlan-group-3 +# - name: VLAN group 4 +# scope_type: dcim.rack +# scope: rack-01 +# slug: vlan-group-4 +# - name: VLAN group 5 +# scope_type: virtualization.cluster +# scope: cluster1 +# slug: vlan-group-5 +# - name: VLAN group 6 +# scope_type: virtualization.clustergroup +# scope: Group 1 +# slug: vlan-group-6 diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..5294799 --- /dev/null +++ b/release.sh @@ -0,0 +1,188 @@ +#!/bin/bash + +DEFAULT_REPO=netbox-community/netbox-docker +REPO="${REPO-${DEFAULT_REPO}}" + +echomoji() { + EMOJI=${1} + TEXT=${2} + shift 2 + if [ -z "$DISABLE_EMOJI" ]; then + echo "${EMOJI}" "${@}" + else + echo "${TEXT}" "${@}" + fi +} + +echo_nok() { + echomoji "❌" "!" "${@}" +} +echo_ok() { + echomoji "βœ…" "-" "${@}" +} +echo_hint() { + echomoji "πŸ‘‰" ">" "${@}" +} + +# check errors shall exit with code 1 + +check_clean_repo() { + changes=$(git status --porcelain 2>/dev/null) + if [ ${?} ] && [ -n "$changes" ]; then + echo_nok "There are git changes pending:" + echo "$changes" + echo_hint "Please clean the repository before continueing: git stash --include-untracked" + exit 1 + fi + echo_ok "Repository has no pending changes." +} + +check_branch() { + expected_branch="${1}" + actual_branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) + if [ ${?} ] && [ "${actual_branch}" != "${expected_branch}" ]; then + echo_nok "Current branch should be '${expected_branch}', but is '${actual_branch}'." + echo_hint "Please change to the '${expected_branch}' branch: git checkout ${expected_branch}" + exit 1 + fi + echo_ok "The current branch is '${actual_branch}'." +} + +check_upstream() { + expected_upstream_branch="origin/${1}" + actual_upstream_branch=$(git rev-parse --abbrev-ref '@{upstream}' 2>/dev/null) + if [ ${?} ] && [ "${actual_upstream_branch}" != "${expected_upstream_branch}" ]; then + echo_nok "Current upstream branch should be '${expected_upstream_branch}', but is '${actual_upstream_branch}'." + echo_hint "Please set '${expected_upstream_branch}' as the upstream branch: git branch --set-upstream-to=${expected_upstream_branch}" + exit 1 + fi + echo_ok "The current upstream branch is '${actual_upstream_branch}'." +} + +check_origin() { + expected_origin="git@github.com:${REPO}.git" + actual_origin=$(git remote get-url origin 2>/dev/null) + if [ ${?} ] && [ "${actual_origin}" != "${expected_origin}" ]; then + echo_nok "The url of origin is '${actual_origin}', but '${expected_origin}' is expected." + echo_hint "Please set '${expected_origin}' as the url for origin: git origin set-url '${expected_origin}'" + exit 1 + fi + echo_ok "The current origin url is '${actual_origin}'." +} + +check_latest() { + git fetch --tags origin + + local_head_commit=$(git rev-parse HEAD 2>/dev/null) + remote_head_commit=$(git rev-parse FETCH_HEAD 2>/dev/null) + if [ "${local_head_commit}" != "${remote_head_commit}" ]; then + echo_nok "HEAD is at '${local_head_commit}', but FETCH_HEAD is at '${remote_head_commit}'." + echo_hint "Please ensure that you have pushed and pulled all the latest chanegs: git pull --prune --rebase origin; git push origin" + exit 1 + fi + echo_ok "HEAD and FETCH_HEAD both point to '${local_head_commit}'." +} + +check_tag() { + local tag + + tag=$(/dev/null >/dev/null; then + echo_nok "The tag '${tag}' already points to '$(git rev-parse "${tag}" 2>/dev/null)'." + echo_hint "Please ensure that the 'VERSION' file has been updated before trying to release: echo X.Y.Z > VERSION" + exit 1 + fi + echo_ok "The tag '${tag}' does not exist yet." +} + +check_develop() { + echomoji πŸ“‹ "?" "Checking 'develop' branch" + + check_branch develop + check_upstream develop + check_clean_repo + check_latest +} + +check_release() { + echomoji πŸ“‹ "?" "Checking 'release' branch" + + check_upstream release + check_clean_repo + check_latest +} + +# git errors shall exit with code 2 + +git_switch() { + echomoji πŸ”€ "β‰ˆ" "Switching to '${1}' branch…" + if ! git checkout "${1}" >/dev/null; then + echo_nok "It was not possible to switch to the branch '${1}'." + exit 2 + fi + echo_ok "The branch is now '${1}'." +} + +git_tag() { + echomoji 🏷 "X" "Tagging version '${1}'…" + if ! git tag "${1}"; then + echo_nok "The tag '${1}' was not created because of an error." + exit 2 + fi + echo_ok "The tag '$(