Hi Torsten, thanks again for posting these.
On 19/07/2012, at 6:35 AM, tcurdt wrote:
> Recently I started playing with babushka (to setup my vserver) ...and I've run into a couple of question/issues. As promised to Ben on twitter here is rub:
>
> 1. It seems like babushka has some "internal deps" (e.g. 'admins can sudo') which so wasn't obvious.
You can see them all with `babushka list`, or filter it, e.g. `babushka list sudo`. That's documented by `babushka help`.
> 2. Question this brings up - what happens when there is a clash? Seems it gets silently overridden.
Deps are never overridden. Within a source, a given name will always define (or augment) the same dep. Across sources, deps are independent: you just namespace them with the source name.
In the case above, you'd use 'core:admins can sudo', as is printed by `babushka list`.
> 3. Permissions and ownerships. All the deps I found so far have an horrific absence of chmod/chown. A couple of dep call them via shell. In the nginx dep I found
>
> cd cert_path, :create => "700", :sudo => true do
>
> which when looking at the implementation does not set the permissions as I would have expect. Why not have a :perms and :owner? Or how should one create directory structures?
Most deps purposefully don't chown, except where ownership change is the actual purpose of the dep. The intention is that babushka is invoked by the user in question, so ownership naturally falls into place.
Permissions are a separate issue, and you're right about :create, that's probably not the best name.
In general though, the same thing applies: the idea is to invoke babushka as the user in question, so that changing ownership isn't relevant within the scope of the deps you're running.
> 4. Either I have missed it - but I have not found a description about how "meta" deps are working. Looking the "rbenv" dep I am not sure I fully understand this yet
>
> meta :rbenv do
> accepts_value_for :version, :basename
> accepts_value_for :patchlevel
> accepts_block_for :customise
> template {
> ...
> }
> end
>
> dep '1.9.2.rbenv' do
> patchlevel 'p290'
> end
This core code explains the function of `accepts_list_for` and friends:
http://github.com/benhoskings/babushka/blob/master/lib/babushka/dep_context.rb
They define methods on the dep that will accept specific data types. The other purpose of a template is to define baked-in met?{} and meet{} blocks, to wrap up the logic for that type of dep (those are overrideable later).
In that case, met?{} and meet{} aren't missing, they're just defaulting to those in the template, using the customised 'patchlevel' value.
Another example is '.bin'. If the package name and binary name match the dep name, you can just declare, e.g.
dep 'curl.bin'
And you're done: all the logic defaults to that in the template. You can still open the block and customise as much of it as you like though.
> 5. Which also brings me to the naming conventions. ".configured", ".managed", ".bin" ...and what's the "1.9.2.rbenv" - almost looks empty. Would be good get some docs/info together on that.
I don't have a '.configured' anywhere, but the suffix just matches a template name. A dep called 'curl.bin' is defined against the 'bin' template.
> 6. Variables I found covered in one of Ben's blog post. There currently is
http://babushka.me/running-deps but that does not explain
>
> dep 'dot files', :username, :github_user, :repo do
>
> ...and while it point to
http://babushka.me/writing-deps for more info - well... that desperately needs some documentation love.
Yep, the docs need work. I'm sorry, I'm very busy. :)
There are plenty of examples of parameter use in the core deps. In that case, you could do, on the command line:
babushka 'dot files' github_user=benhoskings ...
Or, in a dep:
requires 'dot files'.with('ben', 'benhoskings', 'dot-files')
Or
requires 'dot files'.with(username: 'ben')
> 7. How do you guys use babushka with "sudo"? Run babushka itself with sudo or as root? No way in hell it make sense to type in the password for every "sudo" (why doesn't that cached after the first sudo?)
Either will work fine, you can use whichever you like.
The repetitive password typing isn't specific to babushka; it's a result of the way `sudo` is configured on newer versions of ubuntu and friends, and affects many other apps to. It's unfortunate.
> 8. Is there somewhere full documentation on the DSL? Right now one has to dig through the code.
The docs are at
http://babushka.me and the rdocs are at
http://rubydoc.info/github/benhoskings/babushka/master/frames -- but yeah, reading the code is the only complete reference.
- Ben