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

Can't seem to create new profile #195

Open
youradds opened this issue Dec 14, 2016 · 29 comments
Open

Can't seem to create new profile #195

youradds opened this issue Dec 14, 2016 · 29 comments

Comments

@youradds
Copy link

Hi,

I'm trying to set this up on my server. I've got all the dependencies (as far as I'm aware) installed, but I still get an error when trying to init a new profile:

root@steampunklinode:~/thisdomain# sudo oauthd init
oauthd> What will be the name of your oauthd instance?>  thisdomain
oauthd> Do you want to install default plugins?  (Y|n)>  (Y) Y
Generating a folder for thisdomain
Cloning https://github.com/oauth-io/oauthd-admin-auth
Plugin admin-auth successfully installed in "/root/thisdomain/thisdomain/plugins/admin-auth".
Plugin admin-auth successfully activated.
Cloning https://github.com/oauth-io/oauthd-slashme
Plugin slashme successfully installed in "/root/thisdomain/thisdomain/plugins/slashme".
Plugin slashme successfully activated.
Cloning https://github.com/oauth-io/oauthd-request
Plugin request successfully installed in "/root/thisdomain/thisdomain/plugins/request".
Plugin request successfully activated.
Cloning https://github.com/oauth-io/oauthd-front
Plugin front successfully installed in "/root/thisdomain/thisdomain/plugins/front".
Plugin front successfully activated.
Running npm install and grunt. Please wait, this might take up to a few minutes.
Error running command "cd thisdomain && npm install && $(npm bin)/grunt".
{ [Error: Command failed: /usr/bin/env: node: No such file or directory
] killed: false, code: 127, signal: null }

Could someone please explain to me what that error means? (apologies for posting here, but I couldn't find a forum to ask my question)

Thanks

Andy

@youradds
Copy link
Author

Never mind - managed to get past that bit by doing a symlink:

ln -s /usr/bin/nodejs /usr/bin/node

However, I now get another error (and I can't find anything on google about it);

root@steampunklinode:~/thisdomain/thisdomain# oauthd start
No auth plugin found
You need to install an auth plugin to run the server

@youradds
Copy link
Author

Ok - so I got past that step. The problem was that I was running an incomplete install (it had a sub-folder inside it, that was a duplicate)

So now I have that going - I'm trying to access the admin panel. For some reason I just get a blank page:

<!DOCTYPE html>
<html  lang="en" ng-app="oauthd" ng-csp="">
	<head>
		<title>oauthd Administration</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="/style/main.css">
        <link rel="stylesheet" href="/libs/selectize/0.9.1/css/selectize.css">
    	<link rel="stylesheet" href="/libs/selectize/0.9.1/css/selectize.default.css">
    	<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
	</head>
	<body>

        <div ui-view></div>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
		<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script>
        <script src="/libs/bootstrap-3.1.1/js/bootstrap.js"></script>
		<script src="/libs/angular-ui-router.min.js"></script>
		<script src="/libs/angular-ui-bootstrap/ui-bootstrap-tpls-0.11.2.min.js"></script>
		<script src="/libs/oauth.js"></script>
		<script src="/libs/amplify.js"></script>
        <script src="/libs/selectize.js"></script>
		<script src="/src/app.js"></script>
	</body>
</html>

I have it running:

root@steampunklinode:~/steampunkjunkies# oauthd start
oauthd start server
oauthd listening at http://127.0.0.1:6284 for https://mydomain.net
Server is ready (load time: 1.72s) Wed, 14 Dec 2016 16:19:57 GMT

Also, while I'm here. This command DOES start the process, but it means a terminal would need to be running all the time. Can we use something like `nohup` to run it in the background? (I would need to also edit my service scripts, to make sure its currently running - and restart if anything crashes)

Thanks

@thyb
Copy link
Contributor

thyb commented Dec 14, 2016

For the blank page, do you have any logs/errors in the chrome inspector ?

@youradds
Copy link
Author

Hi,

Thanks for the reply, I sure do - a ton of them:

NetworkError: 404 Not Found - https://mysite.net/libs/bootstrap-3.1.1/js/bootstrap.js"
bootstrap.js
"NetworkError: 404 Not Found - https://mysite.net/libs/selectize/0.9.1/css/selectize.css"
selectize.css
"NetworkError: 404 Not Found - https://mysite.net/style/main.css"
main.css
"NetworkError: 404 Not Found - https://mysite.net/libs/selectize/0.9.1/css/selectize.default.css"
selecti...ult.css
"NetworkError: 404 Not Found - https://mysite.net/libs/selectize.js"
selectize.js
"NetworkError: 404 Not Found - https://mysite.net/libs/angular-ui-router.min.js"
angular....min.js
"NetworkError: 404 Not Found - https://mysite.net/libs/amplify.js"
amplify.js
"NetworkError: 404 Not Found - https://mysite.net/libs/oauth.js"
oauth.js
"NetworkError: 404 Not Found - https://mysite.net/libs/angular-ui-bootstrap/ui-bootstrap-tpls-0.11.2.min.js"
ui-boot....min.js
"NetworkError: 404 Not Found - https://mysite.net/src/app.js"
app.js
"NetworkError: 404 Not Found - https://mysite.net/libs/bootstrap-3.1.1/js/bootstrap.js"
bootstrap.js
"NetworkError: 404 Not Found - https://mysite.net/libs/angular-ui-router.min.js"
angular....min.js
"NetworkError: 404 Not Found - https://mysite.net/libs/angular-ui-bootstrap/ui-bootstrap-tpls-0.11.2.min.js"
ui-boot....min.js
"NetworkError: 404 Not Found - https://mysite.net/libs/oauth.js"
oauth.js
"NetworkError: 404 Not Found - https://mysite.net/libs/amplify.js"
amplify.js
"NetworkError: 404 Not Found - https://mysite.net/libs/selectize.js"
selectize.js
"NetworkError: 404 Not Found - https://mysite.net/src/app.js"
app.js
Error: [$injector:modulerr] http://errors.angularjs.org/1.2.22/$injector/modulerr?p0=oauthd&p1=%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.2.22%2F%24injector%2Fnomod%3Fp0%3Doauthd%0Aw%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A6%3A450%0AZc%2Fb.module%3C%2F%3C%2Fb%5Be%5D%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A20%3A391%0AZc%2Fb.module%3C%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A20%3A292%0Ae%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A33%3A208%0Ar%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A7%3A288%0Ae%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A33%3A148%0Agc%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A36%3A252%0Afc%2Fc%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A18%3A60%0Afc%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A18%3A277%0AXc%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A17%3A362%0A%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.22%2Fangular.min.js%3A214%3A78%0An.Callbacks%2Fj%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F2.1.1%2Fjquery.min.js%3A2%3A26855%0An.Callbacks%2Fk.fireWith%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F2.1.1%2Fjquery.min.js%3A2%3A27673%0A.ready%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F2.1.1%2Fjquery.min.js%3A2%3A29465%0AI%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F2.1.1%2Fjquery.min.js%3A2%3A29656%0A

My config file looks like:

var local_config = {
	// Here you can override any configuration field that is specifig to a local machine.
	// The config.local.js is git ignored.
        host_url:   'https://mysite.net',
        base:        "/oauth",
        base_api: 	"/oauth/api",
        port:         6284,
        bind:         '127.0.0.1'
};


module.exports = local_config;

Does that look OK?

It appears the paths are missing /oauth from them:

https://mydomain.net/libs/bootstrap-3.1.1/js/bootstrap.js

..but if I manually try and load this file, it just loads the blank admin page again:

https://mydomain.net/oauth/libs/bootstrap-3.1.1/js/bootstrap.js

Thanks!

@thyb
Copy link
Contributor

thyb commented Dec 14, 2016

This kind of issue is often due to a configuration mistake.

base is used for the public endpoint /auth (base + '/auth*') but not for the frontend. base_api does not exists

We advise to use oauthd on a subdomain at the root, e.g. https://oauth.mysite.net/ or setup the mounted url (/oauth) behind a reverse proxy on nginx or apache (in which case the host_url would be https://mysite.net/oauth)

You also have an issue with the port and host_url that does not match (either use port 443 or host_url like https://mysite.net:6284)

@youradds
Copy link
Author

Thanks. I'm actually on a reverse proxy with nginx, so I have this in my nginx config:

    location /oauth {
        satisfy any;
        allow  my.ip.here;
        deny   all;
        auth_basic "Administrator Login";
        auth_basic_user_file /srv/www/mysite.net/htpasswd;
        proxy_pass http://127.0.0.1:6284;
    }

Then this in config.local.js:

var local_config = {
	// Here you can override any configuration field that is specifig to a local machine.
	// The config.local.js is git ignored.
        host_url:   'https://mysite.net',
        base:        "/oauth",
        base_api: 	"/oauth/api",
        port:         6284,
        bind:         '127.0.0.1'
};

module.exports = local_config;

Are you suggesting something more like:

var local_config = {
	// Here you can override any configuration field that is specifig to a local machine.
	// The config.local.js is git ignored.
        host_url:   'https://mysite.net/oauth',
        base:        "/oauth",
        base_api: 	"/oauth/api",
        port:         443,
        bind:         '127.0.0.1'
};

module.exports = local_config;

I tried that, but I get an error:

root@steampunklinode:~/steampunkjunkies# oauthd start
oauthd start server

Error: listen EADDRINUSE
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1042:14)
    at listen (net.js:1064:10)
    at net.js:1146:9
    at dns.js:72:18
    at process._tickDomainCallback (node.js:463:13)

Not too sure what that is telling me though :)

Cheers

Andy

@bumpmann
Copy link
Contributor

bumpmann commented Dec 14, 2016

i guess you can just use

var local_config = {
	// Here you can override any configuration field that is specific to a local machine.
	// The config.local.js is git ignored.
        host_url:   'https://mysite.net/oauth',
        port:         6284,
        bind:         '127.0.0.1'
};

Edit: i m not sure there's a base mount for the current front, i ll check it but this should be easier with a subdomain to keep the root path

@thyb
Copy link
Contributor

thyb commented Dec 14, 2016

hm after more check, we discovered it wasn't working with custom path like mysite.net/oauth, you need a full domain as mysite.net or oauth.mysite.net. The libraries in the front are referenced using /lib/... directly so it fails to load the right file when routed on a path like /oauth.

So, currently, host_url like https://mysite.net/oauth is not yet supported. PR are welcomed ! It would require some changes in https://github.com/oauth-io/oauthd-front.

@youradds
Copy link
Author

Thanks. That seems to work :) It took a bit of configuring, as I had to re-create our SSL certificates using LetsEncrypt (as it was obviously a new sub-domain). It all loads OK now though

The next question, is how I get it running as a service? This works:

cd /root/mydomain && oauthd start

But it just sits there telling me its running. How do I tell it to run as a background server? I also have a little bash script I wrote, which checks nginx/mysql/solr etc are running. Any suggestions on how to also check for the oauthd process running?

Thanks :)

for i in "${arr[@]}"
do
   echo "Checking $i"
        if (( $(ps -ef | grep -v grep | grep $i | wc -l) > 0 ))
        then
        echo "$i is running!!!"
        else
        echo "service $i start\n"
        service $i start
        service $i restart # do this just in case! bloody thing
        fi
done

# re-run, but this time do a restart if its still not going!
for i in "${arr[@]}"
do
   echo "Checking $i"
        if (( $(ps -ef | grep -v grep | grep $i | wc -l) > 0 ))
        then
        echo "$i is running!!!"
        else
        service $i restart
        fi
done



@bumpmann
Copy link
Contributor

I did not fully tested this script but you can npm install -g forever and copy and tweak this script in /etc/init.d/oauthd to make it a daemon.

#!/bin/sh

### BEGIN INIT INFO
# Provides:	  oauthd
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the oauthd server
# Description:       starts oauthd using forever
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nginx
NAME=oauthd
DESC=oauthd
INSTANCE=/home/myinstance
OAUTHD=/usr/local/lib/node_modules/oauthd/cli/index.js

case "$1" in
	start)
		cd $INSTANCE && forever start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD
		;;
	stop)
		cd $INSTANCE && forever stop $OAUTHD
		;;
	restart)
		cd $INSTANCE && forever restart -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 --killSignal=SIGUSR2 $OAUTHD || forever start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD
		;;
	status)
		forever list
		;;
	reload|force-reload)
		echo "Use $NAME restart instead" >&2
		exit 3
		;;
	*)
		echo "Usage: $NAME {start|stop|restart|reload|force-reload|status}" >&2
		exit 3
		;;
esac

@youradds
Copy link
Author

youradds commented Dec 25, 2016

Hi,

Sorry for the late reply. Paid jobs took over, and I didn't feel like doing any bits on my own stuff after a long day :)

I tried installing forever, but I'm not sure if this actually installed properly?

I did find this post: foreversd/forever#788

My NPM version is coming up as 1.4.21 ... maybe thats too old? I only installed it using apt-get:

sudo apt-get install npm

I then set that script up in /etc/init.d/oauthd , with the contents:

#!/bin/sh

### BEGIN INIT INFO
# Provides:       oauthd
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the oauthd server
# Description:       starts oauthd using forever
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nginx
NAME=oauthd
DESC=oauthd
INSTANCE=/root/steampunkjunkies
OAUTHD=/usr/local/lib/node_modules/oauthd/cli/index.js

case "$1" in
        start)
                cd $INSTANCE && forever start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD
                ;;
        stop)
                cd $INSTANCE && forever stop $OAUTHD
                ;;
        restart)
                cd $INSTANCE && forever restart -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 --killSignal=SIGUSR2 $OAUTHD || forever start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinS$
                ;;
        status)
                forever list
                ;;
        reload|force-reload)
                echo "Use $NAME restart instead" >&2
                exit 3
                ;;
        *)
                echo "Usage: $NAME {start|stop|restart|reload|force-reload|status}" >&2
                exit 3
                ;;
esac

...and then trying to start it with:

service oauthd start

I get an error though:

Failed to start oauthd.service: Unit oauthd.service failed to load: No such file or directory

Am I missing something? This is the first time I've created a daemon script before, so its possible I'm being dumb :)

BTW, Merry Christmas to you and your family. Thanks for everything you all do on this awesome project 👍

@bumpmann
Copy link
Contributor

I used the old way where you can run it directly with (sudo) /etc/init.d/oauthd start (all scripts in init.d will run with start at boot time). Thanks and merry christmas 🎄

@youradds
Copy link
Author

Thanks. Doesn't seem to want to work for me though?

root@steampunklinode:~# sudo /etc/init.d/oauthd start
sudo: /etc/init.d/oauthd: command not found

I double checked, and /etc/init.d/oauthd is where the file is :/

@bumpmann
Copy link
Contributor

maybe sudo chmod 700 /etc/init.d/oauthd before ?

@youradds
Copy link
Author

Ah, that was it :) It appears that "forever" didn't install correctly though:

info:    Forever processing file: /usr/local/lib/node_modules/oauthd/cli/index.js
error:   Cannot start forever
error:   script /usr/local/lib/node_modules/oauthd/cli/index.js does not exist.

It seems to be installed though:

forever --version    
v0.15.3

Not quite sure what to make of that!

@bumpmann
Copy link
Contributor

that was for a global install on my machine but it can be different on yours.

(cd $(dirname $(readlink -e $(whereis oauthd)))/bin/cli && pwd) should give you where the index.js is.

(thinking at it, maybe that's only missing "bin" in your path (...../oauthd/bin/cli/index.js)

@youradds
Copy link
Author

Ahhh that was it ! I now get:

root@steampunklinode:~# sudo /etc/init.d/oauthd start
info:    Forever processing file: /usr/local/lib/node_modules/oauthd/bin/cli/index.js

Unfortunately, I don't seem to be able to access the admin area (or any other functions) ... almost like its not running. Is there a way to check which ones are currently running?

Thanks!

@bumpmann
Copy link
Contributor

You can either check logs (~/.forever/forever.log by default and out.log / err.log) or run oauthd start in your instance without forever to check the logs.

Did you configure the redis server and had no error when creating the instance ? (https://github.com/oauth-io/oauthd/wiki/Quickstart)

@youradds
Copy link
Author

It all boots up fine when running it manually:

root@steampunklinode:~# cd /root/steampunkjunkies/ && oauthd start
oauthd start server
oauthd listening at http://127.0.0.1:6284 for https://oauth.steampunkjunkies.net
Server is ready (load time: 2.55s) Mon, 26 Dec 2016 11:19:46 GMT

I can then access the web-admin section.

The log file has something interesting, but I'm not really sure what it means :)

error: Script restart attempt #238
Usage: oauthd <command> [arguments]

Available commands
    oauthd init					Initializes a new oauthd instance
    oauthd start				Starts an oauthd instance
    oauthd plugins <command> [arguments]	Starts an oauthd instance

oauthd <command> --help for more information about a specific command
error: Forever detected script exited with code: 0
error: Script restart attempt #22
Usage: oauthd <command> [arguments]

@bumpmann
Copy link
Contributor

Ah, my bad, i adapted from another script and forgot the start at the end:

...
case "$1" in
        start)
                cd $INSTANCE && forever start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD start
                ;;
...

@youradds
Copy link
Author

Hi,

We are getting there :) That now boots, but in out.log, I get:

No config file found, using defaults

(the admin panel also doesn't load)

Cheers

Andy

@bumpmann
Copy link
Contributor

Did you change config.js since your test with oauthd start ? the only reasons i can see from (https://github.com/oauth-io/oauthd/blob/master/config.js#L35) would be an error from the instance's config.js or running it ouside the instance.

@youradds
Copy link
Author

Yeah - I tweaked it to:

var local_config = {
	// Here you can override any configuration field that is specifig to a local machine.
	// The config.local.js is git ignored.
        host_url:   'https://oauth.steampunkjunkies.net',
        base:        "/",
        base_api: "/api",
        port:         6284,
        bind:         '127.0.0.1'
};

module.exports = local_config;

That looks ok though, doesn't it? Also, the fact it also boots up fine when I do:

cd /root/steampunkjunkies/ && oauthd start

BTW, just noticed a typo in the comment:

specifig

I'm assuming thats in the dist version? :)

bumpmann added a commit that referenced this issue Dec 27, 2016
@bumpmann
Copy link
Contributor

Indeed that looks fine...

I ll do some tries a little later, until then you can also try with --workingDir instead of cd: forever start --workingDir $INSTANCE -l forever.log ....

@youradds
Copy link
Author

Yay - that seems to have done it :) For anyone reading this at a later time, I changed:

cd $INSTANCE && forever start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD start

to:

forever --workingDir $INSTANCE start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD start

Then spun it up using:

sudo /etc/init.d/oauthd start

I'm not sure why the other command failed, but it seems good now

Thanks for sticking at it 🥇

@bumpmann
Copy link
Contributor

Glad that you finally made it works 👍

@youradds
Copy link
Author

I'm coming back to this post again, as I'm moving servers. I'm trying to get it going with:

nano /etc/init.d/oauthd

Contents are:

#!/bin/sh

### BEGIN INIT INFO
# Provides:       oauthd
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the oauthd server
# Description:       starts oauthd using forever
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nginx
NAME=oauthd
DESC=oauthd
#INSTANCE=/root/steampunkjunkies
#OAUTHD=/usr/local/lib/node_modules/oauthd/cli/index.js
INSTANCE=/usr/local/lib/node_modules/oauthd/steampunkjunkies
OAUTHD=/usr/local/lib/node_modules/oauthd/index.js

case "$1" in
        start)
#                cd $INSTANCE && forever start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD start
                forever --workingDir $INSTANCE start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD start
                echo "forever --workingDir $INSTANCE start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 $OAUTHD start"
                ;;
        stop)
                cd $INSTANCE && forever stop $OAUTHD
                ;;
        restart)
                cd $INSTANCE && forever restart -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 --killSignal=SIGUSR2 $OAUTHD || forever start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinS$
                ;;
        status)
                forever list
                ;;
        reload|force-reload)
                echo "Use $NAME restart instead" >&2
                exit 3
                ;;
        *)
                echo "Usage: $NAME {start|stop|restart|reload|force-reload|status}" >&2
                exit 3
                ;;
esac

I then run it with:

/etc/init.d/oauthd start

but in forever.log, I get:

error: Forever detected script exited with code: 0
error: Script restart attempt #1
error: Forever detected script exited with code: 0
error: Script restart attempt #2

I added some debugging in, and its running this process:

forever --workingDir /usr/local/lib/node_modules/oauthd/steampunkjunkies start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 /usr/local/lib/node_modules/oauthd/index.js start

When I run that manually I get:

forever --workingDir /usr/local/lib/node_modules/oauthd/steampunkjunkies start -l forever.log -a -o out.log -e err.log --minUptime 3000 --spinSleepTime 5000 /usr/local/lib/node_modules/oauthd/index.js start
info: Forever processing file: /usr/local/lib/node_modules/oauthd/index.js

If I try and start it manually it works ok:

root@admin:/usr/local/lib/node_modules/oauthd/steampunkjunkies# oauthd start
oauthd start server
oauthd listening at http://[::]:6284 for http://localhost:6284
Server is ready (load time: 5.06s) Thu, 27 Jul 2017 14:43:43 GMT
^X^C

The directory looks like:

cd /usr/local/lib/node_modules/oauthd/
root@admin:/usr/local/lib/node_modules/oauthd# ls -lh
total 56K
drwxr-xr-x   7 nobody root 4.0K Jul 26 10:24 bin
-rw-r--r--   1 nobody root 1.1K Nov 18  2016 config.js
-rw-r--r--   1 nobody root   41 Nov  3  2014 index.js
-rw-r--r--   1 nobody root  12K Nov  3  2014 LICENSE
drwxr-xr-x 202 root   root 4.0K Jul 26 10:25 node_modules
-rw-r--r--   1 nobody root   84 Nov 18  2016 NOTICE
-rwxr-xr-x   1 nobody root  103 Nov  3  2014 oauthd
-rw-r--r--   1 root   root 2.8K Jul 26 10:24 package.json
drwxr-xr-x 151 nobody root 4.0K Jul 26 10:24 providers
-rw-r--r--   1 nobody root 4.7K Dec 14  2016 README.md
drwxr-xr-x   4 root   root 4.0K Jul 27 14:43 steampunkjunkies

I assume I'm calling the right index.js?

I can't work out why the "forever" version won't work. Any ideas?

@youradds
Copy link
Author

Anyone? I'm still not able to move servers due to this issue :(

Cheers

Andy

@youradds
Copy link
Author

youradds commented Feb 8, 2018

Eugh man, finally got this one !!!

The old server it was:

OAUTHD=/usr/local/lib/node_modules/oauthd/index.js

The new one that path is different:

OAUTHD=/usr/local/lib/node_modules/oauthd/bin/cli/index.js

Hopefully that helps someone in the future!

Andy

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

3 participants