diff --git a/build-info.sh b/build-info.sh new file mode 100755 index 00000000000..44263a3b5ca --- /dev/null +++ b/build-info.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +DATETIME=`date "+%d/%m/%Y %H:%M:%S"` +COMMIT_HASH=`git log --pretty=format:'%H' -n 1` +COMMIT_AUTHOR_NAME=`git log --pretty=format:'%an' -n 1` +COMMIT_AUTHOR_DATE=`git log --pretty=format:'%ad' -n 1` +COMMIT_AUTHOR_EMAIL=`git log --pretty=format:'%ae' -n 1` +COMMIT_SUBJECT=`git log --pretty=format:'%s' -n 1` + +COMMIT_SUBJECT="${COMMIT_SUBJECT//\'/\"}" + +echo "BuildInfo = { + date: '$DATETIME', + commit: { + hash: '$COMMIT_HASH', + subject: '$COMMIT_SUBJECT', + author: { + date: '$COMMIT_AUTHOR_DATE', + name: '$COMMIT_AUTHOR_NAME', + email: '$COMMIT_AUTHOR_EMAIL' + } + } +};" > ./BuildInfo.js diff --git a/build.sh b/build.sh new file mode 100644 index 00000000000..c742fed4ac2 --- /dev/null +++ b/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ ! $1 ]; then + echo " Example of use: source build.sh production" +fi + +if [ $1 ]; then + source ./build-info.sh + export METEOR_SETTINGS=$(cat settings.$1.json) + meteor build --server rocket.chat --directory /var/www/rocket.chat + cd /var/www/rocket.chat/bundle/programs/server + npm install + cd /var/www/rocket.chat + pm2 startOrRestart /var/www/rocket.chat/current/pm2.$1.json +fi diff --git a/pm2.production.json b/pm2.production.json new file mode 100644 index 00000000000..ced06f4f136 --- /dev/null +++ b/pm2.production.json @@ -0,0 +1,18 @@ +{ + "apps": [{ + "name": "rocket.chat", + "exec_mode": "fork_mode", + "max_memory_restart" : "400M", + "log_date_format": "YYYY-MM-DD HH:mm:ss SSS", + "script": "/var/www/rocket.chat/bundle/main.js", + "out_file": "/var/log/rocket.chat/app.log", + "error_file": "/var/log/rocket.chat/err.log", + "port": "80", + "env": { + "MONGO_URL": "mongodb://localhost:27017/rocketchat", + "MONGO_OPLOG_URL": "mongodb://localhost:27017/local", + "ROOT_URL": "http://rocket.chat", + "PORT": "80" + } + }] +}