From c4535ec150519eb720932893239d5c57e4d70912 Mon Sep 17 00:00:00 2001 From: Ruben Hensen Date: Sun, 19 Jan 2025 23:07:36 +0100 Subject: [PATCH] Add ttrss first init --- apps/templates/ttrss-folder.yaml | 19 +++ ttrss/.env | 47 ++++++++ ttrss/app-claim1-persistentvolumeclaim.yaml | 12 ++ ttrss/app-deployment.yaml | 63 ++++++++++ ttrss/app-persistentvolumeclaim.yaml | 12 ++ ttrss/db-deployment.yaml | 59 +++++++++ ttrss/db-persistentvolumeclaim.yaml | 12 ++ ttrss/docker-compose.yaml | 112 ++++++++++++++++++ ttrss/env-configmap.yaml | 11 ++ ttrss/ingress.yaml | 34 ++++++ .../updater-claim1-persistentvolumeclaim.yaml | 12 ++ ttrss/updater-deployment.yaml | 65 ++++++++++ ttrss/web-nginx-deployment.yaml | 61 ++++++++++ ttrss/web-nginx-service.yaml | 16 +++ 14 files changed, 535 insertions(+) create mode 100644 apps/templates/ttrss-folder.yaml create mode 100644 ttrss/.env create mode 100644 ttrss/app-claim1-persistentvolumeclaim.yaml create mode 100644 ttrss/app-deployment.yaml create mode 100644 ttrss/app-persistentvolumeclaim.yaml create mode 100644 ttrss/db-deployment.yaml create mode 100644 ttrss/db-persistentvolumeclaim.yaml create mode 100644 ttrss/docker-compose.yaml create mode 100644 ttrss/env-configmap.yaml create mode 100644 ttrss/ingress.yaml create mode 100644 ttrss/updater-claim1-persistentvolumeclaim.yaml create mode 100644 ttrss/updater-deployment.yaml create mode 100644 ttrss/web-nginx-deployment.yaml create mode 100644 ttrss/web-nginx-service.yaml diff --git a/apps/templates/ttrss-folder.yaml b/apps/templates/ttrss-folder.yaml new file mode 100644 index 0000000..95946c1 --- /dev/null +++ b/apps/templates/ttrss-folder.yaml @@ -0,0 +1,19 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: ttrss + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://github.com/rubenhensen/k8scd.git + targetRevision: HEAD + path: ttrss + destination: + server: https://kubernetes.default.svc + namespace: ttrss + syncPolicy: + syncOptions: + - CreateNamespace=true \ No newline at end of file diff --git a/ttrss/.env b/ttrss/.env new file mode 100644 index 0000000..c4d4e81 --- /dev/null +++ b/ttrss/.env @@ -0,0 +1,47 @@ +# Put any local modifications here. + +# Run FPM under this UID/GID. +# OWNER_UID=1000 +# OWNER_GID=1000 + +# FPM settings. +#PHP_WORKER_MAX_CHILDREN=5 +#PHP_WORKER_MEMORY_LIMIT=256M + +# ADMIN_USER_* settings are applied on every startup. + +# Set admin user password to this value. If not set, random password +# will be generated on startup, look for it in the 'app' container logs. +#ADMIN_USER_PASS= + +# Sets admin user access level to this value. Valid values: +# -2 - forbidden to login +# -1 - readonly +# 0 - default user +# 10 - admin +#ADMIN_USER_ACCESS_LEVEL= + +# Auto create another user (in addition to built-in admin) unless it already exists. +#AUTO_CREATE_USER= +#AUTO_CREATE_USER_PASS= +#AUTO_CREATE_USER_ACCESS_LEVEL=0 + +# Default database credentials. +TTRSS_DB_USER=postgres +TTRSS_DB_NAME=postgres +TTRSS_DB_PASS=password + +# You can customize other config.php defines by setting overrides here. +# See tt-rss/.docker/app/Dockerfile for a complete list. + +# You probably shouldn't disable auth_internal unless you know what you're doing. +# TTRSS_PLUGINS=auth_internal,auth_remote +# TTRSS_SINGLE_USER_MODE=true +# TTRSS_SESSION_COOKIE_LIFETIME=2592000 +# TTRSS_FORCE_ARTICLE_PURGE=30 +# ... + +# Bind exposed port to 127.0.0.1 to run behind reverse proxy on the same host. +# If you plan to expose the container, remove "127.0.0.1:". +HTTP_PORT=127.0.0.1:8280 +#HTTP_PORT=8280 \ No newline at end of file diff --git a/ttrss/app-claim1-persistentvolumeclaim.yaml b/ttrss/app-claim1-persistentvolumeclaim.yaml new file mode 100644 index 0000000..e53349e --- /dev/null +++ b/ttrss/app-claim1-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: app-claim1 + name: app-claim1 +spec: + accessModes: + - ReadOnlyMany + resources: + requests: + storage: 100Mi diff --git a/ttrss/app-deployment.yaml b/ttrss/app-deployment.yaml new file mode 100644 index 0000000..50fff4c --- /dev/null +++ b/ttrss/app-deployment.yaml @@ -0,0 +1,63 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: app + name: app +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: app + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: app + spec: + containers: + - env: + - name: HTTP_PORT + valueFrom: + configMapKeyRef: + key: HTTP_PORT + name: env + - name: TTRSS_DB_NAME + valueFrom: + configMapKeyRef: + key: TTRSS_DB_NAME + name: env + - name: TTRSS_DB_PASS + valueFrom: + configMapKeyRef: + key: TTRSS_DB_PASS + name: env + - name: TTRSS_DB_USER + valueFrom: + configMapKeyRef: + key: TTRSS_DB_USER + name: env + image: cthulhoo/ttrss-fpm-pgsql-static:latest + name: app + volumeMounts: + - mountPath: /var/www/html + name: app + - mountPath: /opt/tt-rss/config.d + name: app-claim1 + readOnly: true + restartPolicy: Always + volumes: + - name: app + persistentVolumeClaim: + claimName: app + - name: app-claim1 + persistentVolumeClaim: + claimName: app-claim1 + readOnly: true diff --git a/ttrss/app-persistentvolumeclaim.yaml b/ttrss/app-persistentvolumeclaim.yaml new file mode 100644 index 0000000..acb3aee --- /dev/null +++ b/ttrss/app-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: app + name: app +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi diff --git a/ttrss/db-deployment.yaml b/ttrss/db-deployment.yaml new file mode 100644 index 0000000..3971904 --- /dev/null +++ b/ttrss/db-deployment.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: db + spec: + containers: + - env: + - name: HTTP_PORT + valueFrom: + configMapKeyRef: + key: HTTP_PORT + name: env + - name: POSTGRES_DB + - name: POSTGRES_PASSWORD + - name: POSTGRES_USER + - name: TTRSS_DB_NAME + valueFrom: + configMapKeyRef: + key: TTRSS_DB_NAME + name: env + - name: TTRSS_DB_PASS + valueFrom: + configMapKeyRef: + key: TTRSS_DB_PASS + name: env + - name: TTRSS_DB_USER + valueFrom: + configMapKeyRef: + key: TTRSS_DB_USER + name: env + image: postgres:15-alpine + name: db + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: db + restartPolicy: Always + volumes: + - name: db + persistentVolumeClaim: + claimName: db diff --git a/ttrss/db-persistentvolumeclaim.yaml b/ttrss/db-persistentvolumeclaim.yaml new file mode 100644 index 0000000..0aa2c19 --- /dev/null +++ b/ttrss/db-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: db + name: db +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi diff --git a/ttrss/docker-compose.yaml b/ttrss/docker-compose.yaml new file mode 100644 index 0000000..5030345 --- /dev/null +++ b/ttrss/docker-compose.yaml @@ -0,0 +1,112 @@ +version: '3' + +services: + + # see FAQ entry below if upgrading from a different PostgreSQL major version (e.g. 12 to 15): + # https://tt-rss.org/wiki/InstallationNotes/#i-got-the-updated-compose-file-above-and-now-my-database-keeps-restarting + db: + image: postgres:15-alpine + restart: unless-stopped + env_file: + - .env + environment: + - POSTGRES_USER=${TTRSS_DB_USER} + - POSTGRES_PASSWORD=${TTRSS_DB_PASS} + - POSTGRES_DB=${TTRSS_DB_NAME} + volumes: + - db:/var/lib/postgresql/data + + app: + image: cthulhoo/ttrss-fpm-pgsql-static:latest + restart: unless-stopped + env_file: + - .env + volumes: + - app:/var/www/html + - ./config.d:/opt/tt-rss/config.d:ro + depends_on: + - db + +# optional, makes weekly backups of your install +# backups: +# image: cthulhoo/ttrss-fpm-pgsql-static:latest +# restart: unless-stopped +# env_file: +# - .env +# volumes: +# - backups:/backups +# - app:/var/www/html +# depends_on: +# - db +# command: /opt/tt-rss/dcron.sh -f + + updater: + image: cthulhoo/ttrss-fpm-pgsql-static:latest + restart: unless-stopped + env_file: + - .env + volumes: + - app:/var/www/html + - ./config.d:/opt/tt-rss/config.d:ro + depends_on: + - app + command: /opt/tt-rss/updater.sh + + web-nginx: + image: cthulhoo/ttrss-web-nginx:latest + restart: unless-stopped + env_file: + - .env + ports: + - ${HTTP_PORT}:80 + volumes: + - app:/var/www/html:ro + depends_on: + - app + +volumes: + db: + app: + backups: + + +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: sol-auth +# spec: +# replicas: 1 +# selector: +# matchLabels: +# app: sol-auth +# template: +# metadata: +# labels: +# app: sol-auth +# spec: +# # securityContext: +# # runAsUser: 1000 +# # runAsGroup: 1000 +# # fsGroup: 1000 +# containers: +# - image: hebury/sol-auth:2.3 +# name: sol-auth +# resources: +# requests: +# memory: "50Mi" +# limits: +# memory: "500Mi" +# ports: +# - name: http +# containerPort: 8002 +# hostPort: 8002 +# protocol: TCP +# volumeMounts: +# - name: config-volume +# mountPath: /config/ +# volumes: +# - name: config-volume +# configMap: +# name: httpd-conf +# restartPolicy: Always +# terminationGracePeriodSeconds: 5 \ No newline at end of file diff --git a/ttrss/env-configmap.yaml b/ttrss/env-configmap.yaml new file mode 100644 index 0000000..487d04d --- /dev/null +++ b/ttrss/env-configmap.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +data: + HTTP_PORT: 127.0.0.1:8280 + TTRSS_DB_NAME: postgres + TTRSS_DB_PASS: password + TTRSS_DB_USER: postgres +kind: ConfigMap +metadata: + labels: + io.kompose.service: app-env + name: env diff --git a/ttrss/ingress.yaml b/ttrss/ingress.yaml new file mode 100644 index 0000000..20e13a3 --- /dev/null +++ b/ttrss/ingress.yaml @@ -0,0 +1,34 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: argocd-server-ingress + annotations: + # nginx.ingress.kubernetes.io/rewrite-target: / + cert-manager.io/cluster-issuer: prod-cluster-issuer + nginx.ingress.kubernetes.io/ssl-passthrough: "true" + # If you encounter a redirect loop or are getting a 307 response code + # then you need to force the nginx ingress to connect to the backend using HTTPS. + # + nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" + namespace: ttrss +spec: + ingressClassName: nginx + rules: + - host: argocd.hensen.io + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: argocd-server + port: + name: "80" + + # TLS configuration for HTTPS + tls: + # TLS secretName used on ClusterIssuer + - secretName: letsencrypt-prod + hosts: + - rss.hensen.io + diff --git a/ttrss/updater-claim1-persistentvolumeclaim.yaml b/ttrss/updater-claim1-persistentvolumeclaim.yaml new file mode 100644 index 0000000..6989033 --- /dev/null +++ b/ttrss/updater-claim1-persistentvolumeclaim.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + io.kompose.service: updater-claim1 + name: updater-claim1 +spec: + accessModes: + - ReadOnlyMany + resources: + requests: + storage: 100Mi diff --git a/ttrss/updater-deployment.yaml b/ttrss/updater-deployment.yaml new file mode 100644 index 0000000..b6b24da --- /dev/null +++ b/ttrss/updater-deployment.yaml @@ -0,0 +1,65 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: updater + name: updater +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: updater + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: updater + spec: + containers: + - args: + - /opt/tt-rss/updater.sh + env: + - name: HTTP_PORT + valueFrom: + configMapKeyRef: + key: HTTP_PORT + name: env + - name: TTRSS_DB_NAME + valueFrom: + configMapKeyRef: + key: TTRSS_DB_NAME + name: env + - name: TTRSS_DB_PASS + valueFrom: + configMapKeyRef: + key: TTRSS_DB_PASS + name: env + - name: TTRSS_DB_USER + valueFrom: + configMapKeyRef: + key: TTRSS_DB_USER + name: env + image: cthulhoo/ttrss-fpm-pgsql-static:latest + name: updater + volumeMounts: + - mountPath: /var/www/html + name: app + - mountPath: /opt/tt-rss/config.d + name: updater-claim1 + readOnly: true + restartPolicy: Always + volumes: + - name: app + persistentVolumeClaim: + claimName: app + - name: updater-claim1 + persistentVolumeClaim: + claimName: updater-claim1 + readOnly: true diff --git a/ttrss/web-nginx-deployment.yaml b/ttrss/web-nginx-deployment.yaml new file mode 100644 index 0000000..d8fae6f --- /dev/null +++ b/ttrss/web-nginx-deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: web-nginx + name: web-nginx +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: web-nginx + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: web-nginx + spec: + containers: + - env: + - name: HTTP_PORT + valueFrom: + configMapKeyRef: + key: HTTP_PORT + name: env + - name: TTRSS_DB_NAME + valueFrom: + configMapKeyRef: + key: TTRSS_DB_NAME + name: env + - name: TTRSS_DB_PASS + valueFrom: + configMapKeyRef: + key: TTRSS_DB_PASS + name: env + - name: TTRSS_DB_USER + valueFrom: + configMapKeyRef: + key: TTRSS_DB_USER + name: env + image: cthulhoo/ttrss-web-nginx:latest + name: web-nginx + ports: + - containerPort: 80 + protocol: TCP + volumeMounts: + - mountPath: /var/www/html + name: app + readOnly: true + restartPolicy: Always + volumes: + - name: app + persistentVolumeClaim: + claimName: app + readOnly: true diff --git a/ttrss/web-nginx-service.yaml b/ttrss/web-nginx-service.yaml new file mode 100644 index 0000000..be79b49 --- /dev/null +++ b/ttrss/web-nginx-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose convert + kompose.version: 1.34.0 (cbf2835db) + labels: + io.kompose.service: web-nginx + name: web-nginx +spec: + ports: + - name: "80" + port: 80 + targetPort: 80 + selector: + io.kompose.service: web-nginx