Skip to content

Commit

Permalink
Merge pull request #26 from irfanhakim-as/update
Browse files Browse the repository at this point in the history
General update
  • Loading branch information
irfanhakim-as authored Jul 20, 2023
2 parents 111446a + 5a8fb01 commit 207a25c
Show file tree
Hide file tree
Showing 91 changed files with 5,515 additions and 1,192 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ Applications, developed or curated by [mika](https://github.com/irfanhakim-as),
- Kubernetes 1.19+
- Helm 3.2.0+

## Chart Directory

| Chart Name | Description | Support | Access |
| ---------- | ----------- | ------- | ------ |
| [clog](https://github.com/irfanhakim-as/charts/tree/master/mika/clog) | Creative blog, Career blog, Coin blog, you name it. || 🔒 |
| [cloudflared](https://github.com/irfanhakim-as/charts/tree/master/mika/cloudflared) | Cloudflare Tunnel is a tunneling software that lets you quickly secure and encrypt application traffic to any type of infrastructure. |||
| [grocy](https://github.com/irfanhakim-as/charts/tree/master/mika/grocy) | Grocy is a web-based self-hosted groceries & household management solution for your home. |||
| [mango](https://github.com/irfanhakim-as/charts/tree/master/mika/mango) | Mango is an easy to use Mastodon bot framework built on top of Django. || 🔒 |
| [postgres](https://github.com/irfanhakim-as/charts/tree/master/mika/postgres) | Easy tool to deploy a PostgreSQL instance on Kubernetes. |||
| [postgres-agent](https://github.com/irfanhakim-as/charts/tree/master/mika/postgres-agent) | Easily deploy a database and create a user, or delete a database in a remote PostgreSQL instance. |||
| [postgres-createdb](https://github.com/irfanhakim-as/charts/tree/master/mika/postgres-createdb) | Easily deploy a database and create a user in a remote PostgreSQL instance. |||
| [postgres-dropdb](https://github.com/irfanhakim-as/charts/tree/master/mika/postgres-dropdb) | Delete a database easily in a remote PostgreSQL instance. |||
| [rizz](https://github.com/irfanhakim-as/charts/tree/master/mika/rizz) | Rizz is a simple web application that tracks and posts content from RSS Feeds to Mastodon. || 🔒 |
| [telego](https://github.com/irfanhakim-as/charts/tree/master/mika/telego) | Telego is an easy to use Telegram bot framework built on top of Django. || 🔒 |
| [vpbot](https://github.com/irfanhakim-as/charts/tree/master/mika/vpbot) | Vpbot is a Telegram bot with support for a number of useful features such as prayer time notifications, COVID-19 statistics, and more. || 🔒 |
| [waktusolat](https://github.com/irfanhakim-as/charts/tree/master/mika/waktusolat) | Waktu Solat is a simple web application that posts local prayer times on Mastodon. || 🔒 |

## How to add repo

Add the repo to your local helm client.
Expand Down Expand Up @@ -51,6 +68,14 @@ Verify that your chart has been installed. Replace `$namespace` and `$release_na
helm ls --namespace $namespace | grep "$release_name"
```

## How to upgrade a chart

After making any necessary changes to the `values.yaml` file, upgrade the desired chart. Replace `$release_name`, `$helm_chart` and `$namespace` accordingly.

```sh
helm upgrade $release_name mika/$helm_chart --namespace $namespace --values values.yaml --wait
```

## How to uninstall a chart

Uninstall the desired chart. Replace `$release_name` and `$namespace` accordingly.
Expand Down
19 changes: 10 additions & 9 deletions mika/clog/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ apiVersion: v2
name: clog
description: Creative blog, Career blog, Coin blog, you name it.
type: application
version: 0.1.10
version: 0.2.0
appVersion: "0.0.1-stable"
keywords:
- clog
home: https://github.com/irfanhakim-as/clog
icon: https://irfanhakim-as.github.io/charts/logos/clog.png
- "clog"
- "blog"
home: "https://github.com/irfanhakim-as/clog"
icon: "https://irfanhakim-as.github.io/charts/logos/clog.png"
sources:
- https://github.com/irfanhakim-as/clog
- https://github.com/irfanhakim-as/charts
- "https://github.com/irfanhakim-as/clog"
- "https://github.com/irfanhakim-as/charts"
maintainers:
- name: Irfan Hakim
email: [email protected]
url: https://github.com/irfanhakim-as
- name: "Irfan Hakim"
email: "[email protected]"
url: "https://github.com/irfanhakim-as"
54 changes: 50 additions & 4 deletions mika/clog/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `clog`
# [`clog`](https://github.com/irfanhakim-as/clog) 🔒

## Prerequisites

Expand Down Expand Up @@ -39,7 +39,7 @@ helm repo update

### Create database

Install [`mika/postgres-createdb`](../postgres-createdb/). This step can be skipped if you have an existing PostgreSQL database.
Deploy [`mika/postgres-agent`](../postgres-agent/) with `postgres.mode.create` set to `true`. This step can be skipped if you have an existing PostgreSQL database.

### Prepare chart values

Expand All @@ -49,7 +49,7 @@ Copy `values.yaml` from the chart you would like to install.
cp mika/clog/values.yaml .
```

Edit `values.yaml` with the appropriate values.
Edit `values.yaml` with the appropriate values. Refer to the [Configurations](#Configurations) section for available options.

```sh
nano values.yaml
Expand All @@ -69,6 +69,14 @@ Verify that your chart has been installed. Replace `$namespace` and `$release_na
helm ls --namespace $namespace | grep "$release_name"
```

## How to upgrade

After making any necessary changes to the `values.yaml` file, upgrade the desired chart. Replace `$release_name` and `$namespace` accordingly.

```sh
helm upgrade $release_name mika/clog --namespace $namespace --values values.yaml --wait
```

## How to uninstall

Uninstall the desired chart. Replace `$release_name` and `$namespace` accordingly.
Expand All @@ -79,4 +87,42 @@ helm uninstall $release_name --namespace $namespace --wait

### Delete database

Install [`mika/postgres-dropdb`](../postgres-dropdb/).
Deploy [`mika/postgres-agent`](../postgres-agent/) with `postgres.mode.drop` set to `true`.

## Configurations

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| clog.cloudflared.domain | string | `""` | Registered domain name on Cloudflare used for Clog. |
| clog.cloudflared.enabled | bool | `false` | Specifies whether Clog should run using a Cloudflare tunnel. |
| clog.debug | string | `""` | Specifies whether Clog should run in debug mode. Default: `false`. |
| clog.name | string | `""` | The name of the Clog service. Default: `"Clog"`. |
| clog.ngrok.enabled | bool | `false` | Specifies whether Clog should run using an Ngrok tunnel. |
| clog.ngrok.token | string | `""` | Ngrok authentication token. |
| clog.persistence.enabled | bool | `false` | Specifies whether Clog should persist its storage. |
| clog.persistence.logs.storage | string | `""` | The amount of persistent storage allocated for Clog logs. Default: `"50Mi"`. |
| clog.persistence.media.storage | string | `""` | The amount of persistent storage allocated for Clog media files. Default: `"100Mi"`. |
| clog.persistence.migrations.storage | string | `""` | The amount of persistent storage allocated for Clog migration files. Default: `"20Mi"`. |
| clog.persistence.static.storage | string | `""` | The amount of persistent storage allocated for Clog static files. Default: `"50Mi"`. |
| clog.persistence.storageClassName | string | `""` | The storage class name used for dynamically provisioning a persistent volume for the Clog storage. Default: `"longhorn"`. |
| clog.secret | string | `""` | A 50-character secret key used for secure session management and cryptographic operations within the Clog service. |
| db.host | string | `""` | The hostname or IP address of the Clog database server. |
| db.name | string | `""` | The name of the database used by Clog. |
| db.password | string | `""` | The password associated with the Clog database's user. |
| db.port | string | `""` | The port number on which the Clog database server is listening. Default: `"5432"`. |
| db.type | string | `""` | The type of the database used by Clog. Default: `"postgresql"`. |
| db.user | string | `""` | The username or user account for accessing the Clog database. |
| image.clog.pullPolicy | string | `""` | The policy that determines when Kubernetes should pull the Clog container image. Default: `"IfNotPresent"`. |
| image.clog.registry | string | `""` | The registry where the Clog container image is hosted. Default: `"ghcr.io"`. |
| image.clog.repository | string | `""` | The name of the repository that contains the Clog container image used. Default: `"irfanhakim-as/clog"`. |
| image.clog.tag | string | `""` | The tag that specifies the version of the Clog container image used. Default: `"Chart appVersion"`. |
| image.ngrok.pullPolicy | string | `""` | The policy that determines when Kubernetes should pull the Ngrok container image. Default: `"IfNotPresent"`. |
| image.ngrok.registry | string | `""` | The registry where the Ngrok container image is hosted. Default: `"docker.io"`. |
| image.ngrok.repository | string | `""` | The name of the repository that contains the Ngrok container image used. Default: `"wernight/ngrok"`. |
| image.ngrok.tag | string | `""` | The tag that specifies the version of the Ngrok container image used. Default: `"latest"`. |
| imagePullSecrets | list | `[]` | Credentials used to securely authenticate and authorise the pulling of container images from private registries. |
| replicaCount | string | `""` | The desired number of running replicas for Clog. Default: `"1"`. |
| resources.clog.limits.cpu | string | `"50m"` | The maximum amount of CPU resources allowed for Clog. |
| resources.clog.limits.memory | string | `"200Mi"` | The maximum amount of memory allowed for Clog. |
| resources.clog.requests.cpu | string | `"10m"` | The minimum amount of CPU resources required by Clog. |
| resources.clog.requests.memory | string | `"100Mi"` | The minimum amount of memory required by Clog. |
6 changes: 5 additions & 1 deletion mika/clog/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
clog is now installed and configured.
Clog is now installed and configured for {{ .Release.Name | toString }}.

See the values.yaml file of this chart for more configuration options.

Please refer to the official documentation for more information on how to use Clog.
34 changes: 34 additions & 0 deletions mika/clog/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,37 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Apache site-config.conf template
*/}}
{{- define "clog.site-config-conf" -}}
<VirtualHost *:80>
ServerName DOMAIN:443
UseCanonicalName On
ServerAdmin [email protected]
DocumentRoot /clog
WSGIScriptAlias / /clog/clog/wsgi.py
WSGIDaemonProcess DOMAIN python-path=/clog
WSGIProcessGroup DOMAIN

<Directory /clog/clog>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

Alias /static /static
<Directory /static>
Require all granted
</Directory>

Alias /media /clog/media
<Directory /clog/media>
Require all granted
</Directory>

ErrorLog /var/log/apache2/apache.error.log
CustomLog /var/log/apache2/apache.access.log combined
</VirtualHost>
{{- end }}
53 changes: 10 additions & 43 deletions mika/clog/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,28 @@
{{- $name := .Values.clog.name | default "Clog" | toString | quote }}
{{- $debug := .Values.clog.debug | default "false" | toString | quote }}
{{- $domain := .Values.clog.cloudflared.domain | default "localhost" | toString }}
{{- $cloudflared := .Values.clog.cloudflared.enabled }}
{{- $ngrok := .Values.clog.ngrok.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-clog-cm
labels:
{{- include "clog.labels" . | nindent 4 }}
data:
SITE_NAME: "{{ .Values.clog.site_name | toString }}"
DEBUG: "{{ .Values.clog.debug | toString }}"
NGROK: "{{ .Values.clog.ngrok.enabled | toString }}"
{{- if .Values.clog.cloudflared.enabled }}
DOMAIN: "{{ $domain }}"
SITE_NAME: {{ $name }}
DEBUG: {{ $debug }}
NGROK: {{ $ngrok | toString | quote }}
{{- if $cloudflared }}
DOMAIN: {{ $domain | quote }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-clog-postgres-cm
labels:
{{- include "clog.labels" . | nindent 4 }}
data:
DB_HOST: "{{ .Values.db.host | toString }}"
DB_NAME: "{{ .Values.db.name | toString }}"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-clog-site-config
labels:
{{- include "clog.labels" . | nindent 4 }}
data:
site-config.conf: |-
<VirtualHost *:80>
{{ "ServerName $domain:443" | replace "$domain" $domain }}
UseCanonicalName On
ServerAdmin [email protected]
DocumentRoot /clog
WSGIScriptAlias / /clog/clog/wsgi.py
{{ "WSGIDaemonProcess $domain python-path=/clog" | replace "$domain" $domain }}
{{ "WSGIProcessGroup $domain" | replace "$domain" $domain }}
<Directory /clog/clog>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static /static
<Directory /static>
Require all granted
</Directory>
Alias /media /clog/media
<Directory /clog/media>
Require all granted
</Directory>
ErrorLog /var/log/apache2/apache.error.log
CustomLog /var/log/apache2/apache.access.log combined
</VirtualHost>
{{- include "clog.site-config-conf" . | replace "DOMAIN" $domain | nindent 4 }}
62 changes: 32 additions & 30 deletions mika/clog/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
{{- $replica_count := .Values.replicaCount | default "1" | toString }}
{{- $clog_registry := .Values.image.clog.registry | default "ghcr.io" | toString }}
{{- $clog_repository := .Values.image.clog.repository | default "irfanhakim-as/clog" | toString }}
{{- $clog_tag := .Values.image.clog.tag | default .Chart.AppVersion | toString }}
{{- $clog_pullPolicy := .Values.image.clog.pullPolicy | default "IfNotPresent" | toString | quote }}
{{- $ngrok_registry := .Values.image.ngrok.registry | default "docker.io" | toString }}
{{- $ngrok_repository := .Values.image.ngrok.repository | default "wernight/ngrok" | toString }}
{{- $ngrok_tag := .Values.image.ngrok.tag | default "latest" | toString }}
{{- $ngrok_pullPolicy := .Values.image.ngrok.pullPolicy | default "IfNotPresent" | toString | quote }}
{{- $cloudflared := .Values.clog.cloudflared.enabled }}
{{- $ngrok := .Values.clog.ngrok.enabled }}
{{- $persistence := .Values.clog.persistence.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-clog
labels:
{{- include "clog.labels" . | nindent 4 }}
spec:
replicas: {{ int $replica_count }}
selector:
matchLabels:
{{- include "clog.selectorLabels" . | nindent 6 }}
Expand All @@ -23,31 +36,16 @@ spec:
{{- end }}
containers:
- name: clog
image: "{{ .Values.image.clog.registry }}/{{ .Values.image.clog.repository }}:{{ .Values.image.clog.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.clog.pullPolicy }}
image: {{ printf "%s/%s:%s" $clog_registry $clog_repository $clog_tag | quote }}
imagePullPolicy: {{ $clog_pullPolicy }}
ports:
- name: clog
containerPort: 80
protocol: TCP
resources:
{{- toYaml .Values.resources.clog | nindent 12 }}
env:
- name: SITE_NAME
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-clog-cm
key: SITE_NAME
- name: DEBUG
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-clog-cm
key: DEBUG
- name: NGROK
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-clog-cm
key: NGROK
{{- if .Values.clog.cloudflared.enabled }}
{{- if $cloudflared }}
- name: ALLOWED_HOSTS
valueFrom:
configMapKeyRef:
Expand All @@ -56,13 +54,13 @@ spec:
{{- end }}
- name: POSTGRES_HOST
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-clog-postgres-cm
secretKeyRef:
name: {{ .Release.Name }}-clog-postgres-secret
key: DB_HOST
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-clog-postgres-cm
secretKeyRef:
name: {{ .Release.Name }}-clog-postgres-secret
key: DB_NAME
- name: POSTGRES_USER
valueFrom:
Expand All @@ -74,16 +72,17 @@ spec:
secretKeyRef:
name: {{ .Release.Name }}-clog-postgres-secret
key: DB_PASS
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-clog-secret
key: SECRET_KEY
envFrom:
- configMapRef:
name: {{ .Release.Name }}-clog-cm
- secretRef:
name: {{ .Release.Name }}-clog-secret
volumeMounts:
- name: {{ .Release.Name }}-clog-site-config
mountPath: /etc/apache2/sites-available/000-default.conf
subPath: site-config.conf
readOnly: true
{{- if $persistence }}
- name: {{ .Release.Name }}-clog-static
mountPath: /static
- name: {{ .Release.Name }}-clog-media
Expand All @@ -94,10 +93,11 @@ spec:
mountPath: /clog/core/migrations
- name: {{ .Release.Name }}-clog-money-migrations
mountPath: /clog/money/migrations
{{- if .Values.clog.ngrok.enabled }}
{{- end }}
{{- if $ngrok }}
- name: ngrok
image: "{{ .Values.image.ngrok.registry }}/{{ .Values.image.ngrok.repository }}:{{ .Values.image.ngrok.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.ngrok.pullPolicy }}
image: {{ printf "%s/%s:%s" $ngrok_registry $ngrok_repository $ngrok_tag | quote }}
imagePullPolicy: {{ $ngrok_pullPolicy }}
command: ["/bin/sh"]
args:
- -c
Expand All @@ -122,6 +122,7 @@ spec:
items:
- key: site-config.conf
path: site-config.conf
{{- if $persistence }}
- name: {{ .Release.Name }}-clog-static
persistentVolumeClaim:
claimName: {{ .Release.Name }}-clog-static-pvc
Expand All @@ -137,3 +138,4 @@ spec:
- name: {{ .Release.Name }}-clog-money-migrations
persistentVolumeClaim:
claimName: {{ .Release.Name }}-clog-money-migrations-pvc
{{- end }}
Loading

0 comments on commit 207a25c

Please sign in to comment.