Commit a088af1d authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg

Add gitlab and kubernetes deploy scripts.

parent be165927
image: registry.uninett.no/system/kubernetes-deploy:v0.13
variables:
KUBE_PROD_DOMAIN: play.oauth.no # The main domain for your application.
KUBE_TEST_DOMAIN: play-oauth.paas2.uninett.no # A domain which test versions of your application can be launched under.
KUBE_REVIEW_DOMAIN: play-oauth-review.paas2.uninett.no # A domain which review versions of your application can be launched under.
HTTP_PORT: '8080' # The port number of the web server.
REPLICAS: '1'
stages:
- build
- test
- review
- staging
- production
build:
stage: build
script:
- build
only:
- branches
production:
stage: production
variables:
CI_ENVIRONMENT_URL: https://$KUBE_PROD_DOMAIN
REPLICAS: '2'
script:
- deploy kubernetes/deployment.yaml
environment:
name: production
url: https://$KUBE_PROD_DOMAIN
when: manual
only:
- master
staging:
stage: staging
variables:
CI_ENVIRONMENT_URL: https://$KUBE_TEST_DOMAIN
script:
- deploy kubernetes/deployment.yaml
environment:
name: staging
url: https://$KUBE_TEST_DOMAIN
only:
- master
review:
stage: review
variables:
CI_ENVIRONMENT_URL: https://$KUBE_REVIEW_DOMAIN
script:
- deploy kubernetes/deployment.yaml
environment:
name: review/$CI_BUILD_REF_NAME
url: https://$KUBE_REVIEW_DOMAIN
on_stop: stop_review
only:
- branches
except:
- master
stop_review:
stage: review
variables:
GIT_STRATEGY: none
script:
- destroy
environment:
name: review/$CI_BUILD_REF_NAME
action: stop
when: manual
only:
- branches
except:
- master
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: $CI_ENVIRONMENT_SLUG
namespace: $KUBE_NAMESPACE
labels:
app: $CI_ENVIRONMENT_SLUG
pipeline_id: "$CI_PIPELINE_ID"
build_id: "$CI_BUILD_ID"
spec:
replicas: $REPLICAS
template:
metadata:
labels:
name: $CI_ENVIRONMENT_SLUG
app: $CI_ENVIRONMENT_SLUG
spec:
containers:
- name: app
image: $CI_REGISTRY_IMAGE:$CI_REGISTRY_TAG
imagePullPolicy: Always
ports:
- containerPort: ${HTTP_PORT}
name: web
env:
- name: OIC_REDIRECT_URI
value: ${CI_ENVIRONMENT_URL}/
- name: NODE_ENV
value: 'production'
livenessProbe:
httpGet:
path: /
port: $HTTP_PORT
initialDelaySeconds: 15
timeoutSeconds: 15
readinessProbe:
httpGet:
path: /
port: $HTTP_PORT
initialDelaySeconds: 5
timeoutSeconds: 15
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