EOX GitLab Instance

Commit 654ed921 authored by Nikola Jankovic's avatar Nikola Jankovic 💻
Browse files

prepared helm chart

updated dockerfile
added bumpversion
updated gitlabci
parent a4ce10d0
[bumpversion]
current_version = 2.0.0
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)\.(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{release}.{build}
{major}.{minor}.{patch}
tag_name = release-{new_version}
[bumpversion:part:release]
optional_value = final
first_value = alpha
values =
alpha
beta
rc
final
[bumpversion:file:.bumpversion.cfg]
search = current_version = {current_version}
[bumpversion:file:Dockerfile]
search = version="{current_version}"
replace = version="{new_version}"
[bumpversion:glob:chart/Chart.yaml]
search = appVersion: "{current_version}"
replace = appVersion: "{new_version}"
chart/
.gitignore
.gitlab-ci.yml
Dockerfile
.git/
.vscode/
stages:
- deploy
- chart
variables:
DOCKER_TLS_CERTDIR: ""
......@@ -13,8 +14,8 @@ deploy_latest:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- docker build -t $CI_REGISTRY_IMAGE .
- docker push $CI_REGISTRY_IMAGE:latest
except:
- tags
only:
- main
deploy:
image: docker:20.10.8
......@@ -23,7 +24,18 @@ deploy:
stage: deploy
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- docker build --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- docker build --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
only:
- tags
helm:
image: devth/helm:v3.6.3
stage: chart
script:
# push Helm chart
- "upload_filename=$(helm package ./chart | sed 's/^Successfully packaged chart and saved it to: \\(.*\\)/\\1/')"
- curl -u $HELM_CHART_REPOSITORY_CREDENTIALS -v -X POST https://charts-public.hub.eox.at/api/charts --data-binary "@${upload_filename}"
only:
- tags
- master
......@@ -31,9 +31,12 @@ LABEL name="view server cache" \
license="MIT Copyright (C) 2019 EOX IT Services GmbH <https://eox.at>" \
type="view server cache"
WORKDIR /opt/cache/
USER root
ADD install.sh \
/
COPY . .
RUN ./install.sh
ENV COLLECTION_ID= \
......@@ -58,23 +61,8 @@ ENV COLLECTION_ID= \
BUCKET_NAME= \
BUCKET_NAME_FULL=
ADD configure.sh \
run-httpd.sh \
run-seeder.sh \
seeder.py \
mapcache-template.xml \
entrypoint.sh \
mapcache_items_view.sql \
/
RUN chmod -v +x \
/configure.sh \
/run-httpd.sh \
/run-seeder.sh \
/entrypoint.sh
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/run-httpd.sh"]
ENTRYPOINT ["./entrypoint.sh"]
CMD ["./run-httpd.sh"]
LABEL version="1.5.2"
LABEL version="2.0.0"
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
apiVersion: v2
name: vs-cache
description: A Helm chart for the View server cache
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2.0.0"
<mapcache>
<default_format>mixed</default_format>
<format name="mypng" type="PNG">
<compression>fast</compression>
</format>
<format name="myjpeg" type="JPEG">
<quality>75</quality>
<photometric>ycbcr</photometric>
</format>
<format name="mixed" type="MIXED">
<transparent>mypng</transparent>
<opaque>myjpeg</opaque>
</format>
{{- if .Values.config.wmsEnabled }}
<service type="wms" enabled="true">
<full_wms>assemble</full_wms>
<resample_mode>bilinear</resample_mode>
<format>mixed</format>
<maxsize>4096</maxsize>
</service>
{{- end }}
{{- if .Values.config.wmtsEnabled }}
<service type="wmts" enabled="true"/>
{{- end }}
{{- with .Values.global.metadata }}
<metadata>
<title>{{ .title }}</title>
<abstract>{{ .abstract }}</abstract>
<url>{{ .url }}</url>
<keywords>
{{- range $keyword := .keywords }}
<keyword>{{ $keyword }}</keyword>
{{ end -}}
</keywords>
<accessconstraints>{{ .accessConstraints }}</accessconstraints>
<fees>{{ .fees }}</fees>
<contactname>{{ .contactName }}</contactname>
<contactphone>{{ .contactPhone }}</contactphone>
<contactfacsimile>{{ .contactFacsimile }}</contactfacsimile>
<contactorganization>{{ .contactOrganization }}</contactorganization>
<contactcity>{{ .contactCity }}</contactcity>
<contactstateorprovince>{{ .contactStateOrProvince }}</contactstateorprovince>
<contactpostcode>{{ .contactPostcode }}</contactpostcode>
<contactcountry>{{ .contactCountry }}</contactcountry>
<contactelectronicmailaddress>{{ .contactElectronicMailAddress }}</contactelectronicmailaddress>
<contactposition>{{ .contactPosition }}</contactposition>
<providername>{{ .providerName }}</providername>
<providerurl>{{ .providerUrl }}</providerurl>
<inspire_profile>{{ .inspireProfile }}</inspire_profile>
<inspire_metadataurl>{{ .inspireMetadataUrl }}</inspire_metadataurl>
<defaultlanguage>{{ .defaultLanguage }}</defaultlanguage>
<language>{{ .language }}</language>
</metadata>
{{- end }}
<errors>empty_img</errors>
<lock_dir>/tmp</lock_dir>
<threaded_fetching>true</threaded_fetching>
{{- if .Values.global.storage.cache.type }}
{{ if eq .Values.global.storage.cache.type "swift" }}
<cache name="cache" type="swift">
<auth_url>{{ .Values.global.storage.cache.auth_url_short }}</auth_url>
<auth_version>{{ .Values.global.storage.cache.auth_version }}</auth_version>
<tenant>{{ .Values.global.storage.cache.tenant_id }}</tenant>
<username>{{ .Values.global.storage.cache.username }}</username>
<password>{{ .Values.global.storage.cache.password }}</password>
<container>{{ .Values.global.storage.cache.container }}</container>
<key>{{ .Values.config.key }}</key>
</cache>
{{- else if eq .Values.global.storage.cache.type "S3" }}
<cache name="cache" type="s3">
<url>{{ .Values.global.storage.cache.endpoint_url }}{{ .Values.config.key }}</url>
<headers>
<Host>{{ .Values.global.storage.cache.host }}</Host>
</headers>
<id>{{ .Values.global.storage.cache.access_key_id }}</id>
<secret>{{ .Values.global.storage.cache.secret_access_key }}</secret>
{{- if .Values.global.storage.cache.region }}
<region>{{ .Values.global.storage.cache.region }}</region>
{{- end }}
</cache>
{{- else }}
<cache name="cache" type="sqlite3">
<dbfile>/tmp/cache.db</dbfile>
</cache>
{{- end }}
{{- else }}
<cache name="cache" type="sqlite3">
<dbfile>/tmp/cache.db</dbfile>
</cache>
{{- end }}
{{- range $layer := .Values.global.layers }}
<source type="wms" name="{{ $layer.id }}">
<getmap>
<params>
<LAYERS>{{ $layer.id }}</LAYERS>
<TRANSPARENT>true</TRANSPARENT>
<STYLES></STYLES>
</params>
</getmap>
<http>
<url>http://{{ include "vs.fullname" $ }}-renderer/ows</url>
<connection_timeout>{{ $.Values.config.connectionTimeout }}</connection_timeout>
<timeout>{{ $.Values.config.timeout }}</timeout>
</http>
</source>
<tileset name="{{ $layer.id }}">
<metadata>
<title>{{ $layer.title }}</title>
<abstract>{{ $layer.abstract }}</abstract>
</metadata>
<source>{{ $layer.id }}</source>
<cache>cache</cache>
{{- $grids := $layer.grids }}
{{- if $grids }}
{{- range $grid := $grids }}
<grid max-cached-zoom="{{ $grid.zoom }}" out-of-zoom-strategy="reassemble">{{ $grid.name }}</grid>
{{- end }}
{{- else }}
<grid max-cached-zoom="10" out-of-zoom-strategy="reassemble">WGS84</grid>
{{- end }}
<format>mixed</format>
<metatile>1 1</metatile>
<metabuffer>1</metabuffer>
<expires>{{ $.Values.config.expires }}</expires>
<dimensions>
<assembly_type>stack</assembly_type>
<store_assemblies>false</store_assemblies>
<subdimensions_read_only>false</subdimensions_read_only>
<dimension type="postgresql" name="time" default="2017/2019" time="true" unit="ISO8601">
<connection>host={{ $.Release.Name }}-database user={{ $.Values.global.env.DB_USER }} password={{ $.Values.global.env.DB_PW }} dbname={{ $.Values.global.env.DB_NAME }} port={{ $.Values.global.env.DB_PORT }}</connection>
<list_query>SELECT to_char(MIN(mapcache_items.begin_time), 'YYYY-MM-DD"T"HH24:MI:SS"Z"') || '/' || to_char(MAX(mapcache_items.end_time), 'YYYY-MM-DD"T"HH24:MI:SS"Z"') FROM mapcache_items WHERE mapcache_items.collection = '{{ $layer.parentLayer }}';</list_query>
<validate_query>SELECT * FROM (SELECT to_char(mapcache_items.begin_time, 'YYYY-MM-DD"T"HH24:MI:SS"Z"') || '/' || to_char(mapcache_items.end_time, 'YYYY-MM-DD"T"HH24:MI:SS"Z"') AS "interval" FROM mapcache_items WHERE (mapcache_items.collection = '{{ $layer.parentLayer }}' AND ((mapcache_items."begin_time" &lt; to_timestamp(:end_timestamp) AND mapcache_items."end_time" &gt; to_timestamp(:start_timestamp)) or (mapcache_items."begin_time" = mapcache_items."end_time" AND mapcache_items."begin_time" &lt;= to_timestamp(:end_timestamp) AND mapcache_items."end_time" &gt;= to_timestamp(:start_timestamp)))) AND mapcache_items."footprint" &amp;&amp; ST_Transform(ST_MakeEnvelope(:minx, :miny, :maxx, :maxy, CAST(SUBSTRING(:gridsrs, 6) AS INTEGER)), 4326) ORDER BY mapcache_items."end_time" DESC LIMIT 20) AS sub ORDER BY interval ASC;</validate_query>
</dimension>
</dimensions>
</tileset>
{{- end }}
</mapcache>
{{/*
Expand the name of the chart.
*/}}
{{- define "vs-cache.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "vs-cache.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "vs-cache.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "vs-cache.labels" -}}
helm.sh/chart: {{ include "vs-cache.chart" . }}
{{ include "vs-cache.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "vs-cache.selectorLabels" -}}
app.kubernetes.io/name: {{ include "vs-cache.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "vs-cache.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vs-cache.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "vs-cache.fullname" . }}-config
data:
{{ (tpl (.Files.Glob "files/mapcache.xml").AsConfig . ) | nindent 2}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "vs-cache.fullname" . }}
labels:
{{- include "vs-cache.labels" . | nindent 4 }}
app.kubernetes.io/service: cache
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "vs-cache.selectorLabels" . | nindent 6 }}
app.kubernetes.io/service: cache
strategy:
rollingUpdate:
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
annotations:
prometheus.io/scrape: "false"
labels:
{{- include "vs-cache.selectorLabels" . | nindent 8 }}
app.kubernetes.io/service: cache
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default ( print "release-" .Chart.AppVersion ) }}"
imagePullPolicy: {{ .Values.image.pullPolicy | default "IfNotPresent" }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
httpGet:
path: /
port: http
startupProbe:
httpGet:
path: /
port: http
failureThreshold: 30
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
args:
- /opt/cache/run-httpd.sh
env:
{{- range $key, $value := .Values.global.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
- name: DB_HOST
value: {{ .Release.Name }}-database
- name: RENDERER_HOST
value: {{ include "vs-cache.fullname" . }}-renderer
- name: WAIT_SERVICES
value: "{{ .Release.Name }}-database:{{ .Values.global.env.DB_PORT }} {{ include "vs-cache.fullname" . }}-renderer:80"
volumeMounts:
- mountPath: /mapcache-template.xml
name: cache-config
subPath: mapcache.xml
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- configMap:
items:
- key: mapcache.xml
path: mapcache.xml
name: {{ include "vs-cache.fullname" . }}-config
name: cache-config
apiVersion: v1
kind: Service
metadata:
name: {{ include "vs-cache.fullname" . }}-cache
labels:
{{- include "vs-cache.labels" . | nindent 4 }}
app.kubernetes.io/service: cache
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "vs-cache.selectorLabels" . | nindent 4 }}
app.kubernetes.io/service: cache
replicaCount: 1
image:
repository: registry.gitlab.eox.at/vs/cache
pullPolicy: IfNotPresent
tag: ""
imagePullSecrets: []
config:
wmsEnabled: true
wmtsEnabled: true
connectionTimeout: 10
timeout: 120
expires: 3600
key: /{tileset}/{grid}/{dim}/{z}/{x}/{y}.{ext}
service:
type: ClusterIP
port: 80
resources: {}
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 80
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
affinity: {}
global:
env:
INSTANCE_ID: prism-view-server_cache
DB_PORT: 5432
metadata:
title: PRISM Data Access Service developed by EOX
header: PRISM Data Access View Server (VS) Client powered by <a href="//eox.at"><img src="//eox.at/wp-content/uploads/2017/09/EOX_Logo.svg" alt="EOX" style="height:25px;margin-left:10px"/></a>
abstract: PRISM Data Access Service developed by EOX
url: https://ecma/cache/ows
keywords:
- view server
accessConstraints: UNKNOWN
fees: UNKNOWN
contactName: Stephan Meissl
contactPhone: Please contact via mail.
contactFacsimile: None
contactOrganization: EOX IT Services GmbH
contactCity: Vienna
contactStateOrProvince: Vienna
contactPostcode: 1090
contactCountry: Austria
contactElectronicMailAddress: office@eox.at
contactPosition: CTO
providerName: EOX
providerUrl: https://eox.at
inspireProfile: true
inspireMetadataUrl: TBD
defaultLanguage: eng
language: eng
storage:
cache: {}
layers: []
File mode changed from 100644 to 100755
......@@ -4,14 +4,14 @@ echo "Running install.sh"
apt update
echo "Adding UbuntuGIS repo"
DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common
DEBIAN_FRONTEND=noninteractive apt --no-install-recommends install -y software-properties-common
add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
add-apt-repository -y ppa:schpidi2/eox
apt update
echo "Installing packages"
VERSION=1.10.0-1~bionic0eox5
DEBIAN_FRONTEND=noninteractive apt install -y \
DEBIAN_FRONTEND=noninteractive apt --no-install-recommends install -y \
libmapcache1=${VERSION} libapache2-mod-mapcache=${VERSION} mapcache-tools=${VERSION} \
sqlite3 curl ca-certificates apache2 python3-dateutil python3-redis wait-for-it postgresql-client
......
#!/bin/bash -e
/configure.sh >&2
./configure.sh >&2
echo "Running Apache server" >&2
rm -rf /run/apache2/* /var/run/apache2/* /tmp/apache2*
......
File mode changed from 100644 to 100755
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