Skip to content

Commit

Permalink
Merge pull request #8 from codex-team/docs-v2
Browse files Browse the repository at this point in the history
Docs v2 support
  • Loading branch information
nikmel2803 authored Nov 16, 2022
2 parents 4ab92fd + 7908aca commit 12beead
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 55 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ jobs:
run: helm lint

deploy:
name: deploy
if: startsWith(github.ref, 'refs/tags/v')
needs: lint
runs-on: ubuntu-latest
steps:
- uses: craftech-io/[email protected]
name: deploy
if: startsWith(github.ref, 'refs/tags/v')
needs: lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Helm Push
uses: bsord/[email protected]
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: .
4 changes: 2 additions & 2 deletions Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
appVersion: "v2.0.0"
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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 <specify_latest_version_here> --install
```

## Running locally

Execute the following commands from the repository root folder:
```
Expand Down
6 changes: 2 additions & 4 deletions templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
data:
codexdocsrc: |-
{{ .Values.configuration.codexdocsrc | toJson }}
production.json: |-
{{ .Values.configuration.production | toJson }}
docs-config.yaml: |-
{{- .Values.configuration | toYaml | nindent 4 }}
38 changes: 26 additions & 12 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "codexdocs.fullname" . }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
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 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
checksum/config: {{ .Values.configuration | toString | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand All @@ -34,35 +40,43 @@ 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:
{{- toYaml .Values.securityContext | nindent 12 }}
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" . }}
{{- if .Values.env }}
{{ toYaml .Values.env | indent 12 }}
{{- end }}
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/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
Expand Down
11 changes: 8 additions & 3 deletions templates/volumes.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{{ if eq .Values.configuration.database.driver "local" }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "codexdocs.fullname" . }}-db
labels:
{{- include "codexdocs.labels" . | nindent 4 }}
spec:
storageClassName: {{ .Values.volumes.db.storageClassName }}
storageClassName: {{ .Values.volumes.db.storageClassName | quote }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.volumes.db.storage }}
{{end}}

{{ if eq .Values.configuration.uploads.driver "local" }}
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -19,9 +23,10 @@ metadata:
labels:
{{- include "codexdocs.labels" . | nindent 4 }}
spec:
storageClassName: {{ .Values.volumes.uploads.storageClassName }}
storageClassName: {{ .Values.volumes.uploads.storageClassName | quote }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.volumes.uploads.storage }}
storage: {{ .Values.volumes.uploads.storage }}
{{end}}
60 changes: 38 additions & 22 deletions values.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
#replicaCount: 1
replicaCount: 1

annotations:

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"
menu:
- "Guides"
- "API"
- "Plugins"
- title: "Support Project"
uri: "/support"
misprintsChatId:
startPage:
yandexMetrikaId:
startPage: ""
misprintsChatId: "12344564"
yandexMetrikaId: ""
carbon:
placement:
serve:
production:
port: 3000
database: "/mnt/db"
rcFile: "./.codexdocsrc"
uploads: "/usr/src/app/public/uploads"
secret: "iamasecretstring"
favicon: ""
serve: ""
placement: ""
menu: []
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

# Additional Environment variables
env: {}
# - name: APP_CONFIG_hawk_backendToken
# valueFrom:
# secretKeyRef:
# key: backend-token
# name: hawk-creds

# Authentication parameters
auth:
Expand All @@ -42,7 +58,7 @@ auth:

image:
repository: ghcr.io/codex-team/codex.docs
pullPolicy: Always
pullPolicy: IfNotPresent
tag: ""

imagePullSecrets: []
Expand Down

0 comments on commit 12beead

Please sign in to comment.