diff --git a/recipes/recipes.yaml b/recipes/recipes.yaml new file mode 100644 index 0000000..515af36 --- /dev/null +++ b/recipes/recipes.yaml @@ -0,0 +1,206 @@ +# ====================================================== +# TANDOOR RECIPES - FULL STACK +# Domain: recipes.juntekim.com +# ====================================================== + +# ------------------------- +# POSTGRES PVC +# ------------------------- +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: tandoor-postgres-pvc +spec: + accessModes: + - ReadWriteOnce + storageClassName: microk8s-hostpath + resources: + requests: + storage: 2Gi + +# ------------------------- +# MEDIA PVC +# ------------------------- +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: tandoor-media-pvc +spec: + accessModes: + - ReadWriteOnce + storageClassName: microk8s-hostpath + resources: + requests: + storage: 5Gi + +# ------------------------- +# POSTGRES +# ------------------------- +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tandoor-postgres +spec: + replicas: 1 + selector: + matchLabels: + app: tandoor-postgres + template: + metadata: + labels: + app: tandoor-postgres + spec: + containers: + - name: postgres + image: postgres:15-alpine + env: + - name: POSTGRES_USER + value: tandoor + - name: POSTGRES_PASSWORD + value: tandoorpassword + - name: POSTGRES_DB + value: tandoor + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: postgres-storage + volumes: + - name: postgres-storage + persistentVolumeClaim: + claimName: tandoor-postgres-pvc + +--- +apiVersion: v1 +kind: Service +metadata: + name: tandoor-postgres +spec: + selector: + app: tandoor-postgres + ports: + - port: 5432 + +# ------------------------- +# REDIS +# ------------------------- +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tandoor-redis +spec: + replicas: 1 + selector: + matchLabels: + app: tandoor-redis + template: + metadata: + labels: + app: tandoor-redis + spec: + containers: + - name: redis + image: redis:7-alpine + ports: + - containerPort: 6379 + +--- +apiVersion: v1 +kind: Service +metadata: + name: tandoor-redis +spec: + selector: + app: tandoor-redis + ports: + - port: 6379 + +# ------------------------- +# TANDOOR APP +# ------------------------- +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tandoor +spec: + replicas: 1 + selector: + matchLabels: + app: tandoor + template: + metadata: + labels: + app: tandoor + spec: + containers: + - name: tandoor + image: vabene1111/recipes:latest + env: + - name: SECRET_KEY + value: replace-with-random-secret + - name: DB_ENGINE + value: django.db.backends.postgresql + - name: POSTGRES_HOST + value: tandoor-postgres + - name: POSTGRES_PORT + value: "5432" + - name: POSTGRES_USER + value: tandoor + - name: POSTGRES_PASSWORD + value: tandoorpassword + - name: POSTGRES_DB + value: tandoor + - name: REDIS_HOST + value: tandoor-redis + - name: REDIS_PORT + value: "6379" + - name: ALLOWED_HOSTS + value: recipes.juntekim.com + - name: DEBUG + value: "0" + ports: + - containerPort: 8080 + volumeMounts: + - name: media-storage + mountPath: /opt/recipes/mediafiles + volumes: + - name: media-storage + persistentVolumeClaim: + claimName: tandoor-media-pvc + +--- +apiVersion: v1 +kind: Service +metadata: + name: tandoor +spec: + selector: + app: tandoor + ports: + - port: 8080 + targetPort: 8080 + +# ------------------------- +# TRAEFIK INGRESS +# ------------------------- +--- +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: tandoor-ingress +spec: + entryPoints: + - websecure + routes: + - match: Host(`recipes.juntekim.com`) + kind: Rule + services: + - name: tandoor + port: 8080 + tls: + certResolver: myresolver + domains: + - main: recipes.juntekim.com \ No newline at end of file