Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions helm/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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/
6 changes: 6 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: librephotos
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
62 changes: 62 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "librephotos.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 "librephotos.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 "librephotos.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "librephotos.labels" -}}
helm.sh/chart: {{ include "librephotos.chart" . }}
{{ include "librephotos.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "librephotos.selectorLabels" -}}
app.kubernetes.io/name: {{ include "librephotos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "librephotos.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "librephotos.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
143 changes: 143 additions & 0 deletions helm/templates/backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-backend
spec:
{{- if not .Values.backend.autoscaling.enabled }}
replicas: {{ .Values.backend.replicaCount }}
{{- end }}
selector:
matchLabels:
app: {{ .Release.Name }}-backend
template:
metadata:
labels:
app: {{ .Release.Name }}-backend
{{- with .Values.backend.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.backend.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.backend.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: backend
image: {{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag | default "2025w44" }}
{{- with .Values.backend.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}-backend
- secretRef:
name: {{ .Release.Name }}-backend
- secretRef:
name: {{ .Release.Name }}-database
ports:
- name: backend
containerPort: 8001
{{- with .Values.backend.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.backend.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.backend.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.backend.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: proxy
image: {{ .Values.backend.proxy.image.repository }}:{{ .Values.backend.proxy.image.tag | default "2025w44" }}
{{- with .Values.backend.proxy.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.backend.proxy.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: proxy
containerPort: 80
{{- with .Values.backend.proxy.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.backend.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
---

apiVersion: v1
kind: Service
metadata:
name: backend # Service names can't be modified because of proxy nginx.conf file
spec:
selector:
app: {{ .Release.Name }}-backend
ports:
- name: http
port: 8001
targetPort: backend

---

apiVersion: v1
kind: Service
metadata:
name: proxy # Service names can't be modified because of proxy nginx.conf file
spec:
selector:
app: {{ .Release.Name }}-backend
ports:
- name: http
port: 80
targetPort: proxy
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-backend
data:
BACKEND_HOST: "{{ .Values.backend.config.backendHost }}"
ADMIN_EMAIL: "{{ .Values.backend.config.adminEmail }}"
ADMIN_USERNAME: "{{ .Values.backend.config.adminUsername }}"
DB_NAME: "{{ .Values.database.config.dbName }}"
DB_HOST: "{{ .Values.database.config.dbHost }}"
DB_PORT: "{{ .Values.database.config.dbPort }}"
WEB_CONCURRENCY: "{{ .Values.backend.config.webConcurrency }}"
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-backend
type: Opaque
data:
SECRET_KEY: {{ .Values.backend.secret.secretKey | default "changemechangemechangemechangeme" | b64enc }}
MAPBOX_API_KEY: {{ .Values.backend.secret.mapboxApiKey | default "" | b64enc }}
ADMIN_PASSWORD: {{ .Values.backend.secret.adminPassword | default "changeme" | b64enc }}
92 changes: 92 additions & 0 deletions helm/templates/database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-database
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-database
template:
metadata:
labels:
app: {{ .Release.Name }}-database
{{- with .Values.database.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.database.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.database.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.database.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.database.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: postgres
image: {{ .Values.database.image.repository }}:{{ .Values.database.image.tag | default "15" }}
env:
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
key: DB_PASS
name: {{ .Release.Name}}-database
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
key: DB_USER
name: {{ .Release.Name}}-database
- name: POSTGRES_DB
value: {{ .Values.database.config.dbName}}
{{- with .Values.database.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.database.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
ports:
- containerPort: 5432
name: psql
{{- with .Values.database.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.database.securityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.database.volumes }}
volumes:
{{- toYaml . | nindent 6 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: database
spec:
ports:
- port: 5432
name: psql
selector:
app: {{ .Release.Name }}-database
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name}}-database
data:
DB_USER: {{ .Values.database.config.dbUser | default "librephotos" | b64enc }}
DB_PASS: {{ .Values.database.config.dbPass | default "changemechangemechangeme" |b64enc }}
Loading