Skip to content

Commit fe1f19f

Browse files
committed
Adds Aye Aye.
1 parent e406e70 commit fe1f19f

10 files changed

+22
-254
lines changed

README.md

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
1-
# Deploy Visualization
2-
Shows visually the services being deployed in real time to different environments using Shippable pipelines
3-
4-
Works with [Box][1], a cron application.
5-
6-
To test this project, run multiple instances of [Box][1] on different environments.
7-
8-
#### Environment Variables Required:
9-
- MONGO_API_URL (this mlab.com api url as we use that as a remote db)
10-
11-
https://api.mlab.com/api/1/databases/[db]/collections/[collection]?apiKey=[key]
12-
13-
[1]:https://github.com/aye0aye/box
1+
# Pipeline Deploy Visualization
2+
A sample project using Shippable Pipelines.

boot.sh

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
#!/bin/bash
22

3-
checkEnvironmentVariables() {
4-
echo 'Checking for required environment variables....'
5-
if [[ -z $MONGO_API_URL ]]; then
6-
echo 'MONGO_API_URL not found. Exiting.'
7-
exit 1;
8-
fi
9-
echo 'All variables are present.'
10-
}
113
startServer() {
124
cd /home/demo/dv
13-
echo 'server started without forever'
5+
echo 'server started'
146
node server.js
157
}
168
main() {
17-
checkEnvironmentVariables
189
startServer
1910
}
2011

package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@
55
"main": "server.js",
66
"repository": {
77
"type": "git",
8-
"url": "git+https://github.com/aye0aye/dv.git"
8+
"url": "git+https://github.com/shippableSamples/samplePipelinesDv.git"
99
},
1010
"keywords": [
1111
"angularjs"
1212
],
13-
"author": "harryi3t (https://github.com/harryi3t)",
1413
"license": "MIT",
1514
"bugs": {
16-
"url": "https://github.com/aye0aye/dv/issues"
15+
"url": "https://github.com/shippableSamples/samplePipelinesDv/issues"
1716
},
18-
"homepage": "https://github.com/aye0aye/dv#readme",
17+
"homepage": "https://github.com/shippableSamples/samplePipelinesDv#readme",
1918
"dependencies": {
2019
"ejs": "^2.4.1",
2120
"express": "^4.13.4",
22-
"mongoose": "^4.4.10",
2321
"underscore": "^1.8.3"
2422
},
2523
"devDependencies": {

server.js

-8
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@ var path = require('path');
22
var express = require('express');
33
var app = express();
44

5-
var mongoApiUrlObj = {
6-
MONGO_API_URL: process.env.MONGO_API_URL
7-
};
8-
95
app.engine('html', require('ejs').renderFile);
106
app.set('view engine', 'html');
117
app.use(express.static(path.join(__dirname, '/static')));
128

13-
app.get('/api/MONGO_API_URL', function (req, res){
14-
res.json(mongoApiUrlObj);
15-
});
16-
179
app.get('/static/*', function (req, res) {
1810
res.sendFile(__dirname + req.url);
1911
});

shippable.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ language: none
33
build:
44
ci:
55
- echo 'CI Running'
6-
- export IMAGE_NAME=aye0aye/dv
6+
- export IMAGE_NAME=aye0aye/samplepipelinesdv
77
- ./build.sh
88

99
post_ci:

static/app.html

+2-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html ng-app="dv">
33
<head>
44
<meta charset="utf-8">
5-
<title>Shippable DV</title>
5+
<title>Shippable Pipelines DV</title>
66
<script type="text/javascript"
77
src="static/js/app.cat.js" ></script>
88
<link rel="stylesheet" href="static/css/app.cat.css" media="screen" title="no title" charset="utf-8">
@@ -13,25 +13,7 @@
1313
<canvas id="pixie"></canvas>
1414
</div>
1515
<div class="container" id="cloudSpace">
16-
<div class="row">
17-
<div class="environment col-xs-12 col-sm-10 col-md-4 col-lg-3" ng-repeat="environment in environments | orderBy:'envName' track by $index">
18-
<div class="cloud">
19-
<div class="parent">
20-
<div class="cloudEnv">
21-
<h3>{{environment.envName}}</h3>
22-
</div>
23-
<div class="child"
24-
ng-repeat="box in environment.boxes track by $index">
25-
<div class="box"
26-
style="background-color:{{box.color}}">
27-
<span class="instanceId">{{box.instanceId}}</span>
28-
</div>
29-
</div>
30-
</div>
31-
<span class='shadow'></span>
32-
</div>
33-
</div>
34-
</div>
16+
<img ng-src="ayeAyeCaptain.png" />
3517
</div>
3618
</body>
3719
<script type="text/javascript"

static/app.js

+2-94
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,12 @@
11
(function () {
22
app = angular.module('dv', [])
3-
.controller('mainController', mainController)
4-
.service('Boxes', boxService);
3+
.controller('mainController', mainController);
54

6-
var MONGO_API_URL = null;
7-
var POLLING_INTERVAL = 3 * 1000; // every 3 seconds
8-
9-
function mainController($scope, $http, Boxes) {
5+
function mainController($scope, $http) {
106
_init();
11-
//_testOffline();
12-
13-
function _testOffline() {
14-
$scope.environments = JSON.parse('[{"envName":"prod","boxes":[{"color":"#038505","environment":"prod","age":1.6,"instanceId":1},{"color":"#038505","environment":"prod","age":1.6,"instanceId":2}],"$$hashKey":"object:550"},{"envName":"prod2","boxes":[{"color":"#038505","environment":"prod2","age":1.6,"instanceId":1},{"color":"#038505","environment":"prod2","age":1.6,"instanceId":2}],"$$hashKey":"object:550"},{"envName":"beta","boxes":[{"color":"#038505","environment":"beta","age":1.6,"instanceId":1},{"color":"#038505","environment":"beta","age":1.6,"instanceId":2}],"$$hashKey":"object:548"},{"envName":"local","boxes":[{"color":"#038505","environment":"local","age":1.5,"instanceId":1}],"$$hashKey":"object:549"},{"envName":"test","boxes":[{"color":"#038505","environment":"test","age":5.5,"instanceId":1},{"color":"#038505","environment":"test","age":5.5,"instanceId":2},{"color":"#038505","environment":"test","age":1.5,"instanceId":3}],"$$hashKey":"object:551"}]');
15-
$scope.environments.shift();
16-
$scope.environments.shift();
17-
$scope.environments.shift();
18-
}
197

208
function _init() {
21-
_getMongoApiUrl(function (err) {
22-
if (err)
23-
console.log('Error while getting the MONGO_API_URL: ', err);
24-
else {
25-
_updateBoxes();
26-
}
27-
});
28-
}
299

30-
function _getMongoApiUrl(next) {
31-
$http({
32-
method: 'GET',
33-
url: '/api/MONGO_API_URL'
34-
})
35-
.then(
36-
function (response) {
37-
MONGO_API_URL = response.data.MONGO_API_URL;
38-
return next();
39-
},
40-
function (err) {
41-
return next(err);
42-
}
43-
);
4410
}
45-
46-
function _updateBoxes() {
47-
Boxes.get(function (err, environments) {
48-
if (err)
49-
console.log('err', err);
50-
else
51-
$scope.environments = environments;
52-
53-
_.delay(_updateBoxes, POLLING_INTERVAL);
54-
});
55-
}
56-
}
57-
58-
function boxService($http) {
59-
return {
60-
get: function (callback) {
61-
$http({
62-
method: 'GET',
63-
url: MONGO_API_URL
64-
})
65-
.then(
66-
function (response) {
67-
var boxes = _.chain(response.data)
68-
.map(function (dbObj) {
69-
var now = new Date().getTime();
70-
var boxUpdatedAt = new Date(dbObj.updatedAt.$date).getTime();
71-
var age = Math.round(10 * (now - boxUpdatedAt) / 1000) / 10;
72-
console.log('age of ', dbObj.environment, ' is ', age);
73-
return new Box(dbObj.color, dbObj.environment, age);
74-
})
75-
.groupBy('environment')
76-
.each(function (envBoxes, envName) {
77-
_.each(envBoxes, function (envBox, index) {
78-
envBox.instanceId = index + 1;
79-
});
80-
})
81-
.map(function (value, key) {
82-
var obj = {};
83-
obj.envName = key;
84-
obj.boxes = value;
85-
return obj;
86-
})
87-
.value();
88-
callback(null, boxes);
89-
},
90-
function (err) {
91-
callback(err);
92-
}
93-
);
94-
}
95-
};
96-
}
97-
98-
function Box(color, environment, age, instanceId) {
99-
this.color = color;
100-
this.environment = environment;
101-
this.age = age;
102-
this.instanceId = instanceId;
10311
}
10412
})();

static/ayeAyeCaptain.png

134 KB
Loading

static/js/app.cat.js

+2-94
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/app.min.js

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)