From c2efed593793465fed6d7fb1fe3b9c4d3ff56778 Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Fri, 19 Jun 2026 21:33:20 +0000 Subject: [PATCH] Adds peertube app. --- peertube/app.yaml | 5 + peertube/versions/8/README.md | 41 ++++++++ peertube/versions/8/db-init-job.yaml | 61 +++++++++++ peertube/versions/8/deployment.yaml | 135 +++++++++++++++++++++++++ peertube/versions/8/ingress.yaml | 26 +++++ peertube/versions/8/kustomization.yaml | 16 +++ peertube/versions/8/manifest.yaml | 33 ++++++ peertube/versions/8/namespace.yaml | 4 + peertube/versions/8/pvc.yaml | 11 ++ peertube/versions/8/service.yaml | 13 +++ 10 files changed, 345 insertions(+) create mode 100644 peertube/app.yaml create mode 100644 peertube/versions/8/README.md create mode 100644 peertube/versions/8/db-init-job.yaml create mode 100644 peertube/versions/8/deployment.yaml create mode 100644 peertube/versions/8/ingress.yaml create mode 100644 peertube/versions/8/kustomization.yaml create mode 100644 peertube/versions/8/manifest.yaml create mode 100644 peertube/versions/8/namespace.yaml create mode 100644 peertube/versions/8/pvc.yaml create mode 100644 peertube/versions/8/service.yaml diff --git a/peertube/app.yaml b/peertube/app.yaml new file mode 100644 index 0000000..7aa0aa0 --- /dev/null +++ b/peertube/app.yaml @@ -0,0 +1,5 @@ +name: peertube +is: peertube +description: PeerTube is a self-hosted, federated video platform that lets you create your own video streaming site with ActivityPub federation support. +icon: https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/peertube.svg +latest: "8" diff --git a/peertube/versions/8/README.md b/peertube/versions/8/README.md new file mode 100644 index 0000000..670b426 --- /dev/null +++ b/peertube/versions/8/README.md @@ -0,0 +1,41 @@ +# PeerTube + +PeerTube is a federated, self-hosted video platform. Videos are served using WebTorrent to reduce bandwidth load on the server. + +## Dependencies + +- **PostgreSQL** - Database for storing video metadata and accounts +- **Redis** - Used for caching and job queuing +- **SMTP** - For account verification and notifications + +## Configuration + +Key settings in `config.yaml`: + +- **domain** - Where PeerTube will be accessible +- **storage** - Persistent volume size for video files (default: `5Gi`) +- **db.name** - Database name (default: `peertube`) +- **smtp** - Email settings inherited from your Wild Cloud SMTP service + +## First-Time Setup + +1. Add and deploy the app: + ```bash + wild app add peertube + wild app deploy peertube + ``` + +2. Log in with the root admin account: + - **Username**: `root` + - **Password**: value of `adminPassword` in your `secrets.yaml` + +3. Complete the setup wizard that appears on first login (instance name, description, etc.). + +4. Start uploading videos or configure federation with other PeerTube instances. + +## Notes + +- Increase `storage` significantly if you plan to host many videos — video files can be large +- The `secretKey` is auto-generated and used for signing tokens +- Federation with other PeerTube instances is opt-in and configured per-instance +- Live streaming requires additional UDP port configuration on your router diff --git a/peertube/versions/8/db-init-job.yaml b/peertube/versions/8/db-init-job.yaml new file mode 100644 index 0000000..70dcfa7 --- /dev/null +++ b/peertube/versions/8/db-init-job.yaml @@ -0,0 +1,61 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: peertube-db-init + labels: + component: db-init +spec: + template: + metadata: + labels: + component: db-init + spec: + restartPolicy: OnFailure + securityContext: + runAsNonRoot: true + runAsUser: 999 + runAsGroup: 999 + seccompProfile: + type: RuntimeDefault + containers: + - name: postgres-init + image: postgres:17 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: false + env: + - name: PGHOST + value: {{ .db.host }} + - name: PGUSER + value: postgres + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: peertube-secrets + key: postgres.password + - name: DB_NAME + value: {{ .db.name }} + - name: DB_USER + value: {{ .db.user }} + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: peertube-secrets + key: dbPassword + command: + - /bin/bash + - -c + - | + set -e + until pg_isready; do sleep 2; done + psql -c "CREATE DATABASE ${DB_NAME};" || echo "Database already exists" + psql -c "CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';" || echo "User already exists" + psql -c "ALTER USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';" + psql -c "GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} TO ${DB_USER};" + psql -d ${DB_NAME} -c "GRANT ALL ON SCHEMA public TO ${DB_USER};" + psql -d ${DB_NAME} -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" || true + psql -d ${DB_NAME} -c "CREATE EXTENSION IF NOT EXISTS unaccent;" || true + echo "Done" diff --git a/peertube/versions/8/deployment.yaml b/peertube/versions/8/deployment.yaml new file mode 100644 index 0000000..eaf5fdf --- /dev/null +++ b/peertube/versions/8/deployment.yaml @@ -0,0 +1,135 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: peertube + namespace: {{ .namespace }} +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + component: web + template: + metadata: + labels: + component: web + spec: + securityContext: + runAsNonRoot: true + runAsUser: 999 + runAsGroup: 999 + fsGroup: 999 + seccompProfile: + type: RuntimeDefault + containers: + - name: peertube + image: chocobozzz/peertube:v8.2.1 + ports: + - name: http + containerPort: 9000 + protocol: TCP + env: + - name: PEERTUBE_WEBSERVER_HOSTNAME + value: {{ .domain }} + - name: PEERTUBE_WEBSERVER_HTTPS + value: "true" + - name: PEERTUBE_WEBSERVER_PORT + value: "443" + - name: PEERTUBE_SECRET + valueFrom: + secretKeyRef: + name: peertube-secrets + key: secretKey + - name: PEERTUBE_DB_HOSTNAME + value: {{ .db.host }} + - name: PEERTUBE_DB_PORT + value: "{{ .db.port }}" + - name: PEERTUBE_DB_NAME + value: {{ .db.name }} + - name: PEERTUBE_DB_USERNAME + value: {{ .db.user }} + - name: PEERTUBE_DB_PASSWORD + valueFrom: + secretKeyRef: + name: peertube-secrets + key: dbPassword + - name: PEERTUBE_DB_SSL + value: "false" + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: peertube-secrets + key: redis.password + - name: PEERTUBE_REDIS_HOSTNAME + value: {{ .redis.host }} + - name: PEERTUBE_REDIS_AUTH + valueFrom: + secretKeyRef: + name: peertube-secrets + key: redis.password + - name: PEERTUBE_SMTP_HOSTNAME + value: {{ .smtp.host }} + - name: PEERTUBE_SMTP_PORT + value: "{{ .smtp.port }}" + - name: PEERTUBE_SMTP_FROM + value: {{ .smtp.from }} + - name: PEERTUBE_SMTP_USERNAME + value: {{ .smtp.user }} + - name: PEERTUBE_SMTP_PASSWORD + valueFrom: + secretKeyRef: + name: peertube-secrets + key: smtpPassword + - name: PEERTUBE_SMTP_TLS + value: "false" + - name: PEERTUBE_SMTP_DISABLE_STARTTLS + value: "false" + - name: PEERTUBE_ADMIN_EMAIL + value: {{ .smtp.from }} + - name: PT_INITIAL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: peertube-secrets + key: adminPassword + - name: PEERTUBE_TRUST_PROXY + value: '["loopback", "linklocal", "uniquelocal"]' + resources: + limits: + cpu: "2" + ephemeral-storage: 2Gi + memory: 2Gi + requests: + cpu: 50m + ephemeral-storage: 100Mi + memory: 256Mi + volumeMounts: + - name: peertube-data + mountPath: /data + livenessProbe: + httpGet: + path: /api/v1/ping + port: 9000 + initialDelaySeconds: 60 + timeoutSeconds: 5 + periodSeconds: 30 + failureThreshold: 6 + readinessProbe: + httpGet: + path: /api/v1/ping + port: 9000 + initialDelaySeconds: 30 + timeoutSeconds: 5 + periodSeconds: 15 + failureThreshold: 3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: false + volumes: + - name: peertube-data + persistentVolumeClaim: + claimName: peertube-data + restartPolicy: Always diff --git a/peertube/versions/8/ingress.yaml b/peertube/versions/8/ingress.yaml new file mode 100644 index 0000000..82f057e --- /dev/null +++ b/peertube/versions/8/ingress.yaml @@ -0,0 +1,26 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: peertube + namespace: {{ .namespace }} + annotations: + external-dns.alpha.kubernetes.io/target: {{ .externalDnsDomain }} + external-dns.alpha.kubernetes.io/cloudflare-proxied: "false" + external-dns.alpha.kubernetes.io/ttl: "60" +spec: + ingressClassName: traefik + rules: + - host: {{ .domain }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: peertube + port: + number: 80 + tls: + - hosts: + - {{ .domain }} + secretName: {{ .tlsSecretName }} diff --git a/peertube/versions/8/kustomization.yaml b/peertube/versions/8/kustomization.yaml new file mode 100644 index 0000000..ee2f67a --- /dev/null +++ b/peertube/versions/8/kustomization.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: {{ .namespace }} +labels: + - includeSelectors: true + pairs: + app: peertube + managedBy: kustomize + partOf: wild-cloud +resources: + - namespace.yaml + - db-init-job.yaml + - pvc.yaml + - deployment.yaml + - service.yaml + - ingress.yaml diff --git a/peertube/versions/8/manifest.yaml b/peertube/versions/8/manifest.yaml new file mode 100644 index 0000000..0f09cdf --- /dev/null +++ b/peertube/versions/8/manifest.yaml @@ -0,0 +1,33 @@ +version: 8.2.1-1 +requires: + - name: postgres + - name: redis + - name: smtp +defaultConfig: + namespace: peertube + externalDnsDomain: '{{ .cloud.domain }}' + domain: peertube.{{ .cloud.domain }} + tlsSecretName: wildcard-wild-cloud-tls + storage: 5Gi + db: + host: '{{ .apps.postgres.host }}' + port: '{{ .apps.postgres.port }}' + name: peertube + user: peertube + redis: + host: '{{ .apps.redis.host }}' + smtp: + host: '{{ .apps.smtp.host }}' + port: '{{ .apps.smtp.port }}' + from: '{{ .apps.smtp.from }}' + user: '{{ .apps.smtp.user }}' +defaultSecrets: + - key: adminPassword + - key: secretKey + - key: dbPassword + - key: dbUrl + default: 'postgresql://{{ .app.db.user }}:{{ .secrets.dbPassword }}@{{ .app.db.host }}:{{ .app.db.port }}/{{ .app.db.name }}?sslmode=disable' + - key: smtpPassword +requiredSecrets: + - postgres.password + - redis.password diff --git a/peertube/versions/8/namespace.yaml b/peertube/versions/8/namespace.yaml new file mode 100644 index 0000000..054927e --- /dev/null +++ b/peertube/versions/8/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .namespace }} diff --git a/peertube/versions/8/pvc.yaml b/peertube/versions/8/pvc.yaml new file mode 100644 index 0000000..5e4acaf --- /dev/null +++ b/peertube/versions/8/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: peertube-data + namespace: {{ .namespace }} +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .storage }} diff --git a/peertube/versions/8/service.yaml b/peertube/versions/8/service.yaml new file mode 100644 index 0000000..f178ca1 --- /dev/null +++ b/peertube/versions/8/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: peertube + namespace: {{ .namespace }} +spec: + selector: + component: web + ports: + - name: http + port: 80 + targetPort: 9000 + protocol: TCP