From 405ec8bf1b0d59fe995ff9a3032bb4a9cf39156d Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Mon, 24 Jul 2017 09:12:10 -0300 Subject: [PATCH] Improve and fix build example script --- example-build.sh | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/example-build.sh b/example-build.sh index 06ac6246124..ddd41734de8 100755 --- a/example-build.sh +++ b/example-build.sh @@ -3,14 +3,30 @@ set -x set -euvo pipefail IFS=$'\n\t' -# Build -export NODE_ENV=production -meteor add rocketchat:internal-hubot -meteor build --server https://demo.rocket.chat --directory /var/www/rocket.chat +# Requies Node.js version 4.x +# Do not run as root -# Run -export METEOR_SETTINGS=$(cat settings.json) -cd /var/www/rocket.chat/bundle/programs/server +DEPLOY_DIR=/var/www/rocket.chat + +### BUILD +meteor npm install + +# on the very first build, meteor build command should fail due to a bug on emojione package (related to phantomjs installation) +# the command below forces the error to happen before build command (not needed on subsequent builds) +set +e +meteor add rocketchat:lib +set -e + +meteor build --server-only --directory $DEPLOY_DIR + +### RUN +cd $DEPLOY_DIR/bundle/programs/server npm install -cd /var/www/rocket.chat/current -pm2 startOrRestart /var/www/rocket.chat/current/pm2.json + +cd $DEPLOY_DIR/bundle +NODE_ENV=production \ +PORT=3000 \ +ROOT_URL=http://localhost:3000 \ +MONGO_URL=mongodb://localhost:27017/rocketchat \ +MONGO_OPLOG_URL=mongodb://localhost:27017/local \ +node main.js