1
0
mirror of /repos/Prototyper.git synced 2025-12-30 06:31:32 +01:00

add deployit

This commit is contained in:
Aiko Mastboom 2013-05-09 15:13:33 +02:00
parent eb1a447023
commit 0a21723133
3 changed files with 24 additions and 3 deletions

View File

@ -1,3 +1,19 @@
#!/usr/bin/env bash
fleet-deploy && fleet-exec -- npm --cache-min=99999 install && fleet-exec npm rebuild bson && fleet-spawn npm start
command -v fleet
fleet_installed=$?
if [ ${fleet_installed} == 1 ]; then
npm install -g http://github.com/aikomastboom/fleet/archive/0.1.8.tar.gz
fi
# deploy new commit
fleet-deploy && fleet-exec -- npm --cache-min=99999 install && fleet-exec -- npm rebuild bson
# stop running one
# stop running
PROTOTYPER=$(basename $PWD)
fleet-ps | grep -B 2 "${PROTOTYPER}/" | grep pid | cut -d " " -f 2 | xargs fleet-stop
# start new
# not using 'npm start' because when killed it doesn't kill its children (server.js)
fleet-spawn node ./server.js

View File

@ -2,6 +2,9 @@
"name": "Prototyper",
"version": "0.0.1",
"main": "server.js",
"config" : {
"port" : "8000"
},
"engine": "node 0.10.4",
"private": "true",
"dependencies": {
@ -32,6 +35,5 @@
"test": "echo \"Error: no test specified\" && exit 1",
"install": "./installit",
"deploy": "./deployit"
}
}

View File

@ -8,7 +8,7 @@ process.title = "Prototyper";
var config = {
errors: true,
debug: process.env.DEBUG || false,
port: 8000,
port: process.env.npm_package_config_port || 8000,
mongo: {
server: "mongodb://localhost:27017/Prototyper",
options: {
@ -72,6 +72,9 @@ MongoClient.connect(config.mongo.server, config.mongo.options, function connecti
return process.exit(1);
}
var server = addRoutes(app, db, config);
server.on('error', function (err) {
config.error && console.log('server error',err);
});
return server.listen(config.port, function handleServerResult(err) {
if (err) {
app.stop();