Skip to content

Commit 6427f49

Browse files
committedOct 12, 2015
Merge pull request #4 from ogazitt/master
pull omris changes
2 parents 812f4f3 + e7506ed commit 6427f49

7 files changed

+82
-11
lines changed
 

‎Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM hwestphal/nodebox
2+
3+
COPY ./ /src
4+
WORKDIR /src
5+
6+
RUN npm install
7+
8+
EXPOSE 8080
9+
CMD ["node", "server.js"]
10+
11+
12+

‎index.html

+15-8
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
<!-- Set the viewport width to device width for mobile -->
1212
<meta name="viewport" content="width=device-width" />
1313

14-
<title>Stackato Environment Variables :: Phani Raju</title>
14+
<title>Node Environment Demo</title>
1515

1616
<!-- Included CSS Files (Uncompressed) -->
1717
<!--
1818
<link rel="stylesheet" href="stylesheets/foundation.css">
1919
-->
2020

2121
<!-- Included CSS Files (Compressed) -->
22-
<link rel="stylesheet" href="stylesheets/foundation.min.css">
22+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/3.2.5/stylesheets/foundation.css">
2323
<link rel="stylesheet" href="stylesheets/app.css">
2424

2525
<script src="javascripts/modernizr.foundation.js"></script>
@@ -45,17 +45,24 @@
4545

4646
<nav class="top-bar">
4747
<ul>
48-
<!-- Title Area -->
48+
<li class="name">
49+
<img src="HP_Helion_cloud_icon.jpg" alt="[ Helion CI ]"</img>
50+
</li>
51+
4952
<li class="name">
5053
<h1>
51-
<a href="#" >
52-
<span style="color: #c5e5ef">[ Stackato ]</span> Aiken Cloud CI System Environment Variables
53-
</a>
54+
<a href="#">&nbsp;Dev Platform Mark Demo</a>
5455
</h1>
5556
</li>
56-
<li class="toggle-nav"><a href="#system-info">CI Deployment Target Failed System Information</a></li>
57-
</ul>
57+
<li class="name two columns">
58+
<h1>
5859

60+
<a href="#">Environment Variables</a>
61+
</h1>
62+
</li>
63+
<li class="toggle-nav seven columns offset-by-one">
64+
<a href="#system-info">System Information</a></li>
65+
</ul>
5966
</nav>
6067

6168

‎kube/kube-node-env

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
kubectl create -f node-env-rc.yaml
3+
kubectl create -f node-env-svc.yaml
4+
kubectl cluster-info --namespace=default

‎kube/node-env-rc.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: v1
2+
kind: ReplicationController
3+
metadata:
4+
name: node-env-v1
5+
labels:
6+
app: node-env
7+
version: v1
8+
kubernetes.io/cluster-service: "true"
9+
spec:
10+
replicas: 1
11+
selector:
12+
app: node-env
13+
version: v1
14+
template:
15+
metadata:
16+
labels:
17+
app: node-env
18+
version: v1
19+
kubernetes.io/cluster-service: "true"
20+
spec:
21+
containers:
22+
- name: node-env
23+
image: ogazitt/node-env:latest
24+
resources:
25+
limits:
26+
cpu: 100m
27+
memory: 50Mi
28+
ports:
29+
- containerPort: 8080
30+

‎kube/node-env-svc.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: node-env
5+
labels:
6+
app: node-env
7+
kubernetes.io/cluster-service: "true"
8+
kubernetes.io/name: "node-env"
9+
spec:
10+
selector:
11+
app: node-env
12+
ports:
13+
- port: 80
14+
targetPort: 8080
15+

‎server.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ var http = require("http"),
55
mustache = require("./lib/mustache"),
66
keyprocessor = require("./lib/keyprocessor"),
77
sysinfo = require('./lib/sysinfo'),
8-
port = process.env.PORT || 8888;
8+
port = process.env.PORT || 8080;
99

1010
http.createServer(function(request, response) {
1111

1212
var uri = url.parse(request.url).pathname,
1313
filename = path.join(process.cwd(), uri);
14+
console.log("uri: " + uri + "\nfilename: " + filename);
1415

15-
path.exists(filename, function(exists) {
16+
fs.exists(filename, function(exists) {
1617
if (!exists) {
1718
response.writeHead(404, {
1819
"Content-Type": "text/plain"
@@ -42,6 +43,7 @@ http.createServer(function(request, response) {
4243
response.end()
4344
return;
4445
});
46+
return; //need to return here otherwise the code below will execute.
4547
}
4648

4749
if (fs.statSync(filename).isDirectory()) filename += '/index.html';
@@ -59,6 +61,7 @@ http.createServer(function(request, response) {
5961
response.writeHead(200);
6062
response.write(file, "binary");
6163
response.end();
64+
return;
6265
});
6366
});
6467
}).listen(parseInt(port, 10));

‎test/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var http = require('http'),
2-
should = require('should'),
2+
should = require('should'),
33
sysInfo = require('../lib/sysinfo.js'),
44
keyProcessor = require('../lib/keyprocessor.js'),
55
hock = require('hock');

0 commit comments

Comments
 (0)
Please sign in to comment.