Commit Graph

71 Commits

Author SHA1 Message Date
Tobias Genannt
ef98ad54fa Install postgresql-client
Make usage of 'manage.py dbshell' possible
2021-10-14 15:37:30 +02:00
Christian Mäder
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
Christian Mäder
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
Tobias Genannt
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
Tobias Genannt
a8b6883183 Changed entrypoint to "tini". 2021-09-13 08:51:23 +02:00
Tobias Genannt
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
Christian Mäder
9255afd060 Improves google-cloud-storage performance
And also fixes the build by providing a 'alpine version'
of the google/crc32c library, which google-crc32c and
google-cloud-storage and ultimately django-storages[google]
depend on.
2021-09-03 09:15:41 +02:00
Tobias Genannt
9d476fa9af Build documentation files in the image 2021-08-21 18:22:24 +02:00
Tobias Genannt
b2ee468871 Alpine update to 3.14 2021-07-07 09:44:21 +02:00
Tobias Genannt
02f30f3a68 'ttf-ubuntu-font-family' was remove from Alpine 2021-05-18 09:34:44 +02:00
Christian Mäder
493fc60401 Use black as formatter for python files 2021-02-08 18:24:29 +01:00
Christian Mäder
5343eaae65 Fix building cryptography pip 2021-02-08 09:03:33 +01:00
Robin Schneider
ee40e339c8
NetBox should always be referred to as NetBox
Fix all instances of "Netbox".

```Shell
git ls-files -z . | xargs --null -I '{}' find './{}' -type f -print0 | xargs --null sed --in-place --regexp-extended 's#Netbox#NetBox#g;'
```

Ref: https://netbox.readthedocs.io/en/stable/development/style-guide/#branding
2021-02-04 21:48:08 +01:00
Tobias Genannt
d273391773 Gunicorn is replaced with nginx-unit
We now serve Netbox with an nginx-unit instance instead of Gunicorn.
This allows us to get rid of the extra Nginx container because Unit is
also serving the static files. The static files are now collected at container
buildtime instead of every startup.
2021-01-15 09:22:22 +01:00
Christian Mäder
43c05d816d Dynamically load configuration files 2020-10-20 20:46:43 +02:00
Tobias Genannt
a6584d2874
Merge pull request #274 from tobiasge/optimise-builds
Optimise builds
2020-05-15 13:57:43 +02:00
ibeljakov
1c65f7af10 Dockerfile: Fixed file permissions for media 2020-04-18 17:08:42 +03:00
Tobias Genannt
8e34f46bad Add checks to verifiy if a new build is needed
This checks if the source materials (python image, Netbox commit,
netbox-docker commit) have changed since the last build. This check is done
by comparing the digest and commit ids from the previous image with the
given tag to the current values taken from the Git and Docker repositories.

The checks are only performed for builds by the automated builds on Github.
2020-04-08 15:50:06 +02:00
Christian Mäder
355f9d4cf7 Prepare for Netbox 2.7 2020-01-20 08:39:26 +01:00
Christian Mäder
0a9991de96
Merge pull request #186 from netbox-community/non-root
Non root
2019-12-20 14:21:34 +01:00
Christian Mäder
8664e42233 Revert "Fix #179 'libc not found'"
This reverts commit feb810ab27.
2019-11-26 11:40:10 +01:00
Christian Mäder
7942e9edbe Remove the named user, change permissions to 'g+w' 2019-11-26 11:24:12 +01:00
Christian Mäder
01c4137dc9 Adds netbox user 2019-11-26 11:24:12 +01:00
Christian Mäder
caaa68234c Adds more labels to the Dockerfile
It also updates the README and the bug_report template to reflect
the changes. Additionally, in the README some relevant shields from
shields.io are added.

The labels follow [label-schema.org][lsorg] and the [OpenContainer
image spec, section annotations][ocis], specifications.

[lsorg]: http://label-schema.org/rc1/
[ocis]: https://github.com/opencontainers/image-spec/blob/master/annotations.md
2019-11-17 17:13:29 +01:00
Tobias Genannt
feb810ab27 Fix #179 'libc not found'
Gunicorn version 20 crashes in this docker image. So for now use a
version <20.
2019-11-11 08:53:11 +01:00
Tobias Genannt
f9662a1e4b Optimize pip install command
As mentioned by @sdktr the "--install-option" is redundant. The added
"--no-warn-script-location" is used to silence warnings when installing
into a directory that is not on $PATH.
2019-10-31 10:11:33 +01:00
Tobias Genannt
e3f632d77f Fixes #170 - "drf-yasg" installed into wrong dir
With the new multistage build the pip install command put some packages
in the wrong directory. This resuled in them not being copied into the
runtime images. This commit add the additional "--prefix" option to the
install command. After that all test run and we no longer get the error
"ModuleNotFoundError: No module named 'drf_yasg'".
2019-10-24 17:02:23 +02:00
Nguyễn Trọng Vĩnh
eb0f704ebe Remove trailing space in Dockerfile 2019-10-23 11:46:26 +07:00
Christian Mäder
20109c3392 Checkout the repository with git
This changes the build process even further. Instead
f using `wget` to fetch the current code, `git` is used.
This allows for faster switching between branches,
because only the differences between them have to be
fetched from the server.

But the main advantage is that the build cache can
finally be used as designed by Docker. Repetitive
builds are very fast now. This is also true between
branches and tags, as long as the `requirements.txt`
file doesn't change.
2019-10-15 00:34:15 +02:00
Christian Mäder
f3b9c34e3b externalize netbox download with wget 2019-10-15 00:34:15 +02:00
Christian Mäder
d0ebb34432 Refactor to multistage builds
This commit introduces a huge change in the build process.

What changed:

- Dockerfile.ldap was integrated into Dockerfile as a seperate
  [build stage][multistage-build].
- All the build scripts were refactored according to this.
- The `docker-compose.yml` file was adjusted likewise.
- The main build script, `/build.sh`, now always builds all
  targets (formerly called variants).
- The minimal requirements for Docker and docker-compose
  have increased.
- The build on hub.docker.com must be adjusted.

This change should also fix #156 permanently.

[multistage-build]: https://docs.docker.com/develop/develop-images/multistage-build/
2019-10-15 00:34:15 +02:00
takumin
7f22d21d5d fix AttributeError for ruamel.yaml 2019-07-30 20:09:02 +09:00
Tobias Genannt
135d29e06f Update base image
This updates the base image to Alpine 3.10 with Python 3.7
2019-07-05 08:22:25 +02:00
Christian Mäder
dc3db2d9fd %s/digitalocean/netbox-community/gi
Thank you Digitalocean for sponsoring Netbox!
And thank you for letting it grow up and move out ;)
2019-07-02 21:32:58 +02:00
Christian Mäder
dfd30f5eae Explain caching strategy in Dockerfile comments 2019-06-12 17:53:35 +02:00
Robert Ellegate
a086c2fc22
Changing REF_URL to use HEAD/TAG agnostic API
Per [dicsuccion](https://github.com/netbox-community/netbox-docker/pull/137#issuecomment-495667921) with @cimnine, changing the API endpoint to one that retains functionality of previous URL while supporting both HEADS and TAGS
2019-05-28 10:45:10 -04:00
Robert Ellegate
e33a2d2c0a
Adding REF to GitHub repo HEAD for cache busting
After installing requirements, check if  HEAD has changed and bust cache for RUN instruction for wget  archive
2019-05-23 11:20:39 -04:00
Christian Mäder
821fb5f36e Caching of requirements.txt
After [a discussion][1] with rje6459 on the networktocode Slack
in the #netbox-docker channel we've come up with a small improvement
to those that regularly have to build netbox docker locally.

It fetches the "requirements.txt" from the desired branch before
downloading netbox itself.

[1]: https://networktocode.slack.com/archives/CD23LP8BC/p1558537080023200
2019-05-22 18:05:54 +02:00
Christian Mäder
6c3db3deff Update django to 2.2 2019-05-09 09:57:01 +02:00
Christian Mäder
582064f4cd
Loosen version pinning for Django
This change is in accordance with https://github.com/digitalocean/netbox/issues/2808
2019-02-22 13:52:37 +01:00
Tobias Genannt
2450a70ca8 Update Alpine
This updates to the newest stable version (Alpine 3.9)
2019-02-21 15:30:40 +01:00
Tobias Genannt
ab72ba10c2 Update Alpine
This updates to the newest stable version (Alpine 3.8)
2018-09-14 09:43:09 +02:00
Christian Mäder
2b3f831749
Don't lock Django to explicit version
... but rather use the same definition that is currently used in
Netbox's `requirements.txt`.
2018-08-14 10:08:34 -07:00
Christian Mäder
013f81b791
♻️ Make netbox-worker it's own container
One container should ideally have one responsibility [1]. Therefore I
implemented the netbox-worker to start in it's own container. This is
possible, because netbox and the worker communicate via redis anyway.

They still use the same image underneath, just the "command" they
execute while starting different.

Or in other words: I see no reason to introduce supervisord, when we
already have docker-compose which can take care of running multiple
processes.

Also, here's another benefit: Now it's possible to view the logs of the
webhook worker independently of the other netbox logs (and vice-versa).

Other changes in this commit:
* I don't see a reason to put a password for Redis in the docker-compose
  setup, so I removed it.
* Slightly changed the nginx config, so that the nginx startup command
  becomes simpler and any error should be visible in the docker log.
* Some housekeeping in the `Dockerfile`.
* Added some troubleshooting advice regarding webhooks to the README.

I'd like to thank Brady (@bdlamprecht [2]) here who did the harder
work of figuring out what's even required to have webhooks working. [3]

[1] 
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#decouple-applications
[2] https://github.com/bdlamprecht
[3] https://github.com/ninech/netbox-docker/pull/90
2018-08-13 14:04:09 -07:00
Brady Lamprecht
b88974ef9f Working implementation of webhooks using new 'redis' container 2018-08-10 17:55:09 -06:00
Tobias Genannt
5e5cc13a05 Update to Alpine 3.7
Because the tag "python:3.6-alpine" points to Alpine 3.4 which is now
end of life (as of 2018-05-01) the image now pulls the Alpine 3.7 python
image
2018-05-09 09:52:33 +02:00
Tobias Genannt
b46bd58e0a
Move config to /etc/netbox/config (Fixes #54)
With this the configuration is moved to /etc/netbox/config and the
default reports directory is set to /etc/netbox/reports. This enables
the user to mount reports from a config map or persistent volume in
OpenShift.
2018-04-04 10:13:30 +02:00
Christian Mäder
f56a79381b
Introduces a Netbox Docker project version 2018-04-04 09:44:58 +02:00
Brady Lamprecht
07b1b4675c
Adding in support for NAPALM 2018-03-08 09:38:43 +01:00
Tobias Genannt
2a1b6e42a8 Externalize gunicorn-config
This moves the gunicorn_config.py into /etc/netbox so that it can be
easily mapped through a Openshift config map
2018-03-07 14:57:56 +01:00