-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a dev server for the pr-deploy branch
N.B. this uses the regular dev postgres database
- Loading branch information
Showing
1 changed file
with
14 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,11 +46,11 @@ jobs: | |
deploy_dev: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/develop' | ||
if: github.ref == 'refs/heads/pr-deploy' | ||
env: | ||
DOCKER_BUILDKIT: '1' | ||
TAG: ${{ github.sha }} | ||
STAGE: dev | ||
STAGE: dev-tmp-pr-deploy | ||
NAME: iati-website | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
@@ -106,6 +106,7 @@ jobs: | |
with: | ||
azcliversion: 2.30.0 | ||
inlineScript: | | ||
set -eux | ||
az vm create \ | ||
--resource-group "${{ env.STAGE }}-${{ env.NAME }}-${{ env.NEW_COLOUR }}" \ | ||
--name "${{ env.STAGE }}-${{ env.NAME }}-${{ env.NEW_COLOUR }}" \ | ||
|
@@ -114,7 +115,7 @@ jobs: | |
--ssh-key-values ${{ secrets.DEV_PUB_KEYS }} && \ | ||
export NEW_IP=$(az vm list-ip-addresses --name "${{ env.STAGE }}-${{ env.NAME }}-${{ env.NEW_COLOUR }}" --resource-group "${{ env.STAGE }}-${{ env.NAME }}-${{ env.NEW_COLOUR }}" --query [].virtualMachine.network[].publicIpAddresses[][].ipAddress --output tsv) && \ | ||
echo "NEW_IP=$NEW_IP" >> $GITHUB_ENV && \ | ||
az postgres server firewall-rule update \ | ||
az postgres server firewall-rule create \ | ||
--resource-group "${{ secrets.DEV_PSQL_RESOURCE_GROUP }}" \ | ||
--server-name "${{ secrets.DEV_PSQL_NAME }}" \ | ||
--name "${{ env.STAGE }}-${{ env.NAME }}-${{ env.NEW_COLOUR }}" \ | ||
|
@@ -231,16 +232,16 @@ jobs: | |
echo "Failure" | ||
exit 1 | ||
fi | ||
- if: steps.new_has_succeeded.outcome == 'success' | ||
name: "Update NGINX VM backend" | ||
env: | ||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | ||
run: | | ||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null && \ | ||
ssh-add - <<< "${{ secrets.DEV_NGINX_KEY }}" && \ | ||
sed -i 's/XX.XX.XX.XX/'${{ env.NEW_IP }}'/g' config/nginx/website_dev.conf && \ | ||
scp -o StrictHostKeyChecking=no config/nginx/website_dev.conf azureuser@${{ secrets.DEV_NGINX_IP }}:/etc/nginx/conf.d/website.conf && \ | ||
ssh -o StrictHostKeyChecking=no azureuser@${{ secrets.DEV_NGINX_IP }} /home/azureuser/restart_nginx.sh | ||
#- if: steps.new_has_succeeded.outcome == 'success' | ||
# name: "Update NGINX VM backend" | ||
# env: | ||
# SSH_AUTH_SOCK: /tmp/ssh_agent.sock | ||
# run: | | ||
# ssh-agent -a $SSH_AUTH_SOCK > /dev/null && \ | ||
# ssh-add - <<< "${{ secrets.DEV_NGINX_KEY }}" && \ | ||
# sed -i 's/XX.XX.XX.XX/'${{ env.NEW_IP }}'/g' config/nginx/website_dev.conf && \ | ||
# scp -o StrictHostKeyChecking=no config/nginx/website_dev.conf azureuser@${{ secrets.DEV_NGINX_IP }}:/etc/nginx/conf.d/website.conf && \ | ||
# ssh -o StrictHostKeyChecking=no azureuser@${{ secrets.DEV_NGINX_IP }} /home/azureuser/restart_nginx.sh | ||
- if: steps.new_has_succeeded.outcome == 'success' | ||
name: "Delete previous VM resource group" | ||
uses: "azure/[email protected]" | ||
|