Skip to content

Commit fcb7e60

Browse files
committed
Adding pm2 and building scripts
1 parent 8f28ed2 commit fcb7e60

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

build-info.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
DATETIME=`date "+%d/%m/%Y %H:%M:%S"`
4+
COMMIT_HASH=`git log --pretty=format:'%H' -n 1`
5+
COMMIT_AUTHOR_NAME=`git log --pretty=format:'%an' -n 1`
6+
COMMIT_AUTHOR_DATE=`git log --pretty=format:'%ad' -n 1`
7+
COMMIT_AUTHOR_EMAIL=`git log --pretty=format:'%ae' -n 1`
8+
COMMIT_SUBJECT=`git log --pretty=format:'%s' -n 1`
9+
10+
COMMIT_SUBJECT="${COMMIT_SUBJECT//\'/\"}"
11+
12+
echo "BuildInfo = {
13+
date: '$DATETIME',
14+
commit: {
15+
hash: '$COMMIT_HASH',
16+
subject: '$COMMIT_SUBJECT',
17+
author: {
18+
date: '$COMMIT_AUTHOR_DATE',
19+
name: '$COMMIT_AUTHOR_NAME',
20+
email: '$COMMIT_AUTHOR_EMAIL'
21+
}
22+
}
23+
};" > ./BuildInfo.js

build.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
if [ ! $1 ]; then
4+
echo " Example of use: source build.sh production"
5+
fi
6+
7+
if [ $1 ]; then
8+
source ./build-info.sh
9+
export METEOR_SETTINGS=$(cat settings.$1.json)
10+
meteor build --server rocket.chat --directory /var/www/rocket.chat
11+
cd /var/www/rocket.chat/bundle/programs/server
12+
npm install
13+
cd /var/www/rocket.chat
14+
pm2 startOrRestart /var/www/rocket.chat/current/pm2.$1.json
15+
fi

pm2.production.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"apps": [{
3+
"name": "rocket.chat",
4+
"exec_mode": "fork_mode",
5+
"max_memory_restart" : "400M",
6+
"log_date_format": "YYYY-MM-DD HH:mm:ss SSS",
7+
"script": "/var/www/rocket.chat/bundle/main.js",
8+
"out_file": "/var/log/rocket.chat/app.log",
9+
"error_file": "/var/log/rocket.chat/err.log",
10+
"port": "80",
11+
"env": {
12+
"MONGO_URL": "mongodb://localhost:27017/rocketchat",
13+
"MONGO_OPLOG_URL": "mongodb://localhost:27017/local",
14+
"ROOT_URL": "http://rocket.chat",
15+
"PORT": "80"
16+
}
17+
}]
18+
}

0 commit comments

Comments
 (0)