feat: homepage
This commit is contained in:
commit
c8a88a578d
2
.env
Normal file
2
.env
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
PROD_URL=apps.gmoker.com
|
||||||
|
IMAGEAPP=ghcr.io/gethomepage/homepage:v0.8.12
|
23
.gitea/workflows/deploy.yaml
Normal file
23
.gitea/workflows/deploy.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: debian
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: setup env
|
||||||
|
run: |
|
||||||
|
. ./.env || true
|
||||||
|
if [ "${{ gitea.ref_name }}" == prod ] && [ -n "$PROD_URL" ]; then
|
||||||
|
BASE_URL="$PROD_URL"
|
||||||
|
else
|
||||||
|
BASE_URL="${{ gitea.ref_name }}.$(tr / '\n' <<< "${{ gitea.repository }}" | tac | tr '\n' .)k8s.gmoker.com"
|
||||||
|
fi
|
||||||
|
cat <<EOF >> .env
|
||||||
|
BASE_URL="$BASE_URL"
|
||||||
|
EOF
|
||||||
|
cat .env
|
||||||
|
|
||||||
|
- uses: actions/k8sdeploy@v1
|
||||||
|
with:
|
||||||
|
kubeconfig: "${{ secrets.K8S }}"
|
9
compose.yaml
Normal file
9
compose.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
element:
|
||||||
|
image: "$IMAGEAPP"
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
volumes:
|
||||||
|
- ./config.json:/app/config.json:ro
|
3
config/bookmarks.yaml
Normal file
3
config/bookmarks.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
# For configuration options and examples, please see:
|
||||||
|
# https://gethomepage.dev/latest/configs/bookmarks
|
0
config/custom.css
Normal file
0
config/custom.css
Normal file
0
config/custom.js
Normal file
0
config/custom.js
Normal file
2
config/kubernetes.yaml
Normal file
2
config/kubernetes.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
mode: cluster
|
6
config/settings.yaml
Normal file
6
config/settings.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
# For configuration options and examples, please see:
|
||||||
|
# https://gethomepage.dev/latest/configs/settings
|
||||||
|
|
||||||
|
headerStyle: clean
|
||||||
|
instanceName: public
|
9
config/widgets.yaml
Normal file
9
config/widgets.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
# For configuration options and examples, please see:
|
||||||
|
# https://gethomepage.dev/latest/configs/service-widgets
|
||||||
|
|
||||||
|
- search:
|
||||||
|
provider: custom
|
||||||
|
url: https://searx.gmoker.com/search?q=
|
||||||
|
suggestionUrl: https://searx.gmoker.com/autocompleter?q=
|
||||||
|
target: _blank
|
39
manifests/bin/deploy.sh
Executable file
39
manifests/bin/deploy.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
function kapply() {
|
||||||
|
for f in "$@"; do
|
||||||
|
kubectl apply -f \
|
||||||
|
<(envsubst "$(env | xargs printf '$%s ')" < "manifests/$f")
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function kcreatesec() {
|
||||||
|
kubectl create secret generic --save-config --dry-run=client -oyaml "$@" | kubectl apply -f-
|
||||||
|
}
|
||||||
|
|
||||||
|
function kcreatecm() {
|
||||||
|
kubectl create configmap --dry-run=client -oyaml "$@" | kubectl apply -f-
|
||||||
|
}
|
||||||
|
|
||||||
|
function kgseckey() {
|
||||||
|
local sec="$1"; shift
|
||||||
|
local key="$1"; shift
|
||||||
|
|
||||||
|
kubectl get secret "$sec" -o jsonpath="{.data.$key}" | base64 -d
|
||||||
|
}
|
||||||
|
|
||||||
|
function kgcmkey() {
|
||||||
|
local cm="$1"; shift
|
||||||
|
local key="$1"; shift
|
||||||
|
|
||||||
|
kubectl get configmap "$cm" -o jsonpath="{.data.$key}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mapfile -t files "$(printf -- '--from-file=%s\n' config/*)"
|
||||||
|
kcreatecm homepage-config "${files[@]}"
|
||||||
|
|
||||||
|
kapply common/clusterrole.yaml common/app.yaml
|
||||||
|
|
||||||
|
kubectl rollout restart deployment app
|
5
manifests/bin/devel.sh
Executable file
5
manifests/bin/devel.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
export NB_REPLICAS=1
|
||||||
|
|
||||||
|
. ./manifests/bin/deploy.sh
|
5
manifests/bin/prod.sh
Executable file
5
manifests/bin/prod.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
export NB_REPLICAS=3
|
||||||
|
|
||||||
|
. ./manifests/bin/deploy.sh
|
76
manifests/common/app.yaml
Normal file
76
manifests/common/app.yaml
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: app
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||||
|
spec:
|
||||||
|
ingressClassName: nginx
|
||||||
|
tls:
|
||||||
|
- secretName: tls-app
|
||||||
|
hosts:
|
||||||
|
- "$BASE_URL"
|
||||||
|
rules:
|
||||||
|
- host: "$BASE_URL"
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: app
|
||||||
|
port:
|
||||||
|
name: http
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: app
|
||||||
|
labels:
|
||||||
|
app: app
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: app
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
targetPort: http
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: app
|
||||||
|
labels:
|
||||||
|
app: app
|
||||||
|
spec:
|
||||||
|
revisionHistoryLimit: 3
|
||||||
|
replicas: $NB_REPLICAS
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: app
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: app
|
||||||
|
spec:
|
||||||
|
serviceAccountName: homepage
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: app
|
||||||
|
image: "$IMAGEAPP"
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 3000
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /app/config/
|
||||||
|
readOnly: true
|
||||||
|
env:
|
||||||
|
- name: LOG_TARGETS
|
||||||
|
value: stdout
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: homepage-config
|
31
manifests/common/clusterrole.yaml
Normal file
31
manifests/common/clusterrole.yaml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: homepage
|
||||||
|
automountServiceAccountToken: true
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: homepage
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- networking.k8s.io
|
||||||
|
resources:
|
||||||
|
- ingresses
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: homepage
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: homepage
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: homepage
|
0
manifests/devel/.gitkeep
Normal file
0
manifests/devel/.gitkeep
Normal file
0
manifests/prod/.gitkeep
Normal file
0
manifests/prod/.gitkeep
Normal file
Loading…
Reference in New Issue
Block a user