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

Small mistake in README ? #4

Open
udiedrichsen opened this issue Jan 28, 2016 · 6 comments
Open

Small mistake in README ? #4

udiedrichsen opened this issue Jan 28, 2016 · 6 comments

Comments

@udiedrichsen
Copy link

Hi,

Great job with this REPO. Good stuff and awesome docs: +1

I followed your description, but is a small typo:

cp src/config.sample.js src/config.js

I think it must be:
cp src/config.sample.js src/config

Or you have to change to src code:
in src/auth/jwt_strategy.js
..
var Config = require('../config'),

to
var Config = require('../config.js'),

I change the cp statement and the deployment on my own openshift domain works.

I got this error message:
remote: Application 'mysnowflake' failed to start (port 8080 not available)
remote: -------------------------
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 56aa11597628e1102100001b (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/56aa11597628e1102100001b/nodej
remote: #IO:0x00000001445290
remote: #IO:0x00000001445218
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed

So I checked the app logs with: rhc tail -a mysnowflake

RSA 1024 bit CA certificates are loaded due to old openssl compatibility
==> app-root/logs/haproxy.log <==
[WARNING] 027/080641 (292020) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 027/080641 (292020) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 027/081740 (292020) : Stopping proxy stats in 0 ms.
[WARNING] 027/081740 (292020) : Stopping proxy express in 0 ms.
[WARNING] 027/081740 (292020) : Proxy stats stopped (FE: 1 conns, BE: 0 conns).
[WARNING] 027/081740 (292020) : Proxy express stopped (FE: 4 conns, BE: 5 conns).
[WARNING] 027/081740 (334524) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 027/081740 (334524) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 027/082720 (334524) : Server express/local-gear is DOWN for maintenance.
[ALERT] 027/082720 (334524) : proxy 'express' has no server available!

==> app-root/logs/haproxy_ctld.log <==

@bartonhammond
Copy link
Owner

@udiedrichsen Thanks for the complement!

The cp src/config.sample.js src/config.js is correct. When a require is used for a JS file, the extension .js is assumed and is not necessary. So var Config = require('../config') is working as designed.

As to the failure on Openshift, what you can do is

rhc ssh mysnowflake
...
cd app-root/logs/ 
less nodejs.log (or whatever tool you prefer)

The nodejs.log will contain the error - it's the best source for determining what goes wrong when the app fails to start as it's the same log you see when running locally.

But I do see the following from your notes:

[WARNING] 027/082720 (334524) : Server express/local-gear is DOWN for maintenance.

You might want to just the following again

git push origin master

Let me know if you have problems.

@udiedrichsen
Copy link
Author

Thx for the fast feedback. Sorry I copied only a part of the console err log :-(

Ulrichs-MacBook-Pro:mysnowflake doedel$ rhc tail -a mysnowflake
RSA 1024 bit CA certificates are loaded due to old openssl compatibility
==> app-root/logs/haproxy.log <==
[WARNING] 027/080641 (292020) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 027/080641 (292020) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 027/081740 (292020) : Stopping proxy stats in 0 ms.
[WARNING] 027/081740 (292020) : Stopping proxy express in 0 ms.
[WARNING] 027/081740 (292020) : Proxy stats stopped (FE: 1 conns, BE: 0 conns).
[WARNING] 027/081740 (292020) : Proxy express stopped (FE: 4 conns, BE: 5 conns).
[WARNING] 027/081740 (334524) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 027/081740 (334524) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 027/082720 (334524) : Server express/local-gear is DOWN for maintenance.
[ALERT] 027/082720 (334524) : proxy 'express' has no server available!

==> app-root/logs/haproxy_ctld.log <==
I, [2016-01-28T08:06:45.030771 #287981] INFO -- : Starting haproxy_ctld

==> app-root/logs/nodejs.log <==
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (/var/lib/openshift/56aa11597628e1102100001b/app-root/runtime/repo/src/auth/jwt-strategy.js:15:15)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
DEBUG: Program node server.js exited with code 1
DEBUG: Starting child process with 'node server.js'
module.js:339
throw err;
^
Error: Cannot find module '../config'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (/var/lib/openshift/56aa11597628e1102100001b/app-root/runtime/repo/src/auth/jwt-strategy.js:15:15)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
DEBUG: Program node server.js exited with code 1
DEBUG: Starting child process with 'node server.js'
module.js:339
throw err;

@udiedrichsen
Copy link
Author

After changing the filename from config.js to config, it works for me.
Maybe my openshift app is different.

@bartonhammond
Copy link
Owner

You must have changed something else somewhere.

You'll notice throughout the entire application the extension js is never used and that is the standard.

In fact, look at jwt-strategy.js and a couple of lines down is

redisClient = require('../database/redis')

and there is no js extension there either.

@udiedrichsen
Copy link
Author

No, I just followed step by step your instructions.
Yes, you are right with then js extension. Its also for me me strange, but the error message
from openshift was clear and after changing the file without the js it works.

But openshift and react native is more or less for me, so big thx for this great introduction.
Its a very good stack. I like very much the effort you took to provided a excellent test-suite.

I will try to setup a new openshift app with your instruction, maybe I will find my mistake.
Again, thx for the both repos and the support!

@bartonhammond
Copy link
Owner

Well - keep me posted - I don't see any evidence that the instructions or code is wrong. I've deployed this app a significant number of times w/o issue.

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

No branches or pull requests

2 participants