-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lucarin91
committed
Apr 20, 2017
1 parent
118a8f9
commit 9a9b46a
Showing
16 changed files
with
337 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
tosker/tests/TOSCA/node-mongo-csar/node-mongo/TOSCA-Metadata/TOSCA.meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TOSCA-Meta-File-Version: 1.0 | ||
CSAR-Version: 1.1 | ||
Created-By: lucarin91 | ||
Entry-Definitions: node-mongo.yaml | ||
Content-Type: application/vnd.oasis.tosca.definitions.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* jslint node: true */ | ||
"use strict"; | ||
var express = require('express'); | ||
var mongoose = require('mongoose'); | ||
|
||
(function connect_to_mongo() { | ||
mongoose.connect('mongodb://db/data1', function(err) { | ||
if (err) connect_to_mongo(); | ||
else console.log('connection successful'); | ||
}); | ||
})(); | ||
|
||
var Schema = mongoose.Schema; | ||
var PeopleSchema = mongoose.model('People', | ||
new Schema({ | ||
name: String, | ||
surname: String | ||
}) | ||
); | ||
new PeopleSchema({ | ||
name: 'Mario', | ||
surname: 'Rossi' | ||
}).save(); | ||
new PeopleSchema({ | ||
name: 'Mario', | ||
surname: 'Verdi' | ||
}).save(); | ||
new PeopleSchema({ | ||
name: 'John', | ||
surname: 'Foo' | ||
}).save(); | ||
new PeopleSchema({ | ||
name: 'John', | ||
surname: 'Bar' | ||
}).save(); | ||
new PeopleSchema({ | ||
name: 'Mario', | ||
surname: 'FooBar' | ||
}).save(); | ||
|
||
var app = express(); | ||
|
||
app.get('/', function(req, res) { | ||
PeopleSchema.find(function(err, people) { | ||
var html = '<h3>People:</h3>'; | ||
html += '<ul>'; | ||
people.forEach(p => html += '<li>' + p.name + ' ' + p.surname + '</li>'); | ||
html += '</ul>'; | ||
res.send(html); | ||
}); | ||
}); | ||
|
||
var port = process.env.PORT || 80; | ||
app.listen(port, function() { | ||
console.log('server listen on port ' + port); | ||
}); |
11 changes: 11 additions & 0 deletions
11
tosker/tests/TOSCA/node-mongo-csar/node-mongo/app/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "node-mongo-example", | ||
"version": "1.0.0", | ||
"description": "", | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"express": "^4.14.0", | ||
"mongoose": "^4.6.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tosker/tests/TOSCA/node-mongo-csar/node-mongo/scripts/app/install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
cp $INPUT_PACKAGE $INPUT_MAIN . | ||
npm install |
3 changes: 3 additions & 0 deletions
3
tosker/tests/TOSCA/node-mongo-csar/node-mongo/scripts/app/start.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
export PORT=$INPUT_PORT | ||
node main.js |
5 changes: 5 additions & 0 deletions
5
tosker/tests/TOSCA/node-mongo-csar/node-mongo/scripts/install_node.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
apt-get update | ||
apt-get install nodejs npm -y | ||
apt-get clean | ||
ln -s /usr/bin/nodejs /usr/bin/node |
8 changes: 8 additions & 0 deletions
8
tosker/tests/TOSCA/node-mongo-csar/node-mongo/scripts/mongo/install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 | ||
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list | ||
apt-get update | ||
apt-get install -y mongodb-org | ||
apt-get clean | ||
|
||
mkdir -p /db |
2 changes: 2 additions & 0 deletions
2
tosker/tests/TOSCA/node-mongo-csar/node-mongo/scripts/mongo/start.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
mongod --dbpath /db > /db/DEBUG_LOG |
Oops, something went wrong.