From 570ee3eefbb5f01811d1a6989904bf29fec3a889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Guillaume?= <74193170+Leoglme@users.noreply.github.com> Date: Sun, 7 Jan 2024 07:09:51 +0100 Subject: [PATCH 1/8] Rename deploy-o2switch.yml to deploy-ovh.yml --- .github/workflows/{deploy-o2switch.yml => deploy-ovh.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{deploy-o2switch.yml => deploy-ovh.yml} (100%) diff --git a/.github/workflows/deploy-o2switch.yml b/.github/workflows/deploy-ovh.yml similarity index 100% rename from .github/workflows/deploy-o2switch.yml rename to .github/workflows/deploy-ovh.yml From 19c4a86f82d7c58b1ee9b11879be7a15d47eed7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Guillaume?= <74193170+Leoglme@users.noreply.github.com> Date: Sun, 7 Jan 2024 07:24:11 +0100 Subject: [PATCH 2/8] Update deploy-ovh.yml --- .github/workflows/deploy-ovh.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy-ovh.yml b/.github/workflows/deploy-ovh.yml index fb2cd82..dbb575b 100644 --- a/.github/workflows/deploy-ovh.yml +++ b/.github/workflows/deploy-ovh.yml @@ -1,4 +1,4 @@ -name: 🚀 Build and Deploy Nuxt.js 3 App to o2switch +name: 🚀 Build and Deploy Nuxt.js 3 App to ovh vps on: push: branches: @@ -39,13 +39,13 @@ jobs: - name: 📝 Create server.js run: echo "import('./server/index.mjs');" > .output/server.js - - name: 📤 Deploy to FTP server - uses: SamKirkland/FTP-Deploy-Action@v4.3.4 + - name: 📤 Deploy to VPS + uses: appleboy/scp-action@master with: - server: ${{ secrets.FTP_SERVER }} - username: ${{ secrets.FTP_USERNAME }} - password: ${{ secrets.FTP_PASSWORD }} - port: 21 - protocol: ftp - local-dir: ./.output/ - server-dir: ${{ secrets.FTP_SERVER_DIR }} + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + source: ".output/" + target: "/var/www/dibodev.com/html" + From 18c61f64e7e6596ad4ce952a96af63944af0b46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Guillaume?= <74193170+Leoglme@users.noreply.github.com> Date: Sun, 7 Jan 2024 07:31:23 +0100 Subject: [PATCH 3/8] Update deploy-ovh.yml --- .github/workflows/deploy-ovh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-ovh.yml b/.github/workflows/deploy-ovh.yml index dbb575b..f03fbde 100644 --- a/.github/workflows/deploy-ovh.yml +++ b/.github/workflows/deploy-ovh.yml @@ -43,9 +43,9 @@ jobs: uses: appleboy/scp-action@master with: host: ${{ secrets.SSH_HOST }} + port: ${{ secrets.SSH_PORT }} username: ${{ secrets.SSH_USERNAME }} key: ${{ secrets.SSH_PRIVATE_KEY }} - port: 22 source: ".output/" target: "/var/www/dibodev.com/html" From 713e46d1a4529ce6c2e441e879f529800f26e8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Guillaume?= <74193170+Leoglme@users.noreply.github.com> Date: Sun, 7 Jan 2024 07:50:54 +0100 Subject: [PATCH 4/8] Update deploy-ovh.yml --- .github/workflows/deploy-ovh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-ovh.yml b/.github/workflows/deploy-ovh.yml index f03fbde..a0491cd 100644 --- a/.github/workflows/deploy-ovh.yml +++ b/.github/workflows/deploy-ovh.yml @@ -33,7 +33,7 @@ jobs: - name: 📝 Modify package.json run: | mv .output/server/package.json .output/package.json - jq '.bundledDependencies |= . as $o | .dependencies = $o | del(.bundledDependencies)' .output/package.json > .output/temp.json + jq '{name: .name, version: .version, private: .private, dependencies: .bundledDependencies}' .output/package.json > .output/temp.json mv .output/temp.json .output/package.json - name: 📝 Create server.js From d508403a9b6e3adcd7104936911f415e8b76ee94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Guillaume?= <74193170+Leoglme@users.noreply.github.com> Date: Sun, 7 Jan 2024 09:13:22 +0100 Subject: [PATCH 5/8] Update deploy-ovh.yml --- .github/workflows/deploy-ovh.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/deploy-ovh.yml b/.github/workflows/deploy-ovh.yml index a0491cd..46a69fe 100644 --- a/.github/workflows/deploy-ovh.yml +++ b/.github/workflows/deploy-ovh.yml @@ -48,4 +48,16 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} source: ".output/" target: "/var/www/dibodev.com/html" + - name: 🚀 Install Dependencies and Restart Server + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SSH_HOST }} + port: ${{ secrets.SSH_PORT }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + cd /var/www/dibodev.com/html/.output + npm install + pm2 restart my-nuxt-app || pm2 start server.js --name my-nuxt-app + From 9561c6194a29cd2a53348f0d3c5de2892e9518f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Guillaume?= <74193170+Leoglme@users.noreply.github.com> Date: Sun, 7 Jan 2024 09:18:49 +0100 Subject: [PATCH 6/8] Update deploy-ovh.yml --- .github/workflows/deploy-ovh.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-ovh.yml b/.github/workflows/deploy-ovh.yml index 46a69fe..e3cc03a 100644 --- a/.github/workflows/deploy-ovh.yml +++ b/.github/workflows/deploy-ovh.yml @@ -27,8 +27,8 @@ jobs: - name: 🛠️ Build App run: npm run build - - name: 🗑️ Remove node_modules from .output/server - run: rm -rf .output/server/node_modules + - name: 🚚 Move node_modules + run: mv .output/server/node_modules .output/ - name: 📝 Modify package.json run: | @@ -48,7 +48,7 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} source: ".output/" target: "/var/www/dibodev.com/html" - - name: 🚀 Install Dependencies and Restart Server + - name: 🚀 Restart Server with PM2 uses: appleboy/ssh-action@master with: host: ${{ secrets.SSH_HOST }} @@ -57,7 +57,7 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/dibodev.com/html/.output - npm install - pm2 restart my-nuxt-app || pm2 start server.js --name my-nuxt-app + pm2 restart dibodev.com || pm2 start server.js --name dibodev.com + From 44296c8d05c173d9fd3e362e1e061207b4f5fc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Guillaume?= <74193170+Leoglme@users.noreply.github.com> Date: Sun, 7 Jan 2024 09:33:41 +0100 Subject: [PATCH 7/8] Update deploy-ovh.yml --- .github/workflows/deploy-ovh.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy-ovh.yml b/.github/workflows/deploy-ovh.yml index e3cc03a..941f389 100644 --- a/.github/workflows/deploy-ovh.yml +++ b/.github/workflows/deploy-ovh.yml @@ -20,16 +20,10 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 - - - name: 📦 Install dependencies - run: npm ci - + - name: 🛠️ Build App run: npm run build - - - name: 🚚 Move node_modules - run: mv .output/server/node_modules .output/ - + - name: 📝 Modify package.json run: | mv .output/server/package.json .output/package.json @@ -48,7 +42,8 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} source: ".output/" target: "/var/www/dibodev.com/html" - - name: 🚀 Restart Server with PM2 + + - name: 🚀 Install dependencies and restart Server with PM2 uses: appleboy/ssh-action@master with: host: ${{ secrets.SSH_HOST }} @@ -57,6 +52,7 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/dibodev.com/html/.output + npm install pm2 restart dibodev.com || pm2 start server.js --name dibodev.com From 90b58a78a21aa292a6a0201af471e3a4bf62de46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Guillaume?= <74193170+Leoglme@users.noreply.github.com> Date: Sun, 7 Jan 2024 09:35:43 +0100 Subject: [PATCH 8/8] Update deploy-ovh.yml --- .github/workflows/deploy-ovh.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/deploy-ovh.yml b/.github/workflows/deploy-ovh.yml index 941f389..e5ec343 100644 --- a/.github/workflows/deploy-ovh.yml +++ b/.github/workflows/deploy-ovh.yml @@ -21,8 +21,14 @@ jobs: with: node-version: 18 + - name: 📦 Install dependencies + run: npm ci + - name: 🛠️ Build App run: npm run build + + - name: 🗑️ Remove node_modules from .output/server + run: rm -rf .output/server/node_modules - name: 📝 Modify package.json run: |