Commit 197d39d5 authored by Kamal Dodiya's avatar Kamal Dodiya

Add gitlab-ci

parent 692a2325
stages:
- deploy
.deploy:
stage: deploy
image: dockerhub.ebi.ac.uk/kamal/deploy-tools:0.2
before_script:
- SERVICE_TAG=`yq r values.yaml fe-services.client-service`
- if [ "${SERVICE_TAG}" == "<BRANCH_NAME>" ] ; then echo "Please sepcify <BRANCH_NAME> for FE services" ; exit 1 ; fi
- SERVICE_TAG="${SERVICE_TAG//[[:space:]]/}"
- SERVICE_SLUG="${SERVICE_TAG//[^[:alnum:]]/-}"
- BROWSER_SERVICE_TAG=`yq r values.yaml be-services.browser-service`
- BROWSER_SERVICE_TAG="${BROWSER_SERVICE_TAG//[[:space:]]/}"
- BROWSER_SERVICE_SLUG="${BROWSER_SERVICE_TAG//[^[:alnum:]]/-}"
- GENOME_SEARCH_SERVICE_TAG=`yq r values.yaml be-services.genome-search-service`
- GENOME_SEARCH_SERVICE_TAG="${GENOME_SEARCH_SERVICE_TAG//[[:space:]]/}"
- GENOME_SEARCH_SERVICE_SLUG="${GENOME_SEARCH_SERVICE_TAG//[^[:alnum:]]/-}"
- sed -i "s#<DEPLOYMENT_ENV>#${SERVICE_SLUG}#g" ensembl_client_service_cluster.yaml
- sed -i "s#<DEPLOYMENT_ENV>#${SERVICE_SLUG}#g" ensembl_client_ingress.yaml
- sed -i "s#<SUB_DOMAIN>#${SERVICE_SLUG}#g" ensembl_client_ingress.yaml
- sed -i "s#<DEPLOYMENT_ENV>#${BROWSER_SERVICE_SLUG}#g" ensembl_server_service.yaml
- sed -i "s#<DEPLOYMENT_ENV>#${BROWSER_SERVICE_SLUG}#g" ensembl_server_ingress.yaml
- sed -i "s#<SUB_DOMAIN>#${SERVICE_SLUG}#g" ensembl_server_ingress.yaml
- sed -i "s#<DEPLOYMENT_ENV>#${GENOME_SEARCH_SERVICE_SLUG}#g" ensembl_genome_search_service.yaml
- sed -i "s#<DEPLOYMENT_ENV>#${GENOME_SEARCH_SERVICE_SLUG}#g" ensembl_genome_search_ingress.yaml
- sed -i "s#<SUB_DOMAIN>#${SERVICE_SLUG}#g" ensembl_genome_search_ingress.yaml
script:
- kubectl apply -f ensembl_server_service.yaml
- kubectl apply -f ensembl_server_ingress.yaml
- kubectl apply -f ensembl_genome_search_service.yaml
- kubectl apply -f ensembl_genome_search_ingress.yaml
- kubectl apply -f ensembl_client_service_cluster.yaml
- kubectl apply -f ensembl_client_ingress.yaml
Setup-2020:
extends: .deploy
environment:
name : wp-hx-dev-ing
except:
- dev
- master
\ No newline at end of file
# ensembl-k8s-manifests
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ensembl-server-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /browser/$2
spec:
rules:
- http:
paths:
- path: /browser($|/)(.*)
backend:
serviceName: ensembl-server-svc
servicePort: 8000
\ No newline at end of file
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: ensembl-client-<DEPLOYMENT_ENV>-deployment
annotations:
app.gitlab.com/app: <CI_PROJECT_PATH_SLUG>
app.gitlab.com/env: <CI_ENVIRONMENT_SLUG>
spec:
replicas: 1
template:
metadata:
labels:
app: ensembl-client-<DEPLOYMENT_ENV>
RUP: nickl
spec:
containers:
- name: ensembl-client-<DEPLOYMENT_ENV>
image: <DOCKER_IMAGE>
ports:
- containerPort: 8000
imagePullPolicy: Always
\ No newline at end of file
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ensembl-client-<DEPLOYMENT_ENV>-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: <SUB_DOMAIN>.review.ensembl.org
http:
paths:
- backend:
serviceName: ensembl-client-<DEPLOYMENT_ENV>-svc
servicePort: 8000
path: /
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: ensembl-client-<DEPLOYMENT_ENV>-svc
labels:
app: ensembl-client-<DEPLOYMENT_ENV>-svc
spec:
selector:
app: ensembl-client-<DEPLOYMENT_ENV>
type: ClusterIP
ports:
- port: 8000
protocol: TCP
targetPort: 8000
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: ensembl-client-<DEPLOYMENT_ENV>-svc
labels:
app: ensembl-client-<DEPLOYMENT_ENV>-svc
spec:
selector:
app: ensembl-client-<DEPLOYMENT_ENV>
type: NodePort
ports:
- port: 8000
protocol: TCP
targetPort: 8000
\ No newline at end of file
apiVersion: v1
data:
DEPLOYMENT_SCHEME: http
kind: ConfigMap
metadata:
name: ensembl-genome-search-<DEPLOYMENT_ENV>-configmap
\ No newline at end of file
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: ensembl-genome-search-<DEPLOYMENT_ENV>-deployment
spec:
replicas: 1
template:
metadata:
labels:
app: ensembl-genome-search-<DEPLOYMENT_ENV>
RUP: nickl
spec:
imagePullSecrets:
- name: ensembl-genome-search-pull-secret
containers:
- name: enesmbl-genome-search-<DEPLOYMENT_ENV>
image: <DOCKER_IMAGE>
command: ["gunicorn"]
args: ["--bind=0.0.0.0:8011", "--preload", "app:app"]
ports:
- containerPort: 8011
imagePullPolicy: Always
envFrom:
- configMapRef:
name: ensembl-genome-search-<DEPLOYMENT_ENV>-configmap
\ No newline at end of file
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ensembl-genome-search-<DEPLOYMENT_ENV>-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /api/$2
spec:
rules:
- host: <SUB_DOMAIN>.review.ensembl.org
http:
paths:
- path: /api($|/)(.*)
backend:
serviceName: ensembl-genome-search-<DEPLOYMENT_ENV>-svc
servicePort: 8011
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: ensembl-genome-search-<DEPLOYMENT_ENV>-svc
labels:
app: ensembl-genome-search-<DEPLOYMENT_ENV>-svc
spec:
selector:
app: ensembl-genome-search-<DEPLOYMENT_ENV>
type: ClusterIP
ports:
- port: 8011
protocol: TCP
targetPort: 8011
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: ensembl-genome-search-<DEPLOYMENT_ENV>-svc
labels:
app: ensembl-genome-search-<DEPLOYMENT_ENV>-svc
spec:
selector:
app: ensembl-genome-search-<DEPLOYMENT_ENV>
type: NodePort
ports:
- port: 8011
protocol: TCP
targetPort: 8011
\ No newline at end of file
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: ensembl-server-<DEPLOYMENT_ENV>-deployment
spec:
replicas: 1
template:
metadata:
labels:
app: ensembl-server-<DEPLOYMENT_ENV>
RUP: nickl
spec:
imagePullSecrets:
- name: ensembl-server-pull-secret
containers:
- name: ensembl-server-<DEPLOYMENT_ENV>
image: <DOCKER_IMAGE>
command: ["gunicorn"]
args: ["--bind=0.0.0.0:4000", "--preload", "-t 120", "server:app"]
ports:
- containerPort: 4000
imagePullPolicy: Always
env:
- name: ett_data_path
value: "/usr/data/e2020-data"
volumeMounts:
- mountPath: /usr/data
name: ett-server-data-vol
volumes:
- name: ett-server-data-vol
persistentVolumeClaim:
claimName: ett-data-pvc
\ No newline at end of file
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ensembl-server-<DEPLOYMENT_ENV>-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /browser/$2
spec:
rules:
- host: <SUB_DOMAIN>.review.ensembl.org
http:
paths:
- path: /browser($|/)(.*)
backend:
serviceName: ensembl-server-<DEPLOYMENT_ENV>-svc
servicePort: 8000
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: ensembl-server-<DEPLOYMENT_ENV>-svc
labels:
app: ensembl-server-<DEPLOYMENT_ENV>-svc
spec:
selector:
app: ensembl-server-<DEPLOYMENT_ENV>
type: ClusterIP
ports:
- port: 8000
protocol: TCP
targetPort: 4000
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: ensembl-server-<DEPLOYMENT_ENV>-svc
labels:
app: ensembl-server-<DEPLOYMENT_ENV>-svc
spec:
selector:
app: ensembl-server-<DEPLOYMENT_ENV>
type: NodePort
ports:
- port: 8000
protocol: TCP
targetPort: 4000
\ No newline at end of file
kind: Endpoints
apiVersion: v1
metadata:
name: refget-db-service
subsets:
- addresses:
# IP Address of mysql db
- ip: pgsql-hxvm7-044
ports:
# Port
- port: 5432
\ No newline at end of file
kind: Service
apiVersion: v1
metadata:
name: refget-db-service
spec:
ports:
- protocol: TCP
port: 5432
targetPort: 5432
\ No newline at end of file
kind: Service
apiVersion: v1
metadata:
name: refget-ext-db-svc
spec:
type: ExternalName
externalName: pgsql-hxvm7-044.ebi.ac.uk
\ No newline at end of file
fe-services:
client-service: <BRANCH_NAME>
be-services:
browser-service: dev
genome-search-service: dev
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment