Conversation
|
Depends on: apache/couchdb-config#20 |
|
I’m working through the test fails, but this is worth reviewing already. |
|
So far, the |
|
Latest push also removes |
|
Question: on the Or |
01e979d to
c1cf9f2
Compare
|
@wohali good catch, if someone were to do that, it’d override the internal ones. I think that’s still okay, if someone wanted to write a mango engine in, say, Python. We could forbid the configuring of those two specifically, but it’d be introducing quite fiddly code for not much benefit IMHO. |
|
This is good to review now |
|
I'm +1 on removing runtime configurability but would prefer that the configuration is expressed in the .app files of the respective erlang applications. This will allow package maintainers (etc) to more easily tweak at build time if necessary without introducing the runtime malleability that concerns us. |
|
@rnewson I’m happy to add query server defaults to the .app file for your use-case. I also want to retain the possibility for folks who run binary builds to add their third party query servers via env vars. |
|
|
also noting that changing couchjs stack size is an important ability. |
def agree! we could introduce |
| %% get vhost globals | ||
| VHostGlobals = re:split(config:get("httpd", | ||
| "vhost_global_handlers",""), "\\s*,\\s*",[{return, list}]), | ||
| VHostGlobals = re:split("_utils, _uuids, _session, _users", "\\s*,\\s*", |
There was a problem hiding this comment.
Did you consider hardcoding it?:
VHostGlobals = ["_utils","_uuids","_session","_users"]
There was a problem hiding this comment.
good call, might have to keep it dynamic to allow couch.app configurability as per
#1602 (comment) but good call
|
+1 on the env var approach vs. app files - this makes modification in e.g. Docker containers very straightforward, as well as systemd unit files / init files. "Why not both" is totally fine for me :) |
davisp
left a comment
There was a problem hiding this comment.
+1 to everything in general. I don't have a strong opinion either way on the environment variable vs. .app config approaches.
| dynamic} | ||
| ], | ||
| Daemons = [ | ||
| {"index_server", "{couch_index_server, start_link, []}"}, |
There was a problem hiding this comment.
It seems a bit silly to keep these as strings just to convert all of the terms in the following list comprehension. I'd at least like to remove that bit of silly for this supervisor. I'd also suggest that we just write out the child specs directly in the SecondarySupervisors list above given that's the more traditional way of doing things (or at least using a helper that gets mapped over the name/mfa pairs.
There was a problem hiding this comment.
Latest push removes the redundant string parsing. I’d accept commits that turn the list comprehension into a helper, or one that writes it all out.
|
@janl How is |
@rnewson latest push defines all http handlers in |
Since query servers can still be setup using env vars, the solution to this already exists: |
The previous configuration `[daemons] httpsd = {chttpd, start_link, [https]}`
is also sill supported for backwards cmpatibility reasons.
|
Pending any test issues and/or review notes, this is good to go now. Thanks everyone for the input! |
Overview
In the 1.x era of CouchDB, many parts of the core systems were managed via the config system. This is mostly due to in the early days, no good standard patterns for what Erlang apps looked like were obvious. This has changed now.
In addition, being able to change core parts of the database, including what code modules to load when and where, and which OS binaries to run when and where, opened us up to a set of security vulnerabilities, that we want to close once and for all with this PR by no longer allowing runtime configuration of core system parts.
Specifically:
daemons[httpd] default_handler-
httpd_global_handlers-
httpd_db_handlers-
httpd_design_handlersvhost_global_handlersredirect_vhost_handleros_daemonsquery_serversnative_query_serversThis patch retains the ability to configure an existing CouchDB installation to, say, add a third party query server, but it’ll require console access to the server and restarting CouchDB from said console.
Details
CouchDB ships with two default query_servers (javascript and coffeescript)
as well as one default native_query_server (query aka mango). These used
to be configured in default.ini in these sections:
This allowed end-users post-install and even runtime-changes to which
query servers are enabled and where their binaries live.
This patch changes things, so only a post-install, but not at-runtime
changes are possible from now on.
This still allows people to configure their CouchDB to run a third-
party query server like the somewhat popular Python query server,
but it changes the way the setup is done.
Query Servers
The javascript and coffeescript query servers continue to be enabled
by default. Setup differences have been moved from default.ini to
the couchdb and couchdb.cmd start scripts respectively.
Additional query servers can now be configured using environment
variables:
Where the last segment in the environment variable matches the usual
lowercase(!) query language in the design doc
languagefield.Multiple query servers can be configured by using more environment
variables.
Native Query Servers
The mango query server continues to be enabled by default. The erlang
query server continues to be disabled by default. This patch adds
a
[native_query_servers] enable_erlang_query_server = BOOLsetting(defaults to
"false") to enable the erlang query server.If the legacy configuration for enabling the query server is detected,
that is counted as a
truesetting as well, so existing configurationscontinue to work just fine.
Windows
Since the setting of the
./configuretimePREFIXhappens duringmake release, I had to adapt thecouchdbandcouchdb.cmdscriptsto have the correct env vars set and the
PREFIXreplaced there.I did this to the best of my abilities and research, but this needs
review from the Windows team (Hi Joan! :).
OS Daemons
OS Daemons have been deleted completely as they were deprecated in 2.2.0
Testing recommendations
make checkas well as following the instructions above for configuring third party query servers and/oros_daemonsas well as enabling the erlang query server.Checklist