From 0a29cd3221d8d4085452e90569e2ed32a04e380d Mon Sep 17 00:00:00 2001 From: Aric Gardner Date: Fri, 4 Oct 2019 15:15:47 -0400 Subject: Rename pharos to laas related to change: https://gerrit.opnfv.org/gerrit/c/releng/+/68161 Signed-off-by: Aric Gardner Change-Id: I4985eb116fd2c214f3639eb991f27b5d75b5ab7c Signed-off-by: Parker Berberian --- Makefile | 2 +- docker-compose.override-dev.yml | 4 +- docker-compose.yml | 20 ++-- readme.txt | 2 +- src/account/urls.py | 2 +- src/api/urls.py | 2 +- src/booking/urls.py | 2 +- src/dashboard/admin.py | 4 +- src/dashboard/populate_db_iol.py | 2 +- src/dashboard/urls.py | 2 +- src/laas_dashboard/__init__.py | 13 ++ src/laas_dashboard/celery.py | 30 +++++ src/laas_dashboard/settings.py | 204 ++++++++++++++++++++++++++++++++ src/laas_dashboard/urls.py | 47 ++++++++ src/laas_dashboard/wsgi.py | 26 ++++ src/manage.py | 2 +- src/notifier/manager.py | 4 +- src/pharos_dashboard/__init__.py | 13 -- src/pharos_dashboard/celery.py | 30 ----- src/pharos_dashboard/settings.py | 204 -------------------------------- src/pharos_dashboard/urls.py | 47 -------- src/pharos_dashboard/wsgi.py | 26 ---- src/resource_inventory/pdf_templater.py | 2 +- src/resource_inventory/urls.py | 2 +- src/static/bower.json | 4 +- src/templates/base.html | 2 +- src/templates/layout.html | 2 +- src/templates/rest_framework/api.html | 4 +- web/Dockerfile | 6 +- web/init.sh | 2 +- worker/Dockerfile | 4 +- worker/init.sh | 2 +- 32 files changed, 359 insertions(+), 359 deletions(-) create mode 100644 src/laas_dashboard/__init__.py create mode 100644 src/laas_dashboard/celery.py create mode 100644 src/laas_dashboard/settings.py create mode 100644 src/laas_dashboard/urls.py create mode 100644 src/laas_dashboard/wsgi.py delete mode 100644 src/pharos_dashboard/__init__.py delete mode 100644 src/pharos_dashboard/celery.py delete mode 100644 src/pharos_dashboard/settings.py delete mode 100644 src/pharos_dashboard/urls.py delete mode 100644 src/pharos_dashboard/wsgi.py diff --git a/Makefile b/Makefile index cc7f70a..0342381 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ stop: docker-compose stop data: - docker volume create --name=pharos-data + docker volume create --name=laas-data shell-nginx: docker exec -ti ng01 bash diff --git a/docker-compose.override-dev.yml b/docker-compose.override-dev.yml index 0087c23..b9de639 100644 --- a/docker-compose.override-dev.yml +++ b/docker-compose.override-dev.yml @@ -10,12 +10,12 @@ version: '3' services: web: - image: opnfv/pharos-tools-laas-dashboard:dev + image: opnfv/laas-dashboard:dev build: context: . dockerfile: web/Dockerfile worker: - image: opnfv/pharos-tools-laas-celery:dev + image: opnfv/laas-celery:dev build: context: . dockerfile: worker/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index eac84e6..ee8de2c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,13 +18,13 @@ services: - "80:80" volumes: - ./config/nginx:/etc/nginx/conf.d - - pharos-static:/static:ro - - pharos-media:/media + - laas-static:/static:ro + - laas-media:/media depends_on: - web web: - image: opnfv/pharos-tools-laas-dashboard:latest + image: opnfv/laas-dashboard:latest restart: always container_name: dg01 depends_on: @@ -33,8 +33,8 @@ services: - postgres env_file: config.env volumes: - - pharos-static:/static - - pharos-media:/media + - laas-static:/static + - laas-media:/media expose: - "8000" @@ -44,7 +44,7 @@ services: container_name: ps01 env_file: config.env volumes: - - pharos-data:/var/lib/postgresql/data + - laas-data:/var/lib/postgresql/data rabbitmq: restart: always @@ -55,14 +55,14 @@ services: - "5672:5672" worker: - image: opnfv/pharos-tools-laas-celery:latest + image: opnfv/laas-celery:latest restart: always env_file: config.env links: - postgres - rabbitmq volumes: - pharos-media: - pharos-static: - pharos-data: + laas-media: + laas-static: + laas-data: external: true diff --git a/readme.txt b/readme.txt index 96ece92..fad9e71 100644 --- a/readme.txt +++ b/readme.txt @@ -10,7 +10,7 @@ The dashboard is deployed using docker-compose. -Application / database files are saved in the 'pharos-data' container +Application / database files are saved in the 'laas-data' container which needs to be pre-built before bringing up the dashboard. Deployment: diff --git a/src/account/urls.py b/src/account/urls.py index 8aad80c..47400e5 100644 --- a/src/account/urls.py +++ b/src/account/urls.py @@ -9,7 +9,7 @@ ############################################################################## -"""pharos_dashboard URL Configuration +"""laas_dashboard URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ diff --git a/src/api/urls.py b/src/api/urls.py index b8b9cff..0e84a6a 100644 --- a/src/api/urls.py +++ b/src/api/urls.py @@ -9,7 +9,7 @@ ############################################################################## -"""pharos_dashboard URL Configuration +"""laas_dashboard URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ diff --git a/src/booking/urls.py b/src/booking/urls.py index 310aaa7..54e29c9 100644 --- a/src/booking/urls.py +++ b/src/booking/urls.py @@ -9,7 +9,7 @@ ############################################################################## -"""pharos_dashboard URL Configuration +"""laas_dashboard URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ diff --git a/src/dashboard/admin.py b/src/dashboard/admin.py index 43b5386..bd4d96c 100644 --- a/src/dashboard/admin.py +++ b/src/dashboard/admin.py @@ -12,5 +12,5 @@ from django.contrib import admin -admin.site.site_header = "Pharos Dashboard Administration" -admin.site.site_title = "Pharos Dashboard" +admin.site.site_header = "Laas Dashboard Administration" +admin.site.site_title = "Laas Dashboard" diff --git a/src/dashboard/populate_db_iol.py b/src/dashboard/populate_db_iol.py index 916dd97..57ebd40 100644 --- a/src/dashboard/populate_db_iol.py +++ b/src/dashboard/populate_db_iol.py @@ -262,7 +262,7 @@ class Populator: def get_lab_data(self, lab): data = {} - path = "/pharos_dashboard/data/" + lab.name + "/" + path = "/laas_dashboard/data/" + lab.name + "/" host_file = open(path + "hostlist.json") host_structure = json.loads(host_file.read()) host_file.close() diff --git a/src/dashboard/urls.py b/src/dashboard/urls.py index 571a987..60334f6 100644 --- a/src/dashboard/urls.py +++ b/src/dashboard/urls.py @@ -9,7 +9,7 @@ ############################################################################## -"""pharos_dashboard URL Configuration +"""laas_dashboard URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ diff --git a/src/laas_dashboard/__init__.py b/src/laas_dashboard/__init__.py new file mode 100644 index 0000000..f104c4d --- /dev/null +++ b/src/laas_dashboard/__init__.py @@ -0,0 +1,13 @@ +############################################################################## +# 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 +############################################################################## + + +# This will make sure the app is always imported when +# Django starts so that shared_task will use this app. +from .celery import app as celery_app # noqa diff --git a/src/laas_dashboard/celery.py b/src/laas_dashboard/celery.py new file mode 100644 index 0000000..65b9211 --- /dev/null +++ b/src/laas_dashboard/celery.py @@ -0,0 +1,30 @@ +############################################################################## +# 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 +############################################################################## + + +import os + +from celery import Celery + +# set the default Django settings module for the 'celery' program. +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'laas_dashboard.settings') + +from django.conf import settings # noqa + +app = Celery('laas_dashboard') + +# Using a string here means the worker will not have to +# pickle the object when using Windows. +app.config_from_object('django.conf:settings') +app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) + + +@app.task(bind=True) +def debug_task(self): + print('Request: {0!r}'.format(self.request)) diff --git a/src/laas_dashboard/settings.py b/src/laas_dashboard/settings.py new file mode 100644 index 0000000..b73e2c8 --- /dev/null +++ b/src/laas_dashboard/settings.py @@ -0,0 +1,204 @@ +############################################################################## +# Copyright (c) 2018 Sawyer Bergeron 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 +############################################################################## +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! +# NOTE: os.environ only returns strings, so making a comparison to +# 'True' here will convert it to the correct Boolean value. +DEBUG = os.environ['DEBUG'] == 'True' +TESTING = os.environ['TEST'] == 'True' + +# Application definition + +INSTALLED_APPS = [ + 'dashboard', + 'resource_inventory', + 'booking', + 'account', + 'notifier', + 'workflow', + 'api', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.humanize', + 'bootstrap4', + 'rest_framework', + 'rest_framework.authtoken' +] + +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 = 'laas_dashboard.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'dashboard.context_processors.debug', + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +TEMPLATE_CONTEXT_PROCESSORS = [ + 'dashboard.context_processors.debug', +] + +WSGI_APPLICATION = 'laas_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': ('django_filters.rest_framework.FilterSet',), + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework.authentication.SessionAuthentication', + 'rest_framework.authentication.TokenAuthentication', + ) +} + +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 = os.environ['DASHBOARD_URL'] + '/accounts/authenticated' + +# Celery Settings +CELERY_TIMEZONE = 'UTC' + +RABBITMQ_URL = 'rabbitmq' +RABBITMQ_DEFAULT_USER = os.environ['RABBITMQ_DEFAULT_USER'] +RABBITMQ_DEFAULT_PASS = os.environ['RABBITMQ_DEFAULT_PASS'] + +BROKER_URL = 'amqp://' + RABBITMQ_DEFAULT_USER + ':' + RABBITMQ_DEFAULT_PASS + '@rabbitmq:5672//' + +CELERYBEAT_SCHEDULE = { + 'booking_poll': { + 'task': 'dashboard.tasks.booking_poll', + 'schedule': timedelta(minutes=1) + }, + 'free_hosts': { + 'task': 'dashboard.tasks.free_hosts', + 'schedule': timedelta(minutes=1) + }, +} + +# Notifier Settings +EMAIL_HOST = os.environ['EMAIL_HOST'] +EMAIL_PORT = os.environ['EMAIL_PORT'] +EMAIL_HOST_USER = os.environ['EMAIL_HOST_USER'] +EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD'] +EMAIL_USE_TLS = True +DEFAULT_EMAIL_FROM = os.environ.get('DEFAULT_EMAIL_FROM', 'webmaster@localhost') +SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" diff --git a/src/laas_dashboard/urls.py b/src/laas_dashboard/urls.py new file mode 100644 index 0000000..f90f18b --- /dev/null +++ b/src/laas_dashboard/urls.py @@ -0,0 +1,47 @@ +############################################################################## +# Copyright (c) 2016 Max Breitenfeldt and others. +# Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, 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 +############################################################################## + + +"""laas_dashboard URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.10/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" +from django.conf import settings +from django.conf.urls import url, include +from django.conf.urls.static import static +from django.contrib import admin + + +urlpatterns = [ + + url(r'^workflow/', include('workflow.urls', namespace='workflow')), + url(r'^', include('dashboard.urls', namespace='dashboard')), + url(r'^booking/', include('booking.urls', namespace='booking')), + url(r'^accounts/', include('account.urls', namespace='account')), + url(r'^resource/', include('resource_inventory.urls', namespace='resource')), + url(r'^admin/', admin.site.urls), + url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), + url(r'^api/', include('api.urls')), + url(r'^messages/', include('notifier.urls', namespace='notifier')) +] + +if settings.DEBUG is True: + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/src/laas_dashboard/wsgi.py b/src/laas_dashboard/wsgi.py new file mode 100644 index 0000000..6858d3c --- /dev/null +++ b/src/laas_dashboard/wsgi.py @@ -0,0 +1,26 @@ +############################################################################## +# 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 +############################################################################## + + +""" +WSGI config for laas_dashboard project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "laas_dashboard.settings") + +application = get_wsgi_application() diff --git a/src/manage.py b/src/manage.py index 3c7aba5..c412c6b 100755 --- a/src/manage.py +++ b/src/manage.py @@ -14,7 +14,7 @@ import os import sys if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pharos_dashboard.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "laas_dashboard.settings") try: from django.core.management import execute_from_command_line except ImportError: diff --git a/src/notifier/manager.py b/src/notifier/manager.py index 240cf85..9b89ef5 100644 --- a/src/notifier/manager.py +++ b/src/notifier/manager.py @@ -93,7 +93,7 @@ class NotificationHandler(object): send_mail( "Your Booking is Ready", message, - os.environ.get("DEFAULT_FROM_EMAIL", "opnfv@pharos-dashboard"), + os.environ.get("DEFAULT_FROM_EMAIL", "opnfv@laas-dashboard"), [user.userprofile.email_addr], fail_silently=False ) @@ -117,7 +117,7 @@ class NotificationHandler(object): send_mail( "Your Booking has Expired", message, - os.environ.get("DEFAULT_FROM_EMAIL", "opnfv@pharos-dashboard"), + os.environ.get("DEFAULT_FROM_EMAIL", "opnfv@laas-dashboard"), user.userprofile.email_addr, fail_silently=False ) diff --git a/src/pharos_dashboard/__init__.py b/src/pharos_dashboard/__init__.py deleted file mode 100644 index f104c4d..0000000 --- a/src/pharos_dashboard/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################## -# 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 -############################################################################## - - -# This will make sure the app is always imported when -# Django starts so that shared_task will use this app. -from .celery import app as celery_app # noqa diff --git a/src/pharos_dashboard/celery.py b/src/pharos_dashboard/celery.py deleted file mode 100644 index 2a44a3d..0000000 --- a/src/pharos_dashboard/celery.py +++ /dev/null @@ -1,30 +0,0 @@ -############################################################################## -# 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 -############################################################################## - - -import os - -from celery import Celery - -# set the default Django settings module for the 'celery' program. -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pharos_dashboard.settings') - -from django.conf import settings # noqa - -app = Celery('pharos_dashboard') - -# Using a string here means the worker will not have to -# pickle the object when using Windows. -app.config_from_object('django.conf:settings') -app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) - - -@app.task(bind=True) -def debug_task(self): - print('Request: {0!r}'.format(self.request)) diff --git a/src/pharos_dashboard/settings.py b/src/pharos_dashboard/settings.py deleted file mode 100644 index b44fed8..0000000 --- a/src/pharos_dashboard/settings.py +++ /dev/null @@ -1,204 +0,0 @@ -############################################################################## -# Copyright (c) 2018 Sawyer Bergeron 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 -############################################################################## -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! -# NOTE: os.environ only returns strings, so making a comparison to -# 'True' here will convert it to the correct Boolean value. -DEBUG = os.environ['DEBUG'] == 'True' -TESTING = os.environ['TEST'] == 'True' - -# Application definition - -INSTALLED_APPS = [ - 'dashboard', - 'resource_inventory', - 'booking', - 'account', - 'notifier', - 'workflow', - 'api', - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.humanize', - 'bootstrap4', - 'rest_framework', - 'rest_framework.authtoken' -] - -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': [ - 'dashboard.context_processors.debug', - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - }, - }, -] - -TEMPLATE_CONTEXT_PROCESSORS = [ - 'dashboard.context_processors.debug', -] - -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': ('django_filters.rest_framework.FilterSet',), - 'DEFAULT_AUTHENTICATION_CLASSES': ( - 'rest_framework.authentication.SessionAuthentication', - 'rest_framework.authentication.TokenAuthentication', - ) -} - -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 = os.environ['DASHBOARD_URL'] + '/accounts/authenticated' - -# Celery Settings -CELERY_TIMEZONE = 'UTC' - -RABBITMQ_URL = 'rabbitmq' -RABBITMQ_DEFAULT_USER = os.environ['RABBITMQ_DEFAULT_USER'] -RABBITMQ_DEFAULT_PASS = os.environ['RABBITMQ_DEFAULT_PASS'] - -BROKER_URL = 'amqp://' + RABBITMQ_DEFAULT_USER + ':' + RABBITMQ_DEFAULT_PASS + '@rabbitmq:5672//' - -CELERYBEAT_SCHEDULE = { - 'booking_poll': { - 'task': 'dashboard.tasks.booking_poll', - 'schedule': timedelta(minutes=1) - }, - 'free_hosts': { - 'task': 'dashboard.tasks.free_hosts', - 'schedule': timedelta(minutes=1) - }, -} - -# Notifier Settings -EMAIL_HOST = os.environ['EMAIL_HOST'] -EMAIL_PORT = os.environ['EMAIL_PORT'] -EMAIL_HOST_USER = os.environ['EMAIL_HOST_USER'] -EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD'] -EMAIL_USE_TLS = True -DEFAULT_EMAIL_FROM = os.environ.get('DEFAULT_EMAIL_FROM', 'webmaster@localhost') -SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" diff --git a/src/pharos_dashboard/urls.py b/src/pharos_dashboard/urls.py deleted file mode 100644 index fd791c3..0000000 --- a/src/pharos_dashboard/urls.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################## -# Copyright (c) 2016 Max Breitenfeldt and others. -# Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, 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 -############################################################################## - - -"""pharos_dashboard URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/1.10/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.conf.urls import url, include - 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) -""" -from django.conf import settings -from django.conf.urls import url, include -from django.conf.urls.static import static -from django.contrib import admin - - -urlpatterns = [ - - url(r'^workflow/', include('workflow.urls', namespace='workflow')), - url(r'^', include('dashboard.urls', namespace='dashboard')), - url(r'^booking/', include('booking.urls', namespace='booking')), - url(r'^accounts/', include('account.urls', namespace='account')), - url(r'^resource/', include('resource_inventory.urls', namespace='resource')), - url(r'^admin/', admin.site.urls), - url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), - url(r'^api/', include('api.urls')), - url(r'^messages/', include('notifier.urls', namespace='notifier')) -] - -if settings.DEBUG is True: - urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/src/pharos_dashboard/wsgi.py b/src/pharos_dashboard/wsgi.py deleted file mode 100644 index 3d43361..0000000 --- a/src/pharos_dashboard/wsgi.py +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################## -# 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 -############################################################################## - - -""" -WSGI config for pharos_dashboard project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ -""" - -import os - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pharos_dashboard.settings") - -application = get_wsgi_application() diff --git a/src/resource_inventory/pdf_templater.py b/src/resource_inventory/pdf_templater.py index 2302530..7e91b87 100644 --- a/src/resource_inventory/pdf_templater.py +++ b/src/resource_inventory/pdf_templater.py @@ -43,7 +43,7 @@ class PDFTemplater: lab = resource_lab.name location = resource_lab.location pod_type = "development" - link = "https://wiki.opnfv.org/display/INF/Pharos+Laas" + link = "https://wiki.opnfv.org/display/INF/Laas" try: # try to get more specific info that may fail, we dont care if it does diff --git a/src/resource_inventory/urls.py b/src/resource_inventory/urls.py index a72871b..a1eace7 100644 --- a/src/resource_inventory/urls.py +++ b/src/resource_inventory/urls.py @@ -9,7 +9,7 @@ ############################################################################## -"""pharos_dashboard URL Configuration +"""laas_dashboard URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ diff --git a/src/static/bower.json b/src/static/bower.json index dda786d..c9c53e7 100644 --- a/src/static/bower.json +++ b/src/static/bower.json @@ -1,9 +1,9 @@ { - "name": "pharos-dashboard-dependencies", + "name": "laas-dashboard-dependencies", "authors": [ "maxbr " ], - "description": "This package contains all the Js/CSS dependencies needed to run the Pharos Dashboard.", + "description": "This package contains all the Js/CSS dependencies needed to run the Laas Dashboard.", "main": "", "license": "Apache2", "homepage": "", diff --git a/src/templates/base.html b/src/templates/base.html index f59740d..0b3f8c2 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -20,7 +20,7 @@ - Pharos Dashboard + Laas Dashboard diff --git a/src/templates/layout.html b/src/templates/layout.html index 205671b..eac0ac3 100644 --- a/src/templates/layout.html +++ b/src/templates/layout.html @@ -10,7 +10,7 @@ - OPNFV Pharos {{ title }} + OPNFV Laas {{ title }} - Pharos Dashboard API + Laas Dashboard API {% endblock %} \ No newline at end of file diff --git a/web/Dockerfile b/web/Dockerfile index a153192..bdb9b41 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -19,8 +19,8 @@ ADD requirements.txt /requirements.txt RUN pip install -r /requirements.txt ADD web/init.sh /init.sh -ADD src/ /pharos_dashboard/ -COPY --from=static /static/ pharos_dashboard/static/ +ADD src/ /laas_dashboard/ +COPY --from=static /static/ laas_dashboard/static/ -WORKDIR /pharos_dashboard/ +WORKDIR /laas_dashboard/ CMD ["/init.sh"] diff --git a/web/init.sh b/web/init.sh index 736acc1..1545fc8 100755 --- a/web/init.sh +++ b/web/init.sh @@ -9,4 +9,4 @@ ############################################################################## python manage.py migrate && \ python manage.py collectstatic --no-input && \ -gunicorn pharos_dashboard.wsgi -b 0.0.0.0:8000 +gunicorn laas_dashboard.wsgi -b 0.0.0.0:8000 diff --git a/worker/Dockerfile b/worker/Dockerfile index cd0f797..5e24bed 100644 --- a/worker/Dockerfile +++ b/worker/Dockerfile @@ -13,10 +13,10 @@ ADD requirements.txt /requirements.txt RUN pip install -r /requirements.txt ADD worker/init.sh /init.sh -ADD src/ /pharos_dashboard/ +ADD src/ /laas_dashboard/ RUN useradd -ms /bin/bash celery USER celery -WORKDIR /pharos_dashboard/ +WORKDIR /laas_dashboard/ CMD ["/init.sh"] diff --git a/worker/init.sh b/worker/init.sh index ecec2a1..27cee33 100755 --- a/worker/init.sh +++ b/worker/init.sh @@ -7,4 +7,4 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -celery -A pharos_dashboard worker -l info -B --schedule=~/celerybeat-schedule +celery -A laas_dashboard worker -l info -B --schedule=~/celerybeat-schedule -- cgit 1.2.3-korg