Commit d91c1910 authored by Nico Vermaas's avatar Nico Vermaas

modifying CI/CD pipelines

parent e472bd0c
Pipeline #10956 passed with stages
in 2 minutes and 30 seconds
import logging
from django.contrib import auth
from rest_framework import viewsets
from rest_framework import permissions
from .serializers import *
from ..models import *
from django.contrib import auth
logger = logging.getLogger(__name__)
class EsapQuerySchemaViewSet(viewsets.ModelViewSet):
"""
......@@ -57,16 +58,20 @@ class EsapUserProfileViewSet(viewsets.ModelViewSet):
def get_queryset(self):
# Returns nothing if no user_name supplied instead of all
print("EsapUserProfileViewSet.get_queryset()")
try:
# id_token = self.request.session["oidc_id_token"]
# uid = id_token["iss"]+id_token["sub"]
# preferred_username = id_token["preferred_username"]
# name = id_token["name"]
# access_token = self.request.session["oidc_access_token"]
id_token = self.request.session["oidc_id_token"]
#uid = id_token["iss"]+id_token["sub"]
#preferred_username = id_token["preferred_username"]
#name = id_token["name"]
#access_token = self.request.session["oidc_access_token"]
user = auth.get_user(self.request)
user_email = user.email
return EsapUserProfile.objects.filter(user_email=user_email)
except AttributeError as e:
print('ERROR: '+str(e))
user_name = self.request.query_params.get("user_name", None)
return EsapUserProfile.objects.filter(user_name=user_name)
version: '3.4'
networks:
esap_network:
traefik_proxy:
external:
name: traefik_proxy
default:
driver: bridge
services:
esap_api:
container_name: esap_api_query
image: git.astron.nl:5000/astron-sdc/esap-api-gateway
expose:
- 8000
networks:
- traefik_proxy
- esap_network
labels:
- "traefik.enable=true"
- "traefik.http.routers.esap-api.entryPoints=esap-api-query"
- "traefik.http.routers.esap-api.service=esap-api"
- "traefik.http.routers.esap-api.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/esap-api`)"
- "traefik.http.services.esap-api.loadbalancer.server.port=8000"
- "traefik.http.routers.esap-qstatic.entryPoints=esap-api-query"
- "traefik.http.routers.esap-qstatic.service=esap-qstatic"
- "traefik.http.routers.esap-qstatic.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/static`)"
- "traefik.http.services.esap-qstatic.loadbalancer.server.port=8000"
env_file:
- $HOME/shared/oidc.env
restart: always
volumes:
- $HOME/shared/esap-gateway-query/:/shared
# uncomment the following section if the esap-gui frontend has to run in a container.
# in that case, also adjust the /static/ proxy section in the esap_nginx.conf file
# esap_gui:
# build:
# context: $HOME/my_docker/esap-gui
# dockerfile: Dockerfile
# container_name: esap-gui-compose
# ports:
# - "8017:80"
# expose:
# - "8017"
# networks:
# - esap_network
# restart: always
esap_nginx:
build:
context: $HOME/shared
dockerfile: Dockerfile
container_name: esap_nginx
image: esap_nginx:latest
networks:
- traefik_proxy
- esap_network
labels:
- "traefik.enable=true"
# route to esap-gui
- "traefik.http.routers.esap-gui.entryPoints=websecure"
- "traefik.http.routers.esap-gui.service=esap-gui"
- "traefik.http.routers.esap-gui.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/esap-gui`)"
- "traefik.http.services.esap-gui.loadbalancer.server.port=80"
# route to adex-gui
- "traefik.http.routers.adex-gui.entryPoints=websecure"
- "traefik.http.routers.adex-gui.service=adex-gui"
- "traefik.http.routers.adex-gui.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/adex-gui`)"
- "traefik.http.services.adex-gui.loadbalancer.server.port=80"
# route to astron-hips
- "traefik.http.routers.astron-hips.entryPoints=websecure"
- "traefik.http.routers.astron-hips.service=astron-hips"
- "traefik.http.routers.astron-hips.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/astron-hips`)"
- "traefik.http.services.astron-hips.loadbalancer.server.port=80"
# route the '/static' calls for the esap-gui frontend
- "traefik.http.routers.esap-static.entryPoints=websecure"
- "traefik.http.routers.esap-static.service=esap-static"
- "traefik.http.routers.esap-static.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/static`)"
- "traefik.http.services.esap-static.loadbalancer.server.port=80"
- "traefik.http.routers.esap-static_esap.entryPoints=websecure"
- "traefik.http.routers.esap-static_esap.service=esap-static_esap"
- "traefik.http.routers.esap-static_esap.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/static_esap`)"
- "traefik.http.services.esap-static_esap.loadbalancer.server.port=80"
# uncomment when the frontend connects to '/esap-api' instead of to 'https://sdc-dev.astron.nl:5555/esap-api'
# - "traefik.http.routers.esap-api-default.entryPoints=websecure"
# - "traefik.http.routers.esap-api-default.service=esap-api-default"
# - "traefik.http.routers.esap-api-default.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/esap-api`)"
# - "traefik.http.services.esap-api-default.loadbalancer.server.port=80"
# route to the '/oidc' authentication
- "traefik.http.routers.esap-oidc.entryPoints=websecure"
- "traefik.http.routers.esap-oidc.service=esap-oidc"
- "traefik.http.routers.esap-oidc.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/oidc`)"
- "traefik.http.services.esap-oidc.loadbalancer.server.port=80"
# ports:
# - 80:80
volumes:
- $HOME/shared:/shared
- $HOME/shared:/etc/nginx/conf.d
- $HOME/shared/static:/static
restart: always
......@@ -183,6 +183,10 @@ LOGGING = {
'handlers': ['my_handler', 'my_file_handler', 'mail_admins'],
'level': 'INFO',
},
'accounts': {
'handlers': ['my_handler', 'my_file_handler', 'mail_admins'],
'level': 'INFO',
},
'django': {
'handlers': ['console', 'mail_admins'],
'level': 'INFO',
......@@ -234,6 +238,6 @@ STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# configuration settings that can be requested through the REST API
VERSION = "ASTRON - version 13 nov 2020"
VERSION = "ESAP-API version 23 feb 2021"
CONFIGURATION_DIR = os.path.join(BASE_DIR, 'configuration')
CONFIGURATION_FILE = 'esap_default'
......@@ -20,11 +20,11 @@ DEBUG = True
ALLOWED_HOSTS = ['*']
CORS_ORIGIN_ALLOW_ALL = True
# CORS_ALLOWED_ORIGINS = [
# "https://sdc-dev.astron.nl",
#]
#CORS_ORIGIN_ALLOW_ALL = False
#CORS_ALLOW_CREDENTIALS = True
CORS_ALLOWED_ORIGINS = [
"https://sdc-dev.astron.nl","https://sdc.astron.nl",
]
CORS_ORIGIN_ALLOW_ALL = False
CORS_ALLOW_CREDENTIALS = True
# Application definition
......
......@@ -4577,3 +4577,22 @@
[10/Dec/2020 17:37:29,772] https://alta.astron.nl/altapi/dataproducts?collection=imaging_and_dataProductType=image_and_release__release_id=APERTIF_DR1_Imaging_and_page=1_and_dataProductSubType__in=calibratedVisibility,continuumMF,continuumChunk,imageCube,beamCube,polarisationImage,polarisationCube,continuumCube_and_page_size=50
[10/Dec/2020 17:37:29,774] query_controller.run_query()
[10/Dec/2020 17:37:29,774] run-query: https://alta.astron.nl/altapi/dataproducts?collection=imaging&dataProductType=image&release__release_id=APERTIF_DR1_Imaging&page=1&dataProductSubType__in=calibratedVisibility,continuumMF,continuumChunk,imageCube,beamCube,polarisationImage,polarisationCube,continuumCube&page_size=50
[23/Feb/2021 15:25:02,802] could not find 'waveband' in the query_params. Continuing...
[23/Feb/2021 15:25:02,803] query_controller.get_services()
[23/Feb/2021 15:25:34,623] query_controller.create_and_run_query()
[23/Feb/2021 15:25:34,625] query_controller.create_query()
[23/Feb/2021 15:25:34,636] ERROR: could not translating key collection 'collection', using it raw.
[23/Feb/2021 15:25:34,639] ERROR: could not translating key release__release_id 'release__release_id', using it raw.
[23/Feb/2021 15:25:34,641] query_controller.create_and_run_query()
[23/Feb/2021 15:25:34,641] construct_query: https://alta.astron.nl/altapi/dataproducts?collection=imaging_and_release__release_id=APERTIF_DR1_Imaging_and_dataProductSubType__in=calibratedVisibility,continuumMF,continuumChunk,imageCube,beamCube,polarisationImage,polarisationCube,continuumCube_and_page_size=50
[23/Feb/2021 15:25:34,642] query_controller.create_query()
[23/Feb/2021 15:25:34,643] https://alta.astron.nl/altapi/dataproducts?collection=imaging_and_release__release_id=APERTIF_DR1_Imaging_and_dataProductSubType__in=calibratedVisibility,continuumMF,continuumChunk,imageCube,beamCube,polarisationImage,polarisationCube,continuumCube_and_page_size=50
[23/Feb/2021 15:25:34,650] ERROR: could not translating key collection 'collection', using it raw.
[23/Feb/2021 15:25:34,651] query_controller.run_query()
[23/Feb/2021 15:25:34,651] ERROR: could not translating key release__release_id 'release__release_id', using it raw.
[23/Feb/2021 15:25:34,653] run-query: https://alta.astron.nl/altapi/dataproducts?collection=imaging&release__release_id=APERTIF_DR1_Imaging&dataProductSubType__in=calibratedVisibility,continuumMF,continuumChunk,imageCube,beamCube,polarisationImage,polarisationCube,continuumCube&page_size=50
[23/Feb/2021 15:25:34,654] ERROR: could not translating key page 'page', using it raw.
[23/Feb/2021 15:25:34,656] construct_query: https://alta.astron.nl/altapi/dataproducts?collection=imaging_and_release__release_id=APERTIF_DR1_Imaging_and_page=1_and_dataProductSubType__in=calibratedVisibility,continuumMF,continuumChunk,imageCube,beamCube,polarisationImage,polarisationCube,continuumCube_and_page_size=50
[23/Feb/2021 15:25:34,658] https://alta.astron.nl/altapi/dataproducts?collection=imaging_and_release__release_id=APERTIF_DR1_Imaging_and_page=1_and_dataProductSubType__in=calibratedVisibility,continuumMF,continuumChunk,imageCube,beamCube,polarisationImage,polarisationCube,continuumCube_and_page_size=50
[23/Feb/2021 15:25:34,661] query_controller.run_query()
[23/Feb/2021 15:25:34,668] run-query: https://alta.astron.nl/altapi/dataproducts?collection=imaging&release__release_id=APERTIF_DR1_Imaging&page=1&dataProductSubType__in=calibratedVisibility,continuumMF,continuumChunk,imageCube,beamCube,polarisationImage,polarisationCube,continuumCube&page_size=50
......@@ -70,7 +70,7 @@
</div>
<p class="footer" small>ASTRON - version 23 feb 2021 - 11:30</p>
<p class="footer" small>ASTRON - version 23 mar 2021 - 10:00</p>
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment