oneuptime/kubernetes/production-server.yaml
2019-08-02 18:26:16 +05:30

448 lines
8.9 KiB
YAML

# This is the production Kubectl config which is used to run the production cluster in Kubernetes.
#
# IMPORTANT: ANY CHANGE TO THIS FILE SHOULD BE ACCOMPANIED WITH CHANGES TO test-server.yaml
#
apiVersion: apps/v1
kind: Deployment
metadata:
name: dashboard
labels:
app: dashboard
spec:
selector:
matchLabels:
app: dashboard
replicas: 1
template:
metadata:
labels:
app: dashboard
spec:
containers:
- image: registry.gitlab.com/fyipe-project/dashboard:master
name: dashboard
imagePullPolicy: IfNotPresent
env:
- name: FYIPE_HOSTED
value: "true"
ports:
- containerPort: 3000
hostPort: 3000
name: dashboard
restartPolicy: Always
imagePullSecrets:
- name: gitlabcredv2
---
# Fyipe Dashoard Service
apiVersion: v1
kind: Service
metadata:
labels:
app: dashboard
name: dashboard
spec:
ports:
- port: 80
protocol: TCP
targetPort: 3000
selector:
app: dashboard
type: LoadBalancer
---
# Fyipe App Accounts Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: accounts
labels:
app: accounts
spec:
selector:
matchLabels:
app: accounts
replicas: 1
template:
metadata:
labels:
app: accounts
spec:
containers:
- image: registry.gitlab.com/fyipe-project/accounts:latest
name: accounts
imagePullPolicy: IfNotPresent
env:
- name: FYIPE_HOSTED
value: "true"
ports:
- containerPort: 3003
hostPort: 3003
name: accounts
restartPolicy: Always
imagePullSecrets:
- name: gitlabcredv2
---
# Fyipe Accounts Service
apiVersion: v1
kind: Service
metadata:
labels:
app: accounts
name: accounts
spec:
ports:
- port: 80
protocol: TCP
targetPort: 3003
selector:
app: accounts
type: LoadBalancer
---
# Fyipe Backend Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
labels:
app: backend
spec:
selector:
matchLabels:
app: backend
replicas: 1
template:
metadata:
labels:
app: backend
spec:
containers:
- image: registry.gitlab.com/fyipe-project/backend:master
name: backend
imagePullPolicy: IfNotPresent
env:
- name: FYIPE_HOSTED
value: "true"
- name: JWT_SECRET
value: "idfn3873458973457453"
- name: MONGO_URL
value: "mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo-headless.default.svc.cluster.local:27017,mongo-1.mongo-headless.default.svc.cluster.local:27017,mongo-2.mongo-headless.default.svc.cluster.local:27017/fyipedb?replicaSet=fyipe"
- name: STRIPE_PUBLIC_KEY
value: "pk_live_j4tvMzviY2MUsRdWvDI8vN8B"
- name: STRIPE_PRIVATE_KEY
value: "sk_live_ADLzzMrOCz0kyYTsxWatAqxh"
- name: PORT
value: "3001"
ports:
- containerPort: 3001
hostPort: 3001
name: backend
restartPolicy: Always
imagePullSecrets:
- name: gitlabcredv2
---
# Fyipe Backend Deployment
apiVersion: v1
kind: Service
metadata:
labels:
app: backend
name: backend
spec:
ports:
- port: 80
protocol: TCP
targetPort: 3001
selector:
app: backend
type: LoadBalancer
---
# Fyipe Home
apiVersion: apps/v1
kind: Deployment
metadata:
name: home
labels:
app: home
spec:
selector:
matchLabels:
app: home
replicas: 1
template:
metadata:
labels:
app: home
spec:
containers:
- image: registry.gitlab.com/fyipe-project/home:master
name: home
imagePullPolicy: IfNotPresent
env:
- name: FYIPE_HOSTED
value: "true"
ports:
- containerPort: 1444
hostPort: 1444
name: home
restartPolicy: Always
imagePullSecrets:
- name: gitlabcredv2
---
apiVersion: v1
kind: Service
metadata:
labels:
app: home
name: home
spec:
ports:
- port: 80
protocol: TCP
targetPort: 1444
selector:
app: home
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: status-page
labels:
app: status-page
spec:
selector:
matchLabels:
app: status-page
replicas: 1
template:
metadata:
labels:
app: status-page
spec:
containers:
- image: registry.gitlab.com/fyipe-project/status-page:master
name: status-page
imagePullPolicy: IfNotPresent
env:
- name: FYIPE_HOSTED
value: "true"
ports:
- containerPort: 3006
hostPort: 3006
name: status-page
restartPolicy: Always
imagePullSecrets:
- name: gitlabcredv2
---
apiVersion: v1
kind: Service
metadata:
labels:
app: status-page
name: status-page
spec:
ports:
- port: 80
protocol: TCP
targetPort: 3006
selector:
app: status-page
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
name: mongo-headless
labels:
name: mongo-headless
spec:
ports:
- port: 27017
targetPort: 27017
clusterIP: None
selector:
role: mongo
---
# stateful set config for mongo
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: mongo
spec:
serviceName: "mongo-headless"
replicas: 3
template:
metadata:
labels:
role: mongo
environment: production
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mongo
image: mongo
command: ["/bin/sh","-c"]
args: ["echo 2J2W5Jm7G38y169r8s5T1dW > mongo.key; chmod 600 mongo.key; mongod --replSet fyipe --keyFile mongo.key --smallfiles --noprealloc --bind_ip_all"]
ports:
- containerPort: 27017
volumeMounts:
- name: persistent-storage
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: persistent-storage
annotations:
volume.beta.kubernetes.io/storage-class: productiondata
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 900Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo-backup-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 900Gi
storageClassName: primarybackup
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo-secondary-backup-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 900Gi
storageClassName: secondbackup
---
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: mongo-backup-primary
name: mongo-backup-primary
spec:
replicas: 1
template:
metadata:
labels:
name: mongo-backup-primary
spec:
containers:
- image: tutum/mongodb-backup
name: mongodb-backup
ports:
- name: mongo
containerPort: 27017
hostPort: 27017
env:
- name: MAX_BACKUPS
value: "15"
- name: MONGODB_USER
value: "admin"
- name: MONGODB_PASS
value: "372b60f4-704c-4205-8e5c-45cdbf44b1fc"
- name: MONGODB_HOST
value: "mongo-0.mongo-headless.default.svc.cluster.local"
- name: MONGODB_PORT
value: "27017"
volumeMounts:
- name: mongo-backup
mountPath: /backup
volumes:
- name: mongo-backup
persistentVolumeClaim:
claimName: mongo-backup-pvc
---
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: mongo-backup-secondary
name: mongo-backup-secondary
spec:
replicas: 1
template:
metadata:
labels:
name: mongo-backup-secondary
spec:
containers:
- image: tutum/mongodb-backup
name: mongodb-backup
ports:
- name: mongo
containerPort: 27017
hostPort: 27017
env:
- name: MAX_BACKUPS
value: "15"
- name: MONGODB_USER
value: "admin"
- name: MONGODB_PASS
value: "372b60f4-704c-4205-8e5c-45cdbf44b1fc"
- name: MONGODB_HOST
value: "mongo-0.mongo-headless.default.svc.cluster.local"
- name: MONGODB_PORT
value: "27017"
volumeMounts:
- name: mongo-backup
mountPath: /backup
volumes:
- name: mongo-backup
persistentVolumeClaim:
claimName: mongo-secondary-backup-pvc
---
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: productiondata
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-ssd
reclaimPolicy: Retain
---
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: primarybackup
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-standard
reclaimPolicy: Retain
---
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: secondbackup
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-standard
reclaimPolicy: Retain
---