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

Implement deployment to staging

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