Merge pull request #15 from MealCraft/feature/moredeployments
Feature/moredeployments
This commit is contained in:
commit
527bfc0621
3 changed files with 171 additions and 4 deletions
46
.github/workflows/ha.yml
vendored
Normal file
46
.github/workflows/ha.yml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
name: Deploy Home Assistant
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
MANIFEST_PATH: "homeassistant/homeassistant.yml"
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: mealcraft-runners
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install kubectl
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y curl ca-certificates
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
sudo install -m 0755 kubectl /usr/local/bin/kubectl
|
||||
|
||||
- name: Install envsubst
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gettext
|
||||
|
||||
- name: Configure kubeconfig
|
||||
run: |
|
||||
KUBE_HOST="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT"
|
||||
SA_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
||||
CA_CERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||
NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
|
||||
|
||||
kubectl config set-cluster microk8s --server="$KUBE_HOST" --certificate-authority="$CA_CERT"
|
||||
kubectl config set-credentials runner --token="$SA_TOKEN"
|
||||
kubectl config set-context runner-context --cluster=microk8s --user=runner --namespace="$NAMESPACE"
|
||||
kubectl config use-context runner-context
|
||||
|
||||
- name: Deploy Home Assistant
|
||||
run: |
|
||||
echo "Deploying Home Assistant from $MANIFEST_PATH"
|
||||
kubectl apply -f $MANIFEST_PATH
|
||||
10
README.md
10
README.md
|
|
@ -14,7 +14,9 @@ TODO:
|
|||
- [x] Traefik certs change from staging to production
|
||||
- [x] Merge my code to main
|
||||
- [x] Push from workflow k8s bootstrap
|
||||
- [] Add my favroutie quotes in a file and everytime someone joins it shows a new one
|
||||
n8n
|
||||
home assistant deploy
|
||||
ajay website deploy
|
||||
- [x] Add my favroutie quotes in a file and everytime someone joins it shows a new one
|
||||
- [x] n8n
|
||||
- [x] home assistant deploy
|
||||
- [ ] Spend some time learning n8n and home assistant
|
||||
- [ ] if i use recallplanner.com and mealcraft.com - put it back up
|
||||
- [ ] If i end up doing it, make sure i put db in aws
|
||||
119
homeassistant/homeassistant.yml
Normal file
119
homeassistant/homeassistant.yml
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
##############################################
|
||||
# Persistent Volume (hostPath on mist)
|
||||
##############################################
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: homeassistant-pv
|
||||
spec:
|
||||
capacity:
|
||||
storage: 10Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: homeassistant-local-storage
|
||||
local:
|
||||
path: /home/kimjunte/k8s_storage/homeassistant
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- mist
|
||||
---
|
||||
##############################################
|
||||
# Persistent Volume Claim
|
||||
##############################################
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: homeassistant-pvc
|
||||
namespace: default
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
storageClassName: homeassistant-local-storage
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
---
|
||||
##############################################
|
||||
# Deployment (Home Assistant Core)
|
||||
##############################################
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: homeassistant
|
||||
namespace: default
|
||||
labels:
|
||||
app: homeassistant
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: homeassistant
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: homeassistant
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: mist
|
||||
containers:
|
||||
- name: homeassistant
|
||||
image: ghcr.io/home-assistant/home-assistant:stable
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8123
|
||||
volumeMounts:
|
||||
- name: ha-data
|
||||
mountPath: /config
|
||||
env:
|
||||
- name: TZ
|
||||
value: "Europe/London"
|
||||
volumes:
|
||||
- name: ha-data
|
||||
persistentVolumeClaim:
|
||||
claimName: homeassistant-pvc
|
||||
---
|
||||
##############################################
|
||||
# Service
|
||||
##############################################
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: homeassistant
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
app: homeassistant
|
||||
ports:
|
||||
- protocol: TCP
|
||||
name: http
|
||||
port: 8123
|
||||
targetPort: 8123
|
||||
---
|
||||
##############################################
|
||||
# IngressRoute (Traefik)
|
||||
##############################################
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: homeassistant-ingressroute
|
||||
namespace: default
|
||||
spec:
|
||||
entryPoints:
|
||||
- websecure
|
||||
routes:
|
||||
- match: Host(`ha.juntekim.com`)
|
||||
kind: Rule
|
||||
services:
|
||||
- name: homeassistant
|
||||
port: 8123
|
||||
tls:
|
||||
certResolver: myresolver
|
||||
domains:
|
||||
- main: ha.juntekim.com
|
||||
Loading…
Add table
Reference in a new issue