Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions helm/kutt/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
30 changes: 30 additions & 0 deletions helm/kutt/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v2
name: kutt
description: A Helm chart for Kutt - Free Modern URL Shortener
type: application
version: 0.1.0
appVersion: "3.2.3"
keywords:
- kutt
- url-shortener
- link-shortener
icon: https://kutt.it/images/logo.svg
home: https://kutt.it
sources:
- https://github.com/webofmars/kutt
maintainers:
- name: webofmars
url: https://github.com/webofmars
dependencies:
- name: postgresql
version: ">=16.0.0 <17.0.0"
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: mariadb
version: ">=20.0.0 <21.0.0"
repository: https://charts.bitnami.com/bitnami
condition: mariadb.enabled
- name: redis
version: ">=20.0.0 <21.0.0"
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
133 changes: 133 additions & 0 deletions helm/kutt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# kutt

A Helm chart for [Kutt](https://kutt.it) – a free, modern URL shortener.

## Prerequisites

- Kubernetes 1.23+
- Helm 3.10+
- PV provisioner support in the cluster (for SQLite persistence)

## Installing the Chart

Add the repository and install the chart:

```bash
helm install my-kutt ./helm/kutt \
--set kutt.auth.jwtSecret=$(openssl rand -hex 32) \
--set kutt.defaultDomain=kutt.example.com
```

## Uninstalling the Chart

```bash
helm uninstall my-kutt
```

## Configuration

The following table lists the most important configurable parameters. See [values.yaml](values.yaml) for the complete list.

### Application

| Parameter | Description | Default |
|-----------|-------------|---------|
| `kutt.defaultDomain` | The domain Kutt is hosted on | `""` |
| `kutt.auth.jwtSecret` | **Required.** JWT encryption secret | `""` |
| `kutt.auth.existingSecret` | Existing secret with `JWT_SECRET` key | `""` |
| `kutt.registration.disallowRegistration` | Disable user registration | `true` |
| `kutt.registration.disallowAnonymousLinks` | Disable anonymous link creation | `true` |

### Database

By default Kutt uses SQLite. Enable one of the sub-charts for a production database:

#### PostgreSQL

```yaml
postgresql:
enabled: true
auth:
database: kutt
username: kutt
password: changeme
```

#### MariaDB

```yaml
mariadb:
enabled: true
auth:
database: kutt
username: kutt
password: changeme
rootPassword: changeme
```

#### External database

```yaml
kutt:
db:
client: pg # or mysql2
host: my-db-host
port: "5432"
name: kutt
user: kutt
password: changeme
```

### Redis

Redis is optional but recommended for rate-limiting and caching:

```yaml
redis:
enabled: true
```

Or configure an external Redis:

```yaml
kutt:
redis:
enabled: true
host: my-redis-host
port: 6379
```

### Ingress

```yaml
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: kutt.example.com
paths:
- path: /
pathType: ImplementationSpecific
tls:
- secretName: kutt-tls
hosts:
- kutt.example.com
```

## Dependencies

This chart has the following optional sub-chart dependencies managed via [Bitnami](https://bitnami.com/):

| Chart | Version | Condition |
|-------|---------|-----------|
| `bitnami/postgresql` | `>=16.0.0` | `postgresql.enabled` |
| `bitnami/mariadb` | `>=20.0.0` | `mariadb.enabled` |
| `bitnami/redis` | `>=20.0.0` | `redis.enabled` |

To download dependencies before installing:

```bash
helm dependency update helm/kutt
```
17 changes: 17 additions & 0 deletions helm/kutt/ci/mariadb-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kutt:
auth:
jwtSecret: "test-jwt-secret-for-ci"
defaultDomain: "kutt.example.com"
mariadb:
enabled: true
auth:
database: kutt
username: kutt
password: "testpassword"
rootPassword: "rootpassword"
redis:
enabled: true
auth:
enabled: false
persistence:
enabled: false
16 changes: 16 additions & 0 deletions helm/kutt/ci/postgresql-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kutt:
auth:
jwtSecret: "test-jwt-secret-for-ci"
defaultDomain: "kutt.example.com"
postgresql:
enabled: true
auth:
database: kutt
username: kutt
password: "testpassword"
redis:
enabled: true
auth:
enabled: false
persistence:
enabled: false
10 changes: 10 additions & 0 deletions helm/kutt/ci/sqlite-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kutt:
auth:
jwtSecret: "test-jwt-secret-for-ci"
defaultDomain: "kutt.example.com"
registration:
disallowRegistration: false
disallowAnonymousLinks: false
persistence:
enabled: true
size: 500Mi
44 changes: 44 additions & 0 deletions helm/kutt/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "kutt.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "kutt.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "kutt.fullname" . }} --template "{{"{{range (index .status.loadBalancer.ingress 0)}}{{.}}{{end}}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "kutt.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:3000 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 3000:$CONTAINER_PORT
{{- end }}

2. Database backend: {{ include "kutt.dbClient" . }}
{{- if .Values.postgresql.enabled }}
PostgreSQL is deployed as a sub-chart ({{ .Release.Name }}-postgresql).
{{- else if .Values.mariadb.enabled }}
MariaDB is deployed as a sub-chart ({{ .Release.Name }}-mariadb).
{{- else }}
SQLite is used as the database.
{{- end }}

3. Redis caching: {{ include "kutt.redisEnabled" . }}
{{- if .Values.redis.enabled }}
Redis is deployed as a sub-chart ({{ .Release.Name }}-redis-master).
{{- end }}

{{- if not .Values.kutt.auth.jwtSecret }}
{{- if not .Values.kutt.auth.existingSecret }}

WARNING: JWT_SECRET is not set! Please set kutt.auth.jwtSecret or kutt.auth.existingSecret
to a long random string before exposing this instance to traffic.
{{- end }}
{{- end }}
Loading