Browse Source

Add efc & efc-shop qa deployments.

feat/mariadb
Antun Franjin 4 years ago
parent
commit
623be6e6f1
  1. 154
      01_onsite/02_qa/efc-shop/deployment.yaml
  2. 251
      01_onsite/02_qa/efc/deployment.yaml

154
01_onsite/02_qa/efc-shop/deployment.yaml

@ -0,0 +1,154 @@
# Deployment description
apiVersion: apps/v1
kind: Deployment
metadata:
name: efc-shop-deployment
namespace: qa-environment
labels:
app: efc-shop-qa
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: efc-shop-qa
template:
metadata:
labels:
app: efc-shop-qa
spec:
containers:
- name: efc-shop-frontend
image: packages.semapp.lan:5000/efc-shop_frontend:$IMAGE_TAG
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "4"
ports:
- containerPort: 8501
name: efc-shop-http
protocol: TCP
volumeMounts:
- mountPath: /etc/nginx/conf.d
readOnly: true
name: nginx-shop-qa
imagePullPolicy: Always
envFrom:
- configMapRef:
name: efc-shop-qa-config
volumes:
- name: nginx-shop-qa
configMap:
name: nginx-shop-qa
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: qa-environment
name: efc-shop-qa-config
labels:
app: efc-shop-qa
data:
REACT_APP_PROD_API_URL: "http://efc-shop-qa.k3s.semapp.lan/"
REACT_APP_DEV_API_URL: http://efc-shop-qa.k3s.semapp.lan/
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: qa-environment
name: nginx-shop-qa
data:
default.conf: |
upstream backend {
server efc-backend-qa:5500;
}
server {
listen 8501;
access_log /var/log/nginx/access.log;
charset utf-8;
client_max_body_size 1G;
location / {
root /srv/efc-shop;
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 /storage {
proxy_pass http://backend/storage;
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;
}
---
# EFC Service
apiVersion: v1
kind: Service
metadata:
name: efc-shop-frontend-qa
namespace: qa-environment
spec:
selector:
app: efc-shop-qa
ports:
- name: efc-http
port: 8501
targetPort: efc-shop-http
type: NodePort
---
# Ingress description
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: efc-shop-qa-ingress
namespace: qa-environment
annotations:
kubernetes.io/ingress.class: "traefik"
spec:
rules:
- host: efc-shop-qa.k3s.semapp.lan
http:
paths:
- path: /
backend:
serviceName: efc-shop-frontend-qa
servicePort: 8501

251
01_onsite/02_qa/efc/deployment.yaml

@ -0,0 +1,251 @@
# Deployment description
apiVersion: apps/v1
kind: Deployment
metadata:
name: efc-deployment
namespace: qa-environment
labels:
app: efc-qa
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: efc-qa
template:
metadata:
labels:
app: efc-qa
spec:
containers:
- name: efc-frontend
image: packages.semapp.lan:5000/efc-admin_frontend:$IMAGE_TAG
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "4"
ports:
- containerPort: 8500
name: efc-http
protocol: TCP
volumeMounts:
- mountPath: /etc/nginx/conf.d
readOnly: true
name: nginx-conf-qa
imagePullPolicy: Always
envFrom:
- configMapRef:
name: efc-qa-config
- name: efc-backend
image: packages.semapp.lan:5000/efc-admin_backend:$IMAGE_TAG
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "4"
ports:
- containerPort: 5500
name: efc-backend
protocol: TCP
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/efc/storage
name: efc-pv-qa
envFrom:
- configMapRef:
name: efc-qa-config
volumes:
- name: nginx-conf-qa
configMap:
name: nginx-conf-qa
- name: efc-pv-qa
persistentVolumeClaim:
claimName: efc-pvc-qa
---
# Persistent Volume Claim description
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efc-pvc-qa
namespace: qa-environment
labels:
app: efc-qa
spec:
storageClassName: longhorn
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: qa-environment
name: efc-qa-config
labels:
app: efc-qa
data:
DJANGO_DB_ENGINE: "django.db.backends.postgresql_psycopg2"
DJANGO_DB_NAME: "efc-qa"
DJANGO_DB_USER: "efc"
DJANGO_DB_PASSWORD: "O35iWjsO6RjvQulI2yti"
DJANGO_DB_HOST: "pdbpg11.semapp.lan"
DJANGO_DB_PORT: "5432"
ALLOWED_HOSTS: '["*"]'
FRONTEND_URL: "http://efc-qa.k3s.semapp.lan"
REACT_APP_PROD_API_URL: "http://efc-qa.k3s.semapp.lan/"
REACT_APP_DEV_API_URL: http://efc-qa.k3s.semapp.lan/
PORT_FRONTEND: '8500'
SHOP_FRONTEND_URL: "http://efc-shop-qa.k3s.semapp.lan"
SHOP_PORT_FRONTEND: '8501'
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: qa-environment
name: nginx-conf-qa
data:
default.conf: |
upstream backend {
server efc-backend-qa:5500;
}
server {
listen 8500;
access_log /var/log/nginx/access.log;
charset utf-8;
client_max_body_size 1G;
location / {
root /srv/efc;
index index.html index.htm;
try_files $uri $uri /index.html =404;
}
location /administration {
root /srv/efc;
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 /storage {
proxy_pass http://backend/storage;
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/admin;
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;
}
---
# EFC Service
apiVersion: v1
kind: Service
metadata:
name: efc-frontend-qa
namespace: qa-environment
spec:
selector:
app: efc-qa
ports:
- name: efc-http
port: 8500
targetPort: efc-http
type: NodePort
---
# EFC backend
apiVersion: v1
kind: Service
metadata:
name: efc-backend-qa
namespace: qa-environment
spec:
selector:
app: efc-qa
ports:
- name: efc-backend
port: 5500
targetPort: efc-backend
type: NodePort
---
# Ingress description
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: efc-qa-ingress
namespace: qa-environment
annotations:
kubernetes.io/ingress.class: "traefik"
spec:
rules:
- host: efc-qa.k3s.semapp.lan
http:
paths:
- path: /
backend:
serviceName: efc-frontend-qa
servicePort: 8500
Loading…
Cancel
Save