Skip to content

Commit 58b913d

Browse files
committed
deploy(ci): use API image for public editor app and add health smoke test
1 parent b0fd26c commit 58b913d

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.github/workflows/docker-deploy.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ jobs:
7373
- name: Deploy editor to App Service (container)
7474
if: ${{ steps.check-secrets.outputs.deploy_ready == 'true' }}
7575
run: |
76-
az webapp config container set --name ${{ secrets.EDITOR_APP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --docker-custom-image-name ${{ needs.build-and-push.outputs.registry }}/app-scripting-editor:latest
76+
# Deploy the API image to the public editor App Service so the same hostname serves the SPA and the /api endpoints.
77+
az webapp config container set --name ${{ secrets.EDITOR_APP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --docker-custom-image-name ${{ needs.build-and-push.outputs.registry }}/app-scripting-editor-api:latest
78+
79+
- name: Set WEBSITES_PORT for editor (public) app
80+
if: ${{ steps.check-secrets.outputs.deploy_ready == 'true' }}
81+
run: |
82+
echo "Setting WEBSITES_PORT=4000 for ${{ secrets.EDITOR_APP_NAME }}"
83+
az webapp config appsettings set --name ${{ secrets.EDITOR_APP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --settings WEBSITES_PORT=4000
7784
7885
- name: Deploy editor-api to App Service (container)
7986
if: ${{ steps.check-secrets.outputs.deploy_ready == 'true' }}
@@ -103,3 +110,21 @@ jobs:
103110
echo "ERROR: editor-api did not become healthy"
104111
az webapp log tail --name ${{ secrets.EDITOR_API_APP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} &
105112
exit 1
113+
114+
- name: Smoke test public editor app
115+
if: ${{ steps.check-secrets.outputs.deploy_ready == 'true' }}
116+
run: |
117+
host=$(az webapp show --name ${{ secrets.EDITOR_APP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --query defaultHostName -o tsv)
118+
echo "Testing https://$host/api/health"
119+
for i in 1 2 3 4 5 6 7 8 9 10; do
120+
status=$(curl -s -o /dev/null -w "%{http_code}" "https://$host/api/health" || echo "000")
121+
if [ "$status" = "200" ]; then
122+
echo "OK: public editor health returned 200"
123+
exit 0
124+
fi
125+
echo "Attempt $i: status=$status; retrying in 5s..."
126+
sleep 5
127+
done
128+
echo "ERROR: public editor did not become healthy"
129+
az webapp log tail --name ${{ secrets.EDITOR_APP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} &
130+
exit 1

0 commit comments

Comments
 (0)