⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(deployment): add Helm chart and improve container security (#116)
Goran Nushkov139fb51c5e7e
diff --git a/README.md b/README.mdindex ce298ca0d..95eb77941 100644--- a/README.md+++ b/README.md@@ -76,6 +76,122 @@ volumes:| `JWT_ACCESS` | Secret key for generating JWT tokens || `DB_PATH` | The path to the database file |+## 🚢 Kubernetes Deployment++Kaneo can also be deployed on Kubernetes using our Helm chart:++1. Clone this repository:++```bash+git clone https://github.com/usekaneo/kaneo.git+cd kaneo+```++2. Install the Helm chart:++```bash+helm install kaneo ./charts/kaneo --namespace kaneo --create-namespace+```++3. Access Kaneo:++```bash+# Port forward to access both services+kubectl port-forward svc/kaneo-web 5173:80 -n kaneo &+kubectl port-forward svc/kaneo-api 1337:1337 -n kaneo &++# Access the application at http://localhost:5173+# The web frontend will communicate with the API at http://localhost:1337+```++### Production Deployments++For production environments, we recommend using Ingress to expose Kaneo:++```bash+# Basic installation with ingress+helm install kaneo ./charts/kaneo \+ --namespace kaneo \+ --create-namespace \+ --set ingress.enabled=true \+ --set ingress.className=nginx \+ --set "ingress.hosts[0].host=kaneo.example.com"+```++For detailed production deployment examples, including:++- TLS configuration+- Cert-manager integration+- Path rewriting with regex capture groups+- Gateway API usage+- Resource configuration++Please refer to the [Helm chart documentation](./charts/kaneo/README.md).++### Local Deployments with Minikube++For local deployments with Minikube:++1. Start Minikube:++```bash+minikube start+```++2. Install the Helm chart with Ingress enabled:++```bash+helm install kaneo ./charts/kaneo \+ --namespace kaneo \+ --create-namespace \+ --set ingress.enabled=true \+ --set ingress.className=nginx \+ --set "ingress.hosts[0].host=kaneo.local"+```++3. Enable the Ingress addon if not already enabled:++```bash+minikube addons enable ingress+```++4. Access Kaneo based on your OS:++#### macOS++For macOS, you need to use `minikube tunnel` to access the Ingress:++```bash+# Start minikube tunnel in a separate terminal+minikube tunnel+```++Update your /etc/hosts file:++```bash+# Add to /etc/hosts+127.0.0.1 kaneo.local+```++Access Kaneo at http://kaneo.local++#### Linux/Windows++Get the Minikube IP:++```bash+minikube ip+```++Update your hosts file with the Minikube IP:++```bash+# Add to /etc/hosts (Linux) or C:\Windows\System32\drivers\etc\hosts (Windows)+192.168.49.2 kaneo.local # Replace with the actual Minikube IP+```++Access Kaneo at http://kaneo.local+## 📖 DocumentationFor detailed instructions and documentation, visit our [Documentation](https://kaneo.app/quick-start).@@ -106,4 +222,4 @@ Thank you to all the contributors and sponsors who have helped make Kaneo better## 📝 License-This project is licensed under the [MIT License](LICENSE).\ No newline at end of file+This project is licensed under the [MIT License](LICENSE).diff --git a/apps/api/.dockerignore b/apps/api/.dockerignorenew file mode 100644index 000000000..ac19670ef--- /dev/null+++ b/apps/api/.dockerignore@@ -0,0 +1,38 @@+# Version control+.git+.gitignore++# Build artifacts+node_modules+dist+build+*.log++# Development files+.env+.env.*+!.env.production+*.local++# Editor directories and files+.vscode+.idea+*.suo+*.ntvs*+*.njsproj+*.sln+*.sw?++# Testing+coverage+*.test.ts+*.spec.ts+test++# Documentation+docs+*.md++# Temporary files+.DS_Store+Thumbs.dbdiff --git a/apps/api/Dockerfile b/apps/api/Dockerfileindex 6e427a966..5ff5d1f65 100644--- a/apps/api/Dockerfile+++ b/apps/api/Dockerfile@@ -8,27 +8,44 @@ RUN apt-get update && apt-get install -y \g++ \&& rm -rf /var/lib/apt/lists/*-COPY package.json .-COPY bun.lockb .-COPY apps/api/package.json ./apps/api/package.json-COPY packages/typescript-config/package.json ./packages/typescript-config/package.json+# Copy package files first for better layer caching+COPY package.json bun.lockb ./+COPY apps/api/package.json ./apps/api/+COPY packages/typescript-config/package.json ./packages/typescript-config/+# Install dependenciesRUN bun install --no-frozen-lockfile+# Copy source codeCOPY packages/typescript-config ./packages/typescript-configCOPY apps/api ./apps/api+# Production stageFROM oven/bun:1-alpine AS runtime++# Create non-root user+RUN addgroup -g 1001 appuser && \+ adduser -u 1001 -G appuser -D appuser+WORKDIR /app/apps/api-RUN mkdir -p /app/apps/api/data && chmod 777 /app/apps/api/data+# Create data directory with proper permissions+RUN mkdir -p /app/apps/api/data && \+ chown -R appuser:appuser /app-COPY --from=base /app/apps/api ./-COPY --from=base /app/node_modules ../node_modules-COPY --from=base /app/packages ../packages+# Copy built files from base stage+COPY --from=base --chown=appuser:appuser /app/apps/api ./+COPY --from=base --chown=appuser:appuser /app/node_modules ../node_modules+COPY --from=base --chown=appuser:appuser /app/packages ../packages+# Set environment variablesENV NODE_ENV=production+ENV BUN_ENV=production++# Switch to non-root user+USER appuserEXPOSE 1337-CMD ["bun", "run", "/app/apps/api/src/index.ts"]\ No newline at end of file+# Use exec form of CMD for proper signal handling+CMD ["bun", "run", "/app/apps/api/src/index.ts"]diff --git a/apps/web/.dockerignore b/apps/web/.dockerignorenew file mode 100644index 000000000..dd27ce75f--- /dev/null+++ b/apps/web/.dockerignore@@ -0,0 +1,44 @@+# Version control+.git+.gitignore++# Build artifacts+node_modules+dist+build+*.log++# Development files+.env+.env.*+!.env.production+*.local++# Editor directories and files+.vscode+.idea+*.suo+*.ntvs*+*.njsproj+*.sln+*.sw?++# Testing+coverage+*.test.ts+*.spec.ts+test+__tests__++# Documentation+docs+*.md++# Temporary files+.DS_Store+Thumbs.db++# Debug files+npm-debug.log*+yarn-debug.log*+yarn-error.log*diff --git a/apps/web/Dockerfile b/apps/web/Dockerfileindex 7f5113f13..adef86558 100644--- a/apps/web/Dockerfile+++ b/apps/web/Dockerfile@@ -9,26 +9,62 @@ RUN apt-get update && apt-get install -y \WORKDIR /app+# Copy package files first for better layer cachingCOPY package.json bun.lockb ./+COPY apps/web/package.json ./apps/web/+COPY packages/typescript-config/package.json ./packages/typescript-config/+COPY packages/libs/package.json ./packages/libs/+COPY apps/api/package.json ./apps/api/-COPY packages ./packages+# Install dependencies+RUN bun install --no-frozen-lockfile++# Copy only necessary source code+COPY packages/typescript-config ./packages/typescript-config+COPY packages/libs ./packages/libsCOPY apps/api ./apps/apiCOPY apps/web ./apps/web-RUN bun install --no-frozen-lockfile-+# Build the applicationWORKDIR /app/apps/webRUN bun run build+# Production stage with pinned versionFROM nginx:alpine-COPY --from=builder /app/apps/web/dist /usr/share/nginx/html+# Create non-root user for nginx+RUN addgroup -g 1001 appuser && \+ adduser -u 1001 -G appuser -D appuser && \+ # Set permissions for nginx directories+ chown -R appuser:appuser /var/cache/nginx && \+ chmod -R 755 /var/cache/nginx && \+ # Create directory for pid file+ mkdir -p /var/run/nginx && \+ chown -R appuser:appuser /var/run/nginx && \+ chmod -R 755 /var/run/nginx && \+ # Set permissions for nginx configuration+ touch /var/run/nginx.pid && \+ chown appuser:appuser /var/run/nginx.pid && \+ chmod 644 /var/run/nginx.pid && \+ # Update nginx configuration to run as non-root+ sed -i 's/user nginx;/user appuser;/' /etc/nginx/nginx.conf && \+ # Remove the user directive completely to avoid warnings+ sed -i 's/user appuser;//' /etc/nginx/nginx.conf++# Copy built files from builder stage+COPY --from=builder --chown=appuser:appuser /app/apps/web/dist /usr/share/nginx/html-COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf+# Copy nginx configuration+COPY --chown=appuser:appuser apps/web/nginx.conf /etc/nginx/conf.d/default.conf-COPY apps/web/env.sh /docker-entrypoint.d/env.sh+# Copy and set permissions for environment script+COPY --chown=appuser:appuser apps/web/env.sh /docker-entrypoint.d/env.shRUN chmod +x /docker-entrypoint.d/env.sh+# Switch to non-root user+USER appuser+EXPOSE 80-CMD ["nginx", "-g", "daemon off;"]\ No newline at end of file+# Use exec form of CMD for proper signal handling+CMD ["nginx", "-g", "daemon off;"]diff --git a/apps/web/env.sh b/apps/web/env.shindex 4ebbd3cc2..a48f1a37e 100644--- a/apps/web/env.sh+++ b/apps/web/env.sh@@ -1,4 +1,9 @@#!/bin/sh+set -e++echo "Replacing environment variables in static files..."++# Process only KANEO_ prefixed environment variablesfor i in $(env | grep KANEO_)dokey=$(echo $i | cut -d '=' -f 1)@@ -6,4 +11,6 @@ doecho $key=$valuefind /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' +-done\ No newline at end of file+done++echo "Environment variable replacement complete"diff --git a/apps/web/nginx.conf b/apps/web/nginx.confindex 9d7643dae..a212370ad 100644--- a/apps/web/nginx.conf+++ b/apps/web/nginx.conf@@ -2,10 +2,32 @@ server {listen 80;server_name localhost;+ # Security headers+ add_header X-Content-Type-Options "nosniff" always;+ add_header X-Frame-Options "SAMEORIGIN" always;+ add_header X-XSS-Protection "1; mode=block" always;+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;++ # Enable gzip compression+ gzip on;+ gzip_vary on;+ gzip_min_length 1000;+ gzip_proxied any;+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;+ gzip_comp_level 6;++ # Root locationlocation / {root /usr/share/nginx/html;index index.html;try_files $uri $uri/ /index.html;}-}\ No newline at end of file+ # Cache static assets+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {+ root /usr/share/nginx/html;+ expires 30d;+ add_header Cache-Control "public, max-age=2592000";+ access_log off;+ }+}diff --git a/charts/kaneo/Chart.yaml b/charts/kaneo/Chart.yamlnew file mode 100644index 000000000..ed0430cab--- /dev/null+++ b/charts/kaneo/Chart.yaml@@ -0,0 +1,30 @@+apiVersion: v2+name: kaneo+description: A Helm chart for Kaneo - an open source project management platform focused on simplicity and efficiency+type: application+version: 0.1.0+appVersion: "1.0.0"+keywords:+ - project-management+ - kanban+ - task-management+ - productivity+ - collaboration+home: https://kaneo.app+sources:+ - https://github.com/usekaneo/kaneo+icon: https://assets.kaneo.app/logo-mono-rounded.png+maintainers:+ - name: Kaneo Team+ url: https://github.com/usekaneo+ email: [email protected]+annotations:+ artifacthub.io/license: MIT+ artifacthub.io/containsSecurityUpdates: "false"+ artifacthub.io/prerelease: "false"+ artifacthub.io/features: |+ - Simple & Fast: Minimalist interface with powerful features+ - Self-hosted: Full control over your data+ - Customizable: Make it yours with extensive customization options+ - Open Source: MIT licensed, free forever+kubeVersion: ">=1.19.0-0"diff --git a/charts/kaneo/README.md b/charts/kaneo/README.mdnew file mode 100644index 000000000..bf7656956--- /dev/null+++ b/charts/kaneo/README.md@@ -0,0 +1,326 @@+# Kaneo Helm Chart++This Helm chart deploys [Kaneo](https://kaneo.app) - an open source project management platform focused on simplicity and efficiency.++## Introduction++This chart bootstraps a Kaneo deployment on a Kubernetes cluster using the Helm package manager. It deploys both the API backend and Web frontend components, with optional ingress resources.++## Prerequisites++- Kubernetes 1.19++- Helm 3.2.0++- PV provisioner support in the underlying infrastructure (if persistence is enabled)++## Installing the Chart++To install the chart with the release name `my-kaneo`:++```bash+helm install my-kaneo ./charts/kaneo+```++The command deploys Kaneo on the Kubernetes cluster with default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.++## Uninstalling the Chart++To uninstall/delete the `my-kaneo` deployment:++```bash+helm uninstall my-kaneo+```++## Parameters++### Global parameters++| Name | Description | Value |+| ------------------------ | ------------------------------------------------------------------------------------------------------------------ | ----------- |+| `nameOverride` | String to partially override the fullname template (will maintain the release name) | `""` |+| `fullnameOverride` | String to fully override the fullname template | `""` |+| `replicaCount` | Number of replicas (ignored if autoscaling is enabled) | `1` |++### Autoscaling parameters++| Name | Description | Value |+| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |+| `autoscaling.enabled` | Enable autoscaling for the deployment | `false` |+| `autoscaling.minReplicas` | Minimum number of replicas | `1` |+| `autoscaling.maxReplicas` | Maximum number of replicas | `10` |+| `autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization percentage | `80` |++### API Backend parameters++| Name | Description | Value |+| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------- |+| `api.enabled` | Enable API deployment | `true` |+| `api.replicaCount` | Number of API replicas | `1` |+| `api.image.repository` | API image repository | `ghcr.io/usekaneo/api` |+| `api.image.tag` | API image tag | `latest` |+| `api.image.pullPolicy` | API image pull policy | `IfNotPresent` |+| `api.service.type` | API service type | `ClusterIP` |+| `api.service.port` | API service port | `1337` |+| `api.service.targetPort` | API container port | `1337` |+| `api.env` | Environment variables for the API container | See `values.yaml` |+| `api.env.jwtAccess` | Secret key for JWT token generation (ignored if existingSecret is enabled) | `change_me` |+| `api.env.existingSecret.enabled` | Whether to use an existing secret for JWT access token | `false` |+| `api.env.existingSecret.name` | Name of the existing secret containing the JWT access token | `""` |+| `api.env.existingSecret.key` | Key in the existing secret that contains the JWT access token | `jwt-access` |+| `api.persistence.enabled` | Enable persistence for SQLite database | `true` |+| `api.persistence.mountPath` | Path where the SQLite database will be stored | `/app/apps/api/data` |+| `api.persistence.dbFilename` | Name of the SQLite database file | `kaneo.db` |+| `api.persistence.accessMode` | PVC access mode | `ReadWriteOnce` |+| `api.persistence.size` | PVC size | `1Gi` |+| `api.persistence.storageClass` | PVC storage class | `""` |+| `api.resources` | Resource requests and limits for the API container (optional, disabled by default) | `{}` |+| `api.autoscaling.enabled` | Enable autoscaling for the API deployment | `false` |+| `api.autoscaling.minReplicas` | Minimum number of replicas | `1` |+| `api.autoscaling.maxReplicas` | Maximum number of replicas | `10` |+| `api.autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization percentage | `80` |++### Web Frontend parameters++| Name | Description | Value |+| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------- |+| `web.enabled` | Enable Web deployment | `true` |+| `web.replicaCount` | Number of Web replicas | `1` |+| `web.image.repository` | Web image repository | `ghcr.io/usekaneo/web` |+| `web.image.tag` | Web image tag | `latest` |+| `web.image.pullPolicy` | Web image pull policy | `IfNotPresent` |+| `web.service.type` | Web service type | `ClusterIP` |+| `web.service.port` | Web service port | `80` |+| `web.service.targetPort` | Web container port | `80` |+| `web.env` | Environment variables for the Web container | See `values.yaml` |+| `web.resources` | Resource requests and limits for the Web container (optional, disabled by default) | `{}` |+| `web.autoscaling.enabled` | Enable autoscaling for the Web deployment | `false` |+| `web.autoscaling.minReplicas` | Minimum number of replicas | `1` |+| `web.autoscaling.maxReplicas` | Maximum number of replicas | `10` |+| `web.autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization percentage | `80` |++### Ingress parameters++| Name | Description | Value |+| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------- |+| `ingress.enabled` | Enable ingress | `false` |+| `ingress.className` | Ingress class name | `""` |+| `ingress.annotations` | Ingress annotations | `{}` |+| `ingress.hosts` | Ingress hosts configuration | See `values.yaml` |+| `ingress.tls` | Ingress TLS configuration | `[]` |++## Configuration Examples++### Minimal Configuration++```yaml+# values.yaml+api:+ env:+ jwtAccess: "your-secure-jwt-secret"++web:+ env:+ apiUrl: "https://your-domain.com"++ingress:+ enabled: true+ className: nginx+ annotations:+ nginx.ingress.kubernetes.io/rewrite-target: /$1+ hosts:+ - host: your-domain.com+ paths:+ - path: /?(.*)+ pathType: Prefix+ service: web+ port: 80+ - path: /api/?(.*)+ pathType: Prefix+ service: api+ port: 1337+```++### Production Configuration with TLS++```yaml+# values.yaml+replicaCount: 1+# Enable and configure resources for production+api:+ resources:+ limits:+ cpu: 1000m+ memory: 1Gi+ requests:+ cpu: 200m+ memory: 256Mi+ env:+ jwtAccess: "your-secure-jwt-secret"+ persistence:+ size: 10Gi+ storageClass: "managed-premium"++web:+ resources:+ limits:+ cpu: 500m+ memory: 512Mi+ requests:+ cpu: 100m+ memory: 128Mi+ env:+ apiUrl: "https://your-domain.com"++ingress:+ enabled: true+ className: nginx+ annotations:+ cert-manager.io/cluster-issuer: letsencrypt-prod+ nginx.ingress.kubernetes.io/ssl-redirect: "true"+ nginx.ingress.kubernetes.io/rewrite-target: /$1+ hosts:+ - host: your-domain.com+ paths:+ - path: /+ pathType: Prefix+ service: web+ port: 80+ - path: /api/?(.*)+ pathType: Prefix+ service: api+ port: 1337+ tls:+ - secretName: kaneo-tls+ hosts:+ - your-domain.com+```++### Using an Existing Secret for Sensitive Data++For production environments, it's recommended to store sensitive data like the JWT access token in a Kubernetes Secret. You can create a secret and configure the chart to use it:++```bash+# Create a Secret for the JWT access token+kubectl create secret generic kaneo-secrets \+ --namespace kaneo \+ --from-literal=jwt-access="your-secure-jwt-secret"+```++Then reference this secret in your values:++```yaml+# values.yaml+api:+ env:+ # The jwtAccess value will be ignored when existingSecret is enabled+ existingSecret:+ enabled: true+ name: "kaneo-secrets"+ key: "jwt-access"+```++## Persistence++The chart mounts a Persistent Volume for the SQLite database used by the API component. The volume is mounted at `/app/apps/api/data` in the API container.++## Single Pod Architecture++This chart deploys both the API and Web containers in a single pod. This architecture provides several benefits:++1. **Simplified Connectivity**: The web frontend can connect directly to the API via localhost, eliminating cross-origin issues+2. **Co-location**: Ensures the web and API components are always deployed together+3. **Reduced Complexity**: Simplifies the deployment and configuration++With this approach, when `web.env.apiUrl` is not set, the web container automatically connects to the API at `http://localhost:1337` without requiring any port forwarding or special configuration.++### Production Environment++For production deployments, you should:++1. Set `web.env.apiUrl` to your domain (e.g., "https://your-domain.com")+2. Use an Ingress controller to expose the application+3. Configure TLS for secure access+4. Set appropriate resource limits and requests++```yaml+ingress:+ enabled: true+ className: nginx+ annotations:+ cert-manager.io/cluster-issuer: letsencrypt-prod+ nginx.ingress.kubernetes.io/ssl-redirect: "true"+ nginx.ingress.kubernetes.io/rewrite-target: /$1+ hosts:+ - host: your-domain.com+ paths:+ - path: /+ pathType: Prefix+ service: web+ port: 80+ - path: /api/?(.*)+ pathType: Prefix+ service: api+ port: 1337+ tls:+ - secretName: kaneo-tls+ hosts:+ - your-domain.com+```++## Using Gateway API++As an alternative to Ingress, you can use the Kubernetes Gateway API for more advanced routing capabilities:++```yaml+# kaneo-gateway.yaml+apiVersion: gateway.networking.k8s.io/v1beta1+kind: HTTPRoute+metadata:+ name: kaneo+ namespace: kaneo+spec:+ parentRefs:+ - name: main-gateway # Your gateway name+ namespace: gateway-system # Your gateway namespace+ sectionName: https+ hostnames:+ - "kaneo.example.com"+ rules:+ # Frontend route (root path)+ - matches:+ - path:+ type: PathPrefix+ value: /+ backendRefs:+ - name: kaneo-web+ port: 80+ # API route (api path prefix)+ - matches:+ - path:+ type: PathPrefix+ value: /api+ backendRefs:+ - name: kaneo-api+ port: 1337+ filters:+ - type: URLRewrite+ urlRewrite:+ path:+ type: ReplacePrefixMatch+ replacePrefixMatch: /+```++Apply the Gateway configuration:++```bash+kubectl apply -f kaneo-gateway.yaml+```++## Security++For production deployments, consider the following security recommendations:++1. Use a secure JWT_ACCESS secret, preferably stored in a Kubernetes Secret+2. Enable TLS for ingress or Gateway API+3. Enable and set resource limits to prevent resource exhaustion+4. Use a dedicated storage class for the SQLite database+5. Consider using a network policy to restrict traffic between componentsdiff --git a/charts/kaneo/templates/NOTES.txt b/charts/kaneo/templates/NOTES.txtnew file mode 100644index 000000000..e77b3db7a--- /dev/null+++ b/charts/kaneo/templates/NOTES.txt@@ -0,0 +1,62 @@+Thank you for installing {{ .Chart.Name }}.++Your release is named {{ .Release.Name }}.++To learn more about the release, try:++ $ helm status {{ .Release.Name }}+ $ helm get all {{ .Release.Name }}++{{- if .Values.ingress.enabled }}+You can access the application using these URLs:+{{- range .Values.ingress.hosts }}+ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .host }}+{{- end }}++Note: This chart uses path patterns with regex capture groups for nginx:+ - /?(.*) -> for web frontend+ - /api/?(.*) -> for API requests+Make sure your ingress controller supports the configured annotations:+ nginx.ingress.kubernetes.io/rewrite-target: /$1+{{- else }}+To access the application, you need to set up port forwarding to both services:++ $ kubectl port-forward svc/{{ include "kaneo.fullname" . }}-web 5173:{{ .Values.web.service.port }} -n {{ .Release.Namespace }} &+ $ kubectl port-forward svc/{{ include "kaneo.fullname" . }}-api 1337:{{ .Values.api.service.port }} -n {{ .Release.Namespace }} &++ Then access the application at http://localhost:5173+ The web frontend will communicate with the API at http://localhost:1337++Alternatively, you can expose the services using an Ingress by setting .Values.ingress.enabled=true+{{- end }}++NOTES:+1. Kaneo is configured with SQLite database for persistence.+ {{- if .Values.api.persistence.enabled }}+ A PersistentVolumeClaim is used to store the SQLite database file.+ {{- else }}+ WARNING: Persistence is disabled. Your data will be lost when the pod is terminated.+ To enable persistence, set .Values.api.persistence.enabled=true+ {{- end }}++2. Important environment variables:+ - API:+ - JWT_ACCESS: Secret key for generating JWT tokens (currently set to: {{ .Values.api.env.jwtAccess }})+ - DB_PATH: Path to the SQLite database file (set to: "{{ .Values.api.persistence.mountPath }}/{{ .Values.api.persistence.dbFilename }}")++ - Web:+ - KANEO_API_URL: URL of the API service (set to: "{{- if .Values.web.env.apiUrl -}}+ {{- if hasSuffix "/" .Values.web.env.apiUrl -}}+ {{- .Values.web.env.apiUrl -}}api+ {{- else -}}+ {{- .Values.web.env.apiUrl -}}/api+ {{- end -}}+ {{- else -}}+ http://localhost:{{ .Values.api.service.targetPort }}+ {{- end -}}")++ You can customize these values in your values.yaml file.++3. IMPORTANT: This chart uses a combined pod approach where both the API and Web containers+ run in the same pod. This allows the web frontend to connect directly to the API via+ localhost, simplifying the deployment and eliminating cross-origin issues.diff --git a/charts/kaneo/templates/_helpers.tpl b/charts/kaneo/templates/_helpers.tplnew file mode 100644index 000000000..90fed4b76--- /dev/null+++ b/charts/kaneo/templates/_helpers.tpl@@ -0,0 +1,104 @@+{{/*+Expand the name of the chart.+*/}}+{{- define "kaneo.name" -}}+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}+{{- end }}++{{/*+Create a default fully qualified app name.+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).+If release name contains chart name it will be used as a full name.+*/}}+{{- define "kaneo.fullname" -}}+{{- if .Values.fullnameOverride }}+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}+{{- else }}+{{- $name := default .Chart.Name .Values.nameOverride }}+{{- if contains $name .Release.Name }}+{{- .Release.Name | trunc 63 | trimSuffix "-" }}+{{- else }}+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}+{{- end }}+{{- end }}+{{- end }}++{{/*+Create chart name and version as used by the chart label.+*/}}+{{- define "kaneo.chart" -}}+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}+{{- end }}++{{/*+Common labels+*/}}+{{- define "kaneo.labels" -}}+helm.sh/chart: {{ include "kaneo.chart" . }}+{{ include "kaneo.selectorLabels" . }}+{{- if .Chart.AppVersion }}+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}+{{- end }}+app.kubernetes.io/managed-by: {{ .Release.Service }}+{{- end }}++{{/*+Selector labels+*/}}+{{- define "kaneo.selectorLabels" -}}+app.kubernetes.io/name: {{ include "kaneo.name" . }}+app.kubernetes.io/instance: {{ .Release.Name }}+{{- end }}++{{/*+Create the name of the service account to use+*/}}+{{- define "kaneo.serviceAccountName" -}}+{{- if .Values.serviceAccount.create }}+{{- default (include "kaneo.fullname" .) .Values.serviceAccount.name }}+{{- else }}+{{- default "default" .Values.serviceAccount.name }}+{{- end }}+{{- end }}++{{/*+API component common labels+*/}}+{{- define "kaneo.api.labels" -}}+helm.sh/chart: {{ include "kaneo.chart" . }}+{{ include "kaneo.api.selectorLabels" . }}+{{- if .Chart.AppVersion }}+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}+{{- end }}+app.kubernetes.io/managed-by: {{ .Release.Service }}+app.kubernetes.io/component: api+{{- end }}++{{/*+API component selector labels+*/}}+{{- define "kaneo.api.selectorLabels" -}}+app.kubernetes.io/name: {{ include "kaneo.name" . }}-api+app.kubernetes.io/instance: {{ .Release.Name }}+{{- end }}++{{/*+Web component common labels+*/}}+{{- define "kaneo.web.labels" -}}+helm.sh/chart: {{ include "kaneo.chart" . }}+{{ include "kaneo.web.selectorLabels" . }}+{{- if .Chart.AppVersion }}+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}+{{- end }}+app.kubernetes.io/managed-by: {{ .Release.Service }}+app.kubernetes.io/component: web+{{- end }}++{{/*+Web component selector labels+*/}}+{{- define "kaneo.web.selectorLabels" -}}+app.kubernetes.io/name: {{ include "kaneo.name" . }}-web+app.kubernetes.io/instance: {{ .Release.Name }}+{{- end }}diff --git a/charts/kaneo/templates/deployment.yaml b/charts/kaneo/templates/deployment.yamlnew file mode 100644index 000000000..e2ba1bd20--- /dev/null+++ b/charts/kaneo/templates/deployment.yaml@@ -0,0 +1,105 @@+apiVersion: apps/v1+kind: Deployment+metadata:+ name: {{ include "kaneo.fullname" . }}+ labels:+ {{- include "kaneo.labels" . | nindent 4 }}+spec:+ {{- if not .Values.autoscaling.enabled }}+ replicas: {{ .Values.replicaCount }}+ {{- end }}+ selector:+ matchLabels:+ {{- include "kaneo.selectorLabels" . | nindent 6 }}+ template:+ metadata:+ {{- with .Values.podAnnotations }}+ annotations:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ labels:+ {{- include "kaneo.selectorLabels" . | nindent 8 }}+ spec:+ serviceAccountName: {{ include "kaneo.serviceAccountName" . }}+ securityContext:+ {{- toYaml .Values.podSecurityContext | nindent 8 }}+ containers:+ - name: api+ securityContext:+ {{- toYaml .Values.api.securityContext | nindent 12 }}+ image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag | default .Chart.AppVersion }}"+ imagePullPolicy: {{ .Values.api.image.pullPolicy }}+ ports:+ - name: api+ containerPort: {{ .Values.api.service.targetPort }}+ protocol: TCP+ env:+ - name: JWT_ACCESS+ {{- if .Values.api.env.existingSecret.enabled }}+ valueFrom:+ secretKeyRef:+ name: {{ .Values.api.env.existingSecret.name }}+ key: {{ .Values.api.env.existingSecret.key }}+ {{- else }}+ value: "{{ .Values.api.env.jwtAccess }}"+ {{- end }}+ - name: DB_PATH+ value: "{{ .Values.api.persistence.mountPath }}/{{ .Values.api.persistence.dbFilename }}"+ livenessProbe:+ {{- toYaml .Values.api.livenessProbe | nindent 12 }}+ readinessProbe:+ {{- toYaml .Values.api.readinessProbe | nindent 12 }}+ resources:+ {{- toYaml .Values.api.resources | nindent 12 }}+ {{- if .Values.api.persistence.enabled }}+ volumeMounts:+ - name: sqlite-data+ mountPath: {{ .Values.api.persistence.mountPath }}+ {{- end }}++ - name: web+ securityContext:+ {{- toYaml .Values.web.securityContext | nindent 12 }}+ image: "{{ .Values.web.image.repository }}:{{ .Values.web.image.tag | default .Chart.AppVersion }}"+ imagePullPolicy: {{ .Values.web.image.pullPolicy }}+ ports:+ - name: web+ containerPort: {{ .Values.web.service.targetPort }}+ protocol: TCP+ env:+ - name: KANEO_API_URL+ value: "{{- if .Values.web.env.apiUrl -}}+ {{- if hasSuffix "/" .Values.web.env.apiUrl -}}+ {{- .Values.web.env.apiUrl -}}api+ {{- else -}}+ {{- .Values.web.env.apiUrl -}}/api+ {{- end -}}+ {{- else -}}+ http://localhost:{{ .Values.api.service.targetPort }}+ {{- end -}}"+ livenessProbe:+ {{- toYaml .Values.web.livenessProbe | nindent 12 }}+ readinessProbe:+ {{- toYaml .Values.web.readinessProbe | nindent 12 }}+ resources:+ {{- toYaml .Values.web.resources | nindent 12 }}++ {{- if .Values.api.persistence.enabled }}+ volumes:+ - name: sqlite-data+ persistentVolumeClaim:+ claimName: {{ include "kaneo.fullname" . }}-sqlite-data+ {{- end }}++ {{- with .Values.nodeSelector }}+ nodeSelector:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ {{- with .Values.affinity }}+ affinity:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ {{- with .Values.tolerations }}+ tolerations:+ {{- toYaml . | nindent 8 }}+ {{- end }}diff --git a/charts/kaneo/templates/hpa.yaml b/charts/kaneo/templates/hpa.yamlnew file mode 100644index 000000000..6ddf60e79--- /dev/null+++ b/charts/kaneo/templates/hpa.yaml@@ -0,0 +1,32 @@+{{- if .Values.autoscaling.enabled }}+apiVersion: autoscaling/v2+kind: HorizontalPodAutoscaler+metadata:+ name: {{ include "kaneo.fullname" . }}+ labels:+ {{- include "kaneo.labels" . | nindent 4 }}+spec:+ scaleTargetRef:+ apiVersion: apps/v1+ kind: Deployment+ name: {{ include "kaneo.fullname" . }}+ minReplicas: {{ .Values.autoscaling.minReplicas }}+ maxReplicas: {{ .Values.autoscaling.maxReplicas }}+ metrics:+ {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}+ - type: Resource+ resource:+ name: cpu+ target:+ type: Utilization+ averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}+ {{- end }}+ {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}+ - type: Resource+ resource:+ name: memory+ target:+ type: Utilization+ averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}+ {{- end }}+{{- end }}diff --git a/charts/kaneo/templates/ingress.yaml b/charts/kaneo/templates/ingress.yamlnew file mode 100644index 000000000..9a5f7d061--- /dev/null+++ b/charts/kaneo/templates/ingress.yaml@@ -0,0 +1,42 @@+{{- if .Values.ingress.enabled -}}+{{- $fullName := include "kaneo.fullname" . -}}+apiVersion: networking.k8s.io/v1+kind: Ingress+metadata:+ name: {{ $fullName }}+ labels:+ {{- include "kaneo.labels" . | nindent 4 }}+ {{- with .Values.ingress.annotations }}+ annotations:+ {{- toYaml . | nindent 4 }}+ {{- end }}+spec:+ {{- if .Values.ingress.className }}+ ingressClassName: {{ .Values.ingress.className }}+ {{- end }}+ {{- if .Values.ingress.tls }}+ tls:+ {{- range .Values.ingress.tls }}+ - hosts:+ {{- range .hosts }}+ - {{ . | quote }}+ {{- end }}+ secretName: {{ .secretName }}+ {{- end }}+ {{- end }}+ rules:+ {{- range .Values.ingress.hosts }}+ - host: {{ .host | quote }}+ http:+ paths:+ {{- range .paths }}+ - path: {{ .path }}+ pathType: {{ .pathType }}+ backend:+ service:+ name: {{ $fullName }}-{{ .service }}+ port:+ number: {{ .port }}+ {{- end }}+ {{- end }}+{{- end }}diff --git a/charts/kaneo/templates/pvc.yaml b/charts/kaneo/templates/pvc.yamlnew file mode 100644index 000000000..679587a4c--- /dev/null+++ b/charts/kaneo/templates/pvc.yaml@@ -0,0 +1,21 @@+{{- if .Values.api.persistence.enabled }}+apiVersion: v1+kind: PersistentVolumeClaim+metadata:+ name: {{ include "kaneo.fullname" . }}-sqlite-data+ labels:+ {{- include "kaneo.labels" . | nindent 4 }}+spec:+ accessModes:+ - {{ .Values.api.persistence.accessMode | default "ReadWriteOnce" }}+ {{- if .Values.api.persistence.storageClass }}+ {{- if (eq "-" .Values.api.persistence.storageClass) }}+ storageClassName: ""+ {{- else }}+ storageClassName: {{ .Values.api.persistence.storageClass }}+ {{- end }}+ {{- end }}+ resources:+ requests:+ storage: {{ .Values.api.persistence.size | default "1Gi" }}+{{- end }}diff --git a/charts/kaneo/templates/serviceaccount.yaml b/charts/kaneo/templates/serviceaccount.yamlnew file mode 100644index 000000000..05a60cc7e--- /dev/null+++ b/charts/kaneo/templates/serviceaccount.yaml@@ -0,0 +1,12 @@+{{- if .Values.serviceAccount.create -}}+apiVersion: v1+kind: ServiceAccount+metadata:+ name: {{ include "kaneo.serviceAccountName" . }}+ labels:+ {{- include "kaneo.labels" . | nindent 4 }}+ {{- with .Values.serviceAccount.annotations }}+ annotations:+ {{- toYaml . | nindent 4 }}+ {{- end }}+{{- end }}diff --git a/charts/kaneo/templates/services.yaml b/charts/kaneo/templates/services.yamlnew file mode 100644index 000000000..d02393f9f--- /dev/null+++ b/charts/kaneo/templates/services.yaml@@ -0,0 +1,36 @@+# API Service+apiVersion: v1+kind: Service+metadata:+ name: {{ include "kaneo.fullname" . }}-api+ labels:+ {{- include "kaneo.labels" . | nindent 4 }}+ app.kubernetes.io/component: api+spec:+ type: {{ .Values.api.service.type }}+ ports:+ - port: {{ .Values.api.service.port }}+ targetPort: api+ protocol: TCP+ name: http+ selector:+ {{- include "kaneo.selectorLabels" . | nindent 4 }}++---+# Web Service+apiVersion: v1+kind: Service+metadata:+ name: {{ include "kaneo.fullname" . }}-web+ labels:+ {{- include "kaneo.labels" . | nindent 4 }}+ app.kubernetes.io/component: web+spec:+ type: {{ .Values.web.service.type }}+ ports:+ - port: {{ .Values.web.service.port }}+ targetPort: web+ protocol: TCP+ name: http+ selector:+ {{- include "kaneo.selectorLabels" . | nindent 4 }}diff --git a/charts/kaneo/values.yaml b/charts/kaneo/values.yamlnew file mode 100644index 000000000..882d2f100--- /dev/null+++ b/charts/kaneo/values.yaml@@ -0,0 +1,149 @@+# Global values+nameOverride: ""+fullnameOverride: ""+replicaCount: 1++# Autoscaling configuration+autoscaling:+ enabled: false+ minReplicas: 1+ maxReplicas: 10+ targetCPUUtilizationPercentage: 80+ # targetMemoryUtilizationPercentage: 80++# Pod configuration+podAnnotations: {}+podSecurityContext: {}+nodeSelector: {}+tolerations: []+affinity: {}++# Service account configuration+serviceAccount:+ create: true+ annotations: {}+ name: ""++# API backend configuration+api:+ image:+ repository: ghcr.io/usekaneo/api+ tag: latest+ pullPolicy: IfNotPresent++ securityContext: {}++ service:+ type: ClusterIP+ port: 1337+ targetPort: 1337++ # Resources are optional and disabled by default+ resources: {}+ # resources:+ # limits:+ # cpu: 500m+ # memory: 512Mi+ # requests:+ # cpu: 100m+ # memory: 128Mi++ # Environment variables for the API+ env:+ jwtAccess: "change_me"+ existingSecret:+ enabled: false+ name: ""+ key: "jwt-access"++ # SQLite data persistence+ persistence:+ enabled: true+ mountPath: "/app/apps/api/data"+ dbFilename: "kaneo.db"+ accessMode: ReadWriteOnce+ size: 1Gi+ storageClass: ""++ livenessProbe:+ httpGet:+ path: /me+ port: api+ initialDelaySeconds: 30+ periodSeconds: 10++ readinessProbe:+ httpGet:+ path: /me+ port: api+ initialDelaySeconds: 5+ periodSeconds: 10++# Web frontend configuration+web:+ image:+ repository: ghcr.io/usekaneo/web+ tag: latest+ pullPolicy: IfNotPresent++ # Environment variables for the Web+ env:+ # Optional: Override the default API URL (http://localhost:1337)+ # The /api path will be automatically appended to the URL+ # apiUrl: "https://kaneo.example.com"+ apiUrl: ""++ securityContext: {}++ service:+ type: ClusterIP+ port: 80+ targetPort: 80++ # Resources are optional and disabled by default+ resources: {}+ # resources:+ # limits:+ # cpu: 300m+ # memory: 256Mi+ # requests:+ # cpu: 100m+ # memory: 128Mi++ livenessProbe:+ httpGet:+ path: /+ port: web+ initialDelaySeconds: 30+ periodSeconds: 10++ readinessProbe:+ httpGet:+ path: /+ port: web+ initialDelaySeconds: 5+ periodSeconds: 10++# Ingress configuration+ingress:+ enabled: false+ className: "nginx"+ annotations:+ nginx.ingress.kubernetes.io/rewrite-target: /$1+ # When using nginx ingress controller, these annotations provide URL rewriting+ # similar to the URLRewrite filter in the Gateway API+ # Other ingress controllers may require different annotations, handle carefully+ # because it can break the API calls from the frontend to the backend+ hosts:+ # Use the same host in the web env variable apiUrl (with http:// or https://)+ - host: kaneo.local+ paths:+ - path: /?(.*)+ pathType: Prefix+ service: web+ port: 80+ - path: /api/?(.*)+ pathType: Prefix+ service: api+ port: 1337+ tls: []