Commit 06d62666 authored by David Mendez's avatar David Mendez
Browse files

Implement deployment to staging

parent dc269e07
......@@ -15,7 +15,7 @@ stages:
- build
- test
- prepare_config
# - deploy
- deploy
build-dev:
image:
......@@ -80,31 +80,31 @@ prepare_config_staging:
- ${INGRESS_STAGING_FILE_PATH}
# deploy-dev-hx:
# image:
# name: lachlanevenson/k8s-kubectl:latest
# entrypoint: ["/bin/sh", "-c"]
# only:
# - dev
# stage: deploy
# script:
# - echo $KUBE_URL_HX
# - echo "$KUBE_CA_PEM_HX" > "$(pwd)/kube.ca.pem"
# - kubectl config set-cluster ${KUBE_CLUS_NAME_HX} --server="${KUBE_URL_HX}" --certificate-authority="$(pwd)/kube.ca.pem"
# - kubectl config set-credentials ${KUBE_USER_HX} --token="${KUBE_TOKEN_HX}"
# - kubectl config set-context ${KUBE_NAMESPACE_DEV} --cluster=${KUBE_CLUS_NAME_HX} --user=${KUBE_USER_HX}
# - kubectl config use-context ${KUBE_NAMESPACE_DEV}
# - kubectl create secret generic ${RUN_CONFIG_SECRET_NAME_STAGING} --from-file=RUN_CONFIG.yml=${CONFIG_STAGING_FILE_PATH} -o yaml -n ${CHEMBL_NS_STAGING} --dry-run=client | kubectl replace -f -
# - kubectl create secret generic ${GUNICORN_CONFIG_SECRET_NAME_STAGING} --from-file=GUNICORN_CONFIG.py=${CONFIG_GUNICORN_STAGING_FILE_PATH} -o yaml -n ${CHEMBL_NS_STAGING} --dry-run=client | kubectl replace -f -
# - cat ${CONFIG_STAGING_FILE_PATH}
# - cat ${CONFIG_GUNICORN_STAGING_FILE_PATH}
# - echo ${KUBE_NAMESPACE_DEV} ${KUBE_URL_HH} ${KUBE_CLUS_NAME_HX} ${KUBE_USER_HX}
# - kubectl get pods -n ${KUBE_NAMESPACE_DEV}
# - sed -i "s~<VERSION>~${CI_COMMIT_SHORT_SHA}~" k8s-deployment.yml
# - sed -i "s~<DOCKER_IMAGE>~${DOCKER_IMAGE}~" k8s-deployment.yml
# - kubectl apply -n ${KUBE_NAMESPACE_DEV} -f k8s-deployment.yml
deploy-dev-hx:
image:
name: lachlanevenson/k8s-kubectl:latest
entrypoint: ["/bin/sh", "-c"]
only:
- dev
stage: deploy
script:
- echo $KUBE_URL_HX
- echo "$KUBE_CA_PEM_HX" > "$(pwd)/kube.ca.pem"
- kubectl config set-cluster ${KUBE_CLUS_NAME_HX} --server="${KUBE_URL_HX}" --certificate-authority="$(pwd)/kube.ca.pem"
- kubectl config set-credentials ${KUBE_USER_HX} --token="${KUBE_TOKEN_HX}"
- kubectl config set-context ${KUBE_NAMESPACE_DEV} --cluster=${KUBE_CLUS_NAME_HX} --user=${KUBE_USER_HX}
- kubectl config use-context ${KUBE_NAMESPACE_DEV}
- kubectl create secret generic ${RUN_CONFIG_SECRET_NAME_STAGING} --from-file=RUN_CONFIG.yml=${CONFIG_STAGING_FILE_PATH} -o yaml -n ${CHEMBL_NS_STAGING} --dry-run=client | kubectl apply -f -
- cat ${CONFIG_STAGING_FILE_PATH}
- echo ${KUBE_NAMESPACE_DEV} ${KUBE_URL_HH} ${KUBE_CLUS_NAME_HX} ${KUBE_USER_HX}
- kubectl get pods -n ${KUBE_NAMESPACE_DEV}
- sed -i "s~<VERSION>~${CI_COMMIT_SHORT_SHA}~" k8s-deployment.yml
- sed -i "s~<DOCKER_IMAGE>~${DOCKER_IMAGE}~" k8s-deployment.yml
- sed -i "s~<HTTP_PROXY>~${HTTP_PROXY_HX}~g" k8s-deployment.yaml
- sed -i "s~<HTTPS_PROXY>~${HTTPS_PROXY_HX}~g" k8s-deployment.yaml
- sed -i "s~<NO_PROXY>~${NO_PROXY_HX_DEFAULT}~g" k8s-deployment.yaml
- sed -i "s~<ENV_SECRET_NAME>~${RUN_CONFIG_SECRET_NAME_STAGING}~g" k8s-deployment.yaml
- kubectl apply -n ${KUBE_NAMESPACE_DEV} -f k8s-deployment.yml
# deploy-dev-hh:
......
FROM node:lts
ENV ENV_FILE_PATH=${ENV_FILE_PATH:-'/etc/run_config/.env'}
LABEL maintainer="heinzke@ebi.ac.uk"
......@@ -22,4 +23,4 @@ ENV HOST 0.0.0.0
EXPOSE 3000
ENTRYPOINT [ "npm", "start" ]
ENTRYPOINT ENV_FILE_PATH=${ENV_FILE_PATH} npm start
apiVersion: apps/v1
kind: Deployment
metadata:
name: malaria-front
name: lina-web
labels:
app: malaria-front
app: lina-web
spec:
selector:
matchLabels:
app: malaria-front
app: lina-web
role: master
tier: frontend
replicas: 2
template:
metadata:
labels:
app: malaria-front
app: lina-web
role: master
tier: frontend
spec:
containers:
- name: malaria-front
- name: lina-web
image: <DOCKER_IMAGE>:<VERSION>
imagePullPolicy: Always
ports:
- containerPort: 3000
imagePullSecrets:
- name: malaria-frontend-registry
volumeMounts:
- name: run-config
mountPath: '/etc/run_config/'
readOnly: true
env:
- name: HTTP_PROXY
value: "<HTTP_PROXY>"
- name: http_proxy
value: "<HTTP_PROXY>"
- name: HTTPS_PROXY
value: "<HTTPS_PROXY>"
- name: https_proxy
value: "<HTTPS_PROXY>"
- name: NO_PROXY
value: "<NO_PROXY>"
- name: no_proxy
value: "<NO_PROXY>"
volumes:
- name: run-config
secret:
secretName: <ENV_SECRET_NAME>
---
apiVersion: v1
kind: Service
......
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