Skip to content

Commit 12beead

Browse files
authored
Merge pull request #8 from codex-team/docs-v2
Docs v2 support
2 parents 4ab92fd + 7908aca commit 12beead

7 files changed

Lines changed: 100 additions & 55 deletions

File tree

.github/workflows/push.yaml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ jobs:
1313
run: helm lint
1414

1515
deploy:
16-
name: deploy
17-
if: startsWith(github.ref, 'refs/tags/v')
18-
needs: lint
19-
runs-on: ubuntu-latest
20-
steps:
21-
- uses: craftech-io/helm-push-action@v0.0.2
16+
name: deploy
17+
if: startsWith(github.ref, 'refs/tags/v')
18+
needs: lint
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- name: Helm Push
24+
uses: bsord/helm-push@v4.1.0
2225
with:
23-
helm-chart-repo-name: codex
24-
helm-chart-repo-url: https://charts.codex.so
25-
chart-dir: .
26-
repo-username: ${{ secrets.HELM_REPO_USERNAME }}
27-
repo-password: ${{ secrets.HELM_REPO_PASSWORD }}
26+
useOCIRegistry: true
27+
registry-url: oci://ghcr.io/${{ github.repository }}
28+
username: ${{ github.actor }}
29+
access-token: ${{ secrets.GITHUB_TOKEN }}
30+
force: true
31+
chart-folder: .

Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: codex-docs
33
description: A Helm chart for CodeX Docs
44
type: application
5-
version: "0.3.0"
6-
appVersion: "0.3.5"
5+
version: "2.0.0"
6+
appVersion: "v2.0.0"

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# codex.docs.chart
22
Helm chart for deploying CodeX Docs
33

4-
## Running
4+
## Installing
5+
6+
In order to install this chart, run the following command:
7+
8+
```bash
9+
helm upgrade codex-docs oci://ghcr.io/codex-team/codex.docs.chart/codex-docs --version <specify_latest_version_here> --install
10+
```
11+
12+
## Running locally
513

614
Execute the following commands from the repository root folder:
715
```

templates/configmap.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ kind: ConfigMap
33
metadata:
44
name: {{ .Release.Name }}-config
55
data:
6-
codexdocsrc: |-
7-
{{ .Values.configuration.codexdocsrc | toJson }}
8-
production.json: |-
9-
{{ .Values.configuration.production | toJson }}
6+
docs-config.yaml: |-
7+
{{- .Values.configuration | toYaml | nindent 4 }}

templates/deployment.yaml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,28 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: {{ include "codexdocs.fullname" . }}
5+
{{- with .Values.annotations }}
6+
annotations:
7+
{{- toYaml . | nindent 4 }}
8+
{{- end }}
59
labels:
610
{{- include "codexdocs.labels" . | nindent 4 }}
711
spec:
8-
{{/* {{- if not .Values.autoscaling.enabled }}*/}}
9-
{{/* replicas: {{ .Values.replicaCount }}*/}}
10-
{{/* {{- end }}*/}}
12+
{{- if or (eq .Values.configuration.database.driver "local") (eq .Values.configuration.uploads.driver "local")}}
1113
replicas: 1
1214
strategy:
1315
type: Recreate
16+
{{- else }}
17+
replicas: {{ .Values.replicaCount }}
18+
{{- end }}
1419
selector:
1520
matchLabels:
1621
{{- include "codexdocs.selectorLabels" . | nindent 6 }}
1722
template:
1823
metadata:
19-
{{- with .Values.podAnnotations }}
2024
annotations:
25+
checksum/config: {{ .Values.configuration | toString | sha256sum }}
26+
{{- with .Values.podAnnotations }}
2127
{{- toYaml . | nindent 8 }}
2228
{{- end }}
2329
labels:
@@ -34,35 +40,43 @@ spec:
3440
configMap:
3541
defaultMode: 420
3642
name: {{ .Release.Name }}-config
43+
{{- if eq .Values.configuration.database.driver "local" }}
3744
- name: {{ include "codexdocs.fullname" . }}-db
3845
persistentVolumeClaim:
3946
claimName: {{ include "codexdocs.fullname" . }}-db
47+
{{- end }}
48+
{{- if eq .Values.configuration.uploads.driver "local" }}
4049
- name: {{ include "codexdocs.fullname" . }}-uploads
4150
persistentVolumeClaim:
4251
claimName: {{ include "codexdocs.fullname" . }}-uploads
52+
{{- end }}
4353
containers:
4454
- name: {{ .Chart.Name }}
4555
securityContext:
4656
{{- toYaml .Values.securityContext | nindent 12 }}
4757
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
4858
imagePullPolicy: {{ .Values.image.pullPolicy }}
4959
env:
50-
- name: PASSWORD
60+
- name: APP_CONFIG_auth_password
5161
valueFrom:
5262
secretKeyRef:
5363
name: {{ template "codexdocs.secretName" . }}
5464
key: {{ template "codexdocs.secretPasswordKey" . }}
65+
{{- if .Values.env }}
66+
{{ toYaml .Values.env | indent 12 }}
67+
{{- end }}
5568
volumeMounts:
5669
- name: config
57-
mountPath: /usr/src/app/.codexdocsrc
58-
subPath: "codexdocsrc"
59-
- name: config
60-
mountPath: /usr/src/app/config/production.json
61-
subPath: "production.json"
70+
mountPath: /usr/src/app/docs-config.yaml
71+
subPath: "docs-config.yaml"
72+
{{- if eq .Values.configuration.database.driver "local" }}
6273
- name: {{ include "codexdocs.fullname" . }}-db
63-
mountPath: {{ .Values.configuration.production.database }}
74+
mountPath: {{ .Values.configuration.database.local.path }}
75+
{{- end}}
76+
{{- if eq .Values.configuration.uploads.driver "local" }}
6477
- name: {{ include "codexdocs.fullname" . }}-uploads
65-
mountPath: {{ .Values.configuration.production.uploads }}
78+
mountPath: {{ .Values.configuration.uploads.local.path }}
79+
{{- end}}
6680
ports:
6781
- name: http
6882
containerPort: 3000

templates/volumes.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
{{ if eq .Values.configuration.database.driver "local" }}
12
apiVersion: v1
23
kind: PersistentVolumeClaim
34
metadata:
45
name: {{ include "codexdocs.fullname" . }}-db
56
labels:
67
{{- include "codexdocs.labels" . | nindent 4 }}
78
spec:
8-
storageClassName: {{ .Values.volumes.db.storageClassName }}
9+
storageClassName: {{ .Values.volumes.db.storageClassName | quote }}
910
accessModes:
1011
- ReadWriteOnce
1112
resources:
1213
requests:
1314
storage: {{ .Values.volumes.db.storage }}
15+
{{end}}
16+
17+
{{ if eq .Values.configuration.uploads.driver "local" }}
1418
---
1519
apiVersion: v1
1620
kind: PersistentVolumeClaim
@@ -19,9 +23,10 @@ metadata:
1923
labels:
2024
{{- include "codexdocs.labels" . | nindent 4 }}
2125
spec:
22-
storageClassName: {{ .Values.volumes.uploads.storageClassName }}
26+
storageClassName: {{ .Values.volumes.uploads.storageClassName | quote }}
2327
accessModes:
2428
- ReadWriteOnce
2529
resources:
2630
requests:
27-
storage: {{ .Values.volumes.uploads.storage }}
31+
storage: {{ .Values.volumes.uploads.storage }}
32+
{{end}}

values.yaml

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,45 @@
1-
#replicaCount: 1
1+
replicaCount: 1
2+
3+
annotations:
24

35
configuration:
4-
codexdocsrc:
6+
port: 3000
7+
host: "0.0.0.0"
8+
uploads:
9+
driver: "s3"
10+
s3:
11+
bucket: "my-bucket"
12+
region: "eu-central-1"
13+
baseUrl: "http://docs-static.codex.so.s3-website.eu-central-1.amazonaws.com"
14+
keyPrefix: "/"
15+
accessKeyId: "my-access-key"
16+
secretAccessKey: "my-secret-key"
17+
frontend:
518
title: "CodeX Docs"
619
description: "A block-styled editor with clean JSON output"
7-
landingFrameSrc: "https://codex.so/editor?frame=1"
8-
menu:
9-
- "Guides"
10-
- "API"
11-
- "Plugins"
12-
- title: "Support Project"
13-
uri: "/support"
14-
misprintsChatId:
15-
startPage:
16-
yandexMetrikaId:
20+
startPage: ""
21+
misprintsChatId: "12344564"
22+
yandexMetrikaId: ""
1723
carbon:
18-
placement:
19-
serve:
20-
production:
21-
port: 3000
22-
database: "/mnt/db"
23-
rcFile: "./.codexdocsrc"
24-
uploads: "/usr/src/app/public/uploads"
25-
secret: "iamasecretstring"
26-
favicon: ""
24+
serve: ""
25+
placement: ""
26+
menu: []
27+
auth:
28+
password: "will be generated automatically"
29+
secret: supersecret
30+
31+
database:
32+
driver: mongodb # you can change database driver here. 'mongodb' or 'local'
33+
mongodb:
34+
uri: mongodb://localhost:27017/docs
35+
36+
# Additional Environment variables
37+
env: {}
38+
# - name: APP_CONFIG_hawk_backendToken
39+
# valueFrom:
40+
# secretKeyRef:
41+
# key: backend-token
42+
# name: hawk-creds
2743

2844
# Authentication parameters
2945
auth:
@@ -42,7 +58,7 @@ auth:
4258

4359
image:
4460
repository: ghcr.io/codex-team/codex.docs
45-
pullPolicy: Always
61+
pullPolicy: IfNotPresent
4662
tag: ""
4763

4864
imagePullSecrets: []

0 commit comments

Comments
 (0)