Deploy script
Features
- Version management
- Automatic back-ups
- Automatic server set-up
Usage
- Install the package
npm install --save-dev @labela/deploy
- Create an deploy.sh in you project folder
#!/bin/bash
PROJECT= #PROJECTNAME
PROD_HOST= #PROD_HOST
ACC_HOST= #ACC_HOST
#Don't touch this
ENV=$1
source ./node_modules/@labela/deploy/index.sh
- Change variables for your project
- Make the file an executable
$ chmod +x deploy.sh
Start the deploy by running the file with 1 argument that's the environment (TEST, ACC or PROD)
$ ./deploy.sh TEST
Upgrading
To upgrade from version 0.5.4 and lower to ^6.0.0 you have to kill the old PM2 process. Previously all processes were named: server
. The new process has the name of your project. Run pm2 kill server
to terminate the old process.
All options to overwrite:
- ROOT_USER - the user to login with ssh
- TEST_PORT - default is 3000
- TEST_HOST - default is 192.168.22.8
- TEST_USER - default is PROJECT
- ACC_USER
- ACC_PORT - default is 3000
- ACC_HOST
- PROD_USER
- PROD_PORT - default is 3000
- PROD_HOST
- STRAPI - default is false
Use caution when overwriting the following values:
- PM2_CONFIG_NAME - default is pm2-server-config.json
Sentry
If you add a .sentryclirc
file to the project root folder, it will also push a new release to Sentry after the deploy has been processed successfully. Read more about this in: https://gitlab.labela.nl/front-end/sentry-setup