From ca04835d2a32d3b91f4adc8b47751f2bdb9acbc4 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Sat, 29 Oct 2022 12:31:56 +0300 Subject: [PATCH 01/16] update chart to support docs v2 --- Chart.yaml | 4 +-- templates/configmap.yaml | 6 ++--- templates/deployment.yaml | 28 +++++++++++++-------- templates/volumes.yaml | 7 +++++- values.yaml | 53 +++++++++++++++++++++++---------------- 5 files changed, 59 insertions(+), 39 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index 4cbcbe0..16c3e29 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: codex-docs description: A Helm chart for CodeX Docs type: application -version: "0.3.0" -appVersion: "0.3.5" +version: "2.0.0-alpha.1" +appVersion: "stage-9f72b32-1666992781" diff --git a/templates/configmap.yaml b/templates/configmap.yaml index 49b29ef..ebb9d9f 100644 --- a/templates/configmap.yaml +++ b/templates/configmap.yaml @@ -3,7 +3,5 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-config data: - codexdocsrc: |- - {{ .Values.configuration.codexdocsrc | toJson }} - production.json: |- - {{ .Values.configuration.production | toJson }} \ No newline at end of file + docs-config.yaml: |- + {{- .Values.configuration | toYaml | nindent 4 }} \ No newline at end of file diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 6d2a1b2..d2c697f 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -5,12 +5,13 @@ metadata: labels: {{- include "codexdocs.labels" . | nindent 4 }} spec: -{{/* {{- if not .Values.autoscaling.enabled }}*/}} -{{/* replicas: {{ .Values.replicaCount }}*/}} -{{/* {{- end }}*/}} + {{- if or (eq .Values.configuration.database.driver "local") (eq .Values.configuration.uploads.driver "local")}} replicas: 1 strategy: type: Recreate + {{- else }} + replicas: {{ .Values.replicaCount }} + {{- end }} selector: matchLabels: {{- include "codexdocs.selectorLabels" . | nindent 6 }} @@ -34,12 +35,16 @@ spec: configMap: defaultMode: 420 name: {{ .Release.Name }}-config + {{- if eq .Values.configuration.database.driver "local" }} - name: {{ include "codexdocs.fullname" . }}-db persistentVolumeClaim: claimName: {{ include "codexdocs.fullname" . }}-db + {{- end }} + {{- if eq .Values.configuration.uploads.driver "local" }} - name: {{ include "codexdocs.fullname" . }}-uploads persistentVolumeClaim: claimName: {{ include "codexdocs.fullname" . }}-uploads + {{- end }} containers: - name: {{ .Chart.Name }} securityContext: @@ -47,22 +52,23 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - - name: PASSWORD + - name: APP_CONFIG_auth_password valueFrom: secretKeyRef: name: {{ template "codexdocs.secretName" . }} key: {{ template "codexdocs.secretPasswordKey" . }} volumeMounts: - name: config - mountPath: /usr/src/app/.codexdocsrc - subPath: "codexdocsrc" - - name: config - mountPath: /usr/src/app/config/production.json - subPath: "production.json" + mountPath: /usr/src/app/config/docs-config.yaml + subPath: "docs-config.yaml" + {{- if eq .Values.configuration.database.driver "local" }} - name: {{ include "codexdocs.fullname" . }}-db - mountPath: {{ .Values.configuration.production.database }} + mountPath: {{ .Values.configuration.database.local.path }} + {{- end}} + {{- if eq .Values.configuration.uploads.driver "local" }} - name: {{ include "codexdocs.fullname" . }}-uploads - mountPath: {{ .Values.configuration.production.uploads }} + mountPath: {{ .Values.configuration.uploads.local.path }} + {{- end}} ports: - name: http containerPort: 3000 diff --git a/templates/volumes.yaml b/templates/volumes.yaml index e8e9ed2..89f4e49 100644 --- a/templates/volumes.yaml +++ b/templates/volumes.yaml @@ -1,3 +1,4 @@ +{{ if eq .Values.configuration.database.driver "local" }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -11,6 +12,9 @@ spec: resources: requests: storage: {{ .Values.volumes.db.storage }} +{{end}} + +{{ if eq .Values.configuration.uploads.driver "local" }} --- apiVersion: v1 kind: PersistentVolumeClaim @@ -24,4 +28,5 @@ spec: - ReadWriteOnce resources: requests: - storage: {{ .Values.volumes.uploads.storage }} \ No newline at end of file + storage: {{ .Values.volumes.uploads.storage }} +{{end}} \ No newline at end of file diff --git a/values.yaml b/values.yaml index cb479ee..1b881c2 100644 --- a/values.yaml +++ b/values.yaml @@ -1,29 +1,40 @@ -#replicaCount: 1 +replicaCount: 1 configuration: - codexdocsrc: + port: 3000 + host: "0.0.0.0" + uploads: + driver: "s3" + s3: + bucket: "my-bucket" + region: "eu-central-1" + baseUrl: "http://docs-static.codex.so.s3-website.eu-central-1.amazonaws.com" + keyPrefix: "/" + accessKeyId: "my-access-key" + secretAccessKey: "my-secret-key" + frontend: title: "CodeX Docs" description: "A block-styled editor with clean JSON output" - landingFrameSrc: "https://codex.so/editor?frame=1" + startPage: "" + misprintsChatId: "12344564" + yandexMetrikaId: "" + carbon: + serve: "" + placement: "" menu: - "Guides" - - "API" - - "Plugins" - - title: "Support Project" - uri: "/support" - misprintsChatId: - startPage: - yandexMetrikaId: - carbon: - placement: - serve: - production: - port: 3000 - database: "/mnt/db" - rcFile: "./.codexdocsrc" - uploads: "/usr/src/app/public/uploads" - secret: "iamasecretstring" - favicon: "" + - title: "CodeX" + uri: "https://codex.so" + + auth: + password: "will be generated automatically" + secret: supersecret + + database: + driver: mongodb # you can change database driver here. 'mongodb' or 'local' + mongodb: + uri: mongodb://localhost:27017/docs + # Authentication parameters auth: @@ -42,7 +53,7 @@ auth: image: repository: ghcr.io/codex-team/codex.docs - pullPolicy: Always + pullPolicy: IfNotPresent tag: "" imagePullSecrets: [] From 19d019dd6b7a3539e8848d1f0ccf5c87dca3479a Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Sat, 29 Oct 2022 12:52:53 +0300 Subject: [PATCH 02/16] some fixes --- templates/deployment.yaml | 10 +++++++++- templates/volumes.yaml | 4 ++-- values.yaml | 9 +++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/templates/deployment.yaml b/templates/deployment.yaml index d2c697f..6b1f88b 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -2,6 +2,11 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "codexdocs.fullname" . }} + annotations: + checksum/config: {{ .Values.configuration | toString | sha256sum }} + {{- if .Values.annotations }} + {{- toYaml .Values.annotations | nindent 4 }} + {{- end }} labels: {{- include "codexdocs.labels" . | nindent 4 }} spec: @@ -57,6 +62,9 @@ spec: secretKeyRef: name: {{ template "codexdocs.secretName" . }} key: {{ template "codexdocs.secretPasswordKey" . }} +{{- if .Values.env }} +{{ toYaml .Values.env | indent 12 }} +{{- end }} volumeMounts: - name: config mountPath: /usr/src/app/config/docs-config.yaml @@ -67,7 +75,7 @@ spec: {{- end}} {{- if eq .Values.configuration.uploads.driver "local" }} - name: {{ include "codexdocs.fullname" . }}-uploads - mountPath: {{ .Values.configuration.uploads.local.path }} + mountPath: {{ .Values.configuration.uploads.local.path }} {{- end}} ports: - name: http diff --git a/templates/volumes.yaml b/templates/volumes.yaml index 89f4e49..82caef9 100644 --- a/templates/volumes.yaml +++ b/templates/volumes.yaml @@ -6,7 +6,7 @@ metadata: labels: {{- include "codexdocs.labels" . | nindent 4 }} spec: - storageClassName: {{ .Values.volumes.db.storageClassName }} + storageClassName: {{ .Values.volumes.db.storageClassName | quote }} accessModes: - ReadWriteOnce resources: @@ -23,7 +23,7 @@ metadata: labels: {{- include "codexdocs.labels" . | nindent 4 }} spec: - storageClassName: {{ .Values.volumes.uploads.storageClassName }} + storageClassName: {{ .Values.volumes.uploads.storageClassName | quote }} accessModes: - ReadWriteOnce resources: diff --git a/values.yaml b/values.yaml index 1b881c2..e14fdee 100644 --- a/values.yaml +++ b/values.yaml @@ -1,5 +1,7 @@ replicaCount: 1 +annotations: + configuration: port: 3000 host: "0.0.0.0" @@ -35,6 +37,13 @@ configuration: mongodb: uri: mongodb://localhost:27017/docs +# Additional Environment variables +env: {} +# - name: APP_CONFIG_hawk_backendToken +# valueFrom: +# secretKeyRef: +# key: backend-token +# name: hawk-creds # Authentication parameters auth: From 3244a2f73f161aff7668c2ad869e50e1c51cebec Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 21:58:33 +0200 Subject: [PATCH 03/16] update publish job --- .github/workflows/push.yaml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index b0c94d7..3a3f0dc 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -13,15 +13,24 @@ jobs: run: helm lint deploy: - name: deploy - if: startsWith(github.ref, 'refs/tags/v') - needs: lint - runs-on: ubuntu-latest - steps: - - uses: craftech-io/helm-push-action@v0.0.2 + name: deploy + if: startsWith(github.ref, 'refs/tags/v') + needs: lint + runs-on: ubuntu-latest + steps: + - name: Helm Push + uses: bsord/helm-push@v4.1.0 with: - helm-chart-repo-name: codex - helm-chart-repo-url: https://charts.codex.so - chart-dir: . - repo-username: ${{ secrets.HELM_REPO_USERNAME }} - repo-password: ${{ secrets.HELM_REPO_PASSWORD }} + useOCIRegistry: true + registry-url: oci://ghcr.io/${{ github.repository }} + username: ${{ github.actor }} + access-token: ${{ secrets.GITHUB_TOKEN }} + force: true + chart-folder: . +# - uses: craftech-io/helm-push-action@v0.0.2 +# with: +# helm-chart-repo-name: codex +# helm-chart-repo-url: https://charts.codex.so +# chart-dir: . +# repo-username: ${{ secrets.HELM_REPO_USERNAME }} +# repo-password: ${{ secrets.HELM_REPO_PASSWORD }} From 2bcedd44d7739108c543927a754fdfe3acbe79e6 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 22:02:03 +0200 Subject: [PATCH 04/16] try to fix workflow --- .github/workflows/push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 3a3f0dc..fa7dcc2 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -26,7 +26,7 @@ jobs: username: ${{ github.actor }} access-token: ${{ secrets.GITHUB_TOKEN }} force: true - chart-folder: . +# chart-folder: . # - uses: craftech-io/helm-push-action@v0.0.2 # with: # helm-chart-repo-name: codex From 622d7ca1edd24c652565483c77d0c4d6fd0dfc0d Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 22:04:01 +0200 Subject: [PATCH 05/16] try to use relative path --- .github/workflows/push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index fa7dcc2..04c682b 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -26,7 +26,7 @@ jobs: username: ${{ github.actor }} access-token: ${{ secrets.GITHUB_TOKEN }} force: true -# chart-folder: . + chart-folder: ./ # - uses: craftech-io/helm-push-action@v0.0.2 # with: # helm-chart-repo-name: codex From d22248e38656203e75c0d8cfb30e2abbf2b41d81 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 22:12:44 +0200 Subject: [PATCH 06/16] fix pipeline --- .github/workflows/push.yaml | 4 +++- Chart.yaml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 04c682b..751ce3e 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -18,6 +18,8 @@ jobs: needs: lint runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v3 - name: Helm Push uses: bsord/helm-push@v4.1.0 with: @@ -26,7 +28,7 @@ jobs: username: ${{ github.actor }} access-token: ${{ secrets.GITHUB_TOKEN }} force: true - chart-folder: ./ + chart-folder: . # - uses: craftech-io/helm-push-action@v0.0.2 # with: # helm-chart-repo-name: codex diff --git a/Chart.yaml b/Chart.yaml index 16c3e29..03cfc58 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: codex-docs description: A Helm chart for CodeX Docs type: application -version: "2.0.0-alpha.1" +version: "2.0.0-rc4" appVersion: "stage-9f72b32-1666992781" From 88e30396a38587a846cd63fbfa82d771066bc0ab Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 22:48:51 +0200 Subject: [PATCH 07/16] fix config path --- templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 6b1f88b..213b9de 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -67,7 +67,7 @@ spec: {{- end }} volumeMounts: - name: config - mountPath: /usr/src/app/config/docs-config.yaml + mountPath: /usr/src/app/docs-config.yaml subPath: "docs-config.yaml" {{- if eq .Values.configuration.database.driver "local" }} - name: {{ include "codexdocs.fullname" . }}-db From 7c811543178750c5eb8970d58b47ca0804c70d6c Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 22:54:23 +0200 Subject: [PATCH 08/16] fix chart yaml --- Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chart.yaml b/Chart.yaml index 03cfc58..abb72b4 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: codex-docs description: A Helm chart for CodeX Docs type: application -version: "2.0.0-rc4" +version: "2.0.0-rc6" appVersion: "stage-9f72b32-1666992781" From 88a248b063bb55137be8cf2baf1dc38a0b43f316 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 23:50:23 +0200 Subject: [PATCH 09/16] menu empty by default --- values.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/values.yaml b/values.yaml index e14fdee..6fb5485 100644 --- a/values.yaml +++ b/values.yaml @@ -23,11 +23,7 @@ configuration: carbon: serve: "" placement: "" - menu: - - "Guides" - - title: "CodeX" - uri: "https://codex.so" - + menu: [] auth: password: "will be generated automatically" secret: supersecret From 601228ffd54e463d6a7b01ee293b9bf33b2ae361 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 23:53:14 +0200 Subject: [PATCH 10/16] fix checksum config annotation --- templates/deployment.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 213b9de..60e051c 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -2,11 +2,10 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "codexdocs.fullname" . }} + {{- with .Values.annotations }} annotations: - checksum/config: {{ .Values.configuration | toString | sha256sum }} - {{- if .Values.annotations }} - {{- toYaml .Values.annotations | nindent 4 }} - {{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} labels: {{- include "codexdocs.labels" . | nindent 4 }} spec: @@ -22,8 +21,9 @@ spec: {{- include "codexdocs.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: + checksum/config: {{ .Values.configuration | toString | sha256sum }} + {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: From e93afa4c04985ff824d2523c0b79ae7b9b7a19d3 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 2 Nov 2022 23:54:06 +0200 Subject: [PATCH 11/16] update chart version --- Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chart.yaml b/Chart.yaml index abb72b4..a926e19 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: codex-docs description: A Helm chart for CodeX Docs type: application -version: "2.0.0-rc6" +version: "2.0.0-rc7" appVersion: "stage-9f72b32-1666992781" From 5caa24c5b6f36f2eed151a699b5dbadc10a48fb3 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Mon, 7 Nov 2022 09:04:20 -0300 Subject: [PATCH 12/16] update chart version --- Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index a926e19..31910cb 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: codex-docs description: A Helm chart for CodeX Docs type: application -version: "2.0.0-rc7" -appVersion: "stage-9f72b32-1666992781" +version: "2.0.0-rc.8" +appVersion: "v2.0.0-rc.2" From 41e5533ea2bd7e5e77e516245701e62255c4881e Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Mon, 7 Nov 2022 09:46:51 -0300 Subject: [PATCH 13/16] update chart version --- Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index 31910cb..ced9b71 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: codex-docs description: A Helm chart for CodeX Docs type: application -version: "2.0.0-rc.8" -appVersion: "v2.0.0-rc.2" +version: "2.0.0-rc.9" +appVersion: "v2.0.0-rc.8" From fa92066e6d45d9e5e0e100770998e1f8cadecf70 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Mon, 7 Nov 2022 09:52:44 -0300 Subject: [PATCH 14/16] update readme --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a7bdf1..d470620 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,15 @@ # codex.docs.chart Helm chart for deploying CodeX Docs -## Running +## Installing + +In order to install this chart, run the following command: + +```bash +helm upgrade codex-docs oci://ghcr.io/codex-team/codex.docs.chart/codex-docs --version --install +``` + +## Running locally Execute the following commands from the repository root folder: ``` From f78a2dd594d22ca712cb6544d34d607df9f6fd9e Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Mon, 7 Nov 2022 10:13:03 -0300 Subject: [PATCH 15/16] remove unnecessary code --- .github/workflows/push.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 751ce3e..6848f97 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -28,11 +28,4 @@ jobs: username: ${{ github.actor }} access-token: ${{ secrets.GITHUB_TOKEN }} force: true - chart-folder: . -# - uses: craftech-io/helm-push-action@v0.0.2 -# with: -# helm-chart-repo-name: codex -# helm-chart-repo-url: https://charts.codex.so -# chart-dir: . -# repo-username: ${{ secrets.HELM_REPO_USERNAME }} -# repo-password: ${{ secrets.HELM_REPO_PASSWORD }} + chart-folder: . \ No newline at end of file From 7908acaa3d3cf4133d5f176d390178b841ecffb9 Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Wed, 16 Nov 2022 07:12:38 -0300 Subject: [PATCH 16/16] set release version --- Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index ced9b71..78b4bdd 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: codex-docs description: A Helm chart for CodeX Docs type: application -version: "2.0.0-rc.9" -appVersion: "v2.0.0-rc.8" +version: "2.0.0" +appVersion: "v2.0.0"