diff --git a/Chart.yaml b/Chart.yaml new file mode 100644 index 0000000..62c3323 --- /dev/null +++ b/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0.x" +description: A Helm chart for Kubernetes +name: peertube +version: 0.1.0 diff --git a/README.md b/README.md index 65e2285..129bca1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,37 @@ -# peertube-helm +# [Peertube](https://github.com/Chocobozzz/PeerTube) on kubernetes -Helm chart for deploying Peertube on kubernetes \ No newline at end of file +Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent. + +--- + +## Before deploy + +Currently if you want use persistent volume you need to create persistent volume and persistent volume claim + +## Installing the chart + +`$ helm install --name my-release peertube` + +Specify each parameter using the --set key=value[,key=value] argument to helm install. For example, + +``` +$ helm install --name my-release \ + --set environment.hostname=new.domain.tld,\ + postgresql.postgresPassword=secretpassword \ + peertube +``` + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +`$ helm install --name my-release -f values.yaml peertube` + +## Status : WIP + +- [x] Run +- [x] Persist perrtube data (redis and postgresql to) +- [ ] Improve readme for deployment + +## Source + +Originated from https://github.com/MikaXII/helm-charts +Thanks! \ No newline at end of file diff --git a/charts/redis-3.3.5.tgz b/charts/redis-3.3.5.tgz new file mode 100644 index 0000000..86b7093 Binary files /dev/null and b/charts/redis-3.3.5.tgz differ diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..58a94e4 --- /dev/null +++ b/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: redis + repository: https://kubernetes-charts.storage.googleapis.com + version: 3.3.5 +digest: sha256:bc60370cbce6d02249e972f74489dc20248f8bd3d61d7e031d6e186ff07c42ad +generated: 2018-06-08T16:58:13.072321307+02:00 diff --git a/requirements.yaml b/requirements.yaml new file mode 100644 index 0000000..0af465b --- /dev/null +++ b/requirements.yaml @@ -0,0 +1,5 @@ +# requirements.yaml +dependencies: +- name: redis + version: "3.3.5" + repository: "@stable" diff --git a/templates/NOTES.txt b/templates/NOTES.txt new file mode 100644 index 0000000..a732624 --- /dev/null +++ b/templates/NOTES.txt @@ -0,0 +1,19 @@ +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 {{ template "peertube.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 {{ template "peertube.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "peertube.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={{ template "peertube.name" . }},release={{ .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:80 +{{- end }} diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl new file mode 100644 index 0000000..e925e2a --- /dev/null +++ b/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "peertube.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 "peertube.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 "peertube.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/templates/deployment.yaml b/templates/deployment.yaml new file mode 100644 index 0000000..57da871 --- /dev/null +++ b/templates/deployment.yaml @@ -0,0 +1,112 @@ +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + name: {{ template "peertube.fullname" . }} + labels: + app: {{ template "peertube.name" . }} + chart: {{ template "peertube.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "peertube.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "peertube.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 9000 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 300 + readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 300 + env: + - name: PEERTUBE_WEBSERVER_HOSTNAME + value: {{ .Values.environment.hostname }} + - name: PEERTUBE_WEBSERVER_PORT + value: {{ .Values.environment.http | quote }} + - name: PEERTUBE_WEBSERVER_HTTPS + value: {{ .Values.environment.httpsEnabled | quote }} + - name: PEERTUBE_DB_HOSTNAME + value: {{ .Values.environment.dbHostname }} + - name: PEERTUBE_DB_SUFFIX + value: _prod + - name: PEERTUBE_DB_USERNAME + value: {{ .Values.environment.dbUser }} + - name: PEERTUBE_DB_PASSWORD + value: {{ .Values.environment.dbPassword }} + - name: PEERTUBE_REDIS_HOSTNAME + value: {{ .Release.Name }}-{{ .Values.environment.redisHostname }}-master + - name: PEERTUBE_SMTP_USERNAME + value: {{ .Values.environment.smtpUser | quote }} + - name: PEERTUBE_SMTP_PASSWORD + value: {{ .Values.environment.smtpPassword }} + - name: PEERTUBE_SMTP_HOSTNAME + value: {{ .Values.environment.smtpHostname }} + - name: PEERTUBE_SMTP_PORT + value: {{ .Values.environment.smtpPort | quote }} + - name: PEERTUBE_SMTP_FROM + value: {{ .Values.environment.smtpFrom | quote }} + - name: PEERTUBE_SMTP_TLS + value: {{ .Values.environment.smtpTls | quote }} + - name: PEERTUBE_ADMIN_EMAIL + value: {{ .Values.environment.admin | quote }} + - name: PEERTUBE_SIGNUP_ENABLED + value: {{ .Values.environment.signup | quote }} + - name: PEERTUBE_TRANSCODING_ENABLED + value: {{ .Values.environment.transcoding | quote }} + - name: PEERTUBE_TRUST_PROXY + value: {{ .Values.environment.trustProxy | quote }} + volumeMounts: + - name: data + mountPath: /data + - name: config + mountPath: /config + 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 }} + volumes: +{{- if .Values.persistence.data.enabled }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.persistence.data.existingClaim }} +{{- else }} + - name: data + emptyDir: {} +{{- end }} +{{- if .Values.persistence.config.enabled }} + - name: config + persistentVolumeClaim: + claimName: {{ .Values.persistence.config.existingClaim }} +{{- else }} + - name: config + emptyDir: {} +{{- end }} \ No newline at end of file diff --git a/templates/ingress.yaml b/templates/ingress.yaml new file mode 100644 index 0000000..39acf42 --- /dev/null +++ b/templates/ingress.yaml @@ -0,0 +1,38 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "peertube.fullname" . -}} +{{- $ingressPath := .Values.ingress.path -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app: {{ template "peertube.name" . }} + chart: {{ template "peertube.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/templates/service.yaml b/templates/service.yaml new file mode 100644 index 0000000..a5d3237 --- /dev/null +++ b/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "peertube.fullname" . }} + labels: + app: {{ template "peertube.name" . }} + chart: {{ template "peertube.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app: {{ template "peertube.name" . }} + release: {{ .Release.Name }}