Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #187 from TrueCar/toddw/resolve-dockerfile-issue
Browse files Browse the repository at this point in the history
Resolve Dockerfile issue and pm2 error
  • Loading branch information
christinebrass committed May 25, 2016
2 parents 16b1569 + 980401b commit c42201a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions docker/generate-dockerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var dockerfile = [
"ADD . /app",
"",
"RUN npm install",
"RUN gluestick build",
""
];

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gluestick",
"version": "0.7.1",
"version": "0.7.2",
"description": "GlueStick is a command line interface for quickly developing universal web applications using React",
"main": "src/cli-harmony.js",
"bin": "src/cli-harmony.js",
Expand Down
29 changes: 26 additions & 3 deletions src/commands/start-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ module.exports = function startServer (debug=false) {
}

// Stop any previous processes with the same name before starting new
// instances
pm2.stop(name, () => {
// instances. If no instances with that name are found then we just
// fall back to starting normally
checkIfPM2ProcessExists(name, (exists) => {
if (exists) {
pm2.stop(name, () => {
startPM2(scriptPath, name);
});
return;
}

startPM2(scriptPath, name);
});
});
Expand Down Expand Up @@ -80,11 +88,26 @@ function startPM2 (scriptPath, name) {
*/
process.on("SIGINT", () => {
logger.info(`Stopping pm2 instance: ${highlight(name)}…`);
pm2.delete(name, () => {
checkIfPM2ProcessExists(name, (exists) => {
if (exists) {
pm2.delete(name, () => {
pm2.disconnect(() => {
process.exit();
});
});
return;
}

pm2.disconnect(() => {
process.exit();
});
});
});
}

function checkIfPM2ProcessExists (name, callback) {
pm2.list((error, result) => {
callback(result.map((i) => i.name === name).length > 0);
});
}

2 changes: 1 addition & 1 deletion templates/new/src/config/.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is automatically generated. You can copy this file and add a
# Dockerfile to the root of the project if you would like to use a custom
# docker setup.
FROM truecar/gluestick:0.7.0
FROM truecar/gluestick:0.7.2

ADD . /app

Expand Down

0 comments on commit c42201a

Please sign in to comment.