Commit Graph

12 Commits

Author SHA1 Message Date
Chad Birch
8ce2db7386 Liveconfig diff: use pprint to generate dict reprs
The write_live_config script often gives really strange results when
trying to display diffs of changes to dict values, since the ordering of
a dict is not defined. So key/value pairs will sometimes be rearranged
between the old and new versions, creating a confusing diff.

This changes to use the pprint module to generate string representations
for dicts, because it sorts the dict by key before outputting it, so we
should get consistent representations that can be compared more easily.
2015-10-14 12:46:53 -06:00
Chad Birch
df68d45d68 write_live_config: check similarity when diffing
Turns out that SequenceMatcher is not quite as neat as it appears. When
diffing a string change like:

 old: "this is the old string value"
 new: "on"

It was displayed as:

 - "this is the "
 - "ld stri"
 - "g value"

Since the "o" and "n" were kept. This just displays it as a wholesale
key removal/addition unless the strings are at least 50% similar.
2015-08-20 17:32:51 -06:00
Chad Birch
650b7f7266 write_live_config: Show only changed settings
The script would previously dump out the entire new parsed live
configuration, which (now that we have a lot of fields in it) made it
difficult to find the ones that had actually changed. This fetches the
existing live config, then compares it to the new one and only outputs
any data that has changed for confirmation.
2015-08-20 14:05:06 -06:00
Neil Williams
f501106d9c zookeeper: gzip live config payload.
This takes our current config payload from 4700 bytes to 1700. The goal
is to reduce zookeeper network load during config changes as well as app
restarts during deploys.
2015-03-02 10:41:07 -08:00
Neil Williams
af09fa8dee Update license headers to 2015.
The highlight of each year for me.
2015-01-08 13:35:03 -08:00
Neil Williams
90cfcaaecc Update license headers to 2014.
Ok, now I'm getting some angst in my commit messages like my
predecessors had.  I understand now.  It's a terrible burden.  Why must
the calendar progress?  Why must numbers increment?  The world is
forever turning.

The future is here.

It is 2014.
2014-05-02 16:26:31 -04:00
Neil Williams
342ad24409 Factor out INI file parsing into util. 2013-11-19 12:16:58 -08:00
Max Goodman
aaf1e51abb write-live-config: Update to reflect PluginLoader API change. 2013-10-21 11:37:17 -07:00
Neil Williams
8af415476b Update and fix license headers for 2013.
Angst!
2013-03-19 20:03:40 -07:00
Ricky Ramirez
4aec9618e6 write_live_config: Fail correctly if there is an error. 2013-02-19 14:49:56 -05:00
Ricky Ramirez
a9b5d2a7b0 write_live_config: Exit with non-zero code on user abort. 2013-02-19 14:49:50 -05:00
Neil Williams
f495dad2a8 Add ZooKeeper-based dynamic configuration system.
The dynamic configuration system has two components: the app, which
reads, and the writer script. The latter is meant for use by humans, and
converts a [live_config] section of the INI file into JSON for storage
in ZooKeeper. The app will read this data on startup and place a watch
on the node to be notified, by ZooKeeper, of changes. This means that
running the writer script with new data will automatically propagate the
changes to every app very quickly, without restart.

The writer script relies on a human-entered password to authenticate
with ZooKeeper. The reddit app uses a different set of credentials
(specified in the INI file) to obtain read-only access to the
configuration data.

Also adds a new "live_config" spec to reddit and plugins. This spec is
parsed at write-time only and the parsed values are stored as JSON in
ZooKeeper.
2012-08-02 17:14:36 -07:00