Merge branch 'master' into Enable-uploading-of-images

This commit is contained in:
Christian Mäder 2017-12-01 17:32:25 +01:00 committed by GitHub
commit 0dd34f3147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 12 deletions

View File

@ -6,6 +6,7 @@ RUN apk add --no-cache \
ca-certificates \ ca-certificates \
cyrus-sasl-dev \ cyrus-sasl-dev \
graphviz \ graphviz \
ttf-ubuntu-font-family \
jpeg-dev \ jpeg-dev \
libffi-dev \ libffi-dev \
libxml2-dev \ libxml2-dev \

View File

@ -12,6 +12,7 @@ To get NetBox up and running:
``` ```
$ git clone -b master https://github.com/ninech/netbox-docker.git $ git clone -b master https://github.com/ninech/netbox-docker.git
$ cd netbox-docker $ cd netbox-docker
$ docker-compose pull
$ docker-compose up -d $ docker-compose up -d
``` ```
@ -29,10 +30,14 @@ $ open "http://$(docker-compose port nginx 80)/"
$ xdg-open "http://$(docker-compose port nginx 80)/" &>/dev/null & $ xdg-open "http://$(docker-compose port nginx 80)/" &>/dev/null &
``` ```
Alternatively, use something like [Reception](https://github.com/ninech/reception) to
connect to _docker-compose_ projects.
Default credentials: Default credentials:
* Username: **admin** * Username: **admin**
* Password: **admin** * Password: **admin**
* API Token: **0123456789abcdef0123456789abcdef01234567**
## Dependencies ## Dependencies
@ -55,7 +60,7 @@ To use this feature, set the environment-variable `VERSION` before launching `do
[any tag of the `ninech/netbox` Docker image](https://hub.docker.com/r/ninech/netbox/tags/). [any tag of the `ninech/netbox` Docker image](https://hub.docker.com/r/ninech/netbox/tags/).
``` ```
$ export VERSION=v2.2.1 $ export VERSION=v2.2.6
$ docker-compose pull netbox $ docker-compose pull netbox
$ docker-compose up -d $ docker-compose up -d
``` ```

View File

@ -1,30 +1,40 @@
#!/bin/bash #!/bin/bash
set -e set -e
# run db migrations (retry on error) # wait shortly and then run db migrations (retry on error)
while ! ./manage.py migrate 2>&1; do while ! ./manage.py migrate 2>&1; do
sleep 5 echo "⏳ Waiting on DB..."
sleep 3
done done
# create superuser silently # create superuser silently
if [[ -z ${SUPERUSER_NAME} || -z ${SUPERUSER_EMAIL} || -z ${SUPERUSER_PASSWORD} ]]; then if [[ -z ${SUPERUSER_NAME} ]]; then
SUPERUSER_NAME='admin' 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 fi
if [[ -z ${SUPERUSER_EMAIL} ]]; then
SUPERUSER_EMAIL='admin@example.com'
fi
if [[ -z ${SUPERUSER_PASSWORD} ]]; then
SUPERUSER_PASSWORD='admin'
fi
if [[ -z ${SUPERUSER_API_TOKEN} ]]; then
SUPERUSER_API_TOKEN='0123456789abcdef0123456789abcdef01234567'
fi
echo "💡 Username: ${SUPERUSER_NAME}, E-Mail: ${SUPERUSER_EMAIL}, Password: ${SUPERUSER_PASSWORD}, Token: ${SUPERUSER_API_TOKEN}"
./manage.py shell --plain << END ./manage.py shell --plain << END
from django.contrib.auth.models import User from django.contrib.auth.models import User
from users.models import Token
if not User.objects.filter(username='${SUPERUSER_NAME}'): if not User.objects.filter(username='${SUPERUSER_NAME}'):
User.objects.create_superuser('${SUPERUSER_NAME}', '${SUPERUSER_EMAIL}', '${SUPERUSER_PASSWORD}') u=User.objects.create_superuser('${SUPERUSER_NAME}', '${SUPERUSER_EMAIL}', '${SUPERUSER_PASSWORD}')
Token.objects.create(user=u, key='${SUPERUSER_API_TOKEN}')
END END
# copy static files # copy static files
./manage.py collectstatic --no-input ./manage.py collectstatic --no-input
echo "✅ Initialisation is done. Launching CMD:" echo "✅ Initialisation is done."
echo "exec ${@}"
# launch whatever is passed by docker via RUN # launch whatever is passed by docker via RUN
exec ${@} exec ${@}

View File

@ -1,7 +1,8 @@
SUPERUSER_NAME=admin SUPERUSER_NAME=admin
SUPERUSER_EMAIL=admin@example.com SUPERUSER_EMAIL=admin@example.com
SUPERUSER_PASSWORD=admin SUPERUSER_PASSWORD=admin
ALLOWED_HOSTS=localhost SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567
ALLOWED_HOSTS=localhost 0.0.0.0 127.0.0.1 [::1] netbox nginx netboxdocker.docker nginx.netboxdocker.docker
DB_NAME=netbox DB_NAME=netbox
DB_USER=netbox DB_USER=netbox
DB_PASSWORD=J5brHrAXFLQSif0K DB_PASSWORD=J5brHrAXFLQSif0K