tableflip / guvnor

A node process manager that isn't spanners all the way down
MIT License
430 stars 37 forks source link

[Question] Okay seriously, how do I get to the web interface? #40

Closed paambaati closed 9 years ago

paambaati commented 9 years ago

I've followed all the steps on the docs, and after configuring and running guv-web, I only get a JSON response like this when I visit the web URL (https://localhost:<port>/).

{
    "method": "methods",
    "arguments": [
        {
            "findProcessInfoById": "[Function]",
            "getServerStatus": "[Function]",
            "listProcesses": "[Function]",
            "deployApplication": "[Function]",
            "removeApplication": "[Function]",
            "listApplications": "[Function]",
            "switchApplicationRef": "[Function]",
            "listApplicationRefs": "[Function]",
            "updateApplicationRefs": "[Function]",
            "startProcess": "[Function]",
            "removeProcess": "[Function]",
            "_connectToProcess": "[Function]",
            "getDetails": "[Function]"
        }
    ],
    "callbacks": {
        "7yl5gZ-xO": [
            "0",
            "findProcessInfoById"
        ],
        "Qy-9gWbxu": [
            "0",
            "getServerStatus"
        ],
        "XkMqeWblu": [
            "0",
            "listProcesses"
        ],
        "7yQcgZWxu": [
            "0",
            "deployApplication"
        ],
        "mk4cxZbg_": [
            "0",
            "removeApplication"
        ],
        "7yrcx-WeO": [
            "0",
            "listApplications"
        ],
        "XyI9gb-gu": [
            "0",
            "switchApplicationRef"
        ],
        "myv9xZbxd": [
            "0",
            "listApplicationRefs"
        ],
        "7J_9xb-l_": [
            "0",
            "updateApplicationRefs"
        ],
        "XJY9gZbxu": [
            "0",
            "startProcess"
        ],
        "mk5cgWbeu": [
            "0",
            "removeProcess"
        ],
        "7ko9xWWe_": [
            "0",
            "_connectToProcess"
        ],
        "Qkn9gbZld": [
            "0",
            "getDetails"
        ]
    },
    "links": []
}

Am I missing something?

achingbrain commented 9 years ago

What port are you using? Looks like you've connected to dnode with the web browser.

By default the guv-web interface listens on http://localhost:3000

paambaati commented 9 years ago

I copied the config in the example, so I connected to 57483.

achingbrain commented 9 years ago

Aah, right no - the web monitor config is in a different file.

FWIW, you don't need to create any config files unless you want to override some settings. Even then you only need to specify the properties you want to change.

E.g. if I wanted to change the http port to 4000 and https port to 4001, I'd create ~/.config/guvnor/guvnor-web and it would contain only:

[http]
port = 4000

[https]
port = 4001

Everything else would be taken from the default config file which is bundled with the app.

paambaati commented 9 years ago

Aha, my bad! I feel like the documentation should be a little more clear about this, and the difference between the two. Can I send a PR with changes? If yes, anything specific I should keep in mind?

paambaati commented 9 years ago

To add, more confusion! My app runs on port 3000, behind nginx. And I have a custom name for the site, website.dev, that is mapped to localhost:3000 via dnsmasq on OS X.

Now after I fixed the above port number issue (by setting port to 5000 under [https]), when I try to access http://website.dev or http://localhost:3000, it redirects me to whatever domain I type, but with :5000 appended to it.

achingbrain commented 9 years ago

Yes please to a PR - I wrote the docs but I'm in too deep - it'd be nice to see stuff from a newcomer's point of view.

By default guv-web runs from an HTTPS server on port 3001. It also starts a plain HTTP server on port 3000 that upgrades the user to https and redirects them to port 3001 on the same host (which is the redirect to :5000 you are seeing above).

Since you're running nginx you can either:

  1. Get nginx to proxy HTTP to port 3000 and HTTPS to port 3001 and let guv-web handle the redirect from HTTP to HTTPS
  2. Configure nginx to do the upgrade/redirect (if desired) and also proxy HTTPS to port 3001
  3. Get nginx to do HTTPS termination and serve guv-web over HTTP proxy. E.g. HTTPS from your browser to nginx, then HTTP over loopback from nginx to guv-web.
  4. is the default behaviour. To do 2, no extra guvnor config is necessary as if you access port 3001 directly, you arrive at the HTTPS server. You probably want to reconfigure the HTTP port though, to prevent a conflict with your app.

To do 3, disable HTTPS in your ~/.config/guvnor/guvnor-web file with:

[https]
enabled = false

This will then serve guv-web over HTTP only and not perform a redirect.

When HTTPS is enabled, guv-web will auto-generate an SSL certificate when you start it up if one is not configured. Self signed certificates are not fantastic but I think it's better than accessing it over HTTP.

paambaati commented 9 years ago

Alright I made those changes, but guv list still shows the guv-web process as starting. I checked the logs and here's what I found.

{"level":"error","message":"\u001b[31mNo password salt was found in the guvnor-web config file!\u001b[39m","timestamp":"2015-02-26T07:00:16.292Z"}
{"level":"error","message":"\u001b[31mPlease run\u001b[39m bs-web gensalt \u001b[31mand follow the instructions\u001b[39m","timestamp":"2015-02-26T07:00:16.293Z"}

Now I ran the command guv-web gensalt (note that the log still says bs-web and not guv-web like it should) and it says -

Passwords for all users will need to be reset!

What does the output mean?

achingbrain commented 9 years ago

Do you have a salt entry in ~/.config/guvnor/guvnor-web?

paambaati commented 9 years ago

I do. The file looks like this.

salt=$2a$10$M3qqqU7ZF5jEN32AG8PC5O

[https]
enabled=false
port=5000
achingbrain commented 9 years ago

According to guv list, what user are you running guv-web as?

paambaati commented 9 years ago

I'm running it as root. All the config files that we've talked about are in /etc/guvnor instead of ~/.config/guvnor. Could that be the problem?

achingbrain commented 9 years ago

Yeah, that'd do it - you should put the guv-web config files in $HOME/.config/guvnor not /etc/guvnor and you don't need to run guv-web as root, only guvnor itself.

achingbrain commented 9 years ago

This has been quiet for a while now, please reopen if you're still having problems.