Skip to content

Commit

Permalink
Update pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
meezaan committed Oct 4, 2021
1 parent 70a7317 commit 717481d
Show file tree
Hide file tree
Showing 7 changed files with 793 additions and 12 deletions.
125 changes: 119 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,27 @@ jobs:
docker tag $IMAGE_NAME:latest $QUAYIO_IMAGE_NAME:$IMAGE_TAG
echo "Pushing tag $IMAGE_TAG to quay.io..."
docker push $QUAYIO_IMAGE_NAME:$IMAGE_TAG
deploy-docker-tag-europe:
deploy-docker-tag-newark:
executor: docker-publisher
steps:
- checkout
- run:
name: Install envsubst
command: |
sudo apt-get update && sudo apt-get -y install gettext-base
- run:
name: Install kubectl
command: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod u+x ./kubectl
- run:
name: Deploy Code
command: |
curl -o ./.k8s/deploy.sh https://raw.githubusercontent.com/islamic-network/k8s-deployment/master/deploy-newark.sh
chmod u+x ./.k8s/deploy.sh
sh ./.k8s/deploy.sh
deploy-docker-tag-dallas:
executor: docker-publisher
steps:
- checkout
Expand All @@ -84,10 +104,10 @@ jobs:
- run:
name: Deploy Code
command: |
curl -o ./.k8s/deploy.sh https://raw.githubusercontent.com/islamic-network/k8s-deployment/master/deploy-europe.sh
curl -o ./.k8s/deploy.sh https://raw.githubusercontent.com/islamic-network/k8s-deployment/master/deploy-dallas.sh
chmod u+x ./.k8s/deploy.sh
sh ./.k8s/deploy.sh
deploy-docker-tag-asia:
deploy-docker-tag-london:
executor: docker-publisher
steps:
- checkout
Expand All @@ -103,7 +123,64 @@ jobs:
- run:
name: Deploy Code
command: |
curl -o ./.k8s/deploy.sh https://raw.githubusercontent.com/islamic-network/k8s-deployment/master/deploy-asia.sh
curl -o ./.k8s/deploy.sh https://raw.githubusercontent.com/islamic-network/k8s-deployment/master/deploy-london.sh
chmod u+x ./.k8s/deploy.sh
sh ./.k8s/deploy.sh
deploy-docker-tag-frankfurt:
executor: docker-publisher
steps:
- checkout
- run:
name: Install envsubst
command: |
sudo apt-get update && sudo apt-get -y install gettext-base
- run:
name: Install kubectl
command: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod u+x ./kubectl
- run:
name: Deploy Code
command: |
curl -o ./.k8s/deploy.sh https://raw.githubusercontent.com/islamic-network/k8s-deployment/master/deploy-frankfurt.sh
chmod u+x ./.k8s/deploy.sh
sh ./.k8s/deploy.sh
deploy-docker-tag-mumbai:
executor: docker-publisher
steps:
- checkout
- run:
name: Install envsubst
command: |
sudo apt-get update && sudo apt-get -y install gettext-base
- run:
name: Install kubectl
command: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod u+x ./kubectl
- run:
name: Deploy Code
command: |
curl -o ./.k8s/deploy.sh https://raw.githubusercontent.com/islamic-network/k8s-deployment/master/deploy-mumbai.sh
chmod u+x ./.k8s/deploy.sh
sh ./.k8s/deploy.sh
deploy-docker-tag-singapore:
executor: docker-publisher
steps:
- checkout
- run:
name: Install envsubst
command: |
sudo apt-get update && sudo apt-get -y install gettext-base
- run:
name: Install kubectl
command: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod u+x ./kubectl
- run:
name: Deploy Code
command: |
curl -o ./.k8s/deploy.sh https://raw.githubusercontent.com/islamic-network/k8s-deployment/master/deploy-singapore.sh
chmod u+x ./.k8s/deploy.sh
sh ./.k8s/deploy.sh
Expand Down Expand Up @@ -139,7 +216,43 @@ workflows:
only: /.*/
branches:
ignore: /.*/
- deploy-docker-tag-europe:
- deploy-docker-tag-newark:
context: org-global
requires:
- build-and-publish-docker-image
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- deploy-docker-tag-dallas:
context: org-global
requires:
- build-and-publish-docker-image
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- deploy-docker-tag-london:
context: org-global
requires:
- build-and-publish-docker-image
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- deploy-docker-tag-frankfurt:
context: org-global
requires:
- build-and-publish-docker-image
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- deploy-docker-tag-mumbai:
context: org-global
requires:
- build-and-publish-docker-image
Expand All @@ -148,7 +261,7 @@ workflows:
only: /.*/
branches:
ignore: /.*/
- deploy-docker-tag-asia:
- deploy-docker-tag-singapore:
context: org-global
requires:
- build-and-publish-docker-image
Expand Down
4 changes: 2 additions & 2 deletions .k8s/manifest-europe.yml → .k8s/manifest-dallas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
Expand Down Expand Up @@ -78,7 +78,7 @@ spec:
name: alquran-cloud-app
minReplicas: 2
maxReplicas: 5
targetCPUUtilizationPercentage: 80
targetCPUUtilizationPercentage: 60
---
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand Down
8 changes: 4 additions & 4 deletions .k8s/manifest-asia.yml → .k8s/manifest-frankfurt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ metadata:
name: alquran-cloud-app
namespace: alquran-cloud
spec:
replicas: 3
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
Expand Down Expand Up @@ -76,9 +76,9 @@ spec:
apiVersion: apps/v1
kind: Deployment
name: alquran-cloud-app
minReplicas: 3
minReplicas: 2
maxReplicas: 5
targetCPUUtilizationPercentage: 80
targetCPUUtilizationPercentage: 60
---
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand Down
167 changes: 167 additions & 0 deletions .k8s/manifest-london.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Deployment
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: alquran-cloud-app
namespace: alquran-cloud
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: alquran-cloud-app
template:
metadata:
labels:
app: alquran-cloud-app
spec:
containers:
- name: apache-exporter-sidecar
image: lusotycoon/apache-exporter
resources:
requests:
cpu: "20m"
memory: 16Mi
limits:
cpu: "100"
memory: 128Mi
args:
- '--scrape_uri=http://localhost:8080/server-status?auto'
ports:
- containerPort: 9117
protocol: TCP
- name: alquran-cloud-app
image: islamicnetwork/alquran.cloud:$COMMIT_TAG
env:
- name: API_BASE_URI
value: http://alquran-cloud-api/
livenessProbe:
httpGet:
path: /liveness
port: 8080
initialDelaySeconds: 7
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
startupProbe:
httpGet:
path: /liveness
port: 8080
periodSeconds: 7
failureThreshold: 3
resources:
requests:
cpu: "100m"
memory: 180Mi
limits:
cpu: "200m"
memory: 380Mi
ports:
- containerPort: 8080
protocol: TCP
---
# HPA
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: alquran-cloud-app
namespace: alquran-cloud
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: alquran-cloud-app
minReplicas: 2
maxReplicas: 5
targetCPUUtilizationPercentage: 60
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: alquran-cloud-ingress
namespace: alquran-cloud
annotations:
konghq.com/protocols: "https"
konghq.com/https-redirect-status-code: "301"
kubernetes.io/tls-acme: "true"
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: kong
spec:
tls:
- hosts:
- alquran.cloud
- "www.alquran.cloud"
secretName: "alquran-cloud-app-tls"
rules:
- host: alquran.cloud
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: alquran-cloud-app
port:
number: 80
- host: www.alquran.cloud
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: alquran-cloud-app
port:
number: 80
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: alquran-cloud-app-metrics
namespace: monitoring
labels:
release: lke-monitor
spec:
selector:
matchLabels:
name: alquran-cloud-app-metrics
namespaceSelector:
any: true
endpoints:
- port: "metrics"
interval: 30s
---
# Service
apiVersion: v1
kind: Service
metadata:
name: alquran-cloud-app
namespace: alquran-cloud
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: alquran-cloud-app
---
apiVersion: v1
kind: Service
metadata:
name: alquran-cloud-app-metrics
namespace: alquran-cloud
labels:
name: alquran-cloud-app-metrics
spec:
type: ClusterIP
selector:
app: alquran-cloud-app
ports:
- name: metrics
port: 9117
targetPort: 9117

Loading

0 comments on commit 717481d

Please sign in to comment.