diff --git a/.github/workflows/update-data-daily.yml b/.github/workflows/update-data-daily.yml index e2c5ef3c..1809fb63 100644 --- a/.github/workflows/update-data-daily.yml +++ b/.github/workflows/update-data-daily.yml @@ -44,10 +44,3 @@ jobs: run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} -o ServerAliveInterval=120 "cd ${APP_DIR} && source venv/bin/activate && flask compute-metrics all" - name: Verify data run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "cd ${APP_DIR} && source venv/bin/activate && flask verify-data" - - name: Azure scale down VM - uses: azure/cli@v2 - with: - inlineScript: | - az vm deallocate --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME} - az vm resize --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME} --size Standard_B2s - az vm start --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME} diff --git a/.github/workflows/update-web.yml b/.github/workflows/update-web.yml index e0bde306..fba2a494 100644 --- a/.github/workflows/update-web.yml +++ b/.github/workflows/update-web.yml @@ -22,6 +22,9 @@ jobs: SSH_KEY: ${{ secrets.SSH_KEY }} SSH_PORT: ${{ secrets.SSH_PORT }} SSH_USER_WEB: ${{ secrets.SSH_USER_WEB }} + AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} + AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }} + AZURE_VM_NAME: ${{ secrets.AZURE_VM_NAME }} steps: - name: Setup SSH key run: | @@ -30,7 +33,18 @@ jobs: eval `ssh-agent -s` echo "${SSH_KEY}" | tr -d '\r' | ssh-add - echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV + - name: Azure login + uses: azure/login@v2 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Check if webserver is running run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "systemctl status ockovani-prd.service" - name: Create static pages run: ssh ${SSH_USER_WEB}@${SSH_HOST} -p ${SSH_PORT} "bash ${APP_DIR}/scripts/create_static_pages.sh" + - name: Azure scale down VM + uses: azure/cli@v2 + with: + inlineScript: | + az vm deallocate --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME} + az vm resize --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME} --size Standard_B2s + az vm start --resource-group ${AZURE_RESOURCE_GROUP} --name ${AZURE_VM_NAME}