initial homebox release

This commit is contained in:
0x6b-dev 2023-06-26 01:08:31 +10:00
parent 83f98cb5a1
commit 3e38808823
12 changed files with 418 additions and 0 deletions

View File

@ -0,0 +1,45 @@
name: generate-chart
on:
push:
tags:
- "*"
jobs:
generate-chart-publish:
runs-on: ubuntu-latest
steps:
- uses: https://gitea.com/actions/checkout@v3
- name: install tools
run: |
apt update -y
apt install -y curl
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | tee /usr/share/keyrings/helm.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list
apt update -y
apt install -y python helm python3-pip apt-transport-https
# - name: Import GPG key
# id: import_gpg
# uses: https://github.com/crazy-max/ghaction-import-gpg@v5
# with:
# gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
# passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
# fingerprint: CC64B1DB67ABBEECAB24B6455FC346329753F4B0
# Using helm gpg plugin as 'helm package --sign' has issues with gpg2: https://github.com/helm/helm/issues/2843
- name: package charts
run: |
# FIXME: use upstream after https://github.com/technosophos/helm-gpg/issues/1 is solved
helm plugin install https://github.com/pat-s/helm-gpg
make all
- name: Deploy to FTP Server
uses: https://github.com/SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ${{ secrets.ftp_host }}
username: ${{ secrets.ftp_user }}
server-dir: ./
local-dir: ./_build/
protocol: ftps
password: ${{ secrets.ftp_password }}

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
_build/

18
Makefile Normal file
View File

@ -0,0 +1,18 @@
.DEFAULT_GOAL := all
configure:
@mkdir -p _build/
helm repo add bitnami https://charts.bitnami.com/bitnami
homebox: configure
helm lint charts/stable/homebox/
helm dependency build charts/stable/homebox/
helm package charts/stable/homebox/ -d _build/
index:
curl -L -o _build/index.yaml https://charts.coo-ops.space/index.yaml
helm repo index _build/ --url https://charts.coo-ops.space --merge index.yaml
stable: homebox
all: stable index

5
charts/README.md Normal file
View File

@ -0,0 +1,5 @@
# Helm charts overview
### Stable charts:
| Chart | Description |
| ----- | ----------- |
| [homebox](stable/homebox) | Homebox is the inventory and organization system built for the Home User |

View File

@ -0,0 +1,37 @@
apiVersion: v2
name: homebox
# This is the chart version.
version: 0.1.0
# A SemVer range of compatible Kubernetes versions (optional)
# kubeVersion: ">=1.16.0-0"
# What is this Application?
description: "Homebox is the inventory and organization system built for the Home User"
type: application
# Meta Keywords
keywords:
- asset
- organisation
- inventory
- QR
- warranty
# The URL of this projects home page
home: https://hay-kot.github.io/homebox/
# A list of URLs to source code for this project
sources:
- https://github.com/hay-kot/homebox
- https://github.com/hay-kot/homebox/pkgs/container/homebox
# Who's looking after this Chart?
maintainers:
- name: Kyle Coo-ops
email: kyle@coo-ops.space
url: https://git.coo-ops.space/cooper
- name: Alice
email: alice@stacktonic.com.au
url: https://github.com/HunterNyan
# A URL to an SVG or PNG image to be used as an icon (optional).
icon: https://github.com/hay-kot/homebox/raw/main/docs/docs/assets/img/lilbox.svg
# This is the version number of the application being deployed. This version number should be
appVersion: "v0.9.2"
# Whether this chart is deprecated (optional, boolean)
deprecated: false

View File

@ -0,0 +1,73 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "homebox.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 "homebox.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 "homebox.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "homebox.labels" -}}
helm.sh/chart: {{ include "homebox.chart" . }}
{{ include "homebox.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "homebox.selectorLabels" -}}
app.kubernetes.io/name: {{ include "homebox.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Storage Class
*/}}
{{- define "homebox.persistence.storageClass" -}}
{{- $storageClass := .Values.global.storageClass | default .Values.persistence.storageClass }}
{{- if $storageClass }}
storageClassName: {{ $storageClass | quote }}
{{- end }}
{{- end -}}
{{- define "homebox.container-additional-mounts" -}}
{{- /* Honor the deprecated extraVolumeMounts variable when defined */ -}}
{{- if gt (len .Values.extraContainerVolumeMounts) 0 -}}
{{- toYaml .Values.extraContainerVolumeMounts -}}
{{- else if gt (len .Values.extraVolumeMounts) 0 -}}
{{- toYaml .Values.extraVolumeMounts -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-config
namespace: {{ .Values.namespace }}
data:
{{- toYaml .Values.homebox.env | nindent 2 }}

View File

@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "homebox.fullname" . }}
namespace: {{ .Values.namespace }}
labels:
{{- include "homebox.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "homebox.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "homebox.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.www.image }}:{{ .Values.www.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}-config
ports:
- name: http
containerPort: 7745
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /data
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- end }}
{{- include "homebox.container-additional-mounts" . | nindent 12 }}
volumes:
{{- if gt (len .Values.extraVolumes) 0 }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
- name: data
persistentVolumeClaim:
{{- with .Values.persistence.existingClaim }}
claimName: {{ tpl . $ }}
{{- end }}
{{- else if not .Values.persistence.enabled }}
- name: data
emptyDir: {}
{{- else if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
- name: data
persistentVolumeClaim:
claimName: {{ include "homebox.fullname" . }}-pvc
{{- 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 }}
{{- with .Values.dnsConfig }}
dnsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,41 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := .Release.Name -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}
{{- 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: {{ $serviceName }}
port:
number: 7745
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,28 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: {{ .Values.namespace }}
name: {{ include "homebox.fullname" . }}-pvc
{{- with .Values.persistence.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
{{- with .Values.persistence.labels }}
labels:
{{- range $key, $value := . }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
{{- include "homebox.persistence.storageClass" . | indent 8 }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
namespace: {{ .Values.namespace }}
labels:
app: {{ .Release.Name }}
spec:
ports:
- port: 7745
selector:
app: {{ .Release.Name }}

View File

@ -0,0 +1,66 @@
# Default values for homebox.
# This is a YAML-formatted file.
# Namespace to use.
namespace: homebox
# Replica's to Deploy.
replicaCount: 1
# Image to use.
www:
image: ghcr.io/hay-kot/homebox
pullPolicy: Always
tag: "v0.9.2"
# Overrides.
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
homebox:
env:
HBOX_MODE: production #application mode used for runtime behavior can be one of: development, production
HBOX_WEB_PORT: 7745 #port to run the web server on, if you're using docker do not change this
# HBOX_WEB_HOST: #host to run the web server on, if you're using docker do not change this
HBOX_OPTIONS_ALLOW_REGISTRATION: true #allow users to register themselves
HBOX_OPTIONS_AUTO_INCREMENT_ASSET_ID: true #auto increments the asset_id field for new items
HBOX_WEB_MAX_UPLOAD_SIZE: 10 #maximum file upload size supported in MB
HBOX_STORAGE_DATA: /data/ #path to the data directory, do not change this if you're using docker
HBOX_STORAGE_SQLITE_URL: /data/homebox.db?_fk=1 #sqlite database url, in you're using docker do not change this
HBOX_LOG_LEVEL: info #log level to use, can be one of: trace, debug, info, warn, error, critical
HBOX_LOG_FORMAT: text #log format to use, can be one of: text, json
# HBOX_MAILER_HOST: #email host to use, if not set no email provider will be used
HBOX_MAILER_PORT: 587 #email port to use
# HBOX_MAILER_USERNAME: #email user to use
# HBOX_MAILER_PASSWORD: #email password to use
# HBOX_MAILER_FROM: #email from address to use
HBOX_SWAGGER_HOST: 7745 #swagger host to use, if not set swagger will be disabled
HBOX_SWAGGER_SCHEMA: http #swagger schema to use, can be one of: http, https
ingress:
enabled: true
className: "nginx"
tls:
- secretName: homebox-domain-tls
hosts:
- homebox.example.com
hosts:
- host: homebox.example.com
paths:
- path: /
pathType: Prefix
persistence:
enabled: true
existingClaim:
size: 10Gi
accessModes:
- ReadWriteOnce
labels: {}
annotations: {}
storageClass:
subPath:
extraVolumes: []
extraContainerVolumeMounts: []