This commit is contained in:
Remy Moll 2024-02-10 19:35:22 +01:00
parent edcb9158f5
commit a38ad1d7e6
11 changed files with 0 additions and 313 deletions

@ -1,29 +0,0 @@
kind: ConfigMap
apiVersion: v1
metadata:
labels:
app: recipes
name: recipes-nginx-config
data:
nginx-config: |-
events {
worker_connections 1024;
}
http {
include mime.types;
server {
listen 80;
server_name _;
client_max_body_size 16M;
# serve static files
location /static/ {
alias /static/;
}
# serve media files
location /media/ {
alias /media/;
}
}
}

@ -1,153 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: recipes
labels:
app: recipes
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: recipes
template:
metadata:
labels:
app: recipes
spec:
restartPolicy: Always
initContainers:
- name: init-chmod-data
env:
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: recipes
key: secret-key
- name: DB_ENGINE
value: django.db.backends.sqlite3
image: recipes
imagePullPolicy: Always
resources:
requests:
cpu: 250m
memory: 64Mi
command:
- sh
- -c
- |
set -e
source venv/bin/activate
echo "Updating database"
python manage.py migrate
python manage.py collectstatic_js_reverse
python manage.py collectstatic --noinput
echo "Setting media file attributes"
chown -R 65534:65534 /opt/recipes/mediafiles
find /opt/recipes/mediafiles -type d | xargs -r chmod 755
find /opt/recipes/mediafiles -type f | xargs -r chmod 644
echo "Done"
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: /opt/recipes/mediafiles
name: media
# mount as subPath due to lost+found on ext4 pvc
subPath: files
- mountPath: /opt/recipes/staticfiles
name: static
# mount as subPath due to lost+found on ext4 pvc
subPath: files
containers:
- name: recipes-nginx
image: nginx:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
protocol: TCP
name: http
- containerPort: 8080
protocol: TCP
name: gunicorn
resources:
requests:
cpu: 250m
memory: 64Mi
volumeMounts:
- mountPath: /media
name: media
# mount as subPath due to lost+found on ext4 pvc
subPath: files
- mountPath: /static
name: static
# mount as subPath due to lost+found on ext4 pvc
subPath: files
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx-config
readOnly: true
- name: recipes
image: recipes
imagePullPolicy: IfNotPresent
command:
- /opt/recipes/venv/bin/gunicorn
- -b
- :8080
- --access-logfile
- "-"
- --error-logfile
- "-"
- --log-level
- INFO
- recipes.wsgi
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 8080
scheme: HTTP
periodSeconds: 30
readinessProbe:
httpGet:
path: /
port: 8080
scheme: HTTP
periodSeconds: 30
resources:
requests:
cpu: 250m
memory: 64Mi
volumeMounts:
- mountPath: /opt/recipes/mediafiles
name: media
# mount as subPath due to lost+found on ext4 pvc
subPath: files
- mountPath: /opt/recipes/staticfiles
name: static
# mount as subPath due to lost+found on ext4 pvc
subPath: files
env:
- name: DEBUG
value: "1"
- name: ALLOWED_HOSTS
value: '*'
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: recipes
key: secret-key
- name: GUNICORN_MEDIA
value: "0"
- name: DB_ENGINE
value: django.db.backends.sqlite3
volumes:
- name: media
persistentVolumeClaim:
claimName: recipes-media
- name: static
persistentVolumeClaim:
claimName: recipes-static
- name: nginx-config
configMap:
name: recipes-nginx-config

@ -1,26 +0,0 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: recipes-ingressroute
spec:
entryPoints:
- websecure
routes:
- match: Host(`recipes.kluster.moll.re`) && PathPrefix(`/`)
kind: Rule
services:
- name: recipes
port: 8080
- match: Host(`recipes.kluster.moll.re`) && PathPrefix(`/media`)
kind: Rule
services:
- name: recipes
port: 80
- match: Host(`recipes.kluster.moll.re`) && PathPrefix(`/static`)
kind: Rule
services:
- name: recipes
port: 80
tls:
certResolver: default-tls

@ -1,17 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- recipes.sealedsecret.yaml
- pvc.yaml
- deployment.yaml
- configmap.yaml
- services.yaml
- ingress.yaml
namespace: recipes
images:
- name: recipes
newName: vabene1111/recipes
newTag: "1.5"

@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: placeholder

@ -1,27 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: recipes-media
labels:
app: recipes
spec:
storageClassName: nfs-client
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: recipes-static
labels:
app: recipes
spec:
storageClassName: nfs-client
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

@ -1,16 +0,0 @@
---
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
creationTimestamp: null
name: recipes
namespace: recipes
spec:
encryptedData:
secret-key: AgASPeIrGAMmyTTcrqPTnKsmzKDpadR7iNVTn2yooM3W0Un/keWe2XRMss36NwxODkNtXEt9Knr0BDtVHc7PWDQ6ZH9+XMm6MLTOW2cSDMEzCCwu+J29tUDWMRLOJsABtuHN/gTJYcvdErXiV/gxvaST3Fzpxhb/rghZWO5k2woNuwUWOxwIyCXilb4gjN+v9TEtBiZUtwD3hsZ+UMHZL8BEiZxPiEG8cuCpod8xFJVX4I8j4lkh2JmChN1ZQ3RDCeYekX71+yYj5agbdRgQn/V500+Ccp38b/H5HxK12o6jHOH/YzoOZGF+704dP6E6dJbb9jOu3mkwqBieT5WMryJ/MOV3+SxeikeAGyf2sUCZBvv2p5Dyqx3pFv7ghrNxevP4EwVVSudY/x8LMixKqd/Tqbh+LOWbd9P33cMJRUOD1yAy6zPDV1FcTi6Fd6uUvpR+qRAgQ7BxsvNIrmfd8NqQ13b4CVSf8i4mynwL8vsoC3FaEbczTkcbtfp01yLW8oowJ3qhPqfw9CAfrRgbtO8fDMWJMkQL3n1bO87J3KdtSFh6z9aT0EdjE1QdEAsIwp/uPxdQr5bsJ4U+bLqfj4sWD3cCaSruGfrJpIgIAmObcYuUHTFZqzFvx0HZtKFK/UtK6gXAIAA+aZ14iLN8LDgm1TeubjnBTyk0kxeRhEHHKIUPAaOtXSCGp2UT0A+CyQzs97CRLO06XtBFRFhA0DY6UzZpb1P6hmpOHhJgQk3XTQBR+2mzEsMwMDu1eHncVR8t8A==
template:
metadata:
creationTimestamp: null
name: recipes
namespace: recipes
type: Opaque

@ -1,18 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: recipes
labels:
app: recipes
spec:
selector:
app: recipes
ports:
- port: 80
targetPort: http
name: http
protocol: TCP
- port: 8080
targetPort: gunicorn
name: gunicorn
protocol: TCP

@ -36,4 +36,3 @@ resources:
- syncthing/
- finance/
- eth-physics/
- recipes/

@ -1,18 +0,0 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: recipes-application
namespace: argocd
spec:
project: apps
source:
repoURL: ssh://git@git.kluster.moll.re:2222/remoll/k3s-infra.git
targetRevision: main
path: apps/recipes/
destination:
server: https://kubernetes.default.svc
namespace: recipes
syncPolicy:
automated:
prune: true
selfHeal: true

@ -1,4 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- application.yaml