EOX GitLab Instance

Commit a9940802 authored by Nikola Jankovic's avatar Nikola Jankovic 💻
Browse files

added helm config

updated docker file
added bumpconfig
updated cicd
pinned requirements values
parent 610572d1
[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/
tests/
.gitignore
.gitlab-ci.yml
Dockerfile
.venv/
.git/
requirements-test.txt
......@@ -111,6 +111,7 @@ venv/
ENV/
env.bak/
venv.bak/
.vscode/
# Spyder project settings
.spyderproject
......
stages:
- test
- deploy
- chart
variables:
DOCKER_TLS_CERTDIR: ""
......@@ -22,8 +23,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:
- master
deploy:
image: docker:20.10.8
......@@ -36,3 +37,14 @@ deploy:
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
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
- main
......@@ -25,29 +25,22 @@
# IN THE SOFTWARE.
#-----------------------------------------------------------------------------
FROM ubuntu:18.04
FROM python:3.8-slim
LABEL name="view server ingestor" \
vendor="EOX IT Services GmbH <https://eox.at>" \
license="MIT Copyright (C) 2020 EOX IT Services GmbH <https://eox.at>" \
type="view server ingestor"
USER root
ADD install.sh requirements.txt \
/
RUN /install.sh
RUN mkdir /ingestor
RUN mkdir -p /var/ingestor/fail /var/ingestor/success
COPY app.py config.py filedaemon.py /
COPY ingestor/ /ingestor
ENV INSTANCE_ID="view-server_ingestor" \
REDIS_HOST="redis" \
REDIS_PORT="6379" \
REDIS_PREPROCESS_MD_QUEUE_KEY="preprocess-md_queue" \
INOTIFY_WATCH_DIR="/mnt/data" \
INOTIFY_MASKS="IN_MOVED_TO,IN_CLOSE_WRITE"
vendor="EOX IT Services GmbH <https://eox.at>" \
license="MIT Copyright (C) 2020 EOX IT Services GmbH <https://eox.at>" \
type="view server ingestor"
WORKDIR /opt/ingestor
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt && \
mkdir -p /var/ingestor/fail /var/ingestor/success
COPY . .
CMD ["gunicorn3", "-c", "config.py", "app"]
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-ingestor
description: A Helm chart for the View server ingestor
# 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"
{{/*
Expand the name of the chart.
*/}}
{{- define "vs-ingestor.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-ingestor.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-ingestor.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "vs-ingestor.labels" -}}
helm.sh/chart: {{ include "vs-ingestor.chart" . }}
{{ include "vs-ingestor.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "vs-ingestor.selectorLabels" -}}
app.kubernetes.io/name: {{ include "vs-ingestor.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "vs-ingestor.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vs-ingestor.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "vs-ingestor.fullname" . }}-ingestor
labels:
{{- include "vs-ingestor.labels" . | nindent 4 }}
app.kubernetes.io/service: ingestor
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "vs-ingestor.selectorLabels" . | nindent 6 }}
app.kubernetes.io/service: ingestor
strategy:
rollingUpdate:
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
annotations:
prometheus.io/scrape: "false"
labels:
{{- include "vs-ingestor.selectorLabels" . | nindent 8 }}
app.kubernetes.io/service: ingestor
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-ingestor
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default ( print "release-" .Chart.AppVersion ) }}"
imagePullPolicy: {{ .Values.image.pullPolicy | default "IfNotPresent" }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
{{- range $key, $value := .Values.global.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
- name: REDIS_HOST
value: {{ .Release.Name }}-redis-master
volumeMounts:
{{- range $volumes := .Values.volumeMounts }}
- {{- toYaml $volumes | nindent 16 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- range $volumes := .Values.volumes }}
- {{- toYaml $volumes | nindent 12 }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "vs-ingestor.fullname" . }}
labels:
{{- include "vs-ingestor.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "vs-ingestor.selectorLabels" . | nindent 4 }}
replicaCount: 1
image:
repository: registry.gitlab.eox.at/vs/ingestor
pullPolicy: IfNotPresent
tag: ""
imagePullSecrets: []
service:
type: ClusterIP
port: 80
resources: {}
affinity: {}
volumes: []
volumeMounts: []
global:
env:
ENV INSTANCE_ID: "view-server_ingestor"
REDIS_PORT: "6379"
REDIS_PREPROCESS_MD_QUEUE_KEY: "preprocess-md_queue"
INOTIFY_WATCH_DIR: "/mnt/data"
INOTIFY_MASKS: "IN_MOVED_TO,IN_CLOSE_WRITE"
#!/bin/bash
echo "Running install.sh"
apt update
echo "Installing packages"
DEBIAN_FRONTEND=noninteractive apt install -y python3-flask python3-lxml python3-dateutil gunicorn3 python3-redis python3-pyinotify
# pip3 install -r /requirements.txt
rm -rf /var/lib/apt/lists/*
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