-
Notifications
You must be signed in to change notification settings - Fork 1
/
heroku.sh
executable file
·71 lines (58 loc) · 1.7 KB
/
heroku.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
##### DEPLOY VARIABLES #######
HEROKU_APP='shooterapp'
ROOT_URL='https://'$HEROKU_APP'.herokuapp.com/'
MONGO_URL='mongodb://trinisoft:[email protected]:23410/development'
MONGO_OPLOG_URL='mongodb://trinisoft:[email protected]:23410/development'
MAIL_URL=''
METEOR_SETTINGS=$(cat ./settings.json)
nodeVersion="4.7.3" ## not all node version works with some meteor version
##### DELETE A LINE IF YOU DON"T WANT SOME ENV VAR #######
runSript="cd ./programs/server &&
npm install &&
cd ../../ &&
export MONGO_URL='"$MONGO_URL"' &&
export ROOT_URL='"$ROOT_URL"' &&
export MAIL_URL='"$MAIL_URL"' &&
export METEOR_SETTINGS='"$METEOR_SETTINGS"' &&
export PORT=80 &&
node ./main.js"
##### DON'T LOOK HERE IT'S ALL MY DOING #######
rm -rf ./.meteor/local/heroku
meteor build ./.meteor/local/heroku --server $ROOT_URL
dirName=${PWD##*/}
cd ./.meteor/local/heroku/
tar -xvzf $dirName.tar.gz
cd bundle
echo $runSript > ./run.sh
packageText='{
"name": "'$HEROKU_APP'",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "sh ./run.sh"
},
"dependencies": {
},
"engines": {
"node": "'$nodeVersion'"
}
}'
echo $packageText > ./package.json
appText='{
"name": "Trinisoft Technologies Pvt. Ltd.",
"description": "Trinisoft Technologies Pvt. Ltd. Official app.",
"repository": "https://git.heroku.com/$HEROKU_APP.git",
"keywords": ["node", "express", "trinisoft"],
"image": "heroku/nodejs"
}'
echo $appText > ./app.json
git init
git remote add heroku https://git.heroku.com/$HEROKU_APP.git
git add -A
git commit -m "init"
git push heroku master --force
echo "Deploy complete"
echo "Sleeping for 5s and checking log"
sleep 5s
heroku logs
echo "Hurray check your app "$ROOT_URL" here"