GithubHelp home page GithubHelp logo

connyay / openshift-node4 Goto Github PK

View Code? Open in Web Editor NEW
17.0 6.0 8.0 27.43 MB

node.js v4 cartridge for OpenShift

License: Apache License 2.0

Shell 0.16% C 78.39% C++ 18.94% Objective-C 1.07% Groff 1.42% HTML 0.01% JavaScript 0.02%

openshift-node4's Introduction

This project is no longer maintained. PRs will be accepted.

node.js v4 cartridge for OpenShift

Usage

rhc create-app <app name> https://raw.githubusercontent.com/connyay/openshift-node4/master/metadata/manifest.yml

What this cartridge provides out of the box

  1. node.js (latest LTS (v4 train) currently 4.3.1)
  2. npm (latest stable currently 2.14.12)
  3. grunt
  4. gulp
  5. forever
  6. bower

What this cartridge does out of the box

Not much.

  1. Installs node.js v4
  2. Installs grunt, gulp, bower, and forever globally (specified by $OPENSHIFT_NPM_GLOBALS)
  3. Allows the user to manually install required dependencies (in a build action_hook). An example of this can be found here
  4. Runs npm start if package.json is found in repo directory (log is written to $OPENSHIFT_NODE4_LOG_DIR)

Note

For now I just dropped the contents of the node-v4.3.1.tar.gz here. I will move to resolving the latest stable and downloading on the gear in the near future.

Thanks!

These repos helped out a ton while developing this cartridge.

  1. engineersamuel/openshift-origin-cartridge-nodejs
  2. wshearn/openshift-origin-cartridge-nodejs
  3. ramr/nodejs-custom-version-openshift
  4. heroku/heroku-buildpack-nodejs

openshift-node4's People

Contributors

connyay avatar notthetup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

openshift-node4's Issues

hot_deploy

Thanks for making this cartridge! I tried adding the hot_deploy marker, but it doesn't reload the node server. Maybe you could add this functionality?

Script changes are not able to start, because port 8080 is already in use

After setting up a cartridge, I cloned the repository onto my computer and made some changes to app.js. After committing the changes via git, it still showed me the original app.js contents in the browser. So I looked at the node-four/logs/node.log file and saw the following:

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::8080
    at Object.exports._errnoException (util.js:837:11)
    at exports._exceptionWithHostPort (util.js:860:20)
    at Server._listen2 (net.js:1231:14)
    at listen (net.js:1267:10)
    at Server.listen (net.js:1363:5)
    at EventEmitter.listen (/var/lib/openshift/560ff22389f5cfca0c000136/app-root/runtime/repo/node_modules/express/lib/application.js:617:24)
    at Object.<anonymous> (/var/lib/openshift/560ff22389f5cfca0c000136/app-root/runtime/repo/app.js:21:20)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
error: Forever detected script exited with code: 1

Then I did an lsof and saw that there was another node process running, which I stopped. Yet I was still not able to restart the app.js. I always got the same message as above in the log, no matter if I tried to restart the application via openshift or directly via node app.js.

Do you have any idea which process might still be blocking port 8080 and how I could kill it?

Thank you very much in advance

EADDRINUSE Port 8080 already in use for this web storm configuration

I'm getting following errors: (error.code: EADDRINUSE)

Port 8080 is already in use
DEBUG: Program node bin/www exited with code 1
DEBUG: Starting child process with 'node bin/www'

package.json

{
  "name": "app",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "main": "bin/www",
  "dependencies": {
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0"
  }
}

bin/www

#!/usr/bin/env node

/**
 * Module dependencies.
 */

var app = require('../app');
var debug = require('debug')('unc:server');
var http = require('http');

/**
 * Get port from environment and store in Express.
 */

var port = normalizePort(process.env.OPENSHIFT_NODEJS_PORT || '8080');
app.set('port', port);

/**
 * Create HTTP server.
 */

var server = http.createServer(app);

/**
 * Listen on provided port, on all network interfaces.
 */

server.listen(port);
server.on('error', onError);
server.on('listening', onListening);

/**
 * Normalize a port into a number, string, or false.
 */

function normalizePort(val) {
  var port = parseInt(val, 10);

  if (isNaN(port)) {
    // named pipe
    return val;
  }

  if (port >= 0) {
    // port number
    return port;
  }

  return false;
}

/**
 * Event listener for HTTP server "error" event.
 */

function onError(error) {
  if (error.syscall !== 'listen') {
    throw error;
  }

  var bind = typeof port === 'string'
    ? 'Pipe ' + port
    : 'Port ' + port;

  // handle specific listen errors with friendly messages
  switch (error.code) {
    case 'EACCES':
      console.error(bind + ' requires elevated privileges');
      process.exit(1);
      break;
    case 'EADDRINUSE':
      console.error(bind + ' is already in use');
      process.exit(1);
      break;
    default:
      throw error;
  }
}

/**
 * Event listener for HTTP server "listening" event.
 */

function onListening() {
  var addr = server.address();
  var bind = typeof addr === 'string'
    ? 'pipe ' + addr
    : 'port ' + addr.port;
  debug('Listening on ' + bind);
}

upgrading?

Thanks for releasing a new version. How would I upgrade my gear? I tried: oo-admin-upgrade upgrade-gear --app-name=node4 --upgrade-gear=gear-uid --login=user --version=1.0.0

Scaling doesn't work

I tried scaling to 3 gears and I only got a 503 error and haproxy reported that the localgear was in MAINT mode and the other 2 were DOWN.

Everything works fine on a single gear. What am i missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.