Update project scaffolding

* Use nginx for static files
* Add netbox to docker-compose
* Lint source code
* Update nginx.conf to actually work
* Build a base `branch` tag for latest of that branch
This commit is contained in:
Marco Ceppi 2019-10-08 11:01:06 -04:00
parent 0c107767e3
commit 67cc069857
7 changed files with 53 additions and 21 deletions

View File

@ -92,6 +92,9 @@ spec:
changeRequest() changeRequest()
} }
} }
environment {
BASE_TAG = getSafeBranchName()
}
agent { agent {
label 'docker-build' label 'docker-build'
} }
@ -107,8 +110,10 @@ spec:
--build-arg BRANCH=${BRANCH_NAME} \ --build-arg BRANCH=${BRANCH_NAME} \
-t ${IMAGE}:${TAG} -t ${IMAGE}:${TAG}
''' '''
sh 'docker tag ${IMAGE}:${TAG} ${IMAGE}:${BASE_TAG}'
withDockerRegistry(registry: [credentialsId: 'vio-docker-hub']) { withDockerRegistry(registry: [credentialsId: 'vio-docker-hub']) {
sh "docker push ${env.IMAGE}:${env.TAG}" sh "docker push ${env.IMAGE}:${env.TAG}"
sh "docker push ${env.IMAGE}:${env.BASE_TAG}"
} }
} }
} }

View File

@ -69,7 +69,6 @@ RUN wget -q -O - "${URL}" | tar xz \
COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
COPY docker/configuration/gunicorn_config.py /etc/netbox/config/ COPY docker/configuration/gunicorn_config.py /etc/netbox/config/
COPY docker/nginx.conf /etc/netbox-nginx/nginx.conf
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
COPY docker/startup_scripts/ /opt/netbox/startup_scripts/ COPY docker/startup_scripts/ /opt/netbox/startup_scripts/
COPY docker/initializers/ /opt/netbox/initializers/ COPY docker/initializers/ /opt/netbox/initializers/

View File

@ -1,12 +1,38 @@
version: '2' version: '3'
services: services:
postgres: postgres:
image: "postgres:9.6" image: "postgres:9.6"
environment: environment:
POSTGRES_PASSWORD: "12345" POSTGRES_PASSWORD: "12345"
POSTGRES_DB: netbox
ports: ports:
- 5432:5432 - 5432:5432
redis: redis:
image: "redis" image: "redis"
nginx:
image: "nginx"
volumes:
- "static:/opt/netbox/netbox/static"
- "./docker/nginx.conf:/etc/nginx/nginx.conf"
ports: ports:
- 6379:6379 - 8000:80
netbox:
image: "vaporio/netbox:develop.5"
environment:
SECRET_KEY: secret
DB_HOST: postgres
DB_USER: postgres
DB_PASSWORD: "12345"
ALLOWED_HOSTS: "*"
REDIS_HOST: redis
depends_on:
- redis
- postgres
volumes:
- "./netbox:/opt/netbox/netbox"
- "static:/opt/netbox/netbox/static"
- "./docker/configuration.docker.py:/opt/netbox/netbox/netbox/configuration.py"
- "./docker/startup_scripts/:/opt/netbox/startup_scripts"
- "./docker/initializers/:/opt/netbox/initializers"
volumes:
static:

View File

@ -1,4 +1,3 @@
daemon off;
worker_processes 1; worker_processes 1;
error_log /dev/stderr info; error_log /dev/stderr info;
@ -18,7 +17,7 @@ http {
client_max_body_size 10M; client_max_body_size 10M;
server { server {
listen 8080; listen 80;
access_log off; access_log off;
location /static/ { location /static/ {

View File

@ -8,6 +8,9 @@ description=
run tests with django. run tests with django.
deps= deps=
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
pycodestyle
tblib
changedir = netbox changedir = netbox
commands= commands=
pycodestyle --ignore=W504,E501 .
python manage.py test --failfast --noinput --parallel 5 --no-color python manage.py test --failfast --noinput --parallel 5 --no-color