Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 76413 invoked from network); 15 Jun 2010 16:15:48 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Jun 2010 16:15:48 -0000 Received: (qmail 47071 invoked by uid 500); 15 Jun 2010 16:15:48 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 47002 invoked by uid 500); 15 Jun 2010 16:15:47 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 46994 invoked by uid 99); 15 Jun 2010 16:15:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jun 2010 16:15:47 +0000 X-ASF-Spam-Status: No, hits=-1521.3 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jun 2010 16:15:46 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o5FGFPEh011763 for ; Tue, 15 Jun 2010 16:15:26 GMT Message-ID: <23189760.9071276618525853.JavaMail.jira@thor> Date: Tue, 15 Jun 2010 12:15:25 -0400 (EDT) From: "Benoit Chesneau (JIRA)" To: dev@couchdb.apache.org Subject: [jira] Commented: (COUCHDB-393) Cannot discover currently running http port if ini file specifies port 0 In-Reply-To: <1736310924.1245763868417.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879015#action_12879015 ] Benoit Chesneau commented on COUCHDB-393: ----------------------------------------- discussed on irc. Also needed to make desktop-couch portable and allowing any other alternative. Actually desktop-couch on ubuntu use an ugly hack to do it. I propose to create a file "couch.uri" containing these infos. This file could be located where the pidfile is. so in /var/run which sound the right place This file will contain the CouchDB uri on one line : http://host:port What do you think ? Patch follow > 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 > > Attachments: 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: > 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 > bitdiddle: you got that far and didn't find it? > davisp: is there a better way to find the port? > oh, is that not the bind port? > I was just thinking a log statement > 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? > aquarius: you have to look at the port returned by the socket > aquarius: in other words, CouchDB was never written to do that > AFAIK > davisp: I found it, just needs some work to expose it > aquarius: and by do that, I mean, we never put in a statement to log that > mochiweb_http is the module that needs to bubble it up > 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 :) > 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.