Fakultas Ilmu Komputer UI

Verified Commit 038c9eec authored by Muhammad Ariq Basyar's avatar Muhammad Ariq Basyar
Browse files

[REFACTOR] custom deployment to private server

- removed variables and unnecessary postgres service (relates to commit 6e6c5ec6)
parent e659f0f0
Pipeline #64588 failed
variables:
POSTGRES_DB: $DB_NAME
POSTGRES_USER: $DB_USER
POSTGRES_PASSWORD: $DB_PASSWORD
POSTGRES_HOST_AUTH_METHOD: $DB_HOST_AUTH_METHOD
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME: $AWS_STORAGE_BUCKET_NAME
services:
- postgres:12.2-alpine
stages:
- test
- linter
- sonarqube
- staging
- production
- deployment
UnitTest:
image: python:3.7
......@@ -43,7 +30,8 @@ Pylint:
- pip install -r requirements.txt
when: on_success
script:
- pylint --load-plugins pylint_django --rcfile=./.pylintrc informasi_fasilitas layanan_khusus new_rest_api oauth registrasi
- pylint --load-plugins pylint_django --rcfile=./.pylintrc \
informasi_fasilitas layanan_khusus new_rest_api oauth registrasi
SonarScanner:
image:
......@@ -57,30 +45,13 @@ SonarScanner:
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
-Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
Staging:
image: ruby:2.4
stage: staging
only:
refs:
- staging
before_script:
- gem install dpl
- wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh
script:
- dpl --provider=heroku --app=$HEROKU_APPNAME_STAGING --api-key=$HEROKU_APIKEY
- export HEROKU_API_KEY=$HEROKU_APIKEY
- heroku run --app $HEROKU_APPNAME_STAGING migrate
environment:
name: staging
url: $HEROKU_APP_HOST_STAGING
Deployment:
image: ruby:2.4
stage: production
stage: deployment
only:
refs:
- master
- staging
- development
before_script:
- apt-get update -qq
- apt-get install -qq git
......@@ -88,16 +59,10 @@ Deployment:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d)
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
script:
- >
ssh $TARGET_USER_AT_HOST
"cd bisago-be &&
git checkout master &&
git pull origin master &&
bash stop.sh &&
bash start.sh &&
exit"
- result=$(ssh $TARGET "bash deployment/reload.sh $CI_COMMIT_REF_NAME")
- echo "$result"
- [ '$(echo "$result" | tail -n 1)' != "success" ] && exit 1
environment:
name: production
url: $HEROKU_APP_HOST
\ No newline at end of file
name: deployment
Supports Markdown
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