Browse Source

Merge branch 'feature/pm2_deploy' into develop

Olivier Massot 4 years ago
parent
commit
475fab7484
2 changed files with 22 additions and 1 deletions
  1. 21 1
      README.md
  2. 1 0
      package.json

+ 21 - 1
README.md

@@ -49,12 +49,32 @@ On pourra ensuite interagir avec le service ainsi :
     pm2 stop app
     pm2 logs app
 
+On enregistre le service pour qu'il soit relancé lors du boot de la machine:
+https://pm2.keymetrics.io/docs/usage/startup/
+
+En tant que non-root:
+
+    pm2 startup
+    
+Puis, comme la commande précédente le suggère, on lance **en tant que root**:
+
+    env PATH=$PATH:/usr/bin /usr/local/share/.config/yarn/global/node_modules/pm2/bin/pm2 startup systemd -u exploitation --hp /home/exploitation
+
+On sauvegarde la nouvelle configuration avec: 
+
+    pm2 save
+
 ### Mettre à jour
 
-Se place dans le répertoire de l'application, puis lancer:
+Se placer dans le répertoire de l'application, puis lancer:
+
+    yarn deploy
+
+Cette commande est un alias qui équivaut à lancer:
 
     git pull
     yarn install
+    yarn build
     pm2 restart
 
 ## Autres

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
     "start:local": "yarn start --dotenv .env.local",
     "start:preprod": "yarn start --dotenv .env.preprod",
     "start:prod": "yarn start --dotenv .env.prod",
+    "deploy": "git pull && yarn install && yarn build && pm2 start app",
     "lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
     "lint": "yarn lint:js",
     "test": "jest",