apiVersion: v1
kind: Namespace
metadata:
  name: homarr
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: homarr-pvc
  namespace: homarr
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: homarr
  namespace: homarr
spec:
  replicas: 1
  selector:
    matchLabels:
      app: homarr
  template:
    metadata:
      labels:
        app: homarr
    spec:
      containers:
        - name: homarr
          image: ghcr.io/homarr-labs/homarr:latest
          ports:
            - containerPort: 7575
          env:
            - name: SECRET_ENCRYPTION_KEY
              value: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
          volumeMounts:
            - name: homarr-data
              mountPath: /appdata
      volumes:
        - name: homarr-data
          persistentVolumeClaim:
            claimName: homarr-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: homarr
  namespace: homarr
spec:
  selector:
    app: homarr
  ports:
    - port: 7575
      targetPort: 7575
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: homarr
  namespace: homarr
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
spec:
  ingressClassName: traefik
  tls:
    - hosts:
        - home.roysland.net
      secretName: homarr-tls
  rules:
    - host: home.roysland.net
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: homarr
                port:
                  number: 7575
