diff --git a/02_hetzner/01_prod/semcust/deployment.yaml b/02_hetzner/01_prod/semcust/deployment.yaml new file mode 100644 index 0000000..82dfaf9 --- /dev/null +++ b/02_hetzner/01_prod/semcust/deployment.yaml @@ -0,0 +1,299 @@ +# Deployment description +apiVersion: apps/v1 +kind: Deployment +metadata: + name: semcust-deployment + namespace: prod-environment + labels: + app: semcust-prod +spec: + strategy: + type: Recreate + replicas: 1 + selector: + matchLabels: + app: semcust-prod + template: + metadata: + labels: + app: semcust-prod + spec: + containers: + - name: semcust-frontend + image: packages.semapp.lan:5000/semcust_frontend:1.2.2 + resources: + requests: + memory: "256Mi" + cpu: "100m" + limits: + memory: "512Mi" + cpu: "4" + ports: + - containerPort: 8200 + name: semcust-http + protocol: TCP + volumeMounts: + - mountPath: /etc/nginx/conf.d + readOnly: true + name: nginx-conf + imagePullPolicy: Always + - name: semcust-backend + image: packages.semapp.lan:5000/semcust_backend:1.2.2 + resources: + requests: + memory: "256Mi" + cpu: "100m" + limits: + memory: "512Mi" + cpu: "4" + ports: + - containerPort: 5200 + name: semcust-backend + protocol: TCP + imagePullPolicy: Always + envFrom: + - configMapRef: + name: semcust-prod-config + volumes: + - name: nginx-conf + configMap: + name: semcust-nginx-conf + +--- +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: prod-environment + name: semcust-prod-config + labels: + app: semcust-prod +data: + DJANGO_DB_ENGINE: "django.db.backends.postgresql_psycopg2" + DJANGO_DB_NAME: "semcust_prod" + DJANGO_DB_USER: "semcust_prod" + DJANGO_DB_PASSWORD: "P{*~976@$S[;%-H35jXw" + DJANGO_DB_HOST: "psql.semprod.local" + DJANGO_DB_PORT: "5432" + ALLOWED_HOSTS: '["*"]' + FRONTEND_URL: "https://portal.semapp.de" + API_URL: "https://portal.semapp.de" + PORT_FRONTEND: "8200" + PORT_BACKEND: "5200" + DEFAULT_FILE_STORAGE: "minio_storage.storage.MinioMediaStorage" + MINIO_STORAGE_ENDPOINT: "minio-api.semprod.local" + MINIO_STORAGE_ACCESS_KEY: "semcust-prod" + MINIO_STORAGE_SECRET_KEY: "8c2$5xVFfg9J&s{QmA!_" + MINIO_STORAGE_USE_HTTPS: "False" + MINIO_STORAGE_MEDIA_BUCKET_NAME: "semcust-prod" + MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET: "True" + EMAIL_USE_TLS: "True" + EMAIL_HOST: "smtp.strato.de" + EMAIL_PORT: "587" + EMAIL_HOST_USER: "support@semantic-applications.de" + EMAIL_HOST_PASSWORD: "uN1zPIqN9@br" + +--- +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: prod-environment + name: semcust-nginx-conf +data: + default.conf: | + upstream backend { + server semcust-backend-prod:5200; + } + + server { + listen 8200; + + #server_name semcust-dev.semapp.lan; + + access_log /var/log/nginx/access.log; + charset utf-8; + client_max_body_size 1G; + + location / { + root /srv/semcust; + #add_header X-Frame-Options "SAMEORIGIN"; + index index.html index.htm; + try_files $uri $uri /index.html =404; + } + + location /administration { + root /srv/semcust; + #add_header X-Frame-Options "SAMEORIGIN"; + index index.html index.htm; + try_files $uri $uri /index.html =404; + } + + location /confluence { + root /srv/semcust; + #add_header X-Frame-Options "SAMEORIGIN"; + index index.html index.htm; + try_files $uri $uri /index.html =404; + } + + location ~ ^/api { + proxy_pass http://backend; + proxy_redirect off; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_read_timeout 300s; + proxy_send_timeout 300s; + send_timeout 300s; + } + + location /admin { + proxy_pass http://backend; + proxy_redirect off; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_read_timeout 300s; + proxy_send_timeout 300s; + send_timeout 300s; + } + + location /forum { + proxy_pass http://backend; + proxy_redirect off; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_read_timeout 300s; + proxy_send_timeout 300s; + send_timeout 300s; + } + + location /confluence/page-overview/ { + proxy_pass http://backend; + proxy_redirect off; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_read_timeout 300s; + proxy_send_timeout 300s; + send_timeout 300s; + } + + location /confluence/storage/ { + proxy_pass http://backend; + proxy_redirect off; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_read_timeout 300s; + proxy_send_timeout 300s; + send_timeout 300s; + } + + location /help-desk { + proxy_pass http://backend; + proxy_redirect off; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_read_timeout 300s; + proxy_send_timeout 300s; + send_timeout 300s; + } + + location /static-backend { + proxy_pass http://backend; + proxy_redirect off; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_read_timeout 300s; + proxy_send_timeout 300s; + send_timeout 300s; + } + + error_page 404 =200 /index.html; + + add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; + + expires off; + open_file_cache off; + sendfile off; + } + +--- +# semcust Service +apiVersion: v1 +kind: Service +metadata: + name: semcust-frontend-prod + namespace: prod-environment +spec: + selector: + app: semcust-prod + ports: + - name: semcust-http + port: 8200 + targetPort: semcust-http + type: NodePort + +--- +# semcust backend +apiVersion: v1 +kind: Service +metadata: + name: semcust-backend-prod + namespace: prod-environment +spec: + selector: + app: semcust-prod + ports: + - name: semcust-backend + port: 5200 + targetPort: semcust-backend + type: NodePort +--- + +# Ingress description +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: semcust-prod-ingress + namespace: prod-environment + annotations: + kubernetes.io/ingress.class: "traefik" +spec: + rules: + - host: semcust-prod.k8s.semprod.local + http: + paths: + - backend: + service: + name: semcust-frontend-prod + port: + number: 8200 + path: / + pathType: ImplementationSpecific + - host: portal.semapp.de + http: + paths: + - backend: + service: + name: semcust-frontend-prod + port: + number: 8200 + path: / + pathType: ImplementationSpecific