Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodejitsu deploy issue #455

Closed
yoshuawuyts opened this issue Jun 12, 2013 · 15 comments
Closed

Nodejitsu deploy issue #455

yoshuawuyts opened this issue Jun 12, 2013 · 15 comments

Comments

@yoshuawuyts
Copy link
Contributor

Everything's working correctly locally; I set my app to run on port 80 (according to the guide), defined the subdomains properly but when deploying to nodejitsu it doesn't run.

error:   Error running command logs app
error:   Nodejitsu Error (500): Internal Server Error
warn:    Error returned from Nodejitsu
error:   Error: socket hang up
error:       at createHangUpError (http.js:1344:15)
error:       at CleartextStream.socketCloseListener (http.js:1395:23)
error:       at CleartextStream.EventEmitter.emit (events.js:126:20)
error:       at SecurePair.destroy (tls.js:956:22)
error:       at process.startup.processNextTick.process._tickCallback (node.js:244:9)

I used sails new appname --template=jade to init my configuration. I only changed the variables described in the guide before trying to deploy.

I also remember getting something from the log that port 80 was already in use. Will try to change ports, see if that fixes my issues. Possibly socket.io conflicting with the server?

Note: the reason I didn't paste the log with the port 80 failure is because I cannot access my logs on nodejitsu anymore, if I somehow do get through I'll add it.

@yoshuawuyts
Copy link
Contributor Author

Bingo, caught the log. I changed from port 80 to port 1337, but the error was the same when it was still on 80.

info Wed, 12 Jun 2013 21:50:13 GMT info: socket.io started
error Wed, 12 Jun 2013 21:50:13 GMT error: Trying to start server on port 1337... 
error: But something else is already running on that port! 
error: Please disable the other server, or choose a different port, and try again. 
error Wed, 12 Jun 2013 21:50:13 GMT Warning: connection.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and obviously only work within a single process.
error Wed, 12 Jun 2013 21:50:11 GMT debug: Starting server in /opt/haibu/apps/yoshuawuyts/modedule2/package... 
error Wed, 12 Jun 2013 21:50:09 GMT error: Please disable the other server, or choose a different port, and try again. 
error Wed, 12 Jun 2013 21:50:09 GMT error: Trying to start server on port 1337... 
error: But something else is already running on that port! 
error Wed, 12 Jun 2013 21:50:09 GMT Warning: connection.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and obviously only work within a single process.
info Wed, 12 Jun 2013 21:50:09 GMT info: socket.io started
error Wed, 12 Jun 2013 21:50:08 GMT debug: Starting server in /opt/haibu/apps/yoshuawuyts/modedule2/package... 
error Wed, 12 Jun 2013 21:50:06 GMT error: Trying to start server on port 1337... 
error: But something else is already running on that port! 
error: Please disable the other server, or choose a different port, and try again. 

Next up: changing back to port 80 and trying node 10.x on nodejitsu (unsure if they support it yet).

EDIT: Eeeh, guess they still don't support 0.10.x.

@yoshuawuyts
Copy link
Contributor Author

@dcbartlett
Copy link
Contributor

This is strange, i know that's all i had to change when i created that documentation, perhaps they made a change on their end. I wish i could help more, but my account doesn't have a subscription, and my free trial ran out. I'll see if i can create a new account and test.

@yoshuawuyts
Copy link
Contributor Author

Much appreciated!

@dcbartlett
Copy link
Contributor

Can you share your package.json and config/application.js with me please.

@yoshuawuyts
Copy link
Contributor Author

package.json

{
    "name": "modedule2",
    "private": true,
    "version": "0.0.0-3",
    "description": "a Sails application",
    "dependencies": {
        "sails": "0.8.91",
        "optimist": "0.4.0"
    },
    "scripts": {
        "start": "sails lift",
        "debug": "node debug app.js"
    },
    "main": "app.js",
    "repository": "",
    "author": "",
    "subdomain": "modedule2",
    "engines": {
        "node": "0.8.x"
    }
}

config/application.js

module.exports = {

    // Name of the application (used as default <title>)
    appName: "Modedule",

    // Port this Sails application will live on
    port: 80,
    subdomain: 'modedule2.jit.su',

    // The environment the app is deployed in 
    // (`development` or `production`)
    //
    // In `production` mode, all css and js are bundled up and minified
    // And your views and templates are cached in-memory.  Gzip is also used.
    // The downside?  Harder to debug, and the server takes longer to start.
    environment: 'development',

    // Logger
    // Valid `level` configs:
    // 
    // - error
    // - warn
    // - debug
    // - info
    // - verbose
    //
    log: {
        level: 'info'
    }

};

@dcbartlett
Copy link
Contributor

Yup, definately don't see anything funky there that should cause it to fail.

Are you by chance already running another nodejitsu instance on the account? But you said you changed the port and still had the issue. Hum. Try changing environment to production, although this shouldn't effect anything, i'm just curious.

@dcbartlett
Copy link
Contributor

Also, switch over to verbose output and maybe it will toss something useful out for us to see.

@dcbartlett
Copy link
Contributor

OK, i've gotten my app to build on nodejitsu by following the guide. i didn't do anything outside of the guide.

here is my config/application.js

module.exports = {

    // Name of the application (used as default <title>)
    appName: 'Sails Application',

    // Port this Sails application will live on
    port: 80,
    host: 'dcbartlett-test.jit.su',

    // The environment the app is deployed in 
    // (`development` or `production`)
    //
    // In `production` mode, all css and js are bundled up and minified
    // And your views and templates are cached in-memory.  Gzip is also used.
    // The downside?  Harder to debug, and the server takes longer to start.
    environment: 'development',

    // Logger
    // Valid `level` configs:
    // 
    // - error
    // - warn
    // - debug
    // - info
    // - verbose
    //
    log: {
        level: 'info'
    }

};

This is the package.json that jitsu deploy created.

{
    "name": "test",
    "private": true,
    "version": "0.0.0-5",
    "description": "a Sails application",
    "dependencies": {
        "sails": "0.8.91",
        "optimist": "0.4.0"
    },
    "scripts": {
        "start": "node app.js",
        "debug": "node debug app.js"
    },
    "main": "app.js",
    "repository": "",
    "author": "",
    "license": "MIT",
    "subdomain": "dcbartlett-test",
    "engines": {
        "node": "0.8.x"
    }
}

@dcbartlett
Copy link
Contributor

ok, i even did a complete fresh install of sails from npm. The only difference i see between your code and mine is that your package.json uses

"scripts": {
    "start": "sails lift",
    "debug": "node debug app.js"
},

whereas mine uses

"scripts": {
    "start": "node app.js",
    "debug": "node debug app.js"
},

In fact, when i changed mine to 'sails lift' to test if it was that, nodejitsu gave me this.

nfo:    Starting app test
error:   Error running command deploy
error:   Nodejitsu Error (500): Internal Server Error
error:   There was an error while attempting to deploy the app
error:   
error:   package.json error: can't find starting script: sails lift
error:   Package.json start script declared but not found
error:   
error:   This type of error is usually a user error.
error:   Error output from Haibu:
error:   
error:   Error: package.json error: can't find starting script: sails lift
error:       at Spawner.spawn (/root/haibu-orchestra/node_modules/haibu/lib/haibu/core/spawner.js:232:17)
error:       at Object.oncomplete (fs.js:297:15)

So, in short, i'm not really sure whats going on on your end.

@yoshuawuyts
Copy link
Contributor Author

Started a fesh intance, noticed that I skipped a step. Forgot to edit the local.js file:

// Local configuration
// 
// Included in the .gitignore by default,
// this is where you include configuration overrides for your local system
// or for a production deployment.
//
// For example, to use port 80 on the local machine, override the `port` config

module.exports.port = 80;
module.exports.environment = 'production';

All is well now, thanks!

@dcbartlett
Copy link
Contributor

technically for deploying to nodejitsu, you don't need to do all of the deployment guide. Only the part in the nodejitsu section, but i'm glad its working for you now.

@yoshuawuyts
Copy link
Contributor Author

Yeah, apparently I wasn't the only one that made a mistake deploying. I'll try to see if I can git diff the changes.

@yoshuawuyts
Copy link
Contributor Author

When removing from config/application.js:

    host: 'puthostnamehere.jit.su', 

I recreated the exact same error.

Cheers!

@dcbartlett
Copy link
Contributor

Yeah, Host is needed as it locks the sails host to the host name that nodejitsu will use for the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants