From 75d6a52251c2d7de2b2b028bd2da1341b3b0e903 Mon Sep 17 00:00:00 2001 From: JuruSysadmin Date: Wed, 7 Jan 2026 16:59:56 -0300 Subject: [PATCH 1/2] feat: Add Gitea Actions workflow for SSH deployment and update PM2 application's working directory. --- .gitea/workflows/deploy.yaml | 21 ++++++++++----------- ecosystem.config.js | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 1748162..928a5a2 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -14,24 +14,23 @@ jobs: username: juru key: ${{ secrets.SSH_PRIVATE_KEY }} script: | - APP_PATH=/home/juru/apps/portal-dias-rota + APP_PATH=/home/juru/Portal-dias-rota + mkdir -p /home/juru/apps + if [ ! -d "$APP_PATH" ]; then git clone http://10.1.1.124:3000/joelson/Portal-dias-rota.git $APP_PATH fi cd $APP_PATH - - git pull origin main - + git fetch origin main + git reset --hard origin/main + npm install npm run build - if [ -d ".next/standalone" ]; then - cp -r public .next/standalone/ - cp -r .next/static .next/standalone/.next/ - fi - - pm2 reload portal-dias-rota || pm2 start npm --name "portal-dias-rota" -- start - pm2 save \ No newline at end of file + cp -r public .next/standalone/ || echo "Aviso: public não encontrada" + cp -r .next/static .next/standalone/.next/ || echo "Aviso: static não encontrada" + + pm2 reload portal-dias-rota || pm2 start npm --name "portal-dias-rota" -- start \ No newline at end of file diff --git a/ecosystem.config.js b/ecosystem.config.js index 655b7c6..4713b93 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -2,7 +2,7 @@ module.exports = { apps: [{ name: "portal-dias-rota", script: "server.js", - cwd: "/home/juru/apps/current/.next/standalone", + cwd: "/home/juru/apps/ortal-dias-rota", env: { NODE_ENV: "production", PORT: 3003, From 10fea9857548ff078431b001e79c391b223a752a Mon Sep 17 00:00:00 2001 From: JuruSysadmin Date: Wed, 7 Jan 2026 17:01:35 -0300 Subject: [PATCH 2/2] feat: update PM2 configuration to use `next start` command, set process arguments, instances, and execution mode, and correct the working directory. --- ecosystem.config.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ecosystem.config.js b/ecosystem.config.js index 4713b93..4517b3f 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -1,13 +1,13 @@ module.exports = { apps: [{ name: "portal-dias-rota", - script: "server.js", - cwd: "/home/juru/apps/ortal-dias-rota", + script: "node_modules/next/dist/bin/next", + args: "start -p 3003", + cwd: "/home/juru/Portal-dias-rota", + instances: 1, + exec_mode: "fork", env: { - NODE_ENV: "production", - PORT: 3003, - HOSTNAME: "0.0.0.0" - + NODE_ENV: "production" } }] } \ No newline at end of file