Skip to content

Commit

Permalink
Create a dev server specifically for this feature branch
Browse files Browse the repository at this point in the history
N.B. this uses the regular dev postgres database
  • Loading branch information
Bjwebb committed Feb 21, 2024
1 parent c0f7392 commit 019db1e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
# but only for the master/develop branches
push:
branches:
- master
- develop
- feature/update-server-os-dev-deploy
pull_request:
branches:
- master
Expand Down Expand Up @@ -57,11 +56,11 @@ jobs:
deploy_dev:
needs: [build]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
if: github.ref == 'refs/heads/feature/update-server-os-dev-deploy'
env:
DOCKER_BUILDKIT: '1'
TAG: ${{ github.sha }}
STAGE: dev
STAGE: dev-feature-update-server-os
NAME: iati-website
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -113,6 +112,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 }}" \
Expand All @@ -121,7 +121,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 }}" \
Expand Down Expand Up @@ -238,16 +238,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]"
Expand Down

0 comments on commit 019db1e

Please sign in to comment.