Commit 0daa8765 authored by Jens Langhammer's avatar Jens Langhammer

Improve dockerfile, use postgres in kubernetes for easier deployment

parent 7dfdb93c
......@@ -6,6 +6,7 @@ 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 openldap-dev && \
pip install -r /${REQUIREMENTS} && \
pip install psycopg2-binary && \
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
......
......@@ -6,9 +6,44 @@ To install pyazo using helm on kubernetes, run the following:
```
helm repo add beryju.org https://pkg.beryju.org/repository/helm/
helm install beryju.org/pyazo
helm install beryju.org/pyazo --name pyazo --namespace pyazo -f <config file>
```
To configure it, you can use a config as following:
```yaml
postgresql:
postgresqlPassword: "<password>"
persistence:
storageClass: standard
redis:
password: "<password>"
master:
persistence:
enabled: false
persistence:
storageClass: standard
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
tls:
- secretName: letsencrypt-prod
hosts:
- <url>
hosts:
- <url>
defaultHost: <url>
```
To see all possible settings you can change, refer to [https://git.beryju.org/BeryJu.org/pyazo/blob/master/helm/pyazo/values.yaml](https://git.beryju.org/BeryJu.org/pyazo/blob/master/helm/pyazo/values.yaml)
## Pure Docker
Pyazo can be run on pure docker. The image is `docker.pkg.beryju.org/pyazo`. The image needs to be run twice, once for the webserver and once for the background worker. The config file needs to be mounted under `/etc/pyazo/config.yml`. Uploaded files are saved under `/app/media`, which should be mounted as well.
......
......@@ -2,8 +2,8 @@ dependencies:
- name: redis
repository: https://kubernetes-charts.storage.googleapis.com/
version: 5.1.0
- name: mariadb
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com/
version: 5.2.3
digest: sha256:67a311ab3117465f4056c9e4d9c09cc0e62c1d654e5f03b7d529627c62fd58c8
generated: 2018-12-07T08:31:22.28475+01:00
version: 3.10.1
digest: sha256:04bd136761f070e94a2ff32ff48ff87f5e07fbd451e5fd7f65551e3bd4680e5e
generated: 2019-03-16T22:17:57.016429+01:00
......@@ -2,6 +2,6 @@ dependencies:
- name: redis
version: 5.1.0
repository: https://kubernetes-charts.storage.googleapis.com/
- name: mariadb
version: 5.2.3
- name: postgresql
version: 3.10.1
repository: https://kubernetes-charts.storage.googleapis.com/
......@@ -7,16 +7,12 @@ data:
# Env for Docker images
databases:
default:
engine: django.db.backends.mysql
name: {{ .Values.db.name }}
user: {{ .Values.db.user }}
password: {{ .Values.db.password }}
host: mysql
engine: django.db.backends.postgresql
name: {{ .Values.postgresql.postgresqlDatabase }}
user: postgres
password: {{ .Values.postgresql.postgresqlPassword }}
host: {{ .Release.Name }}-postgresql
port: ''
options:
charset: UTF8MB4
sql_mode: 'STRICT_TRANS_TABLES'
init_command: "ALTER DATABASE {{ .Values.db.name }} CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
log:
level:
console: DEBUG
......@@ -35,7 +31,7 @@ data:
port: 8000
threads: 30
debug: false
redis: redis
redis: ":{{ .Values.redis.password }}@{{ .Release.Name }}-redis-master"
# Error reporting, disabled by default
error_report_enabled: {{ .Values.config.error_reporting }}
......
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
......@@ -27,9 +9,9 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
name: {{ include "pyazo.fullname" . }}-data
spec:
storageClassName: manual
storageClassName: {{ .Values.persistence.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
storage: 10G
......@@ -18,6 +18,7 @@ spec:
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
pyazo.beryju.org/component: web
spec:
volumes:
- name: config-volume
......
......@@ -17,3 +17,4 @@ spec:
selector:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
pyazo.beryju.org/component: web
......@@ -18,6 +18,7 @@ spec:
labels:
app.kubernetes.io/name: {{ include "pyazo.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
pyazo.beryju.org/component: worker
spec:
volumes:
- name: config-volume
......
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