thaddeusalbers opened a new issue #1705: GET / does not return uuid of server 
for CouchDB 2.2.0 on Ubuntu 18.04 LTS 
URL: https://github.com/apache/couchdb/issues/1705
 
 
   
   ## Expected Behavior
   <!--- If you're describing a bug, tell us what should happen -->
   <!--- If you're suggesting a change/improvement, tell us how it should work 
-->
   The documentation at 
http://docs.couchdb.org/en/stable/api/server/common.html#get-- says a GET / 
request should return the uuid of the couchdb server in the http response 
message. For example:
   `curl -X GET http://localhost:5984/`
   returns
   `{"couchdb": "Welcome", "uuid": "85fb71bf700c17267fef77535820e371", 
"vendor": {"name": "The Apache Software Foundation", "version": "1.3.1"}, 
"version": "1.3.1"}`
   
   ## Current Behavior
   <!--- If describing a bug, tell us what happens instead of the expected 
behavior -->
   <!--- If suggesting a change/improvement, explain the difference from 
current behavior -->
   `curl -X GET http://localhost:5984/ `
   for 2.2.0 returns
   
`{"couchdb":"Welcome","version":"2.2.0","git_sha":"2a16ec4","features":["pluggable-storage-engines","scheduler"],"vendor":{"name":"The
 Apache Software Foundation"}}`
   
   uuid is not included in response. 
   2.1.0 has similar behavior and does not include uuid in response. 
   1.6.1 does include uuid in response. 
   Tried with erlang 1.19.3 and couchdb 2.2.0 and it does not include uuid in 
response.
   
   ## Possible Solution
   <!--- Not obligatory, but suggest a fix/reason for the bug, -->
   <!--- or ideas how to implement the addition or change -->
   Summary: It looks like the 
   `uuid = {{uuid}}` 
   line in rel/overlay/etc/default.ini is not being properly populated.
   Updating the uuid in either etc/default.ini or etc/local.ini does not seem 
to update the response from GET / with a uuid.
   An alternative url can be used to get the uuid:
   `curl -X GET http://localhost:5984/_node/_local/_config`
   (extra elements removed.)
   {"couchdb": {"uuid": "d550a33f9a50f2d908bb608c043f97e9"}}
   
   
   Attempted troubleshooting:
   
   1. Set default.ini with non empty uuid
   
   /opt/couchdb/etc/default.ini after fresh install shows a blank uuid
   > 
   > ; Upgrading CouchDB will overwrite this file.
   > [vendor]
   > name = The Apache Software Foundation
   > 
   > [couchdb]
   > uuid = 
   > 
   
   /opt/couchdb/etc/local.ini after fresh install shows a valid uuid.
   > 
   > ; CouchDB Configuration Settings
   > 
   > ; Custom settings should be made in this file. They will override settings
   > ; in default.ini, but unlike changes made to default.ini, this file won't 
be
   > ; overwritten on server upgrade.
   > 
   > [couchdb]
   > ;max_document_size = 4294967296 ; bytes
   > ;os_process_timeout = 5000
   > uuid = d550a33f9a50f2d908bb608c043f97e9
   
   Copied uuid = d550a33f9a50f2d908bb608c043f97e9 to relevant line in 
default.ini
   sudo systemctl restart couchdb (to restart couchdb)
   GET http://localhost:5984/ shows same result
   
   2. Tried with 2.1.0
   sudo apt-get purge couchdb –autoremove
   sudo apt-cache policy couchdb (shows 2.1.2 bionic as another version)
   sudo apt-get install couchdb=2.1.2\~bionic (to install 2.1.2)
   setup cluster as standalone, 127.0.0.1, no password
   GET http://localhost:5984/ shows same result.
   
   3. Build 2.2.0 from source
   sudo apt-get purge couchdb –autoremove
   from http://docs.couchdb.org/en/latest/install/unix.html#debian-based-systems
   sudo apt-get --no-install-recommends -y install \
       build-essential pkg-config erlang \
       libicu-dev libmozjs185-dev libcurl4-openssl-dev
   Download source 
   wget 
http://mirrors.advancedhosters.com/apache/couchdb/source/2.2.0/apache-couchdb-2.2.0.tar.gz
   tar -xvf apache-couchdb-2.2.0.tar.gz
   ./configure 
   
   yields 
   
   rel/couchdb.config 
   > % Licensed under the Apache License, Version 2.0 (the "License"); you may 
not
   > % use this file except in compliance with the License. You may obtain a 
copy of
   > % the License at
   > %
   > %   http://www.apache.org/licenses/LICENSE-2.0
   > %
   > % Unless required by applicable law or agreed to in writing, software
   > % distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   > % WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   > % License for the specific language governing permissions and limitations 
under
   > % the License.
   > %
   > % The contents of this file are auto-generated by configure
   > %
   > {package_author_name, "The Apache Software Foundation"}.
   > {prefix, "."}.
   > {data_dir, "./data"}.
   > {view_index_dir, "./data"}.
   > {log_file, ""}.
   > {fauxton_root, "./share/www"}.
   > {user, "thaddeus"}.
   > {node_name, "-name [email protected]"}.
   > {cluster_port, 5984}.
   > {backend_port, 5986}.
   
   rel/overlay/etc/default.ini shows
   > ; Upgrading CouchDB will overwrite this file.
   > [vendor]
   > name = {{package_author_name}}
   > 
   > [couchdb]
   > uuid = {{uuid}}
   
   rel/overlay/etc/local.ini shows no uuid lines
   > ; CouchDB Configuration Settings
   > 
   > ; Custom settings should be made in this file. They will override settings
   > ; in default.ini, but unlike changes made to default.ini, this file won't 
be
   > ; overwritten on server upgrade.
   > 
   > [couchdb]
   > ;max_document_size = 4294967296 ; bytes
   > ;os_process_timeout = 5000
   > 
   > [couch_peruser]
   > 
   
   make
   ==> config (compile)
   ==> b64url (compile)
   ==> ets_lru (compile)
   ==> khash (compile)
   ==> snappy (compile)
   ==> ioq (compile)
   ==> bear (compile)
   ==> meck (compile)
   ==> folsom (compile)
   ==> triq (compile)
   ==> hyper (compile)
   ==> ibrowse (compile)
   ==> jiffy (compile)
   ==> mochiweb (compile)
   ==> couch_epi (compile)
   ==> couch_log (compile)
   ==> chttpd (compile)
   ==> couch (compile)
   Compiling priv/couch_js/http.c
   Compiling priv/couch_js/main.c
   Compiling priv/couch_js/utf8.c
   Compiling priv/couch_js/util.c
   ==> couch_index (compile)
   ==> couch_mrview (compile)
   ==> couch_replicator (compile)
   ==> couch_plugins (compile)
   ==> couch_event (compile)
   ==> couch_stats (compile)
   ==> couch_peruser (compile)
   ==> couch_tests (compile)
   ==> ddoc_cache (compile)
   ==> fabric (compile)
   ==> global_changes (compile)
   ==> mango (compile)
   ==> mem3 (compile)
   ==> rexi (compile)
   ==> setup (compile)
   ==> rel (compile)
   ==> apache-couchdb-2.2.0 (compile)
   dev/run --nodes=1 --with-admin-party-please --enable-erlang-views
   
   GET http://localhost:15984/ shows same result
   
   4. Try erlang version 1.19.3 (apt package couchdb 2.2 on ubuntu 18.04 LTS 
includes erlang 1.20)
   sudo apt purge erlang*
   sudo apt purge erlang-*
   install esl-erlang from 
   
https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_19.3.6-1~ubuntu~bionic_amd64.deb
   
   > GET http://localhost:15984/ shows same result (OTP is 19)
   > HTTP/1.1 200 OK
   > Cache-Control: must-revalidate
   > Content-Length: 164
   > Content-Type: application/json
   > Date: Mon, 29 Oct 2018 22:24:11 GMT
   > Server: CouchDB/2.2.0 (Erlang OTP/19)
   > X-Couch-Request-ID: 847b7d90f2
   > X-CouchDB-Body-Time: 0
   > 
   > {
   >     "couchdb": "Welcome",
   >     "features": [
   >         "pluggable-storage-engines",
   >         "scheduler"
   >     ],
   >     "git_sha": "2a16ec4",
   >     "vendor": {
   >         "name": "The Apache Software Foundation"
   >     },
   >     "version": "2.2.0"
   > }
   
   5. Tried alternative url
   curl -X GET http://localhost:5984/_node/_local/_config
   {
       ...
       "couchdb": {
           ...
           "uuid": "d550a33f9a50f2d908bb608c043f97e9",
           …
       }
       …
   }
   So alternative url can be used to get uuid. 
   
   Summary: It looks like the 
   `uuid = {{uuid}} `
   line in rel/overlay/etc/default.ini is not being properly populated.
   Updating the uuid in either etc/default.ini or etc/local.ini does not seem 
to update the response from GET /.
   
   ## Steps to Reproduce (for bugs)
   <!--- Provide a link to a live example, or an unambiguous set of steps to -->
   <!--- reproduce this bug. Include code to reproduce, if relevant -->
   Steps to repeat:
   Using a fresh installation of Ubuntu 18.04 LTS, install couchdb 2.2.0 using 
the following:
   
   1. sudo apt-get --no-install-recommends -y install \
        build-essential pkg-config erlang \
        libicu-dev libmozjs185-dev libcurl4-openssl-dev
   2. sudo apt-get install curl
   3. curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc \
        | sudo apt-key add -
   4. sudo apt-get update && sudo apt-get install couchdb
   5. Configure cluster with standalone server, address 127.0.0.1, no admin 
password
   6. curl -X GET http://localhost:5984/
   returns 
   
{"couchdb":"Welcome","version":"2.2.0","git_sha":"2a16ec4","features":["pluggable-storage-engines","scheduler"],"vendor":{"name":"The
 Apache Software Foundation"}}
   uuid is not included in response. 
   
   Additionally, here is a javascript test case. Apply patch below. It looks 
for the existance of “uuid” in the response from GET /
   
   ```
   diff --git a/test/javascript/tests/basics.js 
b/test/javascript/tests/basics.js
   index a36b3035d..1a24ffa58 100644
   --- a/test/javascript/tests/basics.js
   +++ b/test/javascript/tests/basics.js
   @@ -17,6 +17,7 @@ couchTests.basics = function(debug) {
    
      var result = JSON.parse(CouchDB.request("GET", "/").responseText);
      T(result.couchdb == "Welcome");
   +  T(result.uuid);
    
      var db_name = get_random_db_name()
      var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
   ```
   
   then 
   make javascript to test all of the javascript tests.
   
   ## Context
   <!--- How has this issue affected you? What are you trying to accomplish? -->
   <!--- Providing context helps us come up with a solution that is most useful 
in the real world -->
   We have an CouchDB server serving both localhost and an ip (for example 
1.1.1.1) behind a reverse proxy. CouchDB replicates localhost databases to 
other hosts in the same data center (for example 2.2.2.2, 3.3.3.3, etc...). We 
use the uuid in GET / response to see when localhost and 1.1.1.1 are the same 
CouchDb server instance. Thus, replication knows not to replicate localhost to 
1.1.1.1 which are the same server, but does replicate localhost to 2.2.2.2, 
3.3.3.3, etc… which are different servers.
   
   ## Your Environment
   <!--- Include as many relevant details about the environment you experienced 
the bug in -->
   * Version used: 2.2.0. tried 2.1.0
   * Erlang Version used: 1.20, tried 1.19.3
   * Browser Name and version: chromium, firefox, curl, httpie
   * Operating System and version (desktop or mobile): desktop
   * Link to your project: commercial project
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to