Skip to content
Snippets Groups Projects
Commit ac4193a3 authored by Christian Boettcher's avatar Christian Boettcher
Browse files

remov eneeds, as deployment can change

only redeploy openstack instance if triggered manually,
else only restart docker-compose
parent 6885400b
No related branches found
No related tags found
1 merge request!5Merge CI/CD changes
...@@ -24,7 +24,6 @@ test: ...@@ -24,7 +24,6 @@ test:
deploy-sites: deploy-sites:
cache: {} cache: {}
stage: deploy stage: deploy
needs: ["test"]
script: script:
- pip install -r requirements.txt - pip install -r requirements.txt
- python frontend/createStatic.py -u "https://datacatalog.fz-juelich.de/" - python frontend/createStatic.py -u "https://datacatalog.fz-juelich.de/"
...@@ -36,13 +35,35 @@ deploy-sites: ...@@ -36,13 +35,35 @@ deploy-sites:
paths: paths:
- public - public
deploy-production:
light-deploy-testing:
stage: deploy
# only run when master is updated, unless the pipeline was triggered via the web UI
only:
- master
except:
- tags
- web
environment: Testing
variables:
OS_AUTH_TYPE: v3applicationcredential
OS_AUTH_URL: https://hdf-cloud.fz-juelich.de:5000
OS_IDENTITY_API_VERSION: 3
OS_REGION_NAME: "HDFCloud"
OS_INTERFACE: public
TESTING_URL: https://zam10036.zam.kfa-juelich.de/
TESTING_DOMAIN: zam10036.zam.kfa-juelich.de
script:
# TODO insert private key in gitlab
- ssh apiserver@$TESTING_DOMAIN 'export API_URL=https://zam10036.zam.kfa-juelich.de/ && export SERVER_DOMAIN=zam10036.zam.kfa-juelich.de && sudo /bin/bash /home/apiserver/datacatalog/deploy_scripts/deployment.sh /home/apiserver/datacatalog'
full-deploy-production:
stage: deploy stage: deploy
# only run when stable tag is assigned # only run when stable tag is assigned and the pipeline is triggered in the web UI
only: only:
- tags - tags
- web
tags: [stable] tags: [stable]
needs: ["tag_release"]
environment: Production environment: Production
variables: variables:
OS_AUTH_TYPE: v3applicationcredential OS_AUTH_TYPE: v3applicationcredential
...@@ -52,28 +73,30 @@ deploy-production: ...@@ -52,28 +73,30 @@ deploy-production:
OS_INTERFACE: public OS_INTERFACE: public
PRODUCTION_URL: https://datacatalog.fz-juelich.de/ PRODUCTION_URL: https://datacatalog.fz-juelich.de/
PRODUCTION_DOMAIN: datacatalog.fz-juelich.de PRODUCTION_DOMAIN: datacatalog.fz-juelich.de
VOLUME_ID: 07a93071-5be7-4cc0-8ff3-cb34e7ed2b80
FLOATING_IP: 134.94.199.59
script: script:
- echo "Doing nothing for now. This will become a production deployment." - echo "Starting the full production deployment."
- sed -i 's_/app/mnt/data_/app/mnt && mount /dev/vdb1 /app/mnt_g' deploy_scripts/cloudinit.yml - sed -i 's_datacatalog.fz_zam10036.zam.kfa_g' deploy_scripts/cloudinit.yml
- pip install python-openstackclient - pip install python-openstackclient
- openstack image list - OLD_ID=`openstack server show testing-deployment -f value -c id`
# - openstack server create --flavor s1 --image 149a65b5-aeb8-499f-aaa6-ec966bd28dd6 pipeline-inst # TODO create snapshot copy of old instance
# - reassign floating ip - openstack server remove floating ip $OLD_ID $FLOATING_IP
# - login on the new instance pipeline-inst - openstack server remove volume $OLD_ID $VOLUME_ID
# - sudo docker network create net #net is the docker internal network.. put it in a Variable? - INSTANCE_ID=`openstack server create -f value -c id --prefix IMAGE_ --flavor s2 --image 149a65b5-aeb8-499f-aaa6-ec966bd28dd6 --user-data deploy_scripts/cloudinit.yml --security-group ssh --security-group www --security-group https testing-deployment`
# - sudo docker-compose up -d - while [ "`openstack server show $INSTANCE_ID -c addresses -f value`" = "{}" ]; do sleep 5; done # wait until an address is available to attach the floating ip
# - docker build --no-cache=true --pull -f ./apiserver/Dockerfile -t api-test . #pull from $CI_REGISTRY - openstack server add floating ip $INSTANCE_ID $FLOATING_IP
# - sudo docker run --name api-test-cloud --network net -e VIRTUAL_HOST="zam10028.zam.kfa-juelich.de" -e LETSENCRYPT_HOST="zam10028.zam.kfa-juelich.de" -d api-test - openstack server add volume $INSTANCE_ID $VOLUME_ID
# - openstack server destroy pipeline-inst #old - openstack server delete $OLD_ID
deploy-testing: full-deploy-testing:
stage: deploy stage: deploy
# only run when master is updated # only run when master is updated and the pipeline is triggered in the web UI
only: only:
- master - master
- web
except: except:
- tags - tags
needs: ["transfer_image"]
environment: Testing environment: Testing
variables: variables:
OS_AUTH_TYPE: v3applicationcredential OS_AUTH_TYPE: v3applicationcredential
...@@ -83,20 +106,16 @@ deploy-testing: ...@@ -83,20 +106,16 @@ deploy-testing:
OS_INTERFACE: public OS_INTERFACE: public
TESTING_URL: https://zam10036.zam.kfa-juelich.de/ TESTING_URL: https://zam10036.zam.kfa-juelich.de/
TESTING_DOMAIN: zam10036.zam.kfa-juelich.de TESTING_DOMAIN: zam10036.zam.kfa-juelich.de
VOLUME_ID: 07a93071-5be7-4cc0-8ff3-cb34e7ed2b80
FLOATING_IP: 134.94.199.36 FLOATING_IP: 134.94.199.36
script: script:
- echo "Starting the testing deployment." - echo "Starting the full testing deployment."
- sed -i 's_datacatalog.fz_zam10036.zam.kfa_g' deploy_scripts/cloudinit.yml - sed -i 's_datacatalog.fz_zam10036.zam.kfa_g' deploy_scripts/cloudinit.yml
- pip install python-openstackclient - pip install python-openstackclient
- OLD_ID=`openstack server show testing-deployment -f value -c id` - OLD_ID=`openstack server show testing-deployment -f value -c id`
# TODO create snapshot copy of old instance
- openstack server remove floating ip $OLD_ID $FLOATING_IP - openstack server remove floating ip $OLD_ID $FLOATING_IP
# NO VOLUME IN TESTING DEPLOYMENT - openstack server remove volume $OLD_ID $VOLUME_ID
- INSTANCE_ID=`openstack server create -f value -c id --prefix IMAGE_ --flavor s2 --image 149a65b5-aeb8-499f-aaa6-ec966bd28dd6 --user-data deploy_scripts/cloudinit.yml --security-group ssh --security-group www --security-group https testing-deployment` - INSTANCE_ID=`openstack server create -f value -c id --prefix IMAGE_ --flavor s2 --image 149a65b5-aeb8-499f-aaa6-ec966bd28dd6 --user-data deploy_scripts/cloudinit.yml --security-group ssh --security-group www --security-group https testing-deployment`
- while [ "`openstack server show $INSTANCE_ID -c addresses -f value`" = "{}" ]; do sleep 5; done # wait until an address is available to attach the floating ip - while [ "`openstack server show $INSTANCE_ID -c addresses -f value`" = "{}" ]; do sleep 5; done # wait until an address is available to attach the floating ip
- openstack server add floating ip $INSTANCE_ID $FLOATING_IP - openstack server add floating ip $INSTANCE_ID $FLOATING_IP
# NO VOLUME IN TESTING DEPLOYMENT - openstack server add volume $INSTANCE_ID $VOLUME_ID
- openstack server delete $OLD_ID - openstack server delete $OLD_ID
...@@ -107,7 +126,6 @@ test-testing: ...@@ -107,7 +126,6 @@ test-testing:
- master - master
except: except:
- tags - tags
needs: ["deploy-testing"]
variables: variables:
TESTING_URL: https://zam10036.zam.kfa-juelich.de/ TESTING_URL: https://zam10036.zam.kfa-juelich.de/
script: script:
...@@ -122,7 +140,6 @@ test-production: ...@@ -122,7 +140,6 @@ test-production:
only: only:
- tags - tags
tags: [stable] tags: [stable]
needs: ["deploy-production"]
environment: Production environment: Production
variables: variables:
PRODUCTION_URL: https://datacatalog.fz-juelich.de/ PRODUCTION_URL: https://datacatalog.fz-juelich.de/
...@@ -135,7 +152,6 @@ test-production: ...@@ -135,7 +152,6 @@ test-production:
publishgit-do: publishgit-do:
image: python:3-slim image: python:3-slim
stage: publish stage: publish
needs: ["test"]
only: only:
- tags - tags
tags: [stable] tags: [stable]
...@@ -152,7 +168,6 @@ publishgit-do: ...@@ -152,7 +168,6 @@ publishgit-do:
# This is an automatic push of the docker image into gitLab container repository # This is an automatic push of the docker image into gitLab container repository
transfer_image: transfer_image:
stage: build stage: build
needs: ["test"]
image: docker:latest image: docker:latest
services: services:
- docker:dind - docker:dind
...@@ -168,7 +183,6 @@ transfer_image: ...@@ -168,7 +183,6 @@ transfer_image:
tag_release: tag_release:
stage: publish stage: publish
needs: ["transfer_image"]
image: docker:latest image: docker:latest
services: services:
- docker:dind - docker:dind
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment