From 2fc740b91af289ee09ad399532bf020e851600bd Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Sat, 22 Jul 2023 05:58:36 -0400 Subject: [PATCH] WIP migrate(misskey) migrate to new common **BREAKING CHANGES** (#10285) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Migrate app to new common and update container to latest version. ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [X] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros kois --- charts/incubator/misskey/Chart.yaml | 20 ++-- charts/incubator/misskey/questions.yaml | 56 ++++++--- charts/incubator/misskey/templates/NOTES.txt | 1 + .../misskey/templates/_configmap.tpl | 106 ++++++------------ .../incubator/misskey/templates/common.yaml | 10 +- charts/incubator/misskey/values.yaml | 53 +++++---- 6 files changed, 127 insertions(+), 119 deletions(-) create mode 100644 charts/incubator/misskey/templates/NOTES.txt diff --git a/charts/incubator/misskey/Chart.yaml b/charts/incubator/misskey/Chart.yaml index 0520c8d8b82..3087d8389d0 100644 --- a/charts/incubator/misskey/Chart.yaml +++ b/charts/incubator/misskey/Chart.yaml @@ -1,20 +1,16 @@ apiVersion: v2 -appVersion: "13.8.1" -home: https://truecharts.org/charts/incubator/misskey +appVersion: "13.13.2" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 - - condition: postgresql.enabled - name: postgresql - repository: https://deps.truecharts.org/ - version: 11.0.31 + version: 12.14.6 - condition: redis.enabled name: redis repository: https://deps.truecharts.org - version: 5.0.33 + version: 6.0.62 deprecated: false -description: "Misskey is an open source, decentralized social media platform that's free forever!" +description: Open source decentralized social media platform that's free forever! +home: https://truecharts.org/charts/incubator/misskey icon: https://truecharts.org/img/hotlink-ok/chart-icons/misskey.png keywords: - Misskey @@ -32,9 +28,9 @@ name: misskey sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/misskey - https://github.com/misskey-dev/misskey/ +type: application +version: 4.0.0 annotations: - truecharts.org/SCALE-support: "true" truecharts.org/catagories: | - Social -type: application -version: 3.0.43 + truecharts.org/SCALE-support: "true" diff --git a/charts/incubator/misskey/questions.yaml b/charts/incubator/misskey/questions.yaml index b0291b28a3d..3406b3f7444 100644 --- a/charts/incubator/misskey/questions.yaml +++ b/charts/incubator/misskey/questions.yaml @@ -83,6 +83,13 @@ questions: type: int required: true default: 16 + - variable: relashionshipJobConcurrency + label: Relashionship Job Concurrency + description: Relashionship job concurrency per worker + schema: + type: int + required: true + default: 16 - variable: deliverJobPerSec label: Deliver Jobs Per Second description: Job rate limiter @@ -97,6 +104,13 @@ questions: type: int required: true default: 16 + - variable: relashionshipJobPerSec + label: Relashionship Jobs Per Second + description: Relashionship job rate limiter + schema: + type: int + required: true + default: 64 - variable: deliverJobMaxAttempts label: Max Deliver Job Attempts schema: @@ -122,6 +136,23 @@ questions: type: string required: true default: "" + - variable: proxyBypassHosts + label: Proxy Bypass Hosts + schema: + type: list + default: + - api.deepl.com + - api-free.deepl.com + - www.recaptcha.net + - hcaptcha.com + - challenges.cloudflare.com + items: + - variable: proxyBypassHostEntry + label: Proxy Bypass Host Entry + schema: + type: string + required: true + default: "" # Include{containerConfig} # Include{serviceRoot} - variable: main @@ -171,20 +202,19 @@ questions: # Include{ingressTraefik} # Include{ingressAdvanced} # Include{ingressList} - # Include{podSecurityContextRoot} - - variable: runAsUser - label: runAsUser - description: The UserID of the user running the application - schema: - type: int - default: 0 - - variable: runAsGroup - label: runAsGroup - description: The groupID this App of the user running the application - schema: - type: int - default: 0 + - variable: runAsUser + label: runAsUser + description: The UserID of the user running the application + schema: + type: int + default: 0 + - variable: runAsGroup + label: runAsGroup + description: The groupID this App of the user running the application + schema: + type: int + default: 0 # Include{securityContextContainer} # Include{securityContextAdvanced} # Include{securityContextPod} diff --git a/charts/incubator/misskey/templates/NOTES.txt b/charts/incubator/misskey/templates/NOTES.txt new file mode 100644 index 00000000000..efcb74cb772 --- /dev/null +++ b/charts/incubator/misskey/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/misskey/templates/_configmap.tpl b/charts/incubator/misskey/templates/_configmap.tpl index e545e2f4593..372b23ff59b 100644 --- a/charts/incubator/misskey/templates/_configmap.tpl +++ b/charts/incubator/misskey/templates/_configmap.tpl @@ -1,11 +1,6 @@ {{/* Define the configmap */}} {{- define "misskey.configmap" -}} - ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: misskeyconfig +enabled: true data: default.yml: |- #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -24,56 +19,22 @@ data: # ┌───────────────────────┐ #───┘ Port and TLS settings └─────────────────────────────────── - # - # Misskey supports two deployment options for public. - # - - # Option 1: With Reverse Proxy - # - # +----- https://example.tld/ ------------+ - # +------+ |+-------------+ +----------------+| - # | User | ---> || Proxy (443) | ---> | Misskey (3000) || - # +------+ |+-------------+ +----------------+| - # +---------------------------------------+ - # - # You need to setup reverse proxy. (eg. nginx) - # You do not define 'https' section. - - # Option 2: Standalone - # - # +- https://example.tld/ -+ - # +------+ | +---------------+ | - # | User | ---> | | Misskey (443) | | - # +------+ | +---------------+ | - # +------------------------+ - # - # You need to run Misskey as root. - # You need to set Certificate in 'https' section. - - # To use option 1, uncomment below line. port: {{ .Values.service.main.ports.main.port }} # A port that your Misskey server should listen. - # To use option 2, uncomment below lines. - #port: 443 - - #https: - # # path for certification - # key: /etc/letsencrypt/live/example.tld/privkey.pem - # cert: /etc/letsencrypt/live/example.tld/fullchain.pem # ┌──────────────────────────┐ #───┘ PostgreSQL configuration └──────────────────────────────── db: - host: {{ printf "%v-%v" .Release.Name "postgresql" }} + host: {{ .Values.cnpg.main.creds.host | trimAll "\"" }} port: 5432 # Database name - db: {{ .Values.postgresql.postgresqlDatabase }} + db: {{ .Values.cnpg.main.database }} # Auth - user: {{ .Values.postgresql.postgresqlUsername }} - pass: {{ .Values.postgresql.postgresqlPassword | trimAll "\"" }} + user: {{ .Values.cnpg.main.user }} + pass: {{ .Values.cnpg.main.creds.password | trimAll "\"" }} # Whether disable Caching queries #disableCache: true @@ -84,13 +45,30 @@ data: # ┌─────────────────────┐ #───┘ Redis configuration └───────────────────────────────────── - + {{- $redisHost := .Values.redis.creds.plainhost | trimAll "\"" }} + {{- $redisPass := .Values.redis.creds.redisPassword | trimAll "\"" }} redis: - host: {{ printf "%v-%v" .Release.Name "redis" }} + host: {{ $redisHost }} port: 6379 - pass: {{ .Values.redis.redisPassword | trimAll "\"" }} - #prefix: example-prefix - #db: 1 + pass: {{ $redisPass }} + prefix: main + db: 0 + + redisForPubsub: + host: {{ $redisHost }} + port: 6379 + #family: 0 # 0=Both, 4=IPv4, 6=IPv6 + pass: {{ $redisPass }} + prefix: pub-sub + db: 0 + + redisForJobQueue: + host: {{ $redisHost }} + port: 6379 + #family: 0 # 0=Both, 4=IPv4, 6=IPv6 + pass: {{ $redisPass }} + prefix: job-queue + db: 0 # ┌─────────────────────────────┐ #───┘ Elasticsearch configuration └───────────────────────────── @@ -105,20 +83,11 @@ data: # ┌───────────────┐ #───┘ ID generation └─────────────────────────────────────────── - # You can select the ID generation method. - # You don't usually need to change this setting, but you can - # change it according to your preferences. - - # Available methods: - # aid ... Short, Millisecond accuracy - # meid ... Similar to ObjectID, Millisecond accuracy - # ulid ... Millisecond accuracy - # objectid ... This is left for backward compatibility - # ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE # ID SETTINGS AFTER THAT! id: {{ .Values.misskey.id }} + # ┌─────────────────────┐ #───┘ Other configuration └───────────────────────────────────── @@ -131,10 +100,12 @@ data: # Job concurrency per worker deliverJobConcurrency: {{ .Values.misskey.other.deliverJobConcurrency }} inboxJobConcurrency: {{ .Values.misskey.other.inboxJobConcurrency }} + relashionshipJobConcurrency: {{ .Values.misskey.other.relashionshipJobConcurrency }} # Job rate limiter deliverJobPerSec: {{ .Values.misskey.other.deliverJobPerSec }} inboxJobPerSec: {{ .Values.misskey.other.inboxJobPerSec }} + relashionshipJobPerSec: {{ .Values.misskey.other.relashionshipJobPerSec }} # Job attempts deliverJobMaxAttempts: {{ .Values.misskey.other.deliverJobMaxAttempts }} @@ -143,18 +114,15 @@ data: # IP address family used for outgoing request (ipv4, ipv6 or dual) #outgoingAddressFamily: ipv4 - # Syslog option - #syslog: - # host: localhost - # port: 514 - # Proxy for HTTP/HTTPS #proxy: http://127.0.0.1:3128 - #proxyBypassHosts: [ - # 'example.com', - # '192.0.2.8' - #] + {{- with $hosts := .Values.misskey.other.proxyBypassHosts }} + proxyBypassHosts: + {{- range $item := $hosts }} + - {{ $item }} + {{- end }} + {{- end }} # Proxy for SMTP/SMTPS #proxySmtp: http://127.0.0.1:3128 # use HTTP/1.1 CONNECT @@ -176,6 +144,4 @@ data: # Upload or download file size limits (bytes) maxFileSize: {{ .Values.misskey.other.maxFileSize }} - - {{- end -}} diff --git a/charts/incubator/misskey/templates/common.yaml b/charts/incubator/misskey/templates/common.yaml index ae43900cad9..b4ac6c0692e 100644 --- a/charts/incubator/misskey/templates/common.yaml +++ b/charts/incubator/misskey/templates/common.yaml @@ -1,8 +1,10 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . }} -{{/* Render configmap for misskey */}} -{{- include "misskey.configmap" . }} +{{- $configmap := include "misskey.configmap" . | fromYaml -}} +{{- if $configmap -}} + {{- $_ := set .Values.configmap "misskeyconfig" $configmap -}} +{{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/misskey/values.yaml b/charts/incubator/misskey/values.yaml index 6049d7150d6..026c3263f9f 100644 --- a/charts/incubator/misskey/values.yaml +++ b/charts/incubator/misskey/values.yaml @@ -1,16 +1,16 @@ image: repository: tccr.io/truecharts/misskey pullPolicy: IfNotPresent - tag: 13.8.1@sha256:8c0686172b31fd55c25168f333107ba1ae7a622505d36a95d387a41209927fbe + tag: v13.13.2@sha256:efc293f9d7988327e4e4c9c2694f8889edfb0165edf8bef1ea4a5b4ca6409402 securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false - -podSecurityContext: - runAsUser: 0 - runAsGroup: 0 - fsGroup: 33 + pod: + fsgroup: 33 + container: + runAsNonRoot: false + readOnlyRootFilesystem: false + runAsUser: 0 + runAsGroup: 0 service: main: @@ -25,41 +25,54 @@ misskey: id: "aid" other: disableHSTS: false - signToActivityPubGet: false + signToActivityPubGet: true maxFileSize: 262144000 clusterLimit: 1 deliverJobConcurrency: 128 inboxJobConcurrency: 16 + relashionshipJobConcurrency: 16 deliverJobPerSec: 128 inboxJobPerSec: 16 + relashionshipJobPerSec: 64 deliverJobMaxAttempts: 12 inboxJobMaxAttempts: 8 allowedPrivateNetworks: - 127.0.0.1/32 + proxyBypassHosts: + - api.deepl.com + - api-free.deepl.com + - www.recaptcha.net + - hcaptcha.com + - challenges.cloudflare.com -env: - # NODE_ENV = production | development - NODE_ENV: production +workload: + main: + podSpec: + containers: + main: + env: + NODE_ENV: production persistence: misskeyconfig: enabled: true - type: configMap + type: configmap objectName: misskeyconfig mountPath: "/misskey/.config" files: enabled: true mountPath: "/misskey/files" -postgresql: - enabled: true - existingSecret: "dbcreds" - postgresqlUsername: misskey - postgresqlDatabase: misskey +cnpg: + main: + enabled: true + user: misskey + database: misskey redis: enabled: true - existingSecret: "rediscreds" + username: default portal: - enabled: true + open: + enabled: true