From 105154191f41b74b8be80f3d3773aef4d42393e8 Mon Sep 17 00:00:00 2001 From: Tomasz Subik Date: Thu, 11 Jul 2024 21:06:40 +0200 Subject: [PATCH 1/4] upgrade node to 20 --- .nvmrc | 2 +- e2e/.nvmrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.nvmrc b/.nvmrc index 2a4e4ab8..9a2a0e21 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.17.0 +v20 diff --git a/e2e/.nvmrc b/e2e/.nvmrc index 2a4e4ab8..9a2a0e21 100644 --- a/e2e/.nvmrc +++ b/e2e/.nvmrc @@ -1 +1 @@ -16.17.0 +v20 From 31cd57ed74f522618a4b38b936669d63be9fe749 Mon Sep 17 00:00:00 2001 From: Tomasz Subik Date: Sun, 14 Jul 2024 13:38:30 +0200 Subject: [PATCH 2/4] improve deploy script --- script/deploy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/deploy b/script/deploy index a2e21bef..df3ab089 100755 --- a/script/deploy +++ b/script/deploy @@ -25,7 +25,7 @@ yarn build echo "--> Restarting server" if [ $1 = "staging" ]; then - pm2 restart otp-portal-staging --update-env + pm2 describe otp-portal-staging > /dev/null && pm2 restart otp-portal-staging --update-env || pm2 start index.js --name otp-portal-staging else - pm2 restart otp-portal --update-env + pm2 describe otp-portal > /dev/null && pm2 restart otp-portal --update-env || pm2 start index.js --name otp-portal fi From 3e8acddd46a2fe82b0fef3d0f479528e88b8a61d Mon Sep 17 00:00:00 2001 From: Tomasz Subik Date: Sun, 14 Jul 2024 13:54:10 +0200 Subject: [PATCH 3/4] update gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 238c774e..82b8a6e8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ node_modules/ static/tiles /npm-debug.log .env +.env.staging +.env.production .DS_Store # vscode From 09ba082fcb9f4eda5f40310312f92fb9a926e6bb Mon Sep 17 00:00:00 2001 From: Tomasz Subik Date: Wed, 17 Jul 2024 12:10:36 +0200 Subject: [PATCH 4/4] update deploy script --- script/deploy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/script/deploy b/script/deploy index df3ab089..9b796790 100755 --- a/script/deploy +++ b/script/deploy @@ -5,6 +5,7 @@ echo "set project directory" cd "$(dirname "$(readlink -f "$0")")" cd ".." +export PATH="$HOME/.local/bin:$PATH" export NVM_DIR="$HOME/.nvm" . $NVM_DIR/nvm.sh @@ -22,10 +23,12 @@ yarn transifex:pull echo "--> Building assets" yarn build -echo "--> Restarting server" - -if [ $1 = "staging" ]; then - pm2 describe otp-portal-staging > /dev/null && pm2 restart otp-portal-staging --update-env || pm2 start index.js --name otp-portal-staging +if pm2 describe otp-portal > /dev/null; then + echo "--> Restarting application" + pm2 restart otp-portal --update-env else - pm2 describe otp-portal > /dev/null && pm2 restart otp-portal --update-env || pm2 start index.js --name otp-portal + echo "--> Setting up a new application" + pm2 start index.js --name otp-portal + sudo env PATH=$PATH:/home/ubuntu/.nvm/versions/node/$(node -v)/bin pm2 startup systemd -u ubuntu --hp /home/ubuntu + pm2 save fi