Compare commits

...

34 Commits
1.3.1 ... 1.4.1

Author SHA1 Message Date
9c66cc4c32 Merge pull request #606 from netbox-community/develop
Version 1.4.1
2021-10-14 07:45:50 +02:00
68401caf1c Merge pull request #608 from netbox-community/renovate/django-storages-1.x
Update dependency django-storages to v1.12.1
2021-10-11 22:39:39 +02:00
4f466bb5a1 Update dependency django-storages to v1.12.1 2021-10-11 19:24:42 +00:00
daaea77144 Merge pull request #589 from tobiasge/user-unit
Fix #586: Use user name instead of userid
2021-10-06 17:25:47 +02:00
faa1cb52dd Preparation for 1.4.1 2021-10-06 17:03:48 +02:00
57ac14f295 Merge pull request #605 from netbox-community/renovate/google-crc32c-1.x
Update dependency google-crc32c to v1.3.0
2021-10-06 13:58:47 +02:00
d0f4820baa Update dependency google-crc32c to v1.3.0 2021-10-06 00:32:00 +00:00
b0261e8cc6 Merge pull request #603 from cimnine/GroupBuildOutput
Group the build output in GitHub Action
2021-10-05 11:33:03 +02:00
30a7aa0e9c Group the build output in GitHub Action 2021-10-05 11:08:16 +02:00
5f0b7467d1 Merge pull request #602 from cimnine/FixEdge
Implicit openssl-dev dependency resolution (fixes alpine:edge)
2021-10-05 10:55:55 +02:00
24363b653f Remove openssl-dev from Dockerfile
It is pulled by postgresql-dev anyway
In the upcoming alpine, openssl v3 will be
the default, but postgresql-dev will still
require openssl v1.x.
This creates a conflict, which can be resolved
if postgresql-dev can choose the openssl version
it depends on.
2021-10-05 09:47:55 +02:00
21a3048b96 Merge pull request #601 from cimnine/IssueForms
Use issue template form instead of text template
2021-10-05 09:26:48 +02:00
5679ab435f Use user name instead of userid
Nginx unit needs the user and group parameter as names.
2021-09-24 08:16:07 +02:00
c9b3edd0f1 Merge pull request #587 from netbox-community/renovate/google-crc32c-1.x
Update dependency google-crc32c to v1.2.0
2021-09-21 08:22:15 +02:00
31e6e42a30 Update dependency google-crc32c to v1.2.0 2021-09-20 20:43:14 +00:00
1a868c6847 Merge pull request #583 from cimnine/NBDoVersionTag
Add project version to Docker tag
2021-09-20 13:35:24 +02:00
a9d6f1fefe Use issue template form instead of template 2021-09-17 20:10:15 +02:00
dbfcd5b58c Add project version to Docker tag 2021-09-17 19:02:18 +02:00
6a52a48b71 Merge pull request #582 from netbox-community/develop
Version 1.4.0
2021-09-17 11:35:56 +02:00
e31492a9b4 Merge branch 'release' into develop 2021-09-17 11:08:31 +02:00
f2dbc4f717 Preparation for 1.4.0 2021-09-17 10:56:50 +02:00
1d040ad64d Merge pull request #546 from tobiasge/drop-privileges
Drops privileges to user 101 and group 0
2021-09-17 10:53:08 +02:00
8703749292 Merge pull request #571 from tobiasge/house
Added container for Netbox housekeeping command
2021-09-17 10:52:28 +02:00
d432a84c42 Merge pull request #565 from mk-fg/develop
Print last line of django db connection error while waiting for db to start
2021-09-17 10:50:31 +02:00
c00492cad0 Merge pull request #579 from tobiasge/check-remote
Check if remote branch exists before checkout
2021-09-13 23:42:47 +02:00
c4d545a256 Improved check
Co-authored-by: Christian Mäder <cimnine@users.noreply.github.com>
2021-09-13 22:50:06 +02:00
d0c429c8a1 Check if remote branch exists before checkout 2021-09-13 09:27:28 +02:00
a8b6883183 Changed entrypoint to "tini". 2021-09-13 08:51:23 +02:00
5590b32c93 Merge pull request #576 from netbox-community/renovate/google-crc32c-1.x
Update dependency google-crc32c to v1.1.5
2021-09-08 08:47:17 +02:00
97e7022121 Update dependency google-crc32c to v1.1.5 2021-09-07 22:27:44 +00:00
2926d1a11d Quote variable
Co-authored-by: Christian Mäder <cimnine@users.noreply.github.com>
2021-09-07 09:47:38 +02:00
58debafa8a Added container for Netbox housekeeping command
Adds an additional container in which the new "housekeeping" command from
Netbox v3.0.0 is run.
2021-09-03 12:48:30 +02:00
fc4b78f74a Print last line of django db connection error while waiting for db to start
Fixes #562
2021-09-02 20:22:03 +05:00
03a1793208 Drops privileges to user 101 and group 0
When the container is started as root the default was to drop privileges to "unit:unit". This caused some problems with temporary files. Now the privileges are drop to "101:0".
When the container is started as a normal user unit prints a warning that changing the user and group is not possible. This warning is safe to ignore.
2021-07-30 21:42:05 +02:00
16 changed files with 322 additions and 182 deletions

View File

@ -1,86 +0,0 @@
---
name: Bug report
about: Create a report about a malfunction of the Docker setup
title: ''
labels: ''
assignees: ''
---
<!--
Please only raise an issue if you're certain that you've found a bug.
Else, see these other means to get help:
* See our troubleshooting section:
https://github.com/netbox-community/netbox-docker/wiki/Troubleshooting
* Have a look at the rest of the wiki:
https://github.com/netbox-community/netbox-docker/wiki
* Check the release notes:
https://github.com/netbox-community/netbox-docker/releases
* Look through the issues already resolved:
https://github.com/netbox-community/netbox-docker/issues?q=is%3Aclosed
If you did not find what you're looking for,
try the help of our community:
* Post to Github Discussions:
https://github.com/netbox-community/netbox-docker/discussions
* Join the `#netbox-docker` channel on our Slack:
https://join.slack.com/t/netdev-community/shared_invite/zt-mtts8g0n-Sm6Wutn62q_M4OdsaIycrQ
* Ask on the NetBox mailing list:
https://groups.google.com/d/forum/netbox-discuss
Please don't open an issue to open a PR.
Just submit the PR, that's good enough.
-->
## Current Behavior
<!-- describe what you did and how it misbehaved -->
## Expected Behavior
<!-- describe what you expected instead -->
## Debug Information
<!-- please fill in the following information that helps us debug your problem more quickly -->
The output of `docker-compose version`: `XXXXX`
The output of `docker version`: `XXXXX`
The output of `git rev-parse HEAD`: `XXXXX`
The command you used to start the project: `XXXXX`
<!-- adjust the `latest` tag to the version you're using -->
The output of `docker inspect netboxcommunity/netbox:latest --format "{{json .Config.Labels}}"`:
```json
{
"JSON JSON JSON":
"--> Please paste formatted json. (Use e.g. `jq` or https://jsonformatter.curiousconcept.com/)"
}
```
The output of `docker-compose logs netbox`:
<!--
If your log is very long, create a Gist instead and post the link to it: https://gist.github.com
-->
```text
LOG LOG LOG
```
The output of `cat docker-compose.override.yml`:
<!--
If this file is very long, create a Gist instead and post the link to it: https://gist.github.com
-->
```text
LOG LOG LOG
```

148
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,148 @@
name: Bug report
description: Create a report about a malfunction of the Docker setup
body:
- type: markdown
attributes:
value: |
Please only raise an issue if you're certain that you've found a bug.
Else, see these other means to get help:
- See our troubleshooting section:
https://github.com/netbox-community/netbox-docker/wiki/Troubleshooting
- Have a look at the rest of the wiki:
https://github.com/netbox-community/netbox-docker/wiki
- Check the release notes:
https://github.com/netbox-community/netbox-docker/releases
- Look through the issues already resolved:
https://github.com/netbox-community/netbox-docker/issues?q=is%3Aclosed
If you did not find what you're looking for,
try the help of our community:
- Post to Github Discussions:
https://github.com/netbox-community/netbox-docker/discussions
- Join the `#netbox-docker` channel on our Slack:
https://join.slack.com/t/netdev-community/shared_invite/zt-mtts8g0n-Sm6Wutn62q_M4OdsaIycrQ
- Ask on the NetBox mailing list:
https://groups.google.com/d/forum/netbox-discuss
Please don't open an issue to open a PR.
Just submit the PR, that's good enough.
- type: textarea
id: current-behavior
attributes:
label: Current Behavior
description: Please describe what you did and how you think it misbehaved
placeholder: I tried to … by doing …, but it …
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: Please describe what you expected instead
placeholder: I expected that … when I do …
validations:
required: true
- type: input
id: docker-compose-version
attributes:
label: Docker Compose Version
description: Please paste the output of `docker-compose version`
placeholder: Docker Compose version vX.Y.Z
validations:
required: true
- type: textarea
id: docker-version
attributes:
label: Docker Version
description: Please paste the output of `docker version`
render: text
placeholder: |
Client:
Cloud integration: 1.0.17
Version: 20.10.8
API version: 1.41
Go version: go1.16.6
Git commit: 3967b7d
Built: Fri Jul 30 19:55:20 2021
OS/Arch: darwin/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.8
API version: 1.41 (minimum version 1.12)
Go version: go1.16.6
Git commit: 75249d8
Built: Fri Jul 30 19:52:10 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.9
GitCommit: e25210fe30a0a703442421b0f60afac609f950a3
runc:
Version: 1.0.1
GitCommit: v1.0.1-0-g4144b63
docker-init:
Version: 0.19.0
GitCommit: de40ad0
validations:
required: true
- type: input
id: git-rev
attributes:
label: The git Revision
description: Please paste the output of `git rev-parse HEAD`
validations:
required: true
- type: textarea
id: git-status
attributes:
label: The git Status
description: Please paste the output of `git status`
render: text
placeholder: |
On branch main
nothing to commit, working tree clean
validations:
required: true
- type: input
id: run-command
attributes:
label: Startup Command
description: Please specify the command you used to start the project
placeholder: docker compose up
validations:
required: true
- type: textarea
id: netbox-logs
attributes:
label: NetBox Logs
description: Please paste the output of `docker-compose logs netbox` (or `docker compose logs netbox`)
render: text
placeholder: |
netbox_1 | ⚙️ Applying database migrations
netbox_1 | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox_1 | 🧬 loaded config '/etc/netbox/config/a.py'
netbox_1 | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox_1 | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox_1 | 🧬 loaded config '/etc/netbox/config/plugins.py'
...
validations:
required: true
- type: textarea
id: docker-compose-override-yml
attributes:
label: Content of docker-compose.override.yml
description: Please paste the output of `cat docker-compose.override.yml`
render: yaml
placeholder: |
version: '3.4'
services:
netbox:
ports:
- '8080:8080'
validations:
required: true

View File

@ -1,68 +0,0 @@
---
name: Feature or Change Request
about: Request a new feature or a change of the current behavior
title: ''
labels: ''
assignees: ''
---
<!--
This issue type is to propose new features for the Docker setup.
To just spin an idea, see the Github Discussions section, please.
Before asking for help, see these links first:
* See our troubleshooting section:
https://github.com/netbox-community/netbox-docker/wiki/Troubleshooting
* Have a look at the rest of the wiki:
https://github.com/netbox-community/netbox-docker/wiki
* Check the release notes:
https://github.com/netbox-community/netbox-docker/releases
* Look through the issues already resolved:
https://github.com/netbox-community/netbox-docker/issues?q=is%3Aclosed
If you did not find what you're looking for,
try the help of our community:
* Post to Github Discussions:
https://github.com/netbox-community/netbox-docker/discussions
* Join the `#netbox-docker` channel on our Slack:
https://join.slack.com/t/netdev-community/shared_invite/zt-mtts8g0n-Sm6Wutn62q_M4OdsaIycrQ
* Ask on the NetBox mailing list:
https://groups.google.com/d/forum/netbox-discuss
Please don't open an issue to open a PR.
Just submit the PR, that's good enough.
-->
## Desired Behavior
<!-- please describe the behavior you desire -->
## Contrast to Current Behavior
<!-- please describe how the desired behavior is different from the current behavior -->
## Changes Required
<!-- if you can, please elaborate what changes would exactly be required -->
## Discussion: Benefits and Drawbacks
<!--
Please make your case here:
- Why do you think this project and the community will benefit from your suggestion?
- 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.
-->

View File

@ -0,0 +1,68 @@
name: Feature or Change Request
description: Request a new feature or a change of the current behavior
body:
- type: markdown
attributes:
value: |
This issue type is to propose new features for the Docker setup.
To just spin an idea, see the Github Discussions section, please.
Before asking for help, see these links first:
- See our troubleshooting section:
https://github.com/netbox-community/netbox-docker/wiki/Troubleshooting
- Have a look at the rest of the wiki:
https://github.com/netbox-community/netbox-docker/wiki
- Check the release notes:
https://github.com/netbox-community/netbox-docker/releases
- Look through the issues already resolved:
https://github.com/netbox-community/netbox-docker/issues?q=is%3Aclosed
If you did not find what you're looking for,
try the help of our community:
- Post to Github Discussions:
https://github.com/netbox-community/netbox-docker/discussions
- Join the `#netbox-docker` channel on our Slack:
https://join.slack.com/t/netdev-community/shared_invite/zt-mtts8g0n-Sm6Wutn62q_M4OdsaIycrQ
- Ask on the NetBox mailing list:
https://groups.google.com/d/forum/netbox-discuss
Please don't open an issue to open a PR.
Just submit the PR, that's good enough.
- type: textarea
id: desired-behavior
attributes:
label: Desired Behavior
description: Please describe the desired behavior
placeholder: To me, it would be useful, if … because …
validations:
required: true
- type: textarea
id: contrast-to-current
attributes:
label: Contrast to Current Behavior
description: Please describe how the desired behavior is different from the current behavior
placeholder: The current behavior is …, but this lacks …
validations:
required: true
- type: textarea
id: required-changes
attributes:
label: Required Changes
description: If you can, please elaborate what changes will be required to implement the desired behavior
placeholder: I suggest to change the file …
validations:
required: false
- type: textarea
id: discussion
attributes:
label: 'Discussion: Benefits and Drawbacks'
description: |
Please make your case here:
- Why do you think this project and the community will benefit from your suggestion?
- 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.
placeholder: I suggest to change the file …
validations:
required: false

View File

@ -17,7 +17,6 @@ RUN apk add --no-cache \
make \
musl-dev \
openldap-dev \
openssl-dev \
postgresql-dev \
py3-pip \
python3-dev \
@ -62,11 +61,12 @@ RUN apk add --no-cache \
libevent \
libffi \
libjpeg-turbo \
openssl \
libxslt \
openssl \
postgresql-libs \
python3 \
py3-pip \
python3 \
tini \
unit \
unit-python3
@ -82,6 +82,7 @@ COPY ${NETBOX_PATH} /opt/netbox
COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
COPY docker/housekeeping.sh /opt/netbox/housekeeping.sh
COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh
COPY startup_scripts/ /opt/netbox/startup_scripts/
COPY initializers/ /opt/netbox/initializers/
@ -93,14 +94,15 @@ WORKDIR /opt/netbox/netbox
# Must set permissions for '/opt/netbox/netbox/media' directory
# to g+w so that pictures can be uploaded to netbox.
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
&& chown -R unit:root media /opt/unit/ \
&& chmod -R g+w media /opt/unit/ \
&& cd /opt/netbox/ && /opt/netbox/venv/bin/python -m mkdocs build \
--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
ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD [ "/opt/netbox/launch-netbox.sh" ]
CMD [ "/opt/netbox/docker-entrypoint.sh", "/opt/netbox/launch-netbox.sh" ]
LABEL ORIGINAL_TAG="" \
NETBOX_GIT_BRANCH="" \

View File

@ -1 +1 @@
1.3.1
1.4.1

View File

@ -0,0 +1,21 @@
#!/bin/bash
###
# A regular echo, that only prints if ${GH_ACTION} is defined.
###
gh_echo() {
if [ -n "${GH_ACTION}" ]; then
echo "${@}"
fi
}
###
# Prints the output to the file defined in ${GITHUB_ENV}.
# Only executes if ${GH_ACTION} is defined.
# Example Usage: gh_env "FOO_VAR=bar_value"
###
gh_env() {
if [ -n "${GH_ACTION}" ]; then
echo "${@}" >>"${GITHUB_ENV}"
fi
}

View File

@ -95,6 +95,8 @@ if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then
fi
fi
source ./build-functions/gh-functions.sh
###
# Enabling dry-run mode
###
@ -105,6 +107,8 @@ else
DRY="echo"
fi
gh_echo "::group::⤵️ Fetching the NetBox source code"
###
# Variables for fetching the NetBox source
###
@ -118,6 +122,12 @@ NETBOX_PATH="${NETBOX_PATH-.netbox}"
# Fetching the NetBox source
###
if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ]; then
REMOTE_EXISTS=$(git ls-remote --heads --tags "${URL}" "${NETBOX_BRANCH}" | wc -l)
if [ "${REMOTE_EXISTS}" == "0" ]; then
echo "❌ Remote branch '${NETBOX_BRANCH}' not found in '${URL}'; Nothing to do"
gh_echo "::set-output name=skipped::true"
exit 0
fi
echo "🌐 Checking out '${NETBOX_BRANCH}' of NetBox from the url '${URL}' into '${NETBOX_PATH}'"
if [ ! -d "${NETBOX_PATH}" ]; then
$DRY git clone -q --depth 10 -b "${NETBOX_BRANCH}" "${URL}" "${NETBOX_PATH}"
@ -138,6 +148,9 @@ if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ]; then
echo "✅ Checked out NetBox"
fi
gh_echo "::endgroup::"
gh_echo "::group::🧮 Calculating Values"
###
# Determining the value for DOCKERFILE
# and checking whether it exists
@ -213,11 +226,14 @@ DEFAULT_DOCKER_TARGETS=("main" "ldap")
DOCKER_TARGETS=("${DOCKER_TARGET:-"${DEFAULT_DOCKER_TARGETS[@]}"}")
echo "🏭 Building the following targets:" "${DOCKER_TARGETS[@]}"
gh_echo "::endgroup::"
###
# Build each target
###
export DOCKER_BUILDKIT=${DOCKER_BUILDKIT-1}
for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
gh_echo "::group::🏗 Building the target '${DOCKER_TARGET}'"
echo "🏗 Building the target '${DOCKER_TARGET}'"
###
@ -227,10 +243,10 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
if [ "${DOCKER_TARGET}" != "main" ]; then
TARGET_DOCKER_TAG="${TARGET_DOCKER_TAG}-${DOCKER_TARGET}"
fi
if [ -n "${GH_ACTION}" ]; then
echo "FINAL_DOCKER_TAG=${TARGET_DOCKER_TAG}" >>"$GITHUB_ENV"
echo "::set-output name=skipped::false"
fi
TARGET_DOCKER_TAG_PROJECT="${TARGET_DOCKER_TAG}-${PROJECT_VERSION}"
gh_env "FINAL_DOCKER_TAG=${TARGET_DOCKER_TAG_PROJECT}"
gh_echo "::set-output name=skipped::false"
###
# composing the additional DOCKER_SHORT_TAG,
@ -249,6 +265,9 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
TARGET_DOCKER_SHORT_TAG="${TARGET_DOCKER_SHORT_TAG}-${DOCKER_TARGET}"
TARGET_DOCKER_LATEST_TAG="${TARGET_DOCKER_LATEST_TAG}-${DOCKER_TARGET}"
fi
TARGET_DOCKER_SHORT_TAG_PROJECT="${TARGET_DOCKER_SHORT_TAG}-${PROJECT_VERSION}"
TARGET_DOCKER_LATEST_TAG_PROJECT="${TARGET_DOCKER_LATEST_TAG}-${PROJECT_VERSION}"
fi
###
@ -305,15 +324,18 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
--target "${DOCKER_TARGET}"
-f "${DOCKERFILE}"
-t "${TARGET_DOCKER_TAG}"
-t "${TARGET_DOCKER_TAG_PROJECT}"
)
if [ -n "${TARGET_DOCKER_SHORT_TAG}" ]; then
DOCKER_BUILD_ARGS+=(-t "${TARGET_DOCKER_SHORT_TAG}")
DOCKER_BUILD_ARGS+=(-t "${TARGET_DOCKER_SHORT_TAG_PROJECT}")
DOCKER_BUILD_ARGS+=(-t "${TARGET_DOCKER_LATEST_TAG}")
DOCKER_BUILD_ARGS+=(-t "${TARGET_DOCKER_LATEST_TAG_PROJECT}")
fi
# --label
DOCKER_BUILD_ARGS+=(
--label "ORIGINAL_TAG=${TARGET_DOCKER_TAG}"
--label "ORIGINAL_TAG=${TARGET_DOCKER_TAG_PROJECT}"
--label "org.label-schema.build-date=${BUILD_DATE}"
--label "org.opencontainers.image.created=${BUILD_DATE}"
@ -358,12 +380,12 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
# Building the docker image
###
if [ "${SHOULD_BUILD}" == "true" ]; then
echo "🐳 Building the Docker image '${TARGET_DOCKER_TAG}'."
echo "🐳 Building the Docker image '${TARGET_DOCKER_TAG_PROJECT}'."
echo " Build reason set to: ${BUILD_REASON}"
$DRY docker build "${DOCKER_BUILD_ARGS[@]}" .
echo "✅ Finished building the Docker images '${TARGET_DOCKER_TAG}'"
echo "🔎 Inspecting labels on '${TARGET_DOCKER_TAG}'"
$DRY docker inspect "${TARGET_DOCKER_TAG}" --format "{{json .Config.Labels}}"
echo "✅ Finished building the Docker images '${TARGET_DOCKER_TAG_PROJECT}'"
echo "🔎 Inspecting labels on '${TARGET_DOCKER_TAG_PROJECT}'"
$DRY docker inspect "${TARGET_DOCKER_TAG_PROJECT}" --format "{{json .Config.Labels}}"
else
echo "Build skipped because sources didn't change"
echo "::set-output name=skipped::true"
@ -376,10 +398,15 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
if [ "${2}" == "--push" ] || [ "${2}" == "--push-only" ]; then
source ./build-functions/docker-functions.sh
push_image_to_registry "${TARGET_DOCKER_TAG}"
push_image_to_registry "${TARGET_DOCKER_TAG_PROJECT}"
if [ -n "${TARGET_DOCKER_SHORT_TAG}" ]; then
push_image_to_registry "${TARGET_DOCKER_SHORT_TAG}"
push_image_to_registry "${TARGET_DOCKER_SHORT_TAG_PROJECT}"
push_image_to_registry "${TARGET_DOCKER_LATEST_TAG}"
push_image_to_registry "${TARGET_DOCKER_LATEST_TAG_PROJECT}"
fi
fi
gh_echo "::endgroup::"
done

View File

@ -9,7 +9,7 @@ services:
env_file: env/netbox.env
environment:
SKIP_STARTUP_SCRIPTS: ${SKIP_STARTUP_SCRIPTS-false}
user: '101'
user: 'unit:root'
volumes:
- ./startup_scripts:/opt/netbox/startup_scripts:z,ro
- ./${INITIALIZERS_DIR-initializers}:/opt/netbox/initializers:z,ro
@ -17,8 +17,6 @@ services:
- ./reports:/etc/netbox/reports:z,ro
- ./scripts:/etc/netbox/scripts:z,ro
- netbox-media-files:/opt/netbox/netbox/media:z
ports:
- 8080
postgres:
image: postgres:13-alpine
env_file: env/postgres.env

View File

@ -1,14 +1,14 @@
version: '3.4'
services:
netbox: &netbox
image: netboxcommunity/netbox:${VERSION-v3.0}
image: netboxcommunity/netbox:${VERSION-v3.0-1.4.1}
depends_on:
- postgres
- redis
- redis-cache
- netbox-worker
env_file: env/netbox.env
user: '101'
user: 'unit:root'
volumes:
- ./startup_scripts:/opt/netbox/startup_scripts:z,ro
- ./initializers:/opt/netbox/initializers:z,ro
@ -20,11 +20,18 @@ services:
<<: *netbox
depends_on:
- redis
entrypoint:
- postgres
command:
- /opt/netbox/venv/bin/python
- /opt/netbox/netbox/manage.py
command:
- rqworker
netbox-housekeeping:
<<: *netbox
depends_on:
- redis
- postgres
command:
- /opt/netbox/housekeeping.sh
# postgres
postgres:

View File

@ -15,7 +15,19 @@ source /opt/netbox/venv/bin/activate
DB_WAIT_TIMEOUT=${DB_WAIT_TIMEOUT-3}
MAX_DB_WAIT_TIME=${MAX_DB_WAIT_TIME-30}
CUR_DB_WAIT_TIME=0
while ! ./manage.py showmigrations >/dev/null 2>&1 && [ "${CUR_DB_WAIT_TIME}" -lt "${MAX_DB_WAIT_TIME}" ]; do
while [ "${CUR_DB_WAIT_TIME}" -lt "${MAX_DB_WAIT_TIME}" ]; do
# Read and truncate connection error tracebacks to last line by default
exec {psfd}< <(./manage.py showmigrations 2>&1)
read -rd '' DB_ERR <&$psfd || :
exec {psfd}<&-
wait $! && break
if [ -n "$DB_WAIT_DEBUG" ]; then
echo "$DB_ERR"
else
readarray -tn 0 DB_ERR_LINES <<<"$DB_ERR"
echo "${DB_ERR_LINES[@]: -1}"
echo "[ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]"
fi
echo "⏳ Waiting on DB... (${CUR_DB_WAIT_TIME}s / ${MAX_DB_WAIT_TIME}s)"
sleep "${DB_WAIT_TIMEOUT}"
CUR_DB_WAIT_TIME=$((CUR_DB_WAIT_TIME + DB_WAIT_TIMEOUT))

8
docker/housekeeping.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
SECONDS=${HOUSEKEEPING_INTERVAL:=86400}
echo "Interval set to ${SECONDS} seconds"
while true; do
date
/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py housekeeping
sleep "${SECONDS}s"
done

View File

@ -51,4 +51,6 @@ exec unitd \
--pid /opt/unit/unit.pid \
--log /dev/stdout \
--state /opt/unit/state/ \
--tmp /opt/unit/tmp/
--tmp /opt/unit/tmp/ \
--user unit \
--group root

1
env/netbox.env vendored
View File

@ -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=false
EMAIL_USE_TLS=false
HOUSEKEEPING_INTERVAL=86400
MAX_PAGE_SIZE=1000
MEDIA_ROOT=/opt/netbox/netbox/media
METRICS_ENABLED=false

View File

@ -1,5 +1,5 @@
napalm==3.3.1
ruamel.yaml==0.17.16
django-auth-ldap==3.0.0
google-crc32c==1.1.4
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.11.1
google-crc32c==1.3.0
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.12.1

View File

@ -56,13 +56,13 @@ test_setup() {
test_netbox_unit_tests() {
echo "⏱ Running NetBox Unit Tests"
SKIP_STARTUP_SCRIPTS=true $doco run --rm netbox ./manage.py test
$doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py test
}
test_initializers() {
echo "🏭 Testing Initializers"
export INITIALIZERS_DIR
$doco run --rm netbox ./manage.py check
$doco run --rm netbox /opt/netbox/docker-entrypoint.sh ./manage.py check
}
test_cleanup() {