EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 9fa08c34 authored by Fabian Schindler-Strauss's avatar Fabian Schindler-Strauss
Browse files

EOEPCA staging

parent 46172b3d
No related branches found
No related tags found
1 merge request!49Production release 1.1.1
...@@ -76,6 +76,7 @@ build-master-staging: ...@@ -76,6 +76,7 @@ build-master-staging:
- docker build --cache-from "$IMAGE_7":latest -t "$IMAGE_7":dev -t "$IMAGE_7":"$TAG_USED" sftp/ - docker build --cache-from "$IMAGE_7":latest -t "$IMAGE_7":dev -t "$IMAGE_7":"$TAG_USED" sftp/
- cd ./testing && ./gitlab_test.sh - cd ./testing && ./gitlab_test.sh
- if [ $? -ne 0 ]; then exit 1; fi # actually fail build - if [ $? -ne 0 ]; then exit 1; fi # actually fail build
- cd -
- docker push "$IMAGE_1":"$TAG_USED" - docker push "$IMAGE_1":"$TAG_USED"
- docker push "$IMAGE_2":"$TAG_USED" - docker push "$IMAGE_2":"$TAG_USED"
- docker push "$IMAGE_3":"$TAG_USED" - docker push "$IMAGE_3":"$TAG_USED"
......
...@@ -8,3 +8,16 @@ helm dependency update ...@@ -8,3 +8,16 @@ helm dependency update
helm template testing . --output-dir ../tmp/ -f values.yaml helm template testing . --output-dir ../tmp/ -f values.yaml
``` ```
## Publishing chart
Currently this approach does not work 100% such repos cannot be declared [in dependencies of other charts](https://github.com/helm/helm/issues/6593)
```bash
helm registry login registry.gitlab.eox.at
helm chart save . registry.gitlab.eox.at/esa/prism/vs/chart
helm chart push registry.gitlab.eox.at/esa/prism/vs/chart:0.1.0-beta.1
```
...@@ -37,18 +37,18 @@ var config = { ...@@ -37,18 +37,18 @@ var config = {
"searchDebounceTime": 500, "searchDebounceTime": 500,
"language": "en", "language": "en",
"timeDomain": [ "timeDomain": [
"2017-01-01T00:00:00Z", "2019-01-01T00:00:00Z",
"2019-12-31T23:59:59Z", "2020-12-31T23:59:59Z",
], ],
"constrainTimeDomain": true, "constrainTimeDomain": true,
"displayTimeDomain": [ "displayTimeDomain": [
"2017-01-01T00:00:00Z", "2019-01-01T00:00:00Z",
"2019-12-31T23:59:59Z", "2020-12-31T23:59:59Z",
], ],
"displayInterval": "P1096D", "displayInterval": "P1096D",
"selectedTimeDomain": [ "selectedTimeDomain": [
"2018-08-01T00:00:00Z", "2020-08-01T00:00:00Z",
"2018-08-31T23:59:59Z", "2020-08-31T23:59:59Z",
], ],
"selectableInterval": "P1096D", "selectableInterval": "P1096D",
"timeSliderControls": true, "timeSliderControls": true,
......
...@@ -33,11 +33,16 @@ backends: ...@@ -33,11 +33,16 @@ backends:
kwargs: kwargs:
instance_base_path: /var/www/pvs/dev instance_base_path: /var/www/pvs/dev
instance_name: pvs_instance instance_name: pvs_instance
mapping: mapping:
{{- $product_levels := list }}
{{- range $product_type_name, $product_type := .Values.config.products.types }} {{- range $product_type_name, $product_type := .Values.config.products.types }}
{{- range $_, $collection_def := $.Values.config.collections }}
{{- if has $product_type_name $collection_def.product_types }}
{{ $product_levels = concat $product_levels ( get $collection_def "product_levels" | default list ) }}
{{- end }}
{{- end }}
{{ $product_type_name }}: {{ $product_type_name }}:
{{- range $level := list "Level_1" "Level_3" "Level-2A" }} {{- range $level := $product_levels | uniq }}
{{ $level }}: {{ $level }}:
product_type_name: {{ $product_type_name | quote }} product_type_name: {{ $product_type_name | quote }}
collections: collections:
...@@ -48,9 +53,24 @@ backends: ...@@ -48,9 +53,24 @@ backends:
{{- end }} {{- end }}
coverages: coverages:
{{- toYaml $product_type.coverages | nindent 16 }} {{- toYaml $product_type.coverages | nindent 16 }}
browses:
{{- if hasKey $product_type "default_browse_locator" }}
{{ $product_type.default_browse_locator }}: null
{{- end }}
{{- range $browse_name, $browse_config := $product_type.browses }}
{{- if hasKey $browse_config "locator" }}
{{ $browse_config.locator }}: {{ $browse_name }}
{{- end }}
{{- end }}
masks: masks:
{{- range $mask_name, $_ := $product_type.masks }} {{- range $mask_name, $_ := $product_type.masks }}
{{ $mask_name }}: {{ $mask_name }} {{ $mask_name }}: {{ $mask_name }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
- type: pycsw
filter:
kwargs:
instance_base_path: /var/www/pvs/dev
instance_name: pvs_instance
mapping:
...@@ -29,7 +29,7 @@ spec: ...@@ -29,7 +29,7 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: {{ .Chart.Name }}-client - name: {{ .Chart.Name }}-client
image: 'registry.gitlab.eox.at/esa/prism/vs/pvs_client:{{ .Values.image.tag | default .Chart.AppVersion }}' image: '{{ .Values.image.repository | default "registry.gitlab.eox.at/esa/prism/vs" }}/pvs_client:{{ .Values.image.tag | default .Chart.AppVersion }}'
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
ports: ports:
- name: http - name: http
......
...@@ -29,7 +29,7 @@ spec: ...@@ -29,7 +29,7 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: {{ .Chart.Name }}-registrar - name: {{ .Chart.Name }}-registrar
image: "registry.gitlab.eox.at/esa/prism/vs/pvs_core:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository | default "registry.gitlab.eox.at/esa/prism/vs" }}/{{ .Values.renderer.image | default "pvs_core" }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
resources: resources:
{{- toYaml .Values.registrar.resources | nindent 12 }} {{- toYaml .Values.registrar.resources | nindent 12 }}
......
...@@ -29,7 +29,7 @@ spec: ...@@ -29,7 +29,7 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: {{ .Chart.Name }}-renderer - name: {{ .Chart.Name }}-renderer
image: "registry.gitlab.eox.at/esa/prism/vs/pvs_core:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository | default "registry.gitlab.eox.at/esa/prism/vs" }}/{{ .Values.renderer.image | default "pvs_core" }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
ports: ports:
- name: http - name: http
......
...@@ -9,11 +9,13 @@ import django ...@@ -9,11 +9,13 @@ import django
from django.db import transaction from django.db import transaction
from django.db.models import Count from django.db.models import Count
from django.contrib.gis.geos import GEOSGeometry, Polygon from django.contrib.gis.geos import GEOSGeometry, Polygon
from lxml import etree
from osgeo import gdal from osgeo import gdal
from .exceptions import RegistrationError from .exceptions import RegistrationError
from .context import Context from .context import Context
from .source import Source, LocalSource, S3Source, SwiftSource from .source import Source, LocalSource, S3Source, SwiftSource
from .utils import import_by_path
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -251,20 +253,24 @@ class EOxServerBackend(Backend): ...@@ -251,20 +253,24 @@ class EOxServerBackend(Backend):
BACKENDS = { BACKENDS = {
'eoxserver': EOxServerBackend 'eoxserver': EOxServerBackend,
} }
def get_backends(config: dict, path: str) -> List[Backend]: def get_backends(config: dict, path: str) -> List[Backend]:
cfg_backends = config['backends'] backends = []
for cfg_backend in config['backends']:
backends = [ if not cfg_backend.get('filter') or re.match(cfg_backend['filter'], path):
BACKENDS[cfg_backend['type']]( if 'type' in cfg_backend:
*cfg_backend.get('args', []), backend_cls = BACKENDS[cfg_backend['type']]
**cfg_backend.get('kwargs', {}), else:
) backend_cls = import_by_path(cfg_backend['path'])
for cfg_backend in cfg_backends
if not cfg_backend.get('filter') or re.match(cfg_backend['filter'], path) backends.append(
] backend_cls(
*cfg_backend.get('args', []),
**cfg_backend.get('kwargs', {}),
)
)
if not backends: if not backends:
raise RegistrationError(f'Could not find a suitable backend for the path {path}') raise RegistrationError(f'Could not find a suitable backend for the path {path}')
......
...@@ -6,6 +6,7 @@ from .source import get_source ...@@ -6,6 +6,7 @@ from .source import get_source
from .scheme import get_scheme from .scheme import get_scheme
from .backend import get_backends from .backend import get_backends
from .exceptions import RegistrationError from .exceptions import RegistrationError
from .utils import import_by_path
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -43,8 +44,7 @@ def register_file(config: dict, path: str, replace: bool=False): ...@@ -43,8 +44,7 @@ def register_file(config: dict, path: str, replace: bool=False):
def _get_handlers(config, name): def _get_handlers(config, name):
handlers = [] handlers = []
for handler_def in config.get(name, []): for handler_def in config.get(name, []):
module_path, _, handler_name = handler_def['path'].rpartition('.') handler_cls = import_by_path(handler_def['path'])
handler_cls = getattr(importlib.import_module(module_path), handler_name)
handlers.append( handlers.append(
handler_cls( handler_cls(
*handler_def.get('args', []), *handler_def.get('args', []),
......
import importlib
def isoformat(dt): def isoformat(dt):
""" Formats a datetime object to an ISO string. Timezone naive datetimes are """ Formats a datetime object to an ISO string. Timezone naive datetimes are
are treated as UTC Zulu. UTC Zulu is expressed with the proper "Z" are treated as UTC Zulu. UTC Zulu is expressed with the proper "Z"
...@@ -10,3 +12,13 @@ def isoformat(dt): ...@@ -10,3 +12,13 @@ def isoformat(dt):
dt = dt.replace(tzinfo=None) dt = dt.replace(tzinfo=None)
return dt.isoformat("T") + "Z" return dt.isoformat("T") + "Z"
return dt.isoformat("T") return dt.isoformat("T")
def import_by_path(path: str):
""" Imports the object from the referenced module.
:param path: the dotted Python path, where the last element is the
object in the referenced module.
"""
module_path, _, object_name = path.rpartition('.')
return getattr(importlib.import_module(module_path), object_name)
...@@ -81,7 +81,7 @@ client = redis.Redis( ...@@ -81,7 +81,7 @@ client = redis.Redis(
watchmanager = pyinotify.WatchManager() watchmanager = pyinotify.WatchManager()
class EventHandler(pyinotify.ProcessEvent): class EventHandler(pyinotify.ProcessEvent):
def process_IN_CREATE(self, event): def process_IN_CLOSE_WRITE(self, event):
logger.info(f'Parsing browse file: {event.pathname}') logger.info(f'Parsing browse file: {event.pathname}')
try: try:
with open(event.pathname) as f: with open(event.pathname) as f:
...@@ -100,6 +100,6 @@ class EventHandler(pyinotify.ProcessEvent): ...@@ -100,6 +100,6 @@ class EventHandler(pyinotify.ProcessEvent):
handler = EventHandler() handler = EventHandler()
notifier = pyinotify.Notifier(watchmanager, handler) notifier = pyinotify.Notifier(watchmanager, handler)
wdd = watchmanager.add_watch(watch_dir, pyinotify.IN_CREATE, rec=True) wdd = watchmanager.add_watch(watch_dir, pyinotify.IN_CLOSE_WRITE, rec=True)
notifier.loop() notifier.loop()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment