fix: update deployment scripts to use dynamic DEPLOY_PATH for backend and frontend

This commit is contained in:
2025-06-09 16:44:25 -03:00
parent 125c6cf269
commit 953483ee15
3 changed files with 5 additions and 3 deletions

View File

@@ -5,8 +5,6 @@ on:
branches: branches:
- main - main
jobs: jobs:
deploy: deploy:
runs-on: website-deploy-runner runs-on: website-deploy-runner
@@ -66,6 +64,8 @@ jobs:
rsync -a --delete --exclude 'frontend/.next/cache/' --exclude '.git/' ./ /var/www/website.joaoloureiro.dev.br/ rsync -a --delete --exclude 'frontend/.next/cache/' --exclude '.git/' ./ /var/www/website.joaoloureiro.dev.br/
- name: Restart Applications with PM2 - name: Restart Applications with PM2
env:
DEPLOY_PATH: ${{ vars.DEPLOY_PATH }}
run: | run: |
echo "Restarting applications with PM2..." echo "Restarting applications with PM2..."
pm2 startOrRestart backend/ecosystem.config.js --update-env pm2 startOrRestart backend/ecosystem.config.js --update-env

View File

@@ -1,7 +1,8 @@
module.exports = { module.exports = {
apps: [{ apps: [{
name: 'portfolio-backend', // A name for your application in PM2 name: 'portfolio-backend', // A name for your application in PM2
script: 'backend/server.js', // The path to the script PM2 will run script: 'server.js', // The path to the script PM2 will run
cwd: `${process.env.DEPLOY_PATH}/backend`, // Current working directory for the script
instances: 1, // Run a single instance of the application instances: 1, // Run a single instance of the application
autorestart: true, // Automatically restart if the app crashes autorestart: true, // Automatically restart if the app crashes
watch: false, // Do NOT watch for file changes in production watch: false, // Do NOT watch for file changes in production

View File

@@ -3,6 +3,7 @@ module.exports = {
name: 'portfolio-frontend', // A name for your application in PM2 name: 'portfolio-frontend', // A name for your application in PM2
script: 'npm', // Tell PM2 to run an npm command script: 'npm', // Tell PM2 to run an npm command
args: 'start', // The argument to pass to npm, which runs 'next start' args: 'start', // The argument to pass to npm, which runs 'next start'
cwd: `${process.env.DEPLOY_PATH}/frontend`, // Current working directory for the script
instances: 1, // Run a single instance of the application instances: 1, // Run a single instance of the application
autorestart: true, // Automatically restart if the app crashes autorestart: true, // Automatically restart if the app crashes
watch: false, // Do NOT watch for file changes in production watch: false, // Do NOT watch for file changes in production