Skip to content

Commit

Permalink
Merge pull request #432 from netbox-community/develop
Browse files Browse the repository at this point in the history
Version 1.0.2
  • Loading branch information
cimnine authored Feb 10, 2021
2 parents 4dd7a51 + 74543ec commit c80fb19
Show file tree
Hide file tree
Showing 83 changed files with 1,240 additions and 1,039 deletions.
23 changes: 23 additions & 0 deletions .ecrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"Verbose": false,
"Debug": false,
"IgnoreDefaults": false,
"SpacesAftertabs": false,
"NoColor": false,
"Exclude": [
"LICENSE",
"\\.initializers",
"\\.vscode"
],
"AllowedContentTypes": [],
"PassedFiles": [],
"Disable": {
// set these options to true to disable specific checks
"EndOfLine": false,
"Indentation": false,
"InsertFinalNewline": false,
"TrimTrailingWhitespace": false,
"IndentSize": true,
"MaxLineLength": false
}
}
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

[*.py]
indent_size = 4
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 100
extend-ignore = E203, W503
per-file-ignores =
configuration/*:E131,E251,E266,E302,E305,E501,E722
startup_scripts/startup_script_utils/__init__.py:F401
docker/*:E266,E722
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Before raising an issue here, answer the following questions for yourself, pleas
* Have you updated to the latest version and tried again? (i.e. `git pull` and `docker-compose pull`)
* Have you reset the project and tried again? (i.e. `docker-compose down -v`)
* Are you confident that your problem is related to the Docker image or Docker Compose file this project provides?
(Otherwise ask on the Netbox mailing list, please: https://groups.google.com/d/forum/netbox-discuss)
(Otherwise ask on the NetBox mailing list, please: https://groups.google.com/d/forum/netbox-discuss)
* Have you looked through the issues already resolved?
Please try this means to get help before opening an issue here:
* On the networktocode Slack in the #netbox-docker channel: http://slack.networktocode.com/
* On the networktocode Slack in the #netbox channel: http://slack.networktocode.com/
* On the Netbox mailing list: https://groups.google.com/d/forum/netbox-discuss
* On the NetBox mailing list: https://groups.google.com/d/forum/netbox-discuss
Please don't open an issue when you have a PR ready. Just submit the PR, that's good enough.
Expand Down
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
blank_issues_enabled: false
contact_links:
- name: The \#netbox-docker Slack channel
url: http://slack.networktocode.com/
about: It's usually the quickest way to seek help when you're in trouble with regards to Netbox Docker.

- name: Github Discussions
- name: Question
url: https://github.com/netbox-community/netbox-docker/discussions
about: This is the right place to ask questions about how to use or do certain things with Netbox Docker.
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/
about: 'Usually the quickest way to seek help with small issues is to join our #netbox-docker Slack channel.'

- name: Have you had a look at our Wiki?
- name: Community Wiki
url: https://github.com/netbox-community/netbox-docker/wiki
about: Our wiki contains information for common problems and tips for operating Netbox Docker in production.
about: |
Our wiki contains information for common problems and tips for operating NetBox Docker in production.
It's maintained by our excellent community.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Before raising an issue here, answer the following questions for yourself, pleas
* Have you had a look at the rest of the wiki? (https://github.com/netbox-community/netbox-docker/wiki)
* Have you read the release notes recently (https://github.com/netbox-community/netbox-docker/releases)
* Are you confident that your feature/change request is related to the Docker image or Docker Compose file this project provides?
(Otherwise ask on the Netbox mailing list, please: https://groups.google.com/d/forum/netbox-discuss)
(Otherwise ask on the NetBox mailing list, please: https://groups.google.com/d/forum/netbox-discuss)
* Have you looked through the issues already resolved?
Please try this means to get help before opening an issue here:
* On the networktocode Slack in the #netbox-docker channel: http://slack.networktocode.com/
* On the networktocode Slack in the #netbox channel: http://slack.networktocode.com/
* On the Netbox mailing list: https://groups.google.com/d/forum/netbox-discuss
* On the NetBox mailing list: https://groups.google.com/d/forum/netbox-discuss
Please don't open an issue when you have a PR ready. Just submit the PR, that's good enough.
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ on:
- release

jobs:
lint:
runs-on: ubuntu-latest
name: Checks syntax of our code
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Lint Code Base
uses: github/super-linter@v3
env:
DEFAULT_BRANCH: develop
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SUPPRESS_POSSUM: true
LINTER_RULES_PATH: /
VALIDATE_ALL_CODEBASE: false
VALIDATE_DOCKERFILE: false
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)

EDITORCONFIG_FILE_NAME: .ecrc
DOCKERFILE_HADOLINT_FILE_NAME: .hadolint.yaml
MARKDOWN_CONFIG_FILE: .markdown-lint.yml
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
PYTHON_FLAKE8_CONFIG_FILE: .flake8
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
build:
continue-on-error: ${{ matrix.docker_from == 'alpine:edge' }}
strategy:
Expand All @@ -23,7 +46,7 @@ jobs:
- alpine:edge
fail-fast: false
runs-on: ubuntu-latest
name: Builds new Netbox Docker Images
name: Builds new NetBox Docker Images
steps:
- id: git-checkout
name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- ./build.sh develop
fail-fast: false
runs-on: ubuntu-latest
name: Builds new Netbox Docker Images
name: Builds new NetBox Docker Images
steps:
- id: git-checkout
name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ configuration/*
configuration/ldap/*
!configuration/ldap/ldap_config.py
prometheus.yml
super-linter.log
3 changes: 3 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ignored:
- DL3006
- DL3018
2 changes: 2 additions & 0 deletions .markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MD013: false
MD041: false
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,31 @@ FROM ${FROM} as builder
RUN apk add --no-cache \
bash \
build-base \
cargo \
ca-certificates \
cyrus-sasl-dev \
graphviz \
jpeg-dev \
libevent-dev \
libffi-dev \
libressl-dev \
libxslt-dev \
musl-dev \
openldap-dev \
postgresql-dev \
py3-pip \
python3-dev \
&& python3 -m venv /opt/netbox/venv \
&& /opt/netbox/venv/bin/python3 -m pip install --upgrade pip setuptools
&& python3 -m venv /opt/netbox/venv \
&& /opt/netbox/venv/bin/python3 -m pip install --upgrade \
pip \
setuptools \
wheel

ARG NETBOX_PATH
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
RUN /opt/netbox/venv/bin/pip install -r /requirements.txt -r /requirements-container.txt
RUN /opt/netbox/venv/bin/pip install \
-r /requirements.txt \
-r /requirements-container.txt

###
# Main stage
Expand Down Expand Up @@ -81,8 +89,8 @@ LABEL ORIGINAL_TAG="" \
# Also https://microbadger.com/labels
org.label-schema.schema-version="1.0" \
org.label-schema.build-date="" \
org.label-schema.name="Netbox Docker" \
org.label-schema.description="A container based distribution of Netbox, the free and open IPAM and DCIM solution." \
org.label-schema.name="NetBox Docker" \
org.label-schema.description="A container based distribution of NetBox, the free and open IPAM and DCIM solution." \
org.label-schema.vendor="The netbox-docker contributors." \
org.label-schema.url="https://github.com/netbox-community/netbox-docker" \
org.label-schema.usage="https://github.com/netbox-community/netbox-docker/wiki" \
Expand All @@ -91,8 +99,8 @@ LABEL ORIGINAL_TAG="" \
org.label-schema.version="snapshot" \
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md#pre-defined-annotation-keys
org.opencontainers.image.created="" \
org.opencontainers.image.title="Netbox Docker" \
org.opencontainers.image.description="A container based distribution of Netbox, the free and open IPAM and DCIM solution." \
org.opencontainers.image.title="NetBox Docker" \
org.opencontainers.image.description="A container based distribution of NetBox, the free and open IPAM and DCIM solution." \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.authors="The netbox-docker contributors." \
org.opencontainers.image.vendor="The netbox-docker contributors." \
Expand Down
51 changes: 13 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![MicroBadger Size](https://img.shields.io/microbadger/image-size/netboxcommunity/netbox)][netbox-docker-microbadger]
[![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 Docker container.
[The Github repository](netbox-docker-github) houses the components needed to build NetBox as a Docker container.
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?
Expand All @@ -27,14 +27,14 @@ Before opening an issue on Github, please join the [Network To Code][ntc-slack]

## Docker Tags

* `vX.Y.Z`: These are release builds, automatically built from [the corresponding releases of Netbox][netbox-releases].
* `latest`: These are release builds, automatically built from [the `master` branch of Netbox][netbox-master].
* `snapshot`: These are pre-release builds, automatically built from the [`develop` branch of Netbox][netbox-develop].
* `develop-X.Y`: These are pre-release builds, automatically built from the corresponding [branch of Netbox][netbox-branches].
* `vX.Y.Z`: These are release builds, automatically built from [the corresponding releases of NetBox][netbox-releases].
* `latest`: These are release builds, automatically built from [the `master` branch of NetBox][netbox-master].
* `snapshot`: These are pre-release builds, automatically built from the [`develop` branch of NetBox][netbox-develop].
* `develop-X.Y`: These are pre-release builds, automatically built from the corresponding [branch of NetBox][netbox-branches].

Then there is currently one extra tags for each of the above tags:

* `-ldap`: Contains additional dependencies and configurations for connecting Netbox to an LDAP directory.
* `-ldap`: Contains additional dependencies and configurations for connecting NetBox to an LDAP directory.
[Learn more about that in our wiki][netbox-docker-ldap].

New images are built and published automatically every ~24h.
Expand All @@ -47,7 +47,7 @@ New images are built and published automatically every ~24h.

## Quickstart

To get Netbox Docker up and running run the following commands.
To get NetBox Docker up and running run the following commands.
There is a more complete [_Getting Started_ guide on our wiki][wiki-getting-started] which explains every step.

```bash
Expand All @@ -66,7 +66,7 @@ docker-compose up

The whole application will be available after a few minutes.
Open the URL `http://0.0.0.0:8000/` in a web-browser.
You should see the Netbox homepage.
You should see the NetBox homepage.
In the top-right corner you can login.
The default credentials are:

Expand All @@ -79,7 +79,7 @@ The default credentials are:

## Documentation

Please refer [to our wiki on Github][netbox-docker-wiki] for further information on how to use this Netbox Docker image properly.
Please refer [to our wiki on Github][netbox-docker-wiki] for further information on how to use this NetBox Docker image properly.
It covers advanced topics such as using files for secrets, deployment to Kubernetes, monitoring and configuring NAPALM or LDAP.

[netbox-docker-wiki]: https://github.com/netbox-community/netbox-docker/wiki/
Expand All @@ -89,44 +89,19 @@ It covers advanced topics such as using files for secrets, deployment to Kuberne
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],
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 on the same Slack instance very helpful.

[netbox-community]: https://github.com/netbox-community/netbox-docker/discussions

## Dependencies

This project relies only on *Docker* and *docker-compose* meeting these requirements:

* The *Docker version* must be at least `17.05`.
* The *docker-compose version* must be at least `1.17.0`.
* The *Docker version* must be at least `19.03`.
* The *docker-compose version* must be at least `1.28.0`.

To check the version installed on your system run `docker --version` and `docker-compose --version`.

## Use a Specific Netbox Version

The `docker-compose.yml` file is prepared to run a specific version of Netbox, instead of `latest`.
To use this feature, set and export the environment-variable `VERSION` before launching `docker-compose`, as shown below.
`VERSION` may be set to the name of
[any tag of the `netboxcommunity/netbox` Docker image on Docker Hub][netbox-dockerhub] or [Quay.io][netbox-quayio].

```bash
export VERSION=v2.7.1
docker-compose pull netbox
docker-compose up -d
```

You can also build a specific version of the Netbox Docker image yourself.
`VERSION` can be any valid [git ref][git-ref] in that case.

```bash
export VERSION=v2.7.1
./build.sh $VERSION
docker-compose up -d
```

[git-ref]: https://git-scm.com/book/en/v2/Git-Internals-Git-References
[netbox-github]: https://github.com/netbox-community/netbox/releases

## Breaking Changes

From time to time it might become necessary to re-engineer the structure of this setup.
Expand All @@ -151,7 +126,7 @@ For more details on custom builds [consult our wiki][netbox-docker-wiki-build].
## Tests

We have a test script.
It runs Netbox's own unit tests and ensures that all initializers work:
It runs NetBox's own unit tests and ensures that all initializers work:

```bash
IMAGE=netboxcommunity/netbox:latest ./test.sh
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.2
2 changes: 1 addition & 1 deletion build-functions/docker-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ push_image_to_registry() {
echo "⏫ Pushing '${target_tag}'"
$DRY docker push "${target_tag}"
echo "✅ Finished pushing the Docker image '${target_tag}'."
}
}
16 changes: 8 additions & 8 deletions build-functions/get-public-image-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ _get_image_configuration() {
--silent \
--location \
--header "Authorization: Bearer $token" \
"https://registry-1.docker.io/v2/$image/blobs/$digest" \
| jq -r ".config.Labels.\"$label\""
"https://registry-1.docker.io/v2/$image/blobs/$digest" |
jq -r ".config.Labels.\"$label\""
}

_get_token() {
local image=$1
curl \
--silent \
"https://auth.docker.io/token?scope=repository:$image:pull&service=registry.docker.io" \
| jq -r '.token'
"https://auth.docker.io/token?scope=repository:$image:pull&service=registry.docker.io" |
jq -r '.token'
}

_get_digest() {
Expand All @@ -65,8 +65,8 @@ _get_digest() {
--silent \
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
--header "Authorization: Bearer $token" \
"https://registry-1.docker.io/v2/$image/manifests/$tag" \
| jq -r '.config.digest'
"https://registry-1.docker.io/v2/$image/manifests/$tag" |
jq -r '.config.digest'
}

_get_layers() {
Expand All @@ -77,6 +77,6 @@ _get_layers() {
--silent \
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
--header "Authorization: Bearer $token" \
"https://registry-1.docker.io/v2/$image/manifests/$tag" \
| jq -r '.layers[].digest'
"https://registry-1.docker.io/v2/$image/manifests/$tag" |
jq -r '.layers[].digest'
}
Loading

0 comments on commit c80fb19

Please sign in to comment.