Skip to content

Commit c9bb572

Browse files
Merge pull request #170 from CloudBoost/staging
Staging
2 parents ee5c2e5 + 3f9fc63 commit c9bb572

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.travis.yml

+17-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ install:
2020
- npm install grunt-cli -g
2121
- npm install
2222
- docker build -t cloudboost/cloudboost:2.0.$TRAVIS_BUILD_NUMBER .
23-
- docker build -t cloudboost/cloudboost:latest .
23+
- if [ "$TRAVIS_BRANCH" == "master" ]; then
24+
docker build -t cloudboost/cloudboost:latest .;
25+
fi
26+
- if [ "$TRAVIS_BRANCH" == "staging" ]; then
27+
docker build -t cloudboost/cloudboost:staging .;
28+
fi
2429
- docker run --name cloudboost -e MAIL_PROVIDER=$MAIL_PROVIDER -e MAIL_PROVIDER_API_KEY=$MAIL_PROVIDER_API_KEY -e DOMAIN=$DOMAIN -e FROM_EMAIL=$FROM_EMAIL -e FROM_NAME=$FROM_NAME -p 4730:4730 -it --link redis:redis --link mongo:mongo -d cloudboost/cloudboost:2.0.$TRAVIS_BUILD_NUMBER
2530
- sleep 30s
2631
- git clone https://github.com/cloudboost/javascriptsdk
@@ -30,7 +35,16 @@ install:
3035
- npm test
3136
- cd ..
3237
after_success:
33-
- echo "OK"
38+
- if [ "$TRAVIS_BRANCH" == "staging" ]; then
39+
docker login --username $DOCKERUSERNAME --password $DOCKERPASSWORD --email $DOCKEREMAIL;
40+
docker push cloudboost/cloudboost:staging;
41+
git clone https://github.com/CloudBoost/kube-cred.git;
42+
cd kube-cred;
43+
openssl enc -in config.enc -out config -d -aes256 -k $KUBE_ENC;
44+
mkdir ~/.kube;
45+
mv config ~/.kube/;
46+
kubectl rolling-update cloudboost-engine-staging --image=cloudboost/cloudboost:staging --image-pull-policy=Always;
47+
fi
3448
before_deploy:
3549
- git config --global user.email "[email protected]"
3650
- git config --global user.name "Travis CI"
@@ -44,7 +58,7 @@ deploy:
4458
skip_cleanup: true
4559
on:
4660
tags: false
47-
all_branches: true
61+
branch: master
4862
after_deploy:
4963
# Docker Deploy.
5064
- if [ "$TRAVIS_BRANCH" == "master" ]; then

server.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,19 @@ function setUpAnalytics() {
479479
if (process.env["CLOUDBOOST_ANALYTICS_SERVICE_HOST"]) {
480480
//this is running on Kubernetes
481481
console.log("CloudBoost Analytics is running on Kubernetes");
482-
global.keys.analyticsUrl = "http://" + process.env["CLOUDBOOST_ANALYTICS_SERVICE_HOST"];
482+
483+
if(process.env["IS_STAGING"]){
484+
if (process.env["CLOUDBOOST_ANALYTICS_STAGING_SERVICE_HOST"]) {
485+
global.keys.analyticsUrl = "http://" + process.env["CLOUDBOOST_ANALYTICS_STAGING_SERVICE_HOST"];
486+
}
487+
} else {
488+
global.keys.analyticsUrl = "http://" + process.env["CLOUDBOOST_ANALYTICS_SERVICE_HOST"];
489+
}
483490
console.log(global.keys.analyticsUrl);
491+
484492
} else {
485493
console.log("Analytics URL : ");
494+
global.keys.analyticsUrl = "http://localhost:5555"
486495
console.log(global.keys.analyticsUrl);
487496
}
488497
} catch (err) {

0 commit comments

Comments
 (0)