Skip to content

Commit 118a62f

Browse files
committed
fix(workflow): update PM2 commands to use absolute path
- Change PM2 commands to use the absolute path for consistency. - Ensure the PM2 process is correctly described and managed in the workflow. - Improve maintainability by avoiding reliance on a potentially misconfigured PATH. - Remove unnecessary comment from server configuration for clarity.
1 parent b965d55 commit 118a62f

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

.github/workflows/backend.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ jobs:
8989
npm ci --production || npm install --production
9090
9191
# Restart PM2 service
92-
if pm2 describe cp-backend-production > /dev/null 2>&1; then
92+
if /usr/local/bin/pm2 describe cp-backend-production > /dev/null 2>&1; then
9393
# Process exists, reload it (zero-downtime restart)
94-
pm2 reload cp-backend-production --update-env
94+
/usr/local/bin/pm2 reload cp-backend-production --update-env
9595
else
9696
# Process doesn't exist, start it
97-
pm2 start dist/server.js \
97+
/usr/local/bin/pm2 start dist/server.js \
9898
--name cp-backend-production \
9999
--cwd "$DEPLOY_DIR" \
100100
--update-env
101-
pm2 save
101+
/usr/local/bin/pm2 save
102102
fi
103103
104104
# Cleanup old backups (keep last 5)
@@ -119,6 +119,6 @@ jobs:
119119
script: |
120120
sleep 5
121121
# Check PM2 process status
122-
pm2 status cp-backend-production
123-
pm2 info cp-backend-production
122+
/usr/local/bin/pm2 status cp-backend-production
123+
/usr/local/bin/pm2 info cp-backend-production
124124

backend/src/server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { startS3CleanupCron } from "./s3-cleanup-cron";
1010

1111
const app = express();
1212

13-
// Trust proxy for proper IP handling behind reverse proxy (Vercel + Railway)
1413
// Trust only specific proxy IPs or use 'loopback' for local development
1514
app.set('trust proxy', process.env.NODE_ENV === 'production' ? 1 : 'loopback');
1615

0 commit comments

Comments
 (0)