4 ms·
To get a canonical server configuration in raw text: $ echo '.dump' | sqlite3 mongrel2conf.sqlite > mongrel2conf.human_readable $ git add mongrel2conf.
by yummyfajitas 16y ago
To get a canonical server configuration in raw text:
$ echo '.dump' | sqlite3 mongrel2conf.sqlite > mongrel2conf.human_readable
$ git add mongrel2conf.human_readable
$ git commit -m "Added mongrel2 configuration"
Then type the following before invoking mongrel2:
$ rm mongrel2conf.sqlite
$ cat mongrel2conf.human_readable > sqlite mongrel2conf.sqlite
I agree with you - I prefer a human readable/git friendly config file. That's why I invested 10 minutes coming up with this solution and putting it into run_mongrel2.sh.
[edit: earlier version of this post was unnecessarily snarky.]
- Goladus 16y agoNow imagine if everyone had their own version of this great idea and you had to make similar modifications to 100 different startup.sh scripts.
- yummyfajitas 16y agoContributor: "Please pull from me." You, after examining diff outputs: "No, you are adding a second config file. Use the existing config file and deploy script." Contributor: "Ok, fixed and rebased, now there is no trace of my stupid misconfiguration in the repository. I'll be sure to learn about the project conventions before committing in the future. My mistake."
- mechanical_fish 16y agoCongratulations, you have invented the "facsimile" that tptacek spoke of. Because your "canonical" dump file is just a dump file. At any given moment your server cannot be guaranteed to be in a configuration that is specified by your dump file, or by any version of your dump file. Why? Because the server exposes a tempting non-file-based interface to its internal state, and people who are trying to fix the servers at three in the morning will tend to use this to make "out-of-process changes". If the server is broken, do you dare to naively overwrite its configuration with the version that is in git? The general answer is "no". Because two weeks ago somebody did an INSERT into the server's internal database to make Customer X's site work, and afterwords they didn't take time to properly dump the config and commit the dump to git. Because it was 3AM, and the edit was only one of seventeen switches that they were desperately flipping, and they just forgot. When you restart the server that config setting will be lost and the customer will crash and you will spend hours trying to recapture the lost state of the server. You can prevent all this by making it difficult or impossible to alter the server config without altering the config file. But then why did we bother exposing the non-file-based interface in the first place?
- yummyfajitas 16y agoThe non-human readable interface is exposed for experts who wish to have python/ruby/whatever edit the sqlite interface. If you don't like this interface, don't use it. If your sysadmins are desperate to screw things up, they will. If you really want to make it hard, your runmongrel2.py script can store the actual sqlite file in os.path.join('/tmp',str(uuid.uuid4())), thereby making it more difficult for sysadmins to find/edit. Lastly, if you are truly paranoid, you can put something along these lines into your server restart script: $ echo '.dump' | sqlite /tmp/b5497e39-f55a-4234-8f5c-99ea8c1e8ee8 > /tmp/oldconfig.human_readable $ diff /tmp/oldconfig.human_readable main-git-repo/conf/config.sqlite_human_readable
- zedshaw 16y ago> At any given moment your server cannot be guaranteed to be in a configuration that is specified by your dump file, or by any version of your dump file. It's a database, and one that's used by the entire world to reliably store data guaranteed. So this is just false on technical merits. > Why? Because the server exposes a tempting non-file-based interface to its internal state, and people who are trying to fix the servers at three in the morning will tend to use this to make "out-of-process changes". Yet, you say people store things in version control. You have the exact same problem then. People can go and make changes out of band that aren't in version control and forget about them. Happens all the time, and that's a people problem. What you seem to not understand is that you just need to take people out of the equation. Automation is the future of operations, and a system that allows any programming language with sqlite3 bindings manage the config is going to help with automation. Once you don't have humans logging onto machines like it's the 90's then you've actually solved the problem. A config file won't do that.
- tptacek 16y agoYour last sentence is hard to argue with, but it's worth pointing out that there's a cost to designing systems as if the universe you want to live in is the universe we actually live in. Let's call it "the Bernstein tax".
- 16y ago
- deleted 16y ago[deleted]