Commit f09d816f authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

Start on deploy scripts

parent 80fae372
......@@ -59,7 +59,7 @@ test_web_backend_database:
- cd src/backend
- vendor/bin/phpunit --testsuite Database
deploy_production:
deploy_backend_production:
stage: deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
......@@ -68,10 +68,37 @@ deploy_production:
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- SSH_COMMAND_STRING=""
- SSH_COMMAND_STRING="cd doorcode && bin/deploy-update.sh"
- echo "$SSH_COMMAND_STRING"
# Execute the deploy
- ssh $SSH_USER@$SSH_HOST "${SSH_COMMAND_STRING}"
# Make sure it is running
- "curl --insecure --location https://${SSH_HOST}/api/me | grep \"Unauthenticated\""
environment:
name: production
url: http://elock.cs.wallawalla.edu
url: https://elock.cs.wallawalla.edu/api
when: manual
only:
- 55-create-deploy-server
deploy_frontend_production:
stage: deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d -w 0)
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- "SSH_COMMAND_STRING=\"curl --location --header 'PRIVATE-TOKEN: ${CI_JOB_TOKEN}' '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_BUILD_REF_NAME}/download?job=build_web_frontend' --output test\""
- echo "$SSH_COMMAND_STRING"
# Execute the deploy
- ssh $SSH_USER@$SSH_HOST "${SSH_COMMAND_STRING}"
# Make sure it is running
- "curl --insecure --location https://${SSH_HOST} | grep \"Doorcode\""
environment:
name: production
url: https://elock.cs.wallawalla.edu
when: manual
only:
- 55-create-deploy-server
......@@ -4,6 +4,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "${DIR}/.." || exit 1
docker-compose stop webserver || exit 1
git pull || exit 1
docker-compose -f "${DIR}/../docker-compose.yml" exec api ./install-prod.sh || exit 1
docker-compose exec api ./install-prod.sh || exit 1
docker-compose up -d || exit 1
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