Skip to content

Commit 46e0a79

Browse files
committed
config updates
1 parent 0ec26d5 commit 46e0a79

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
)
3737
3838
# Send webhook with secret for authentication
39+
# Note: WEBHOOK_URL should point to /api/deploy-website endpoint
3940
curl -X POST "$WEBHOOK_URL" \
4041
-H "Content-Type: application/json" \
4142
-H "X-GitHub-Event: push" \

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ This repository uses GitHub Actions with webhook-based deployment. The deploymen
8888
- **Domain:** `staging.processordb.mit.edu`
8989
- **Server:** `128.52.141.130`
9090
- **GitHub Environment:** `staging`
91-
- **Webhook Endpoint:** `http://staging.processordb.mit.edu/api/deploy`
91+
- **Webhook Endpoint:** `https://staging.processordb.mit.edu/api/deploy-website`
9292

9393
- **Production Environment:**
9494
- **Branch:** `main`
@@ -111,7 +111,7 @@ To enable automated deployments, you must configure environment-specific secrets
111111
2. **Configure Staging Environment:**
112112
- Click on `staging` environment (or create it if it doesn't exist)
113113
- Add the following secrets:
114-
- **`WEBHOOK_URL`:** `https://staging.processordb.mit.edu/api/deploy` (HTTPS enabled)
114+
- **`WEBHOOK_URL`:** `https://staging.processordb.mit.edu/api/deploy-website` (HTTPS enabled)
115115
- **`WEBHOOK_SECRET`:** The secret token that matches `DEPLOY_WEBHOOK_SECRET` in your staging server's `.env` file
116116
- **Note:** SSL certificate is configured and active. Use `https://` for the webhook URL.
117117

@@ -198,7 +198,7 @@ sudo tail -f /var/log/nginx/staging.processordb.mit.edu.access.log
198198
sudo tail -f /var/log/nginx/staging.processordb.mit.edu.error.log
199199

200200
# Filter for webhook requests only
201-
sudo tail -f /var/log/nginx/staging.processordb.mit.edu.access.log | grep "/api/deploy"
201+
sudo tail -f /var/log/nginx/staging.processordb.mit.edu.access.log | grep "/api/deploy-website"
202202
```
203203

204204
**Troubleshooting Failed Deployments:**
@@ -230,7 +230,8 @@ The application is served through nginx as a reverse proxy. Configuration files
230230
- **HTTP:** Port 80 automatically redirects to HTTPS (301 redirect)
231231
- **Frontend (Nuxt 3):** All requests to `/` are proxied to `http://localhost:3000`
232232
- **Backend API:** Requests to `/backend/api/` are proxied to `http://localhost:3001/api/`
233-
- **Webhook:** `/api/deploy` endpoint accessible via HTTPS
233+
- **Website Webhook:** `/api/deploy-website` endpoint accessible via HTTPS
234+
- **API Webhook:** `/api/deploy-api` endpoint accessible via HTTPS (proxies to backend API)
234235

235236
**Key Proxy Headers:**
236237
- `Host`: Preserves original host header
@@ -285,7 +286,8 @@ The staging environment is currently configured with:
285286
1. **Nginx Configuration:** `/etc/nginx/sites-available/staging.processordb.mit.edu`
286287
- Frontend proxy: `http://localhost:3000` (Nuxt.js)
287288
- Backend API proxy: `http://localhost:3001/api/` (via `/backend/api/` path)
288-
- Webhook endpoint: `/api/deploy``http://localhost:3000` (secured by webhook secret authentication)
289+
- Website webhook endpoint: `/api/deploy-website``http://localhost:3000` (secured by webhook secret authentication)
290+
- API webhook endpoint: `/api/deploy-api``http://localhost:3001/api/deploy/webhook` (proxies to backend API)
289291
- **Access:** Currently **publicly accessible** - no IP restrictions are enabled. All IP restriction directives in nginx config are commented out.
290292

291293
2. **Application Services:**
@@ -299,7 +301,8 @@ The staging environment is currently configured with:
299301
- PM2 ecosystem config loads `.env` file automatically
300302

301303
4. **Deployment:**
302-
- Webhook endpoint: `https://staging.processordb.mit.edu/api/deploy` (HTTPS enabled)
304+
- Website webhook endpoint: `https://staging.processordb.mit.edu/api/deploy-website` (HTTPS enabled)
305+
- API webhook endpoint: `https://staging.processordb.mit.edu/api/deploy-api` (HTTPS enabled)
303306
- Deployment script: `~/processordb-website-staging/scripts/deploy.sh`
304307
- Git credentials: Configured via credential helper
305308

@@ -316,7 +319,7 @@ The staging site uses Let's Encrypt SSL certificates managed by certbot for auto
316319

317320
### Current Status
318321

319-
**SSL is configured and active:**
322+
**SSL is configured and active:**
320323
- Certificate obtained and installed
321324
- HTTP automatically redirects to HTTPS
322325
- Auto-renewal is enabled via systemd timer
@@ -388,7 +391,7 @@ BACKEND_URL=https://staging.processordb.mit.edu/backend/api
388391
**GitHub Actions Environment Secrets:**
389392
Update the `WEBHOOK_URL` in GitHub repository settings:
390393
- Go to: Repository → Settings → Environments → Staging
391-
- Update `WEBHOOK_URL` from `http://` to `https://staging.processordb.mit.edu/api/deploy`
394+
- Update `WEBHOOK_URL` to `https://staging.processordb.mit.edu/api/deploy-website`
392395

393396
**After updating URLs:**
394397
```bash
@@ -438,7 +441,7 @@ sudo certbot renew && sudo systemctl reload nginx
438441

439442
To make a subdomain (e.g., staging) only accessible from internal MIT networks, you can restrict access at the nginx level using IP whitelisting by uncommenting and configuring the IP restriction directives.
440443

441-
**Note:** The webhook endpoint (`/api/deploy`) uses secret-based authentication and does not have IP restrictions. This section applies to frontend and backend API access only.
444+
**Note:** The webhook endpoints (`/api/deploy-website` and `/api/deploy-api`) use secret-based authentication and do not have IP restrictions. This section applies to frontend and backend API access only.
442445

443446
### Quick Setup for Staging Instance
444447

@@ -599,7 +602,7 @@ server {
599602
}
600603
```
601604

602-
**Important:** The webhook endpoint (`/api/deploy`) should **NOT** have IP restrictions enabled, as it uses secret-based authentication and needs to be accessible from GitHub Actions IPs (which change frequently).
605+
**Important:** The webhook endpoints (`/api/deploy-website` and `/api/deploy-api`) should **NOT** have IP restrictions enabled, as they use secret-based authentication and need to be accessible from GitHub Actions IPs (which change frequently).
603606

604607
### Implementation Steps
605608

@@ -679,6 +682,6 @@ location / {
679682
- **Error Response:** Users outside MIT networks will see a 403 Forbidden error when restrictions are enabled
680683
- **VPN Access:** VPN connections to MIT networks will be treated as internal if they use MIT IP ranges
681684
- **Testing:** Test thoroughly from both internal and external networks before deploying restrictions
682-
- **Webhook Endpoint:** The `/api/deploy` endpoint does **NOT** use IP restrictions. It relies on secret-based authentication (`X-Webhook-Secret` header) for security. This allows GitHub Actions to trigger deployments from any IP address while maintaining strong security through the webhook secret. **Do not enable IP restrictions on the webhook endpoint.**
685+
- **Webhook Endpoints:** The `/api/deploy-website` (website) and `/api/deploy-api` (API) endpoints do **NOT** use IP restrictions. They rely on secret-based authentication (`X-Webhook-Secret` header) for security. This allows GitHub Actions to trigger deployments from any IP address while maintaining strong security through the webhook secret. **Do not enable IP restrictions on the webhook endpoints.**
683686

684687
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
File renamed without changes.

0 commit comments

Comments
 (0)