diff options
| author | ckonstanski <kostcarl@isu.edu> | 2026-07-30 18:17:14 -0600 |
|---|---|---|
| committer | ckonstanski <kostcarl@isu.edu> | 2026-07-30 18:17:14 -0600 |
| commit | 640ff61422bc0ee3966941b93d9889ddbbd38d77 (patch) | |
| tree | abf1c08f5d38ee53ec8b29dc4f425722517505e6 /src/far_edge_ops_api | |
| parent | 22dae02a86c1fce71091bfa5289cf99abba1b217 (diff) | |
Diffstat (limited to 'src/far_edge_ops_api')
| -rw-r--r-- | src/far_edge_ops_api/.gitignore | 2 | ||||
| -rw-r--r-- | src/far_edge_ops_api/settings.py.example | 213 | ||||
| -rw-r--r-- | src/far_edge_ops_api/urls.py | 7 | ||||
| -rw-r--r-- | src/far_edge_ops_api/wsgi.py | 22 |
4 files changed, 229 insertions, 15 deletions
diff --git a/src/far_edge_ops_api/.gitignore b/src/far_edge_ops_api/.gitignore index fce19e4..55abd48 100644 --- a/src/far_edge_ops_api/.gitignore +++ b/src/far_edge_ops_api/.gitignore @@ -1 +1,3 @@ settings.py +settings.py.prod +settings.py.wclab diff --git a/src/far_edge_ops_api/settings.py.example b/src/far_edge_ops_api/settings.py.example index e64066c..82f3c49 100644 --- a/src/far_edge_ops_api/settings.py.example +++ b/src/far_edge_ops_api/settings.py.example @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os +from pathlib import Path # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -31,22 +32,29 @@ ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = [ - 'django.contrib.admin', + 'caas.apps.CaasConfig', + 'orchestration.apps.OrchestrationConfig', + 'dashboard.apps.DashboardConfig', + 'automationstatus.apps.AutomationStatusConfig', + 'rest_framework', + 'django_crontab', + # 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django_db_views', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware' ] ROOT_URLCONF = 'far_edge_ops_api.urls' @@ -60,11 +68,21 @@ TEMPLATES = [ 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - }, - }, + # 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages' + ] + } + } +] + +REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': [], + 'DEFAULT_PERMISSION_CLASSES': [], +} + +CRONJOBS = [ + ('20 * * * *', 'automationstatus.crons.summary', '>> /var/log/far-edge-ops-api/dashboard-cron.log'), + ('25 * * * *', 'automationstatus.crons.orchestration_summary', '>> /var/log/far-edge-ops-api/orchestration_summary-cron.log'), ] WSGI_APPLICATION = 'far_edge_ops_api.wsgi.application' @@ -75,10 +93,10 @@ WSGI_APPLICATION = 'far_edge_ops_api.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.mysql', + 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'faredge', 'HOST': 'localhost', - 'PORT': '3306', + 'PORT': '5432', 'USER': 'faredge', 'PASSWORD': 'password' } @@ -122,3 +140,178 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/' +STATIC_ROOT = "%s/static/" % BASE_DIR + + +# caas section +# ansible-queue services +VAULT_PASSWORD_FILE = "/etc/far-edge-ops-api/.ansible_pass.far_edge" +ANSIBLE = { + "icinga": { + "target": "build.hqplan.lab", + "git": "git@gitlab.verizon.com:vcp/webscale/far-edge/caas/icinga.git", + "branch": "master", + "playbook": "icinga.yaml", + "zmq": "tcp://127.0.0.1:5555" + }, + "bmc": { + "git": "git@gitlab.verizon.com:vcp/webscale/far-edge/caas/bmc.git", + "branch": "master", + "playbook": "bmc.yaml", + "playbook_adminpassword": "adminpassword.yaml", + "zmq": "tcp://127.0.0.1:5556" + }, + "nic": { + "git": "git@gitlab.verizon.com:vcp/webscale/far-edge/caas/wr-installer.git", + "branch": "master", + "playbook": "firmware_upgrade.yaml", + "zmq": "tcp://127.0.0.1:5557" + }, + "wr": { + "git": "git@gitlab.verizon.com:vcp/webscale/far-edge/caas/wr-installer.git", + "branch": "master", + "playbook": "wr_remote.yaml", + "playbook_central": "wr_central.yaml", + "zmq": "tcp://127.0.0.1:5558" + }, + "dns": { + "git": "git@gitlab.verizon.com:vcp/webscale/far-edge/caas/dns.git", + "branch": "master", + "playbook": "dns.yaml", + "zmq": "tcp://127.0.0.1:5559" + }, + "patch": { + "git": "git@gitlab.verizon.com:vcp/webscale/far-edge/caas/wr-installer.git", + "branch": "master", + "playbook": "patch.yaml", + "zmq": "tcp://127.0.0.1:5560" + }, + "icinga_poll": { + "git": "git@gitlab.verizon.com:vcp/webscale/far-edge/caas/icinga_poll.git", + "brach": "master", + "playbook": "icinga_poll.yaml", + "zmq": "tcp://127.0.0.1:5561" + } +} + +MOCKCIQ = False +ENABLE_BMC = True +ZEROMQ_IPV6 = False +GIT_SHALLOW = True +SYSLOG_SERVER = "vcp-faredge-syslog.mon.vzwops.com" +SYSLOG_SERVER_PORT = 5140 +WR_VERSION = "20.06" +WR_MAX_CHILD_CLUSTERS = 200 +INTEL_NIC_FIRMWARE_VERSION = "1.2585.0" +CAAS_MIDDLEWARE_ENDPOINT = "http://middleware.vcpfe.vzwops.com" +CAAS_MIDDLEWARE_USERNAME = "middlewareuser" +CAAS_MIDDLEWARE_PASSWORD = "middlewarepassword" +ICINGA_API_URL = "https://icinga.vcpfe.vzwops.com:5665/v1/objects/services" +ICINGA_API_USERNAME = "someuser" +ICINGA_API_PASSWORD = "somepass" +BMC_USERNAME = "k8sctl" +DNS_DOMAIN = "vcpfe.vzwops.com" +INFOBLOX_USERNAME = "someuser" +INFOBLOX_PASSWORD = "somepass" +FIRMWARE_ISO = "intel-firmware-upgrade-1.2585.0.iso" +DNS_SERVERS = ["2001:4888:a00:f::103:0:1", "2001:4888:a00:f::103:0:2"] +NTP_SERVERS = ["pool.ntp.org"] +WR_BMC_USERNAME = "someuser" +WR_BMC_PASSWORD = "somepass" +WR_REGISTRY_SERVER = "vnf.vzwnet.com/far-edge-infra" +WR_REGISTRY_USERNAME = "admin" +WR_REGISTRY_PASSWORD = "somepass" +WR_WEBDAV_SERVER = "https://vnf.vzwnet.com/far-edge-image-infra" +#WR_WEBDAV_SERVER = "http://mirror.meter.vzwops.com/faredge/webdav/" +WR_WEBDAV_USERNAME = "someuser" +WR_WEBDAV_PASSWORD = "somepass" +WR_DOCKER_HTTP_PROXY = None +WR_DOCKER_HTTPS_PROXY = None +WR_DOCKER_NO_PROXY = None +WR_SSL_CA_CERT = """PEM block here""" + + +# orchestration section +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'verbose': { + 'format': '{levelname} {asctime} {filename} {funcName} {lineno} {message}', + 'style': '{', + }, + }, + 'handlers': { + 'orchestration': { + 'level':'DEBUG', + 'class':'logging.handlers.RotatingFileHandler', + 'filename': '/var/log/far-edge-ops-api/orchestration.log', + 'maxBytes': 10000, + 'backupCount': 10, + 'formatter': 'verbose', + }, + }, + 'loggers': { + 'orchestration': { + 'handlers': ['orchestration'], + 'level': 'DEBUG', + }, + 'caas': { + 'handlers': ['caas'], + 'level': 'DEBUG', + }, + }, +} + +ORCH_TEMP_FILE_LOCATION = "/var/log/far-edge-ops-api/" +SCP_TIMEOUT = 30 +SETTINGS = False + +MIDDLEWARE_ENDPOINT = "http://middleware.hqplan.lab" + +VMB = { + 'SERVICE_URL': 'pulsar+ssl://txslvmbda12v.nss.vzwnet.com:6651/', + 'CERTS_PATH': '/etc/ssl/certs', + 'TLS_CERT_FILE': 'faredge-vmb-i1wv.cert.pem', + 'TLS_KEY_FILE': 'faredge-vmb-i1wv.key-pk8.pem', + 'TLS_TRUST_CERTS_FILE_PATH': 'faredge-vmb-ca.cert.pem', + 'VMB_TOPICS': { + 'TOPIC_CLUSTER_STATUS': 'persistent://i1wv/vcpfe-cluster-status/VCPFarEdgeAutomation-VCPFE-Cluster-Status-On-Demand', + 'TOPIC_NAMESPACE_CREATION': 'persistent://i1wv/vcpfe-namespace-creation/VCPFarEdgeAutomation-VCPFE-Namespace-Creation-On-Demand', + 'TOPIC_KUBECONFIG_TOKEN': 'persistent://i1wv/vcpfe-kubeconfig-token/VCPFarEdgeAutomation-VCPFE-Kubeconfig-Token-On-Demand', + 'TOPIC_IMAGE_STATUS': 'persistent://i1wv/vcpfe-image-status/VCPFarEdgeAutomation-VCPFE-Image-Status-On-Demand', + }, +} + +TIMEOUT = { + 'central': 600, + 'remote': 3600, +} + +ARTIFACTORY_CREDS = { + 'username': '', + 'password': '', +} + +HOST_CREDS = { + 'username': '', + 'password': '', +} + +CENTRAL_DR_CREDS = { + 'username': '', + 'password': '', +} + +LDAP_USER_CREDS = { + 'edge_eng': '', + 'orchestration': '', +} + +FE_LDAP_SVC_CREDS = { + 'username': '', + 'password': '', +} + +KUBECONFIG_SRC = 'SA' # Two options: 'SA'/'LDAP' + diff --git a/src/far_edge_ops_api/urls.py b/src/far_edge_ops_api/urls.py index 298a4a7..13bd80d 100644 --- a/src/far_edge_ops_api/urls.py +++ b/src/far_edge_ops_api/urls.py @@ -13,10 +13,13 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.contrib import admin +# from django.contrib import admin from django.urls import include, path urlpatterns = [ + path('caas/', include('caas.urls')), path('orchestration/', include('orchestration.urls')), - path('admin/', admin.site.urls) + path('', include('dashboard.urls')), + path('automationstatus/', include('automationstatus.urls')) + # path('admin/', admin.site.urls) ] diff --git a/src/far_edge_ops_api/wsgi.py b/src/far_edge_ops_api/wsgi.py index 3b5d6a6..7f9b679 100644 --- a/src/far_edge_ops_api/wsgi.py +++ b/src/far_edge_ops_api/wsgi.py @@ -6,11 +6,27 @@ It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ """ - import os - +import sys from django.core.wsgi import get_wsgi_application +from django.conf import settings +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +sys.path.append(BASE_DIR) +sys.path.append("%s../static/" % BASE_DIR) +sys.path.append("%s/../../venv/lib/python3.6/site-packages" % BASE_DIR) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'far_edge_ops_api.settings') -application = get_wsgi_application() +if settings.DEBUG: + application = get_wsgi_application() +else: + import time + import traceback + import signal + try: + application = get_wsgi_application() + except Exception: + if "mod_wsgi" in sys.modules: + traceback.print_exc() + os.kill(os.getpid(), signal.SIGINT) + time.sleep(2.5) |
