You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Filipe Manana (JIRA)" <ji...@apache.org> on 2010/09/25 19:17:34 UTC
[jira] Updated: (COUCHDB-393) Cannot discover currently running
http port if ini file specifies port 0
[ https://issues.apache.org/jira/browse/COUCHDB-393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana updated COUCHDB-393:
----------------------------------
Attachment: couch_uri_var_run_couch.patch
I don't like much the fact that the .uri file goes into the same directory as the DB files (var/lib/couchdb).
With the following patch, I propose moving it into %localstaterundir% (defaults to var/run/couchdb/).
Anyone against?
> Cannot discover currently running http port if ini file specifies port 0
> ------------------------------------------------------------------------
>
> Key: COUCHDB-393
> URL: https://issues.apache.org/jira/browse/COUCHDB-393
> Project: CouchDB
> Issue Type: Improvement
> Components: HTTP Interface
> Affects Versions: 0.9
> Environment: Ubuntu 9.04
> Reporter: Stuart Langridge
> Assignee: Noah Slater
> Priority: Blocker
> Fix For: 0.12, 1.0
>
> Attachments: couch_uri.patch, couch_uri_var_run_couch.patch, couchctl.patch
>
>
> It is currently not possible, if the ini file specifies port 0 as the http port (so that the OS chooses a random port) to discover which port the OS actually chose.
> It would be nice if the currently running port was made available in the statusline output (couchdb -s), but a log statement would be adequate; some way that an external script can discover which port a running CouchDB is listening on.
> Edited discussion from #couchdb:
> <bitdiddle> aquarius: well at a glance it appears couch_http passes the 0 to mochiweb_http which passes it to the mochiweb_socket_server, which passes it to gen_tcp, an erlang module that lets the underlying OS assign it. mochiweb_socket_server then grabs that port and stores it. It has a get method to retrieve properties but that needs to be exposed to mochiweb_http so it would take a little work to do it. It's probably a JIRA ticket, unless someone else sees a quicker approach
> <davisp> bitdiddle: you got that far and didn't find it?
> <aquarius> davisp: is there a better way to find the port?
> <davisp> oh, is that not the bind port?
> I was just thinking a log statement
> <aquarius> davisp: the problem is if you specify 0 as the bind port (so the OS chooses a port), how do you find out what was chosen?
> <davisp> aquarius: you have to look at the port returned by the socket
> aquarius: in other words, CouchDB was never written to do that
> <davisp> AFAIK
> <bitdiddle> davisp: I found it, just needs some work to expose it
> <davisp> aquarius: and by do that, I mean, we never put in a statement to log that
> <bitdiddle> mochiweb_http is the module that needs to bubble it up
> <aquarius> davisp: I don't really mind whether it's a log statement or it's exposed to couchdb -s (the latter seems tidier to me, but whichever), I just want to be able to start couch on port 0 and then later find out which port got chosen :)
> <davisp> aquarius: for the time being you can use something like netstat or lsof, but we'll get a log statement in there or something
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Updated: (COUCHDB-393) Cannot discover currently running http port if ini file specifies port 0
Posted by Noah Slater <ns...@apache.org>.
On 25 Sep 2010, at 18:54, Benoit Chesneau wrote:
> I need to check what is the bsd way. Main reason i put it /var/lib/couchdb
> wa because it was the home of couchdb user.
I don't understand how this makes a difference either way. :)
Re: [jira] Updated: (COUCHDB-393) Cannot discover currently running
http port if ini file specifies port 0
Posted by Benoit Chesneau <bc...@gmail.com>.
I need to check what is the bsd way. Main reason i put it /var/lib/couchdb
wa because it was the home of couchdb user.
Sent from my nexus one.
On Sep 25, 2010 7:48 PM, "Paul Davis" <pa...@gmail.com> wrote:
For /var/lib/
http://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE38
State information is generally used to preserve the condition of an
application (or a group of inter-related applications) between
invocations and between different instances of the same application.
For /var/run/
http://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE46
This directory contains system information data describing the system
since it was booted.
Ie, things that describe an instance of a running program go in
/var/run, where things that must remain valid across multiple
instances of the same program go in /var/lib. A randomly chosen port
is obviously only valid for a single instance of the program, so
should be placed in /var/run.
Paul Davis
On Sat, Sep 25, 2010 at 1:40 PM, Benoit Chesneau <bc...@gmail.com>
wrote:
> Why?
>
> Sent from ...
Re: [jira] Updated: (COUCHDB-393) Cannot discover currently running
http port if ini file specifies port 0
Posted by Paul Davis <pa...@gmail.com>.
For /var/lib/
http://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE38
State information is generally used to preserve the condition of an
application (or a group of inter-related applications) between
invocations and between different instances of the same application.
For /var/run/
http://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE46
This directory contains system information data describing the system
since it was booted.
Ie, things that describe an instance of a running program go in
/var/run, where things that must remain valid across multiple
instances of the same program go in /var/lib. A randomly chosen port
is obviously only valid for a single instance of the program, so
should be placed in /var/run.
Paul Davis
On Sat, Sep 25, 2010 at 1:40 PM, Benoit Chesneau <bc...@gmail.com> wrote:
> Why?
>
> Sent from my nexus one.
>
> On Sep 25, 2010 7:17 PM, "Filipe Manana (JIRA)" <ji...@apache.org> wrote:
>
>
> [
> https://issues.apache.org/jira/browse/COUCHDB-393?page=com.atlassian.jira.plugin.system.issu.
> ..
> Filipe Manana updated COUCHDB-393:
> ----------------------------------
>
> Attachment: couch_uri_var_run_couch.patch
>
> I don't like much the fact that the .uri file goes into the same directory
> as the DB files (var/lib/couchdb).
>
> With the following patch, I propose moving it into %localstaterundir%
> (defaults to var/run/couchdb/).
>
> Anyone against?
>
>
>> Cannot discover currently running http port if ini file specifies port 0
>> ----------------------...
>> Fix For: 0.12, 1.0
>>
>> Attachments: couch_uri.patch, couch_uri_var_run_couch.patch,
> couchctl.patch
>
>>
>>
>> It is currently not possible, if the ini file specifies port 0 as the http
> port (so that the O...
>
Re: [jira] Updated: (COUCHDB-393) Cannot discover currently running
http port if ini file specifies port 0
Posted by Benoit Chesneau <bc...@gmail.com>.
Why?
Sent from my nexus one.
On Sep 25, 2010 7:17 PM, "Filipe Manana (JIRA)" <ji...@apache.org> wrote:
[
https://issues.apache.org/jira/browse/COUCHDB-393?page=com.atlassian.jira.plugin.system.issu.
..
Filipe Manana updated COUCHDB-393:
----------------------------------
Attachment: couch_uri_var_run_couch.patch
I don't like much the fact that the .uri file goes into the same directory
as the DB files (var/lib/couchdb).
With the following patch, I propose moving it into %localstaterundir%
(defaults to var/run/couchdb/).
Anyone against?
> Cannot discover currently running http port if ini file specifies port 0
> ----------------------...
> Fix For: 0.12, 1.0
>
> Attachments: couch_uri.patch, couch_uri_var_run_couch.patch,
couchctl.patch
>
>
> It is currently not possible, if the ini file specifies port 0 as the http
port (so that the O...