Commit 82fff9e0 authored by Jens Langhammer's avatar Jens Langhammer

Merge: Docker images via CI

parent 512707ad
[bumpversion]
current_version = 1.6.3
current_version = 1.8.8
tag = True
commit = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
......@@ -9,3 +9,7 @@ tag_name = debian/{new_version}
[bumpversion:file:pyazo/__init__.py]
[bumpversion:file:Dockerfile]
[bumpversion:file:.gitlab-ci.yml]
......@@ -32,6 +32,20 @@ coverage:
- coverage report
stage: test
package-docker:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- echo "{\"auths\":{\"https://index.docker.io/v1/\":{\"username\":\"$DOCKER_USERNAME\",\"password\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination beryjuorg/pyazo:stable
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination beryjuorg/pyazo:1.8.8
stage: build
only:
- tags
- docker-ci-test
- /^debian/.*$/
package-3.5:
before_script:
- apt update
......
FROM python:3.6-alpine
ARG REQUIREMENTS=requirements.txt
LABEL version="1.8.8"
COPY ${REQUIREMENTS} /
RUN apk update && \
apk add --no-cache openssl-dev libffi-dev libmagic libffi-dev build-base py2-pip python2-dev jpeg libxml2-dev libxslt-dev libffi-dev gcc musl-dev libgcc openssl-dev curl jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev && \
pip install -r /${REQUIREMENTS} && \
apk del openssl-dev libffi-dev libffi-dev build-base py2-pip python2-dev libxml2-dev libxslt-dev libffi-dev gcc musl-dev libgcc openssl-dev curl jpeg-dev zlib-dev freetype-dev lcms2-dev tk-dev tcl-dev && \
adduser -S pyazo
USER pyazo
COPY ./allauth_supervisr/ /app/allauth_supervisr/
COPY ./pyazo/ /app/pyazo
COPY ./static/ /app/static
COPY ./manage.py /app/
WORKDIR /app/
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
apiVersion: v1
appVersion: "1.8.8"
description: A Helm chart for pyazo.
name: pyazo
version: 0.1.0
icon: https://pyazo.beryju.org/images/logo.png
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "pyazo.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ include "pyazo.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "pyazo.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "pyazo.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:8000
{{- end }}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "pyazo.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 "pyazo.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 "pyazo.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
kind: PersistentVolume
apiVersion: v1
metadata:
name: mysql-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
selector:
app: mysql
clusterIP: None
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: mysql
spec:
selector:
matchLabels:
app: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mariadb:10.3.10-bionic
name: mysql
env:
- name: MYSQL_DATABASE
value: {{ .Values.config.databases.default.name }}
- name: MYSQL_PASSWORD
value: {{ .Values.config.databases.default.password }}
- name: MYSQL_RANDOM_ROOT_PASSWORD
value: "yes"
- name: MYSQL_USER
value: {{ .Values.config.databases.default.user }}
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "pyazo.fullname" . }}-config
data:
config.yml: |
# Env for Docker images
databases:
default:
engine: django.db.backends.mysql
name: {{ .Values.config.databases.default.name }}
user: {{ .Values.config.databases.default.user }}
password: {{ .Values.config.databases.default.password }}
host: mysql
port: ''
options:
charset: UTF8MB4
sql_mode: 'STRICT_TRANS_TABLES'
init_command: "ALTER DATABASE {{ .Values.config.databases.default.name }} CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
# This is the default configuration file
log:
level:
console: DEBUG
file: DEBUG
file: /dev/null
email:
host: localhost
port: 25
user: ''
password: ''
use_tls: false
use_ssl: false
from: pyazo <pyazo@domain.tld>
web:
listen: 0.0.0.0
port: 8000
threads: 30
debug: false
secure_proxy_header:
HTTP_X_FORWARDED_PROTO: https
redis: redis
# Error reporting, disabled by default
error_report_enabled: false
# Set this to the server's external address.
# This is used to generate external URLs
external_url: {{ .Values.ingress.defaultHost }}
# This dictates how the Path is generated
# can be either of:
# - view_sha512_short
# - view_md5
# - view_sha256
# - view_sha512
default_return_view: view_sha256
# Set this to this server's hostname or the external domain if behind a reverse proxy
domains: {{ .Values.ingress.hosts }}
# Set this to true if you only want to use external authentication
external_auth_only: false
# If this is true, images are automatically claimed if the windows user exists
# in django
auto_claim_enabled: true
secret_key: {{ .Values.config.secret_key }}
kind: PersistentVolume
apiVersion: v1
metadata:
name: {{ include "pyazo.fullname" . }}-data
labels:
type: local
app.kubernetes.io/name: {{ include "pyazo.name" . }}
helm.sh/chart: {{ include "pyazo.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
storageClassName: manual
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/pyazo"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
helm.sh/chart: {{ include "pyazo.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
name: {{ include "pyazo.fullname" . }}-data
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ include "pyazo.fullname" . }}-web
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
helm.sh/chart: {{ include "pyazo.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
volumes:
- name: config-volume
configMap:
name: {{ include "pyazo.fullname" . }}-config
- name: media-storage
persistentVolumeClaim:
claimName: {{ include "pyazo.fullname" . }}-data
initContainers:
- name: fix-volume-permissions
image: "beryjuorg/pyazo:{{ .Values.image.tag }}"
command: ["sh", "-c", "chown -R pyazo:pyazo /app/media"]
volumeMounts:
- mountPath: /app/media
name: media-storage
containers:
- name: {{ .Chart.Name }}
image: "beryjuorg/pyazo:{{ .Values.image.tag }}"
imagePullPolicy: IfNotPresent
command: ["./manage.py", "web"]
ports:
- name: http
containerPort: 8000
protocol: TCP
volumeMounts:
- mountPath: /etc/pyazo
name: config-volume
- mountPath: /app/media
name: media-storage
# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "pyazo.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
helm.sh/chart: {{ include "pyazo.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "pyazo.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
helm.sh/chart: {{ include "pyazo.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ include "pyazo.fullname" . }}-worker
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
helm.sh/chart: {{ include "pyazo.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
volumes:
- name: config-volume
configMap:
name: {{ include "pyazo.fullname" . }}-config
- name: media-storage
persistentVolumeClaim:
claimName: {{ include "pyazo.fullname" . }}-data
containers:
- name: {{ .Chart.Name }}
image: "beryjuorg/pyazo:{{ .Values.image.tag }}"
imagePullPolicy: IfNotPresent
command: ["./manage.py", "worker"]
ports:
- name: http
containerPort: 8000
protocol: TCP
volumeMounts:
- mountPath: /etc/pyazo
name: config-volume
- mountPath: /app/media
name: media-storage
# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
ports:
- port: 6379
selector:
app: redis
clusterIP: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
io.kompose.service: redis
name: redis
spec:
selector:
matchLabels:
app: redis
strategy:
type: Recreate
template:
metadata:
labels:
app: redis
spec:
containers:
- image: redis:latest
name: redis
resources: {}
restartPolicy: Always
# Default values for pyazo.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
tag: 1.8.8
nameOverride: ""
config:
secret_key: _k*@6h2u2@q-dku57hhgzb7tnx*ba9wodcb^s9g0j59@=y(@_o
databases:
default:
name: pyazo
user: pyazo
password: EK-5jnKfjrGRm<77
service:
type: ClusterIP
port: 80
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: /
hosts:
- pyazo.k8s.local
defaultHost: pyazo.k8s.local
tls: []
# - secretName: chart-example-tls
# hosts:
# - pyazo.k8s.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
"""pyazo version header"""
__version__ = '1.6.3'
__version__ = '1.8.8'
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