mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Closes #1008: Moved Docker components into their own repository
This commit is contained in:
parent
a98c9ed0af
commit
864fa17b75
20
Dockerfile
20
Dockerfile
@ -1,20 +0,0 @@
|
|||||||
FROM python:2.7-wheezy
|
|
||||||
|
|
||||||
WORKDIR /opt/netbox
|
|
||||||
|
|
||||||
ARG BRANCH=v2-beta
|
|
||||||
ARG URL=https://github.com/digitalocean/netbox.git
|
|
||||||
RUN git clone --depth 1 $URL -b $BRANCH . && \
|
|
||||||
apt-get update -qq && apt-get install -y libldap2-dev libsasl2-dev libssl-dev graphviz && \
|
|
||||||
pip install gunicorn==17.5 && \
|
|
||||||
pip install django-auth-ldap && \
|
|
||||||
pip install -r requirements.txt
|
|
||||||
|
|
||||||
ADD docker/docker-entrypoint.sh /docker-entrypoint.sh
|
|
||||||
ADD netbox/netbox/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
|
||||||
|
|
||||||
ADD docker/gunicorn_config.py /opt/netbox/
|
|
||||||
ADD docker/nginx.conf /etc/netbox-nginx/
|
|
||||||
VOLUME ["/etc/netbox-nginx/"]
|
|
@ -29,5 +29,5 @@ Please see [the documentation](http://netbox.readthedocs.io/en/stable/) for inst
|
|||||||
|
|
||||||
## Alternative Installations
|
## Alternative Installations
|
||||||
|
|
||||||
* [Docker container](http://netbox.readthedocs.io/en/stable/installation/docker/)
|
* [Docker container](https://github.com/digitalocean/netbox-docker)
|
||||||
* [Heroku deployment](https://heroku.com/deploy?template=https://github.com/BILDQUADRAT/netbox/tree/heroku) (via [@mraerino](https://github.com/BILDQUADRAT/netbox/tree/heroku))
|
* [Heroku deployment](https://heroku.com/deploy?template=https://github.com/BILDQUADRAT/netbox/tree/heroku) (via [@mraerino](https://github.com/BILDQUADRAT/netbox/tree/heroku))
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
version: '2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:9.6
|
|
||||||
container_name: postgres
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: netbox
|
|
||||||
POSTGRES_PASSWORD: J5brHrAXFLQSif0K
|
|
||||||
POSTGRES_DB: netbox
|
|
||||||
netbox:
|
|
||||||
build: .
|
|
||||||
image: digitalocean/netbox
|
|
||||||
links:
|
|
||||||
- postgres
|
|
||||||
container_name: netbox
|
|
||||||
depends_on:
|
|
||||||
- postgres
|
|
||||||
environment:
|
|
||||||
SUPERUSER_NAME: admin
|
|
||||||
SUPERUSER_EMAIL: admin@example.com
|
|
||||||
SUPERUSER_PASSWORD: admin
|
|
||||||
ALLOWED_HOSTS: localhost
|
|
||||||
DB_NAME: netbox
|
|
||||||
DB_USER: netbox
|
|
||||||
DB_PASSWORD: J5brHrAXFLQSif0K
|
|
||||||
DB_HOST: postgres
|
|
||||||
SECRET_KEY: r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj
|
|
||||||
EMAIL_SERVER: localhost
|
|
||||||
EMAIL_PORT: 25
|
|
||||||
EMAIL_USERNAME: foo
|
|
||||||
EMAIL_PASSWORD: bar
|
|
||||||
EMAIL_TIMEOUT: 10
|
|
||||||
EMAIL_FROM: netbox@bar.com
|
|
||||||
NETBOX_USERNAME: guest
|
|
||||||
NETBOX_PASSWORD: guest
|
|
||||||
volumes:
|
|
||||||
- netbox-static-files:/opt/netbox/netbox/static
|
|
||||||
nginx:
|
|
||||||
image: nginx:1.11.1-alpine
|
|
||||||
links:
|
|
||||||
- netbox
|
|
||||||
container_name: nginx
|
|
||||||
command: nginx -g 'daemon off;' -c /etc/netbox-nginx/nginx.conf
|
|
||||||
depends_on:
|
|
||||||
- netbox
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
volumes_from:
|
|
||||||
- netbox
|
|
||||||
volumes:
|
|
||||||
netbox-static-files:
|
|
||||||
driver: local
|
|
@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# run db migrations (retry on error)
|
|
||||||
while ! /opt/netbox/netbox/manage.py migrate 2>&1; do
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
# create superuser silently
|
|
||||||
if [[ -z ${SUPERUSER_NAME} || -z ${SUPERUSER_EMAIL} || -z ${SUPERUSER_PASSWORD} ]]; then
|
|
||||||
SUPERUSER_NAME='admin'
|
|
||||||
SUPERUSER_EMAIL='admin@example.com'
|
|
||||||
SUPERUSER_PASSWORD='admin'
|
|
||||||
echo "Using defaults: Username: ${SUPERUSER_NAME}, E-Mail: ${SUPERUSER_EMAIL}, Password: ${SUPERUSER_PASSWORD}"
|
|
||||||
fi
|
|
||||||
echo "from django.contrib.auth.models import User; User.objects.create_superuser('${SUPERUSER_NAME}', '${SUPERUSER_EMAIL}', '${SUPERUSER_PASSWORD}')" | python /opt/netbox/netbox/manage.py shell
|
|
||||||
|
|
||||||
# copy static files
|
|
||||||
/opt/netbox/netbox/manage.py collectstatic --no-input
|
|
||||||
|
|
||||||
# start unicorn
|
|
||||||
gunicorn --log-level debug --debug --error-logfile /dev/stderr --log-file /dev/stdout -c /opt/netbox/gunicorn_config.py netbox.wsgi
|
|
@ -1,5 +0,0 @@
|
|||||||
command = '/usr/bin/gunicorn'
|
|
||||||
pythonpath = '/opt/netbox/netbox'
|
|
||||||
bind = '0.0.0.0:8001'
|
|
||||||
workers = 3
|
|
||||||
user = 'root'
|
|
@ -1,35 +0,0 @@
|
|||||||
worker_processes 1;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
sendfile on;
|
|
||||||
tcp_nopush on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
gzip on;
|
|
||||||
server_tokens off;
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
access_log off;
|
|
||||||
|
|
||||||
location /static/ {
|
|
||||||
alias /opt/netbox/netbox/static/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://netbox:8001;
|
|
||||||
proxy_set_header X-Forwarded-Host $server_name;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
This guide demonstrates how to build and run NetBox as a Docker container. It assumes that the latest versions of [Docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/) are already installed in your host.
|
|
||||||
|
|
||||||
# Quickstart
|
|
||||||
|
|
||||||
To get NetBox up and running:
|
|
||||||
|
|
||||||
```no-highlight
|
|
||||||
# git clone -b master https://github.com/digitalocean/netbox.git
|
|
||||||
# cd netbox
|
|
||||||
# docker-compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
The application will be available on http://localhost/ after a few minutes.
|
|
||||||
|
|
||||||
Default credentials:
|
|
||||||
|
|
||||||
* Username: **admin**
|
|
||||||
* Password: **admin**
|
|
||||||
|
|
||||||
# Configuration
|
|
||||||
|
|
||||||
You can configure the app at runtime using variables (see `docker-compose.yml`). Possible environment variables include:
|
|
||||||
|
|
||||||
* SUPERUSER_NAME
|
|
||||||
* SUPERUSER_EMAIL
|
|
||||||
* SUPERUSER_PASSWORD
|
|
||||||
* ALLOWED_HOSTS
|
|
||||||
* DB_NAME
|
|
||||||
* DB_USER
|
|
||||||
* DB_PASSWORD
|
|
||||||
* DB_HOST
|
|
||||||
* DB_PORT
|
|
||||||
* SECRET_KEY
|
|
||||||
* EMAIL_SERVER
|
|
||||||
* EMAIL_PORT
|
|
||||||
* EMAIL_USERNAME
|
|
||||||
* EMAIL_PASSWORD
|
|
||||||
* EMAIL_TIMEOUT
|
|
||||||
* EMAIL_FROM
|
|
||||||
* LOGIN_REQUIRED
|
|
||||||
* MAINTENANCE_MODE
|
|
||||||
* NETBOX_USERNAME
|
|
||||||
* NETBOX_PASSWORD
|
|
||||||
* PAGINATE_COUNT
|
|
||||||
* TIME_ZONE
|
|
||||||
* DATE_FORMAT
|
|
||||||
* SHORT_DATE_FORMAT
|
|
||||||
* TIME_FORMAT
|
|
||||||
* SHORT_TIME_FORMAT
|
|
||||||
* DATETIME_FORMAT
|
|
||||||
* SHORT_DATETIME_FORMAT
|
|
@ -8,7 +8,6 @@ pages:
|
|||||||
- 'Web Server': 'installation/web-server.md'
|
- 'Web Server': 'installation/web-server.md'
|
||||||
- 'LDAP (Optional)': 'installation/ldap.md'
|
- 'LDAP (Optional)': 'installation/ldap.md'
|
||||||
- 'Upgrading': 'installation/upgrading.md'
|
- 'Upgrading': 'installation/upgrading.md'
|
||||||
- 'Alternate Install: Docker': 'installation/docker.md'
|
|
||||||
- 'Configuration':
|
- 'Configuration':
|
||||||
- 'Mandatory Settings': 'configuration/mandatory-settings.md'
|
- 'Mandatory Settings': 'configuration/mandatory-settings.md'
|
||||||
- 'Optional Settings': 'configuration/optional-settings.md'
|
- 'Optional Settings': 'configuration/optional-settings.md'
|
||||||
|
Loading…
Reference in New Issue
Block a user