diff options
author | maxbr <maxbr@mi.fu-berlin.de> | 2016-09-26 16:36:11 +0200 |
---|---|---|
committer | maxbr <maxbr@mi.fu-berlin.de> | 2016-09-26 16:36:11 +0200 |
commit | ff30b14a212f38cf59084d30e9f13f9f92d2be3b (patch) | |
tree | cbe10ef00ef2be5650bedb5b81e24bd3b205f52c /tools | |
parent | 3ebfdcbcc91202482edb3f63fedde48646728fcd (diff) |
Restructure dashboard project for docker deploying
Change-Id: I13cad51270504ee4bed8558598a8891af58a26ab
Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/pharos-dashboard/.gitignore | 12 | ||||
-rw-r--r-- | tools/pharos-dashboard/Makefile | 35 | ||||
-rw-r--r-- | tools/pharos-dashboard/celerybeat-schedule | bin | 16384 -> 0 bytes | |||
-rw-r--r-- | tools/pharos-dashboard/config.env.sample | 18 | ||||
-rw-r--r-- | tools/pharos-dashboard/config/nginx/pharos_dashboard.conf | 24 | ||||
-rwxr-xr-x | tools/pharos-dashboard/config/postgres/docker-entrypoint-initdb.d/pharos_dashboard.sh | 14 | ||||
-rw-r--r-- | tools/pharos-dashboard/deploy.org | 45 | ||||
-rw-r--r-- | tools/pharos-dashboard/docker-compose.yml | 69 | ||||
-rw-r--r-- | tools/pharos-dashboard/readme.txt | 35 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/__init__.py (renamed from tools/pharos-dashboard/account/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/admin.py (renamed from tools/pharos-dashboard/account/admin.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/apps.py (renamed from tools/pharos-dashboard/account/apps.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/forms.py (renamed from tools/pharos-dashboard/account/forms.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/jira_util.py (renamed from tools/pharos-dashboard/account/jira_util.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/middleware.py (renamed from tools/pharos-dashboard/account/middleware.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/migrations/__init__.py (renamed from tools/pharos-dashboard/account/migrations/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/models.py (renamed from tools/pharos-dashboard/account/models.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/rsa.pem (renamed from tools/pharos-dashboard/account/rsa.pem) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/rsa.pub (renamed from tools/pharos-dashboard/account/rsa.pub) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/tests/__init__.py (renamed from tools/pharos-dashboard/account/tests/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/tests/test_general.py (renamed from tools/pharos-dashboard/account/tests/test_general.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/urls.py (renamed from tools/pharos-dashboard/account/urls.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/account/views.py (renamed from tools/pharos-dashboard/account/views.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/api/__init__.py (renamed from tools/pharos-dashboard/api/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/api/serializers.py (renamed from tools/pharos-dashboard/api/serializers.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/api/urls.py (renamed from tools/pharos-dashboard/api/urls.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/api/views.py (renamed from tools/pharos-dashboard/api/views.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/__init__.py (renamed from tools/pharos-dashboard/booking/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/admin.py (renamed from tools/pharos-dashboard/booking/admin.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/apps.py (renamed from tools/pharos-dashboard/booking/apps.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/forms.py (renamed from tools/pharos-dashboard/booking/forms.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/migrations/__init__.py (renamed from tools/pharos-dashboard/booking/migrations/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/models.py (renamed from tools/pharos-dashboard/booking/models.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/tests/__init__.py (renamed from tools/pharos-dashboard/booking/tests/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/tests/test_models.py (renamed from tools/pharos-dashboard/booking/tests/test_models.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/tests/test_views.py (renamed from tools/pharos-dashboard/booking/tests/test_views.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/urls.py (renamed from tools/pharos-dashboard/booking/urls.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/booking/views.py (renamed from tools/pharos-dashboard/booking/views.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/__init__.py (renamed from tools/pharos-dashboard/dashboard/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/admin.py (renamed from tools/pharos-dashboard/dashboard/admin.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/apps.py (renamed from tools/pharos-dashboard/dashboard/apps.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/fixtures/dashboard.json (renamed from tools/pharos-dashboard/dashboard/fixtures/dashboard.json) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/migrations/__init__.py (renamed from tools/pharos-dashboard/dashboard/migrations/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/models.py (renamed from tools/pharos-dashboard/dashboard/models.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/tasks.py (renamed from tools/pharos-dashboard/dashboard/tasks.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/templatetags/__init__.py (renamed from tools/pharos-dashboard/dashboard/templatetags/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/templatetags/jenkins_filters.py (renamed from tools/pharos-dashboard/dashboard/templatetags/jenkins_filters.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/templatetags/jira_filters.py (renamed from tools/pharos-dashboard/dashboard/templatetags/jira_filters.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/urls.py (renamed from tools/pharos-dashboard/dashboard/urls.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/dashboard/views.py (renamed from tools/pharos-dashboard/dashboard/views.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/jenkins/__init__.py (renamed from tools/pharos-dashboard/jenkins/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/jenkins/adapter.py (renamed from tools/pharos-dashboard/jenkins/adapter.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/jenkins/admin.py | 17 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/jenkins/apps.py (renamed from tools/pharos-dashboard/jenkins/apps.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/jenkins/migrations/__init__.py (renamed from tools/pharos-dashboard/jenkins/migrations/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/jenkins/models.py (renamed from tools/pharos-dashboard/jenkins/models.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/jenkins/tasks.py (renamed from tools/pharos-dashboard/jenkins/tasks.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/jenkins/tests.py (renamed from tools/pharos-dashboard/jenkins/tests.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/manage.py (renamed from tools/pharos-dashboard/manage.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification/__init__.py (renamed from tools/pharos-dashboard/notification/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification/admin.py (renamed from tools/pharos-dashboard/notification/admin.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification/apps.py (renamed from tools/pharos-dashboard/notification/apps.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification/migrations/__init__.py (renamed from tools/pharos-dashboard/notification_framework/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification/models.py (renamed from tools/pharos-dashboard/notification/models.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification/signals.py (renamed from tools/pharos-dashboard/notification/signals.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification/tasks.py (renamed from tools/pharos-dashboard/notification/tasks.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification_framework/__init__.py | 10 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/notification_framework/notification.py (renamed from tools/pharos-dashboard/notification_framework/notification.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/pharos_dashboard/__init__.py (renamed from tools/pharos-dashboard/pharos_dashboard/__init__.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/pharos_dashboard/celery.py (renamed from tools/pharos-dashboard/pharos_dashboard/celery.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/pharos_dashboard/settings.py | 176 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/pharos_dashboard/urls.py (renamed from tools/pharos-dashboard/pharos_dashboard/urls.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/pharos_dashboard/wsgi.py (renamed from tools/pharos-dashboard/pharos_dashboard/wsgi.py) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/static/bower.json (renamed from tools/pharos-dashboard/static/bower.json) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/static/css/theme.css (renamed from tools/pharos-dashboard/static/css/theme.css) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/static/js/booking-calendar.js (renamed from tools/pharos-dashboard/static/js/booking-calendar.js) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/static/js/dataTables-sort.js (renamed from tools/pharos-dashboard/static/js/dataTables-sort.js) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/static/js/datetimepicker-options.js (renamed from tools/pharos-dashboard/static/js/datetimepicker-options.js) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/static/js/flot-pie-chart.js (renamed from tools/pharos-dashboard/static/js/flot-pie-chart.js) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/static/js/fullcalendar-options.js (renamed from tools/pharos-dashboard/static/js/fullcalendar-options.js) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/account/user_list.html (renamed from tools/pharos-dashboard/templates/account/user_list.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/account/userprofile_update_form.html (renamed from tools/pharos-dashboard/templates/account/userprofile_update_form.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/base.html (renamed from tools/pharos-dashboard/templates/base.html) | 5 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/booking/booking_calendar.html (renamed from tools/pharos-dashboard/templates/booking/booking_calendar.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/booking/booking_detail.html (renamed from tools/pharos-dashboard/templates/booking/booking_detail.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/booking/booking_table.html (renamed from tools/pharos-dashboard/templates/booking/booking_table.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/dashboard/ci_pods.html (renamed from tools/pharos-dashboard/templates/dashboard/ci_pods.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/dashboard/dev_pods.html (renamed from tools/pharos-dashboard/templates/dashboard/dev_pods.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/dashboard/jenkins_slaves.html (renamed from tools/pharos-dashboard/templates/dashboard/jenkins_slaves.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/dashboard/resource.html (renamed from tools/pharos-dashboard/templates/dashboard/resource.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/dashboard/resource_all.html (renamed from tools/pharos-dashboard/templates/dashboard/resource_all.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/dashboard/resource_detail.html (renamed from tools/pharos-dashboard/templates/dashboard/resource_detail.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/dashboard/server_table.html (renamed from tools/pharos-dashboard/templates/dashboard/server_table.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/dashboard/table.html (renamed from tools/pharos-dashboard/templates/dashboard/table.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/layout.html (renamed from tools/pharos-dashboard/templates/layout.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/src/templates/rest_framework/api.html (renamed from tools/pharos-dashboard/templates/rest_framework/api.html) | 0 | ||||
-rw-r--r-- | tools/pharos-dashboard/web/Dockerfile | 7 | ||||
-rw-r--r-- | tools/pharos-dashboard/web/requirements.txt | 16 | ||||
-rw-r--r-- | tools/pharos-dashboard/worker/Dockerfile | 8 | ||||
-rw-r--r-- | tools/pharos-dashboard/worker/requirements.txt | 16 |
100 files changed, 455 insertions, 52 deletions
diff --git a/tools/pharos-dashboard/.gitignore b/tools/pharos-dashboard/.gitignore index 2b73909a..4154fdd3 100644 --- a/tools/pharos-dashboard/.gitignore +++ b/tools/pharos-dashboard/.gitignore @@ -19,8 +19,9 @@ coverage.xml # Django: *.log *.pot -migrations/ -settings.py + +# Celery +celerybeat-schedule.db # KDE: .directory @@ -36,3 +37,10 @@ venv/ # Bower Components: bower_components/ + +# Production settings +config.env + +# rsa key files +rsa.pem +rsa.pub diff --git a/tools/pharos-dashboard/Makefile b/tools/pharos-dashboard/Makefile new file mode 100644 index 00000000..e52e15d2 --- /dev/null +++ b/tools/pharos-dashboard/Makefile @@ -0,0 +1,35 @@ +build: + docker-compose build + +up: + docker-compose up -d + +start: + docker-compose start + +stop: + docker-compose stop + +shell-nginx: + docker exec -ti ng01 bash + +shell-web: + docker exec -ti dg01 bash + +shell-db: + docker exec -ti ps01 bash + +log-nginx: + docker-compose logs nginx + +log-web: + docker-compose logs web + +log-ps: + docker-compose logs postgres + +log-rmq: + docker-compose logs rabbitmq + +log-worker: + docker-compose logs worker diff --git a/tools/pharos-dashboard/celerybeat-schedule b/tools/pharos-dashboard/celerybeat-schedule Binary files differdeleted file mode 100644 index 7e5fe853..00000000 --- a/tools/pharos-dashboard/celerybeat-schedule +++ /dev/null diff --git a/tools/pharos-dashboard/config.env.sample b/tools/pharos-dashboard/config.env.sample new file mode 100644 index 00000000..bd936164 --- /dev/null +++ b/tools/pharos-dashboard/config.env.sample @@ -0,0 +1,18 @@ +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG=False + +DB_NAME=sample_name +DB_USER=sample_user +DB_PASS=sample_pass +DB_SERVICE=postgres +DB_PORT=5432 + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY=http://www.miniwebtool.com/django-secret-key-generator/ + +OAUTH_CONSUMER_KEY=sample_key +OAUTH_CONSUMER_SECRET=sample_secret + +JIRA_URL=sample_url +JIRA_USER_NAME=sample_jira_user +JIRA_USER_PASSWORD=sample_jira_pass
\ No newline at end of file diff --git a/tools/pharos-dashboard/config/nginx/pharos_dashboard.conf b/tools/pharos-dashboard/config/nginx/pharos_dashboard.conf new file mode 100644 index 00000000..87b6f8e8 --- /dev/null +++ b/tools/pharos-dashboard/config/nginx/pharos_dashboard.conf @@ -0,0 +1,24 @@ +upstream web { + ip_hash; + server web:8000; +} + +# portal +server { + listen 80; + server_name localhost; + charset utf-8; + + location /static { + alias /static; + } + + location /media { + alias /media; + } + + location / { + proxy_set_header Host $host; + proxy_pass http://web/; + } +} diff --git a/tools/pharos-dashboard/config/postgres/docker-entrypoint-initdb.d/pharos_dashboard.sh b/tools/pharos-dashboard/config/postgres/docker-entrypoint-initdb.d/pharos_dashboard.sh new file mode 100755 index 00000000..526228a8 --- /dev/null +++ b/tools/pharos-dashboard/config/postgres/docker-entrypoint-initdb.d/pharos_dashboard.sh @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2016 Max Breitenfeldt and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +#!/bin/env bash + +psql -U postgres -c "CREATE USER $DB_USER PASSWORD '$DB_PASS'" +psql -U postgres -c "CREATE DATABASE $DB_NAME OWNER $DB_USER" diff --git a/tools/pharos-dashboard/deploy.org b/tools/pharos-dashboard/deploy.org deleted file mode 100644 index b8399215..00000000 --- a/tools/pharos-dashboard/deploy.org +++ /dev/null @@ -1,45 +0,0 @@ -* Database - -** Setup -- sudo -u postgres psql -- postgres=# CREATE DATABASE pharos_dashboard -- postgres=# CREATE USER opnfv WITH PASSWORD 'opnfvopnfv' -- postgres# createuser --interactive -- postgres# ALTER ROLE opnfv SET client_encoding TO 'utf8'; -- postgres# ALTER ROLE opnfv SET default_transaction_isolation TO 'read committed'; -- postgres# ALTER ROLE opnfv SET timezone TO 'UTC'; -- postgres# GRANT ALL PRIVILEGES ON DATABASE pharos_dashboard TO opnfv; - -** Dump data - -- log out all users, stop server -- (venv) # python manage.py dumpdata > dashboard/fixtures/<dump_name>.json - -** Load dump - -- setup clean database, run migrate -- (venv) # python manage.py loaddata <dump_name> - -* Django - -** Virtualenv setup - -- # virtualenv venv -- # source venv/bin/activate -- (venv) # pip install -r requirements.txt - -** initializing or after change in models.py - -- (venv) # python manage.py makemigrations -- (venv) # python manage.py migrate - -** Development - -- (venv) # python manage.py runserver -- (venv) # python manage.py shell - -* Dependencies - -Javascript / CSS dependencies are managed with bower. To install them, you have to install bower, switch directory to the dashboard/static folder and run -# bower install -Bower will download and install the right versions of all the static files. diff --git a/tools/pharos-dashboard/docker-compose.yml b/tools/pharos-dashboard/docker-compose.yml new file mode 100644 index 00000000..00a8d151 --- /dev/null +++ b/tools/pharos-dashboard/docker-compose.yml @@ -0,0 +1,69 @@ +############################################################################## +# Copyright (c) 2016 Max Breitenfeldt and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +version: '2' +services: + nginx: + restart: always + image: nginx:latest + container_name: ng01 + ports: + - "80:80" + volumes: + - ./config/nginx:/etc/nginx/conf.d + - /var/lib/pharos_dashboard/static:/static + - /var/lib/pharos_dashboard/media:/media + depends_on: + - web + + web: + restart: always + build: ./web/ + container_name: dg01 + command: bash -c "python manage.py makemigrations && python manage.py migrate && python manage.py collectstatic --no-input && gunicorn pharos_dashboard.wsgi -b 0.0.0.0:8000" + depends_on: + - postgres + links: + - postgres + env_file: config.env + volumes: + - ./src:/src + - /var/lib/pharos_dashboard/static:/static + - /var/lib/pharos_dashboard/media:/media + expose: + - "8000" + + postgres: + restart: always + image: postgres:latest + container_name: ps01 + env_file: config.env + volumes: + - ./config/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d + - /var/lib/pharos_dashboard/postgresql:/var/lib/postgresql + + rabbitmq: + restart: always + image: rabbitmq:latest + container_name: rm01 + expose: + - "5672" + + worker: + restart: always + build: ./worker/ + command: bash -c "celery -A pharos_dashboard worker -l info -B" + env_file: config.env + links: + - postgres + - rabbitmq + volumes: + - ./src:/src +
\ No newline at end of file diff --git a/tools/pharos-dashboard/readme.txt b/tools/pharos-dashboard/readme.txt new file mode 100644 index 00000000..b21320f3 --- /dev/null +++ b/tools/pharos-dashboard/readme.txt @@ -0,0 +1,35 @@ +############################################################################## +# Copyright (c) 2016 Max Breitenfeldt and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +The dashboard is deployed using docker-compose. +Application / database files are saved in /var/lib/pharos_dashboard/. + +Deployment: + +- clone the repository +- complete the config.env.sample file and save it as config.env +- install docker, docker-compose and bower +- run 'bower install' in ./src/static/ to fetch javascript dependencies +- run 'make build' to build the containers +- run 'make up' to run the dashboard + +Updating: + +- make stop +- git pull +- run 'bower install' if javascript dependencies changed +- make build +- make start + +If there is migrations that need user input (like renaming a field), they need to be run manually! + +Logs / Shell access: + +- there is some shortcuts in the makefile
\ No newline at end of file diff --git a/tools/pharos-dashboard/account/__init__.py b/tools/pharos-dashboard/src/account/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/account/__init__.py +++ b/tools/pharos-dashboard/src/account/__init__.py diff --git a/tools/pharos-dashboard/account/admin.py b/tools/pharos-dashboard/src/account/admin.py index 18b2e1a8..18b2e1a8 100644 --- a/tools/pharos-dashboard/account/admin.py +++ b/tools/pharos-dashboard/src/account/admin.py diff --git a/tools/pharos-dashboard/account/apps.py b/tools/pharos-dashboard/src/account/apps.py index 9814648f..9814648f 100644 --- a/tools/pharos-dashboard/account/apps.py +++ b/tools/pharos-dashboard/src/account/apps.py diff --git a/tools/pharos-dashboard/account/forms.py b/tools/pharos-dashboard/src/account/forms.py index 7653e2b1..7653e2b1 100644 --- a/tools/pharos-dashboard/account/forms.py +++ b/tools/pharos-dashboard/src/account/forms.py diff --git a/tools/pharos-dashboard/account/jira_util.py b/tools/pharos-dashboard/src/account/jira_util.py index c333f8c4..c333f8c4 100644 --- a/tools/pharos-dashboard/account/jira_util.py +++ b/tools/pharos-dashboard/src/account/jira_util.py diff --git a/tools/pharos-dashboard/account/middleware.py b/tools/pharos-dashboard/src/account/middleware.py index 0f1dbd86..0f1dbd86 100644 --- a/tools/pharos-dashboard/account/middleware.py +++ b/tools/pharos-dashboard/src/account/middleware.py diff --git a/tools/pharos-dashboard/account/migrations/__init__.py b/tools/pharos-dashboard/src/account/migrations/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/account/migrations/__init__.py +++ b/tools/pharos-dashboard/src/account/migrations/__init__.py diff --git a/tools/pharos-dashboard/account/models.py b/tools/pharos-dashboard/src/account/models.py index 621f6697..621f6697 100644 --- a/tools/pharos-dashboard/account/models.py +++ b/tools/pharos-dashboard/src/account/models.py diff --git a/tools/pharos-dashboard/account/rsa.pem b/tools/pharos-dashboard/src/account/rsa.pem index dbd4eedd..dbd4eedd 100644 --- a/tools/pharos-dashboard/account/rsa.pem +++ b/tools/pharos-dashboard/src/account/rsa.pem diff --git a/tools/pharos-dashboard/account/rsa.pub b/tools/pharos-dashboard/src/account/rsa.pub index cc50e45e..cc50e45e 100644 --- a/tools/pharos-dashboard/account/rsa.pub +++ b/tools/pharos-dashboard/src/account/rsa.pub diff --git a/tools/pharos-dashboard/account/tests/__init__.py b/tools/pharos-dashboard/src/account/tests/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/account/tests/__init__.py +++ b/tools/pharos-dashboard/src/account/tests/__init__.py diff --git a/tools/pharos-dashboard/account/tests/test_general.py b/tools/pharos-dashboard/src/account/tests/test_general.py index 72e7ea11..72e7ea11 100644 --- a/tools/pharos-dashboard/account/tests/test_general.py +++ b/tools/pharos-dashboard/src/account/tests/test_general.py diff --git a/tools/pharos-dashboard/account/urls.py b/tools/pharos-dashboard/src/account/urls.py index 3962a0c6..3962a0c6 100644 --- a/tools/pharos-dashboard/account/urls.py +++ b/tools/pharos-dashboard/src/account/urls.py diff --git a/tools/pharos-dashboard/account/views.py b/tools/pharos-dashboard/src/account/views.py index 3b4269de..3b4269de 100644 --- a/tools/pharos-dashboard/account/views.py +++ b/tools/pharos-dashboard/src/account/views.py diff --git a/tools/pharos-dashboard/api/__init__.py b/tools/pharos-dashboard/src/api/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/api/__init__.py +++ b/tools/pharos-dashboard/src/api/__init__.py diff --git a/tools/pharos-dashboard/api/serializers.py b/tools/pharos-dashboard/src/api/serializers.py index 78e6020e..78e6020e 100644 --- a/tools/pharos-dashboard/api/serializers.py +++ b/tools/pharos-dashboard/src/api/serializers.py diff --git a/tools/pharos-dashboard/api/urls.py b/tools/pharos-dashboard/src/api/urls.py index 5206ac7f..5206ac7f 100644 --- a/tools/pharos-dashboard/api/urls.py +++ b/tools/pharos-dashboard/src/api/urls.py diff --git a/tools/pharos-dashboard/api/views.py b/tools/pharos-dashboard/src/api/views.py index 761ce6e7..761ce6e7 100644 --- a/tools/pharos-dashboard/api/views.py +++ b/tools/pharos-dashboard/src/api/views.py diff --git a/tools/pharos-dashboard/booking/__init__.py b/tools/pharos-dashboard/src/booking/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/booking/__init__.py +++ b/tools/pharos-dashboard/src/booking/__init__.py diff --git a/tools/pharos-dashboard/booking/admin.py b/tools/pharos-dashboard/src/booking/admin.py index 7a7f251a..7a7f251a 100644 --- a/tools/pharos-dashboard/booking/admin.py +++ b/tools/pharos-dashboard/src/booking/admin.py diff --git a/tools/pharos-dashboard/booking/apps.py b/tools/pharos-dashboard/src/booking/apps.py index 99bf115f..99bf115f 100644 --- a/tools/pharos-dashboard/booking/apps.py +++ b/tools/pharos-dashboard/src/booking/apps.py diff --git a/tools/pharos-dashboard/booking/forms.py b/tools/pharos-dashboard/src/booking/forms.py index 02ac887a..02ac887a 100644 --- a/tools/pharos-dashboard/booking/forms.py +++ b/tools/pharos-dashboard/src/booking/forms.py diff --git a/tools/pharos-dashboard/booking/migrations/__init__.py b/tools/pharos-dashboard/src/booking/migrations/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/booking/migrations/__init__.py +++ b/tools/pharos-dashboard/src/booking/migrations/__init__.py diff --git a/tools/pharos-dashboard/booking/models.py b/tools/pharos-dashboard/src/booking/models.py index 200dc830..200dc830 100644 --- a/tools/pharos-dashboard/booking/models.py +++ b/tools/pharos-dashboard/src/booking/models.py diff --git a/tools/pharos-dashboard/booking/tests/__init__.py b/tools/pharos-dashboard/src/booking/tests/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/booking/tests/__init__.py +++ b/tools/pharos-dashboard/src/booking/tests/__init__.py diff --git a/tools/pharos-dashboard/booking/tests/test_models.py b/tools/pharos-dashboard/src/booking/tests/test_models.py index 612b35c0..612b35c0 100644 --- a/tools/pharos-dashboard/booking/tests/test_models.py +++ b/tools/pharos-dashboard/src/booking/tests/test_models.py diff --git a/tools/pharos-dashboard/booking/tests/test_views.py b/tools/pharos-dashboard/src/booking/tests/test_views.py index e568c155..e568c155 100644 --- a/tools/pharos-dashboard/booking/tests/test_views.py +++ b/tools/pharos-dashboard/src/booking/tests/test_views.py diff --git a/tools/pharos-dashboard/booking/urls.py b/tools/pharos-dashboard/src/booking/urls.py index 53206233..53206233 100644 --- a/tools/pharos-dashboard/booking/urls.py +++ b/tools/pharos-dashboard/src/booking/urls.py diff --git a/tools/pharos-dashboard/booking/views.py b/tools/pharos-dashboard/src/booking/views.py index 2fe167af..2fe167af 100644 --- a/tools/pharos-dashboard/booking/views.py +++ b/tools/pharos-dashboard/src/booking/views.py diff --git a/tools/pharos-dashboard/dashboard/__init__.py b/tools/pharos-dashboard/src/dashboard/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/dashboard/__init__.py +++ b/tools/pharos-dashboard/src/dashboard/__init__.py diff --git a/tools/pharos-dashboard/dashboard/admin.py b/tools/pharos-dashboard/src/dashboard/admin.py index a1463a7a..a1463a7a 100644 --- a/tools/pharos-dashboard/dashboard/admin.py +++ b/tools/pharos-dashboard/src/dashboard/admin.py diff --git a/tools/pharos-dashboard/dashboard/apps.py b/tools/pharos-dashboard/src/dashboard/apps.py index e0c4f442..e0c4f442 100644 --- a/tools/pharos-dashboard/dashboard/apps.py +++ b/tools/pharos-dashboard/src/dashboard/apps.py diff --git a/tools/pharos-dashboard/dashboard/fixtures/dashboard.json b/tools/pharos-dashboard/src/dashboard/fixtures/dashboard.json index f0ac3b2f..f0ac3b2f 100644 --- a/tools/pharos-dashboard/dashboard/fixtures/dashboard.json +++ b/tools/pharos-dashboard/src/dashboard/fixtures/dashboard.json diff --git a/tools/pharos-dashboard/dashboard/migrations/__init__.py b/tools/pharos-dashboard/src/dashboard/migrations/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/dashboard/migrations/__init__.py +++ b/tools/pharos-dashboard/src/dashboard/migrations/__init__.py diff --git a/tools/pharos-dashboard/dashboard/models.py b/tools/pharos-dashboard/src/dashboard/models.py index 050834ea..050834ea 100644 --- a/tools/pharos-dashboard/dashboard/models.py +++ b/tools/pharos-dashboard/src/dashboard/models.py diff --git a/tools/pharos-dashboard/dashboard/tasks.py b/tools/pharos-dashboard/src/dashboard/tasks.py index 4c09bf90..4c09bf90 100644 --- a/tools/pharos-dashboard/dashboard/tasks.py +++ b/tools/pharos-dashboard/src/dashboard/tasks.py diff --git a/tools/pharos-dashboard/dashboard/templatetags/__init__.py b/tools/pharos-dashboard/src/dashboard/templatetags/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/dashboard/templatetags/__init__.py +++ b/tools/pharos-dashboard/src/dashboard/templatetags/__init__.py diff --git a/tools/pharos-dashboard/dashboard/templatetags/jenkins_filters.py b/tools/pharos-dashboard/src/dashboard/templatetags/jenkins_filters.py index e7e14257..e7e14257 100644 --- a/tools/pharos-dashboard/dashboard/templatetags/jenkins_filters.py +++ b/tools/pharos-dashboard/src/dashboard/templatetags/jenkins_filters.py diff --git a/tools/pharos-dashboard/dashboard/templatetags/jira_filters.py b/tools/pharos-dashboard/src/dashboard/templatetags/jira_filters.py index 70208436..70208436 100644 --- a/tools/pharos-dashboard/dashboard/templatetags/jira_filters.py +++ b/tools/pharos-dashboard/src/dashboard/templatetags/jira_filters.py diff --git a/tools/pharos-dashboard/dashboard/urls.py b/tools/pharos-dashboard/src/dashboard/urls.py index f04f5ca9..f04f5ca9 100644 --- a/tools/pharos-dashboard/dashboard/urls.py +++ b/tools/pharos-dashboard/src/dashboard/urls.py diff --git a/tools/pharos-dashboard/dashboard/views.py b/tools/pharos-dashboard/src/dashboard/views.py index 022a4af0..022a4af0 100644 --- a/tools/pharos-dashboard/dashboard/views.py +++ b/tools/pharos-dashboard/src/dashboard/views.py diff --git a/tools/pharos-dashboard/jenkins/__init__.py b/tools/pharos-dashboard/src/jenkins/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/jenkins/__init__.py +++ b/tools/pharos-dashboard/src/jenkins/__init__.py diff --git a/tools/pharos-dashboard/jenkins/adapter.py b/tools/pharos-dashboard/src/jenkins/adapter.py index ff0508d9..ff0508d9 100644 --- a/tools/pharos-dashboard/jenkins/adapter.py +++ b/tools/pharos-dashboard/src/jenkins/adapter.py diff --git a/tools/pharos-dashboard/src/jenkins/admin.py b/tools/pharos-dashboard/src/jenkins/admin.py new file mode 100644 index 00000000..c4996702 --- /dev/null +++ b/tools/pharos-dashboard/src/jenkins/admin.py @@ -0,0 +1,17 @@ +############################################################################## +# Copyright (c) 2016 Max Breitenfeldt and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +from django.conf import settings +from django.contrib import admin + +from jenkins.models import JenkinsSlave + +if settings.DEBUG: + admin.site.register(JenkinsSlave)
\ No newline at end of file diff --git a/tools/pharos-dashboard/jenkins/apps.py b/tools/pharos-dashboard/src/jenkins/apps.py index 41faf600..41faf600 100644 --- a/tools/pharos-dashboard/jenkins/apps.py +++ b/tools/pharos-dashboard/src/jenkins/apps.py diff --git a/tools/pharos-dashboard/jenkins/migrations/__init__.py b/tools/pharos-dashboard/src/jenkins/migrations/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/jenkins/migrations/__init__.py +++ b/tools/pharos-dashboard/src/jenkins/migrations/__init__.py diff --git a/tools/pharos-dashboard/jenkins/models.py b/tools/pharos-dashboard/src/jenkins/models.py index 0875bba5..0875bba5 100644 --- a/tools/pharos-dashboard/jenkins/models.py +++ b/tools/pharos-dashboard/src/jenkins/models.py diff --git a/tools/pharos-dashboard/jenkins/tasks.py b/tools/pharos-dashboard/src/jenkins/tasks.py index 7c037827..7c037827 100644 --- a/tools/pharos-dashboard/jenkins/tasks.py +++ b/tools/pharos-dashboard/src/jenkins/tasks.py diff --git a/tools/pharos-dashboard/jenkins/tests.py b/tools/pharos-dashboard/src/jenkins/tests.py index 4f350d20..4f350d20 100644 --- a/tools/pharos-dashboard/jenkins/tests.py +++ b/tools/pharos-dashboard/src/jenkins/tests.py diff --git a/tools/pharos-dashboard/manage.py b/tools/pharos-dashboard/src/manage.py index 80c496f3..80c496f3 100644 --- a/tools/pharos-dashboard/manage.py +++ b/tools/pharos-dashboard/src/manage.py diff --git a/tools/pharos-dashboard/notification/__init__.py b/tools/pharos-dashboard/src/notification/__init__.py index 37dcbddf..37dcbddf 100644 --- a/tools/pharos-dashboard/notification/__init__.py +++ b/tools/pharos-dashboard/src/notification/__init__.py diff --git a/tools/pharos-dashboard/notification/admin.py b/tools/pharos-dashboard/src/notification/admin.py index bcaa1ab7..bcaa1ab7 100644 --- a/tools/pharos-dashboard/notification/admin.py +++ b/tools/pharos-dashboard/src/notification/admin.py diff --git a/tools/pharos-dashboard/notification/apps.py b/tools/pharos-dashboard/src/notification/apps.py index 2de22c4e..2de22c4e 100644 --- a/tools/pharos-dashboard/notification/apps.py +++ b/tools/pharos-dashboard/src/notification/apps.py diff --git a/tools/pharos-dashboard/notification_framework/__init__.py b/tools/pharos-dashboard/src/notification/migrations/__init__.py index b5914ce7..b5914ce7 100644 --- a/tools/pharos-dashboard/notification_framework/__init__.py +++ b/tools/pharos-dashboard/src/notification/migrations/__init__.py diff --git a/tools/pharos-dashboard/notification/models.py b/tools/pharos-dashboard/src/notification/models.py index 2d199181..2d199181 100644 --- a/tools/pharos-dashboard/notification/models.py +++ b/tools/pharos-dashboard/src/notification/models.py diff --git a/tools/pharos-dashboard/notification/signals.py b/tools/pharos-dashboard/src/notification/signals.py index 936c25ba..936c25ba 100644 --- a/tools/pharos-dashboard/notification/signals.py +++ b/tools/pharos-dashboard/src/notification/signals.py diff --git a/tools/pharos-dashboard/notification/tasks.py b/tools/pharos-dashboard/src/notification/tasks.py index 61ab14af..61ab14af 100644 --- a/tools/pharos-dashboard/notification/tasks.py +++ b/tools/pharos-dashboard/src/notification/tasks.py diff --git a/tools/pharos-dashboard/src/notification_framework/__init__.py b/tools/pharos-dashboard/src/notification_framework/__init__.py new file mode 100644 index 00000000..b5914ce7 --- /dev/null +++ b/tools/pharos-dashboard/src/notification_framework/__init__.py @@ -0,0 +1,10 @@ +############################################################################## +# Copyright (c) 2016 Max Breitenfeldt and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + diff --git a/tools/pharos-dashboard/notification_framework/notification.py b/tools/pharos-dashboard/src/notification_framework/notification.py index 84fbcffa..84fbcffa 100644 --- a/tools/pharos-dashboard/notification_framework/notification.py +++ b/tools/pharos-dashboard/src/notification_framework/notification.py diff --git a/tools/pharos-dashboard/pharos_dashboard/__init__.py b/tools/pharos-dashboard/src/pharos_dashboard/__init__.py index f104c4db..f104c4db 100644 --- a/tools/pharos-dashboard/pharos_dashboard/__init__.py +++ b/tools/pharos-dashboard/src/pharos_dashboard/__init__.py diff --git a/tools/pharos-dashboard/pharos_dashboard/celery.py b/tools/pharos-dashboard/src/pharos_dashboard/celery.py index f60f2433..f60f2433 100644 --- a/tools/pharos-dashboard/pharos_dashboard/celery.py +++ b/tools/pharos-dashboard/src/pharos_dashboard/celery.py diff --git a/tools/pharos-dashboard/src/pharos_dashboard/settings.py b/tools/pharos-dashboard/src/pharos_dashboard/settings.py new file mode 100644 index 00000000..2c4e8ccf --- /dev/null +++ b/tools/pharos-dashboard/src/pharos_dashboard/settings.py @@ -0,0 +1,176 @@ +import os +from datetime import timedelta + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = os.environ['DEBUG'] + +# Application definition + +INSTALLED_APPS = [ + 'dashboard', + 'booking', + 'account', + 'jenkins', + 'notification', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.humanize', + 'bootstrap3', + 'crispy_forms', + 'rest_framework', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'account.middleware.TimezoneMiddleware', +] + +ROOT_URLCONF = 'pharos_dashboard.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')] + , + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'pharos_dashboard.wsgi.application' + +# Password validation +# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + +# Internationalization +# https://docs.djangoproject.com/en/1.10/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.10/howto/static-files/ +MEDIA_URL = '/media/' +STATIC_URL = '/static/' + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.10/howto/static-files/ +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, "static"), +] + +LOGIN_REDIRECT_URL = '/' + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = os.environ['SECRET_KEY'] + +BOOTSTRAP3 = { + 'set_placeholder': False, +} + +ALLOWED_HOSTS = ['*'] + +# Database +# https://docs.djangoproject.com/en/1.10/ref/settings/#databases +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': os.environ['DB_NAME'], + 'USER': os.environ['DB_USER'], + 'PASSWORD': os.environ['DB_PASS'], + 'HOST': os.environ['DB_SERVICE'], + 'PORT': os.environ['DB_PORT'] + } +} + + +# Rest API Settings +REST_FRAMEWORK = { + 'DEFAULT_PERMISSION_CLASSES': [ + 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly' + ], + 'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',) +} + +MEDIA_ROOT = '/media' +STATIC_ROOT = '/static' + +# Jira Settings +CREATE_JIRA_TICKET = False + +JIRA_URL = os.environ['JIRA_URL'] + +JIRA_USER_NAME = os.environ['JIRA_USER_NAME'] +JIRA_USER_PASSWORD = os.environ['JIRA_USER_PASSWORD'] + +OAUTH_CONSUMER_KEY = os.environ['OAUTH_CONSUMER_KEY'] +OAUTH_CONSUMER_SECRET = os.environ['OAUTH_CONSUMER_SECRET'] + +OAUTH_REQUEST_TOKEN_URL = JIRA_URL + '/plugins/servlet/oauth/request-token' +OAUTH_ACCESS_TOKEN_URL = JIRA_URL + '/plugins/servlet/oauth/access-token' +OAUTH_AUTHORIZE_URL = JIRA_URL + '/plugins/servlet/oauth/authorize' + +OAUTH_CALLBACK_URL = JIRA_URL + '/accounts/authenticated' + +# Celery Settings +CELERY_TIMEZONE = 'UTC' + +RABBITMQ_URL = 'rabbitmq' +BROKER_URL = 'amqp://guest:guest@rabbitmq:5672//' + +CELERYBEAT_SCHEDULE = { + 'sync-jenkins': { + 'task': 'jenkins.tasks.sync_jenkins', + 'schedule': timedelta(minutes=5) + }, + 'send-booking-notifications': { + 'task': 'notification.tasks.send_booking_notifications', + 'schedule': timedelta(minutes=5) + }, + 'clean-database': { + 'task': 'dashboard.tasks.database_cleanup', + 'schedule': timedelta(hours=24) + }, +}
\ No newline at end of file diff --git a/tools/pharos-dashboard/pharos_dashboard/urls.py b/tools/pharos-dashboard/src/pharos_dashboard/urls.py index adcb5b8f..adcb5b8f 100644 --- a/tools/pharos-dashboard/pharos_dashboard/urls.py +++ b/tools/pharos-dashboard/src/pharos_dashboard/urls.py diff --git a/tools/pharos-dashboard/pharos_dashboard/wsgi.py b/tools/pharos-dashboard/src/pharos_dashboard/wsgi.py index 3d43361b..3d43361b 100644 --- a/tools/pharos-dashboard/pharos_dashboard/wsgi.py +++ b/tools/pharos-dashboard/src/pharos_dashboard/wsgi.py diff --git a/tools/pharos-dashboard/static/bower.json b/tools/pharos-dashboard/src/static/bower.json index f473747f..f473747f 100644 --- a/tools/pharos-dashboard/static/bower.json +++ b/tools/pharos-dashboard/src/static/bower.json diff --git a/tools/pharos-dashboard/static/css/theme.css b/tools/pharos-dashboard/src/static/css/theme.css index bd156372..bd156372 100644 --- a/tools/pharos-dashboard/static/css/theme.css +++ b/tools/pharos-dashboard/src/static/css/theme.css diff --git a/tools/pharos-dashboard/static/js/booking-calendar.js b/tools/pharos-dashboard/src/static/js/booking-calendar.js index 9cb0f32f..9cb0f32f 100644 --- a/tools/pharos-dashboard/static/js/booking-calendar.js +++ b/tools/pharos-dashboard/src/static/js/booking-calendar.js diff --git a/tools/pharos-dashboard/static/js/dataTables-sort.js b/tools/pharos-dashboard/src/static/js/dataTables-sort.js index 3072d2f1..3072d2f1 100644 --- a/tools/pharos-dashboard/static/js/dataTables-sort.js +++ b/tools/pharos-dashboard/src/static/js/dataTables-sort.js diff --git a/tools/pharos-dashboard/static/js/datetimepicker-options.js b/tools/pharos-dashboard/src/static/js/datetimepicker-options.js index d43f5fb8..d43f5fb8 100644 --- a/tools/pharos-dashboard/static/js/datetimepicker-options.js +++ b/tools/pharos-dashboard/src/static/js/datetimepicker-options.js diff --git a/tools/pharos-dashboard/static/js/flot-pie-chart.js b/tools/pharos-dashboard/src/static/js/flot-pie-chart.js index 3b80b2a2..3b80b2a2 100644 --- a/tools/pharos-dashboard/static/js/flot-pie-chart.js +++ b/tools/pharos-dashboard/src/static/js/flot-pie-chart.js diff --git a/tools/pharos-dashboard/static/js/fullcalendar-options.js b/tools/pharos-dashboard/src/static/js/fullcalendar-options.js index 22a1b95e..22a1b95e 100644 --- a/tools/pharos-dashboard/static/js/fullcalendar-options.js +++ b/tools/pharos-dashboard/src/static/js/fullcalendar-options.js diff --git a/tools/pharos-dashboard/templates/account/user_list.html b/tools/pharos-dashboard/src/templates/account/user_list.html index c2b81938..c2b81938 100644 --- a/tools/pharos-dashboard/templates/account/user_list.html +++ b/tools/pharos-dashboard/src/templates/account/user_list.html diff --git a/tools/pharos-dashboard/templates/account/userprofile_update_form.html b/tools/pharos-dashboard/src/templates/account/userprofile_update_form.html index 542ea81e..542ea81e 100644 --- a/tools/pharos-dashboard/templates/account/userprofile_update_form.html +++ b/tools/pharos-dashboard/src/templates/account/userprofile_update_form.html diff --git a/tools/pharos-dashboard/templates/base.html b/tools/pharos-dashboard/src/templates/base.html index c5da483d..5bb55473 100644 --- a/tools/pharos-dashboard/templates/base.html +++ b/tools/pharos-dashboard/src/templates/base.html @@ -67,11 +67,6 @@ Slaves</a> </li> <li> - <a href="{% url 'dashboard:resources' %}"><i - class="fa fa-fw"></i>Resources - </a> - </li> - <li> <a href="{% url 'account:users' %}"><i class="fa fa-fw"></i>Users </a> diff --git a/tools/pharos-dashboard/templates/booking/booking_calendar.html b/tools/pharos-dashboard/src/templates/booking/booking_calendar.html index de3e3b3d..de3e3b3d 100644 --- a/tools/pharos-dashboard/templates/booking/booking_calendar.html +++ b/tools/pharos-dashboard/src/templates/booking/booking_calendar.html diff --git a/tools/pharos-dashboard/templates/booking/booking_detail.html b/tools/pharos-dashboard/src/templates/booking/booking_detail.html index d3f47538..d3f47538 100644 --- a/tools/pharos-dashboard/templates/booking/booking_detail.html +++ b/tools/pharos-dashboard/src/templates/booking/booking_detail.html diff --git a/tools/pharos-dashboard/templates/booking/booking_table.html b/tools/pharos-dashboard/src/templates/booking/booking_table.html index 216eaf57..216eaf57 100644 --- a/tools/pharos-dashboard/templates/booking/booking_table.html +++ b/tools/pharos-dashboard/src/templates/booking/booking_table.html diff --git a/tools/pharos-dashboard/templates/dashboard/ci_pods.html b/tools/pharos-dashboard/src/templates/dashboard/ci_pods.html index 7ef62a43..7ef62a43 100644 --- a/tools/pharos-dashboard/templates/dashboard/ci_pods.html +++ b/tools/pharos-dashboard/src/templates/dashboard/ci_pods.html diff --git a/tools/pharos-dashboard/templates/dashboard/dev_pods.html b/tools/pharos-dashboard/src/templates/dashboard/dev_pods.html index 2b4b0177..2b4b0177 100644 --- a/tools/pharos-dashboard/templates/dashboard/dev_pods.html +++ b/tools/pharos-dashboard/src/templates/dashboard/dev_pods.html diff --git a/tools/pharos-dashboard/templates/dashboard/jenkins_slaves.html b/tools/pharos-dashboard/src/templates/dashboard/jenkins_slaves.html index aa74507c..aa74507c 100644 --- a/tools/pharos-dashboard/templates/dashboard/jenkins_slaves.html +++ b/tools/pharos-dashboard/src/templates/dashboard/jenkins_slaves.html diff --git a/tools/pharos-dashboard/templates/dashboard/resource.html b/tools/pharos-dashboard/src/templates/dashboard/resource.html index c9e57354..c9e57354 100644 --- a/tools/pharos-dashboard/templates/dashboard/resource.html +++ b/tools/pharos-dashboard/src/templates/dashboard/resource.html diff --git a/tools/pharos-dashboard/templates/dashboard/resource_all.html b/tools/pharos-dashboard/src/templates/dashboard/resource_all.html index a770d4e8..a770d4e8 100644 --- a/tools/pharos-dashboard/templates/dashboard/resource_all.html +++ b/tools/pharos-dashboard/src/templates/dashboard/resource_all.html diff --git a/tools/pharos-dashboard/templates/dashboard/resource_detail.html b/tools/pharos-dashboard/src/templates/dashboard/resource_detail.html index 657d5656..657d5656 100644 --- a/tools/pharos-dashboard/templates/dashboard/resource_detail.html +++ b/tools/pharos-dashboard/src/templates/dashboard/resource_detail.html diff --git a/tools/pharos-dashboard/templates/dashboard/server_table.html b/tools/pharos-dashboard/src/templates/dashboard/server_table.html index f01bd603..f01bd603 100644 --- a/tools/pharos-dashboard/templates/dashboard/server_table.html +++ b/tools/pharos-dashboard/src/templates/dashboard/server_table.html diff --git a/tools/pharos-dashboard/templates/dashboard/table.html b/tools/pharos-dashboard/src/templates/dashboard/table.html index addd5c12..addd5c12 100644 --- a/tools/pharos-dashboard/templates/dashboard/table.html +++ b/tools/pharos-dashboard/src/templates/dashboard/table.html diff --git a/tools/pharos-dashboard/templates/layout.html b/tools/pharos-dashboard/src/templates/layout.html index 64fed4ae..64fed4ae 100644 --- a/tools/pharos-dashboard/templates/layout.html +++ b/tools/pharos-dashboard/src/templates/layout.html diff --git a/tools/pharos-dashboard/templates/rest_framework/api.html b/tools/pharos-dashboard/src/templates/rest_framework/api.html index 9c6c4f7d..9c6c4f7d 100644 --- a/tools/pharos-dashboard/templates/rest_framework/api.html +++ b/tools/pharos-dashboard/src/templates/rest_framework/api.html diff --git a/tools/pharos-dashboard/web/Dockerfile b/tools/pharos-dashboard/web/Dockerfile new file mode 100644 index 00000000..d5432359 --- /dev/null +++ b/tools/pharos-dashboard/web/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.5 +ENV PYTHONUNBUFFERED 1 +RUN mkdir /config +ADD ./requirements.txt /config/ +RUN pip install -r /config/requirements.txt +RUN mkdir /src; +WORKDIR /src diff --git a/tools/pharos-dashboard/web/requirements.txt b/tools/pharos-dashboard/web/requirements.txt new file mode 100644 index 00000000..edb20d03 --- /dev/null +++ b/tools/pharos-dashboard/web/requirements.txt @@ -0,0 +1,16 @@ +celery==3.1.23 +cryptography==1.4 +Django==1.10 +django-bootstrap3==7.0.1 +django-crispy-forms==1.6.0 +django-filter==0.14.0 +django-registration==2.1.2 +djangorestframework==3.4.6 +gunicorn==19.6.0 +jira==1.0.7 +oauth2==1.9.0.post1 +oauthlib==1.1.2 +pika==0.10.0 +psycopg2==2.6.2 +PyJWT==1.4.2 +requests==2.11.0 diff --git a/tools/pharos-dashboard/worker/Dockerfile b/tools/pharos-dashboard/worker/Dockerfile new file mode 100644 index 00000000..86395e01 --- /dev/null +++ b/tools/pharos-dashboard/worker/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.5 +ENV PYTHONUNBUFFERED 1 +RUN mkdir /config +ADD ./requirements.txt /config/ +RUN pip install -r /config/requirements.txt +RUN useradd -ms /bin/bash celery +USER celery +WORKDIR /src diff --git a/tools/pharos-dashboard/worker/requirements.txt b/tools/pharos-dashboard/worker/requirements.txt new file mode 100644 index 00000000..edb20d03 --- /dev/null +++ b/tools/pharos-dashboard/worker/requirements.txt @@ -0,0 +1,16 @@ +celery==3.1.23 +cryptography==1.4 +Django==1.10 +django-bootstrap3==7.0.1 +django-crispy-forms==1.6.0 +django-filter==0.14.0 +django-registration==2.1.2 +djangorestframework==3.4.6 +gunicorn==19.6.0 +jira==1.0.7 +oauth2==1.9.0.post1 +oauthlib==1.1.2 +pika==0.10.0 +psycopg2==2.6.2 +PyJWT==1.4.2 +requests==2.11.0 |