Skip to content

Commit 2e9c753

Browse files
committed
Deploying on heroku
2 parents ba182a3 + f1c43c9 commit 2e9c753

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

.travis.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@ services:
55
- mongodb
66
cache:
77
directories:
8-
- node_modules
8+
- node_modules
99
git:
1010
depth: 3
11+
install:
12+
- git clone $GIT_CLONE_REMOTE
13+
- cd $REPO_NAME
14+
- git checkout $TRAVIS_BRANCH
15+
- npm i
1116
script: npm run travis-script
1217
after_script:
1318
- npm report-coverage
1419
before_script:
1520
- npm install -g gulp-cli
21+
before_deploy:
22+
- if [ "$TRAVIS_BRANCH" == "develop" ] ; then if [ "$TRAVIS_PULL_REQUEST" == "false"] ; then bash travis.sh ; fi ; fi
1623
deploy:
17-
app: $APP_NAME
24+
app: $PROVIDER_APP_NAME
1825
provider: $PROVIDER
1926
on:
20-
repo: surabhi226005/express-mongoose-es6-rest-api
21-
branch: release
27+
repo: $PROVIDER_REPO_NAME
28+
all_branches: true
2229
api_key:
2330
secure: $TRAVIS_SECURE_API_KEY
24-
after_success:
25-
- if [ "$TRAVIS_BRANCH" == "develop" ] ; then
26-
if [ "$TRAVIS_PULL_REQUEST" == "false" ] ; then bash travis.sh ; fi ; fi

config/config.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ const envVarsSchema = Joi.object({
1818
}),
1919
JWT_SECRET: Joi.string().required()
2020
.description('JWT Secret required to sign'),
21-
MONGO_HOST: Joi.string().required()
22-
.description('Mongo DB host url'),
23-
MONGO_PORT: Joi.number()
24-
.default(27017)
21+
MONGODB_URI: Joi.string().required()
22+
.description('Mongo DB host url')
2523
}).unknown()
2624
.required();
2725

@@ -36,8 +34,7 @@ const config = {
3634
mongooseDebug: envVars.MONGOOSE_DEBUG,
3735
jwtSecret: envVars.JWT_SECRET,
3836
mongo: {
39-
host: envVars.MONGO_HOST,
40-
port: envVars.MONGO_PORT
37+
host: envVars.MONGODB_URI
4138
}
4239
};
4340

travis.sh

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
# vi /etc/ssh/ssh_config
2-
# i Host 192.168.0.* StrictHostKeyChecking no UserKnownHostsFile=/dev/null
3-
4-
# cd ~/.ssh
5-
# rm known_hosts
6-
# ln -s /dev/null known_hosts
7-
81
git config --global user.name "$GIT_USER_NAME"
2+
93
git config --global user.email $GIT_USER_EMAIL
104

115
# Install the Heroku gem (or the Heroku toolbelt)
126
gem install $PROVIDER
7+
138
# Add your Heroku git repo:
14-
git remote rm $PROVIDER ;
9+
git remote rm $PROVIDER ;
10+
1511
git remote add $PROVIDER git@$PROVIDER.com:$PROVIDER_APP_NAME.git ;
12+
1613
# Add your Heroku API key:
1714
export HEROKU_API_KEY=$HEROKU_API_KEY
15+
1816
# Turn off warnings about SSH keys:
1917
echo " Host heroku.com" >> ~/.ssh/config
18+
2019
echo " StrictHostKeyChecking no" >> ~/.ssh/config
20+
2121
echo " CheckHostIP no" >> ~/.ssh/config
22+
2223
echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config
24+
2325
# Clear your current Heroku SSH keys:
2426
$PROVIDER keys:clear
27+
2528
# Add a new SSH key to Heroku
2629
yes | $PROVIDER keys:add
2730

2831
git add dist/ ;
32+
2933
git checkout -b $NEW_TRAVIS_BRANCH ;
30-
git commit -m "$TRAVIS_COMMIT_MESSAGE" ;
31-
# Push to Heroku!
32-
git fetch --all --unshallow
33-
yes | git push --force $PROVIDER $NEW_TRAVIS_BRANCH:$PROVIDER_BRANCH ;
3434

35+
git commit -m "$TRAVIS_COMMIT_MESSAGE" ;
3536

36-
# echo -e "yes" | ./travis.sh
37+
# Push to Heroku
38+
yes | git push --force $PROVIDER $NEW_TRAVIS_BRANCH:$PROVIDER_BRANCH ;

0 commit comments

Comments
 (0)