@@ -57,14 +57,114 @@ azd-login: ## 🔑 Login to Azure with azd and a SPN
5757 @echo -e " \e[34m$@ \e[0m" || true
5858 @azd auth login --client-id ${AZURE_CLIENT_ID} --client-secret ${AZURE_CLIENT_SECRET} --tenant-id ${AZURE_TENANT_ID}
5959
60- deploy : azd-login # # 🚀 Deploy everything to Azure
60+ azd-login : # # 🔑 Login to Azure with azd and a SPN
61+ @echo -e " \e[34m$@ \e[0m" || true
62+ @azd auth login --client-id ${AZURE_CLIENT_ID} --client-secret ${AZURE_CLIENT_SECRET} --tenant-id ${AZURE_TENANT_ID}
63+
64+ # Fixed Makefile section for deploy target
65+ # Fixed Makefile section for deploy target
66+ deploy : azd-login # # Deploy everything to Azure
6167 @echo -e " \e[34m$@ \e[0m" || true
6268 @azd env new ${AZURE_ENV_NAME}
63- @azd env set AZURE_APP_SERVICE_HOSTING_MODEL code --no-prompt
69+
70+ # Provision and deploy
6471 @azd provision --no-prompt
65- @azd deploy web --no-prompt
66- @azd deploy function --no-prompt
72+ @azd deploy web --no-prompt || true
73+ @azd deploy function --no-prompt || true
6774 @azd deploy adminweb --no-prompt
75+ @azd env get-values > .env.temp
76+ @cat .env.temp
77+
78+ @sleep 30
79+ @azd show --output json > deploy_output.json || echo "{}" > deploy_output.json
80+ @echo "=== deploy_output.json contents ==="
81+ @cat deploy_output.json | jq . || cat deploy_output.json
82+
83+ # Extract URLs
84+ @echo "=== Extracting URLs using multiple methods ==="
85+ @azd show 2>&1 | tee full_deployment_output.log
86+ @jq -r '.services.web?.project?.hostedEndpoints?[0]?.url // ""' deploy_output.json > frontend_url.txt || echo "" > frontend_url.txt
87+ @jq -r '.services.adminweb?.project?.hostedEndpoints?[0]?.url // ""' deploy_output.json > admin_url.txt || echo "" > admin_url.txt
88+ @grep -oE "https://app-[a-zA-Z0-9-]*\.azurewebsites\.net/" full_deployment_output.log | grep -v admin | head -1 >> frontend_url.txt || true
89+ @grep -oE "https://app-[a-zA-Z0-9-]*-admin\.azurewebsites\.net/" full_deployment_output.log | head -1 >> admin_url.txt || true
90+ @sort frontend_url.txt | uniq | grep -v '^$$' | head -1 > frontend_url_clean.txt && mv frontend_url_clean.txt frontend_url.txt || echo "" > frontend_url.txt
91+ @sort admin_url.txt | uniq | grep -v '^$$' | head -1 > admin_url_clean.txt && mv admin_url_clean.txt admin_url.txt || echo "" > admin_url.txt
92+
93+ @echo "=== URL Extraction Results ==="
94+ @FRONTEND_URL=$$(cat frontend_url.txt 2>/dev/null | tr -d '\n\r' | xargs); \
95+ ADMIN_URL=$$(cat admin_url.txt 2>/dev/null | tr -d '\n\r' | xargs); \
96+ echo "Frontend URL: $$FRONTEND_URL"; \
97+ echo "Admin URL: $$ADMIN_URL"
98+
99+ @echo "=== Final Deployment Status ==="
100+ @echo "Frontend URL:" && cat frontend_url.txt || echo "Not available"
101+ @echo "Admin URL:" && cat admin_url.txt || echo "Not available"
102+ @echo ""
103+ @echo "🚀 Deployment completed!"
104+ @echo "⏰ Authentication will be disabled via GitHub Actions pipeline."
105+ @echo "🔄 Check the pipeline logs for authentication disable status."
106+ @echo "=== Extracting PostgreSQL Host Endpoint ==="
107+ @azd env get-values > .env.temp 2>/dev/null || echo "" > .env.temp
108+
109+ @PG_HOST_VAL=$$(grep '^AZURE_POSTGRESQL_HOST_NAME=' .env.temp | cut -d'=' -f2 | tr -d '"' | xargs); \
110+ if [ -z "$$PG_HOST_VAL" ]; then \
111+ echo "❌ PostgreSQL host not found in .env.temp. Using fallback localhost"; \
112+ PG_HOST_VAL="localhost"; \
113+ else \
114+ echo "✅ PostgreSQL host extracted from .env.temp: $$PG_HOST_VAL"; \
115+ fi; \
116+ echo "$$PG_HOST_VAL" > pg_host.txt
117+
118+
119+
120+
121+
122+ @echo "=== PostgreSQL Configuration ==="
123+ @echo "Username: admintest (hardcoded)"
124+ @echo "Database: postgres (hardcoded)"
125+ @echo "Port: 5432 (hardcoded)"
126+ @echo "Host: $$(cat pg_host.txt 2>/dev/null || echo 'Not available')"
127+ @echo "Password: Initial_0524 (hardcoded)"
128+
129+ # Helper target to check current authentication status
130+ check-auth :
131+ @echo " === Checking Authentication Status ==="
132+ @FRONTEND_URL=$$(cat frontend_url.txt 2>/dev/null | tr -d '\n\r' | xargs ) ; \
133+ ADMIN_URL=$$(cat admin_url.txt 2>/dev/null | tr -d '\n\r' | xargs ) ; \
134+ if [ -n " $$ FRONTEND_URL" ]; then \
135+ echo " Testing Frontend: $$ FRONTEND_URL" ; \
136+ HTTP_CODE=$$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 "$$FRONTEND_URL" 2>/dev/null || echo "000" ) ; \
137+ echo " Frontend HTTP Status: $$ HTTP_CODE" ; \
138+ fi ; \
139+ if [ -n " $$ ADMIN_URL" ]; then \
140+ echo " Testing Admin: $$ ADMIN_URL" ; \
141+ HTTP_CODE=$$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 "$$ADMIN_URL" 2>/dev/null || echo "000" ) ; \
142+ echo " Admin HTTP Status: $$ HTTP_CODE" ; \
143+ fi
144+
145+ # Helper target to manually disable authentication (for debugging)
146+ disable-auth-manual :
147+ @echo " === Manually Disabling Authentication ==="
148+ @echo " This target requires Azure CLI to be logged in manually"
149+ @FRONTEND_URL=$$(cat frontend_url.txt 2>/dev/null | tr -d '\n\r' | xargs ) ; \
150+ ADMIN_URL=$$(cat admin_url.txt 2>/dev/null | tr -d '\n\r' | xargs ) ; \
151+ export FRONTEND_WEBSITE_URL=" $$ FRONTEND_URL" ; \
152+ export ADMIN_WEBSITE_URL=" $$ ADMIN_URL" ; \
153+ if [ -f " disable_auth.sh" ]; then \
154+ chmod +x disable_auth.sh && ./disable_auth.sh; \
155+ else \
156+ echo " ERROR: disable_auth.sh not found" ; \
157+ exit 1; \
158+ fi
159+
160+ disable-auth-fixed :
161+ @echo " === Using Fixed Authentication Disable Script ==="
162+ @if [ -f " disable_auth_fixed.sh" ]; then \
163+ chmod +x disable_auth_fixed.sh && ./disable_auth_fixed.sh; \
164+ else \
165+ echo " ERROR: disable_auth_fixed.sh not found" ; \
166+ exit 1; \
167+ fi
68168
69169destroy : azd-login # # 🧨 Destroy everything in Azure
70170 @echo -e " \e[34m$@ \e[0m" || true
0 commit comments