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

Support listening on a UNIX socket #4030

Closed
julianbrost opened this Issue Feb 14, 2016 · 3 comments

Comments

Projects
None yet
5 participants
@julianbrost

I'd like to be able to make Grafana listen on a UNIX socket. This can be useful when running Grafana with external authentication performed by the webserver, as you can easily prevent other local users from directly connecting to the socket via filesystem permissions.

This Go code can be used to handle HTTP requests on a UNIX socket:

l, err := net.Listen("unix", "/run/grafana/http.socket")
if err != nil {
    panic(err)
}

err = http.Serve(l, nil)
if err != nil {
    panic(err)
}

For testing, nginx supports proxy_pass http://unix:/run/grafana/http.sock:/;

@gummiboll

This comment has been minimized.

Show comment
Hide comment
@gummiboll

gummiboll Feb 20, 2016

👍 I'm always for running services through unix sockets.

However, on a side-note and not really sure if this is still the case, but go's implementation of fcgi looks like its a bit slow: https://gist.github.com/hgfischer/7965620

👍 I'm always for running services through unix sockets.

However, on a side-note and not really sure if this is still the case, but go's implementation of fcgi looks like its a bit slow: https://gist.github.com/hgfischer/7965620

@julianbrost

This comment has been minimized.

Show comment
Hide comment
@julianbrost

julianbrost Feb 20, 2016

I wasn't talking about FastCGI, you can do normal HTTP over UNIX sockets.

In the benchmark you reference, FastCGI over UNIX socket is fast than over TCP, so you might even get a bit more performance when doing HTTP over UNIX sockets compared to TCP.

And implementing this should be pretty easy, I think it would need no more than about 10 to 20 lines of code.

I wasn't talking about FastCGI, you can do normal HTTP over UNIX sockets.

In the benchmark you reference, FastCGI over UNIX socket is fast than over TCP, so you might even get a bit more performance when doing HTTP over UNIX sockets compared to TCP.

And implementing this should be pretty easy, I think it would need no more than about 10 to 20 lines of code.

@cactus

This comment has been minimized.

Show comment
Hide comment
@cactus

cactus Mar 2, 2016

Searching for info on Grafana and unix socket support brought me here.
I run grafana behind nginx, and currently have it listening on loopback.
It would be nice to move it over to a unix sock.

cactus commented Mar 2, 2016

Searching for info on Grafana and unix socket support brought me here.
I run grafana behind nginx, and currently have it listening on loopback.
It would be nice to move it over to a unix sock.

mitjaziv added a commit to mitjaziv/grafana that referenced this issue Apr 26, 2017

torkelo added a commit that referenced this issue Apr 27, 2017

@torkelo torkelo added this to the 4.3.0 milestone Apr 27, 2017

@torkelo torkelo closed this Apr 27, 2017

daniellee added a commit that referenced this issue May 10, 2017

Update CHANGELOG.md
ref #8277, ref #8250, ref #8262, ref #8165, ref #8093, ref #8056, ref #8043, ref #7970, ref #7914, ref #7864, ref #7750, ref #7740, ref #7697, ref #7619, ref #5619, ref #4030, ref #5278, ref #3302, ref #2524
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment