Commit 361fcec9 by Chif Gergő

Add staging deployment stage to CI pipeline

parent 915ac7b4
Pipeline #1258 failed in 0 seconds
...@@ -12,7 +12,7 @@ DJANGO_SETTINGS_MODULE=myproject.settings.local ...@@ -12,7 +12,7 @@ DJANGO_SETTINGS_MODULE=myproject.settings.local
DATABASE_PASSWORD=database_password DATABASE_PASSWORD=database_password
DATABASE_USER=user DATABASE_USER=user
DATABASE_NAME=user DATABASE_NAME=user
DATABASE_HOST=hostname_of_batabase DATABASE_HOST=hostname_of_database
# For channels communication and periodic tasks we need a redis server # For channels communication and periodic tasks we need a redis server
REDIS_HOST=redis_host REDIS_HOST=redis_host
......
...@@ -6,16 +6,45 @@ before_script: ...@@ -6,16 +6,45 @@ before_script:
- git submodule sync --recursive - git submodule sync --recursive
- git submodule update --init --recursive - git submodule update --init --recursive
stages:
- testing
- build
- deploy
flake8: flake8:
stage:
- testing
script: script:
- python3.6 -m pip install flake8 - python3.6 -m pip install flake8
- flake8 - flake8
build-local: test:
stage:
- testing
script: script:
- docker build --tag recircle-backend:1.0 . - docker build --tag recircle-backend-local:latest .
- docker run recircle-backend-local:latest pipenv run python manage.py test
test: build_prod_image:
stage:
- build
script: script:
- docker build --tag recircle-backend:1.0 . - docker build ./Dockerfile.prod --tag recircle-backend:latest
- docker run recircle-backend:1.0 pipenv run python manage.py test
# deploy needs sshpass installed on gitlab runner machince
deploy_staging:
stage:
- deploy
script: # When the docker registry ready, pull images from it
- sshpass -p "$STAGING_SSH_PASS" ssh -o StrictHostKeyChecking=no cloud@vm.niif.cloud.bme.hu -p 17668
- git pull https://git.ik.bme.hu/RECIRCLE/portal.git DEV
- git git submodule update --init --recursive
- docker-compose up -f docker-compose.prod.yml
- exit
environment:
name: staging
url: http://vm.niif.cloud.bme.hu:20088
only:
- dockerization
- DEV
- master
#!/bin/bash #!/bin/bash
## This file used by the gitlab ci runner
## Reads the environment variables from the CI config then echoes it to the .env file
# This variables are interpreted automatically by the Docker Engine # This variables are interpreted automatically by the Docker Engine
# And by the Django runtime # And by the Django runtime
# Django configuration # Django configuration
......
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 sign in to comment