-
Notifications
You must be signed in to change notification settings - Fork 81
feat(webapp): custom domain support, social graph assets & hardened sync prompt #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
webmaxru
wants to merge
32
commits into
microsoft:main
Choose a base branch
from
webmaxru:webapp-custom-domain
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
ac92f14
feat: add support for custom domain and managed certificate in deploy…
webmaxru 98cc3b9
feat: add user-assigned managed identity for ACR pull and update role…
webmaxru 8620d10
feat: add favicon assets and generation script
webmaxru bd2e967
Refactor code structure for improved readability and maintainability
webmaxru a77e8fe
feat: add support for custom domain configuration and ACR admin crede…
webmaxru f267f90
feat: update Open Graph and Twitter Card meta tags to support dynamic…
webmaxru 26d42fe
feat: enhance custom domain handling with validation and dynamic site…
webmaxru c756d33
fix: correct frontend directory path in Dockerfile
webmaxru b6fb117
Update webapp/backend/src/server.js
webmaxru 4dc269c
Update infra/webapp/main.bicep
webmaxru 2390cab
Update webapp/backend/src/server.js
webmaxru 9bad285
test: add progress spinner tests and fix CSS hidden attribute override
webmaxru 6bd5b21
Update webapp/backend/src/server.js
webmaxru b5a497e
Update webapp/backend/tests/routes.test.js
webmaxru c6b755f
fix: update custom domain condition to check for DNS verification rea…
webmaxru c865eef
fix: handle comma-separated host headers in createApp function
webmaxru 7f6b6ca
fix: align runtime.port with actual ephemeral port for correct URL re…
webmaxru c5b3158
Update webapp/backend/src/server.js
webmaxru 032d1a3
fix: enable cross-origin access to static assets for social media cra…
webmaxru 633ff6f
Merge branch 'webapp-custom-domain' of https://github.com/webmaxru/ag…
webmaxru 3a7e63c
Update webapp/.env.example
webmaxru 8a3be6b
fix: update root route to serve index.html and prevent direct serving…
webmaxru f464041
Merge branch 'webapp-custom-domain' of https://github.com/webmaxru/ag…
webmaxru 0f8f160
fix: update Open Graph image for improved social media sharing
webmaxru 9dd8e1b
Update webapp/backend/src/server.js
webmaxru 3956c9a
Update infra/webapp/main.bicep
webmaxru 629cebb
feat: add deployment instructions for webapp and update test environm…
webmaxru a2b6a0d
docs: update local webapp setup instructions for clarity and synchron…
webmaxru 4b5e233
chore: remove .github instruction files to unblock fork PR eval
webmaxru ca78797
Update .github/workflows/webapp-cd.yml
webmaxru bccaf10
refactor: improve server closure handling in API route tests
webmaxru e95975d
Merge branch 'webapp-custom-domain' of https://github.com/webmaxru/ag…
webmaxru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| description: "Global rules for the agentrc project." | ||
| --- | ||
|
|
||
| # Global Copilot Instructions | ||
|
|
||
| ## Webapp Deployment Instructions — Auto-Update Rule | ||
|
|
||
| Whenever you modify any file matching the patterns below, review `.github/instructions/webapp-deploy.instructions.md` and update it if the change affects deployment behavior: | ||
|
|
||
| - `webapp/**` — frontend or backend code, dependencies, config | ||
| - `Dockerfile.webapp` — container build instructions | ||
| - `infra/webapp/**` — Bicep infrastructure templates | ||
| - `packages/core/src/**` — shared library bundled into the backend | ||
|
|
||
| Changes that require updating the deployment instructions include: | ||
|
|
||
| - New environment variables or secrets added to the container app | ||
| - New files or directories that the Dockerfile copies | ||
| - Changes to the esbuild config or build pipeline | ||
| - New Azure resources in the Bicep template | ||
| - Changes to the ACR registry name, container app name, or resource group | ||
| - Changes to dependency structure (new `package.json` files copied in Docker build) | ||
| - New probes, scaling rules, or ingress configuration | ||
|
|
||
| Do NOT update the deployment instructions for changes that are purely internal (test files, local dev config, code logic that doesn't affect the build/deploy pipeline). |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| --- | ||
| description: "Webapp deployment guide. Determines the MINIMUM deployment steps needed based on which files changed. Covers infra (Bicep), Docker image (ACR build), and container app update." | ||
| applyTo: "webapp/**,Dockerfile.webapp,infra/webapp/**,packages/core/src/**" | ||
| --- | ||
|
|
||
| # Webapp Deployment — Minimum Required Actions | ||
|
|
||
| When the user asks to deploy the webapp, determine the **minimum set of actions** needed based on which files changed. Do NOT run a full deployment every time. Use the decision tree below. | ||
|
|
||
| ## Azure Resource Names | ||
|
|
||
| | Resource | Name / Value | | ||
| | ---------------- | ------------------------------- | | ||
| | Resource group | `agentrc-webapp` | | ||
| | Container App | `agentrc-webapp` | | ||
| | ACR registry | `agentrcwebapp` | | ||
| | Image repository | `agentrc-webapp` | | ||
| | Custom domain | `agentrc.isainative.dev` | | ||
| | Dockerfile | `Dockerfile.webapp` (repo root) | | ||
| | Bicep entrypoint | `infra/webapp/main.bicep` | | ||
| | Bicep params | `infra/webapp/main.bicepparam` | | ||
|
|
||
| ## Decision Tree — What Changed → What to Do | ||
|
|
||
| ### 1. Infrastructure changes (`infra/webapp/**`) | ||
|
|
||
| Files: `infra/webapp/main.bicep`, `infra/webapp/main.bicepparam` | ||
|
|
||
| These change Azure resources (Container Apps Environment, ACR, storage, networking, secrets, probes, scale rules, custom domain). **Full infra redeployment required.** | ||
|
|
||
| ```sh | ||
| # Validate first | ||
| az bicep build --file infra/webapp/main.bicep | ||
|
|
||
| # Deploy infrastructure | ||
| az deployment group create \ | ||
| --resource-group agentrc-webapp \ | ||
| --template-file infra/webapp/main.bicep \ | ||
| --parameters infra/webapp/main.bicepparam | ||
|
|
||
| # If container image also changed, follow steps 2+3 after. | ||
| # If only infra params changed (e.g. scaling, domain), this is sufficient. | ||
| ``` | ||
|
|
||
| ### 2. Docker build required (image rebuild + push to ACR) | ||
|
|
||
| A new container image must be built when **any** of these files changed: | ||
|
|
||
| | Path pattern | Reason | | ||
| | ---------------------------------- | ------------------------------------------------- | | ||
| | `Dockerfile.webapp` | Build instructions themselves changed | | ||
| | `webapp/backend/src/**` | Backend application code (bundled by esbuild) | | ||
| | `webapp/backend/esbuild.config.js` | Build config for backend bundle | | ||
| | `webapp/backend/package.json` | Backend dependencies | | ||
| | `webapp/backend/package-lock.json` | Backend dependency lockfile | | ||
| | `webapp/frontend/**` | Static frontend files (copied into image as-is) | | ||
| | `packages/core/src/**` | Shared core library (aliased into backend bundle) | | ||
| | `package.json` (root) | Root workspace dependencies | | ||
| | `package-lock.json` (root) | Root workspace lockfile | | ||
|
|
||
| Build command — run from repo root: | ||
|
|
||
| ```sh | ||
| az acr build \ | ||
| --registry agentrcwebapp \ | ||
| --image agentrc-webapp:<tag> \ | ||
| --file Dockerfile.webapp . | ||
| ``` | ||
|
|
||
| Pick a descriptive `<tag>` for the change (e.g. `fix-og-meta`, `update-styles`), or use `latest`. | ||
|
|
||
| **After building, always proceed to step 3.** | ||
|
|
||
| ### 3. Container App update (deploy new image) | ||
|
|
||
| After pushing a new image to ACR, update the running container: | ||
|
|
||
| ```sh | ||
| az containerapp update \ | ||
| --name agentrc-webapp \ | ||
| --resource-group agentrc-webapp \ | ||
| --image agentrcwebapp.azurecr.io/agentrc-webapp:<tag> | ||
| ``` | ||
|
|
||
| Use the same `<tag>` from step 2. This is the only step needed when the image tag changed but no infra changes occurred. | ||
|
|
||
| ## Quick Reference — Change → Minimum Actions | ||
|
|
||
| | What changed | Actions needed | | ||
| | -------------------------------------------- | ------------------------------------- | | ||
| | `webapp/frontend/` only (HTML/CSS/JS/assets) | ACR build → App update | | ||
| | `webapp/backend/src/` only | ACR build → App update | | ||
| | `packages/core/src/` only | ACR build → App update | | ||
| | `Dockerfile.webapp` | ACR build → App update | | ||
| | `webapp/backend/package.json` (deps) | ACR build → App update | | ||
| | `infra/webapp/main.bicep` (resources) | Bicep deploy | | ||
| | `infra/webapp/main.bicepparam` (params) | Bicep deploy | | ||
| | Infra + app code together | Bicep deploy → ACR build → App update | | ||
| | `webapp/backend/tests/**` only | No deployment needed | | ||
| | `webapp/frontend/tests/**` only | No deployment needed | | ||
| | `webapp/backend/vitest.config.js` only | No deployment needed | | ||
| | `webapp/frontend/vitest.config.js` only | No deployment needed | | ||
| | `webapp/docker-compose.yml` only | No deployment needed (local dev only) | | ||
| | `webapp/.env` or `webapp/.env.example` | No deployment needed (local dev only) | | ||
|
|
||
| ## Build Pipeline Details | ||
|
|
||
| The Docker build has three stages: | ||
|
|
||
| 1. **deps** — `npm ci` for root workspace + backend (installs `@agentrc/core` from `packages/core/`) | ||
| 2. **build** — `node esbuild.config.js` bundles `webapp/backend/src/server.js` → `dist/server.js`, resolving `@agentrc/core` via alias to `packages/core/src/` | ||
| 3. **runtime** — Node 24 Alpine, copies `dist/`, `node_modules/`, and `webapp/frontend/` (served as static files by Express) | ||
|
|
||
| The frontend has no build step — files in `webapp/frontend/` are served directly by `express.static`. | ||
|
|
||
| ## Pre-deploy Checklist | ||
|
|
||
| Before deploying, run backend tests to verify the change: | ||
|
|
||
| ```sh | ||
| cd webapp/backend && npx vitest run | ||
| ``` | ||
|
|
||
| If frontend tests exist: | ||
|
|
||
| ```sh | ||
| cd webapp/frontend && npx vitest run | ||
| ``` | ||
|
|
||
| ## Container App Architecture | ||
|
|
||
| - **Hosting**: Azure Container Apps (Consumption, East US) | ||
| - **Ingress**: External, port 3000, HTTPS only | ||
| - **Identity**: User-assigned managed identity for ACR pull (no admin credentials) | ||
| - **Storage**: Azure Files mount at `/app/data` for shared reports | ||
| - **Monitoring**: Application Insights via connection string secret | ||
| - **Scaling**: 1–4 replicas, HTTP-based autoscaling | ||
| - **Health**: Liveness + Readiness probes on `/api/health` |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.