sprinkle-tool / sprinkle

Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails, or Sinatra stack on a brand new slice directly after its been created
https://github.com/sprinkle-tool/sprinkle
MIT License
1.15k stars 138 forks source link

Per host rendering of configuration templates #193

Open k1w1 opened 10 years ago

k1w1 commented 10 years ago

As I use sprinkle for more sophisticated deployments I am running into a problem where I need my configuration files to be slightly different for each destination host. The differences are trivial, so using the template rendering would be ideal, however it looks like there is a fundamental problem. The rendering is done once and the same resulting file sent to each server.

Ideally in my template I could have code like this:

...
/path/on/machine/<%= @server_info.name %>/more/path
...

and generate a path that includes the name of the server.

This is related to #95, and probably difficult to support because of the way capistrano works in parallel. However it seems that flexibility in configuration is more valuable than the performance benefits of parallel execution. Though it is not clear to me that it is not possible to concurrently copy different files to each server, but perhaps capistrano doesn't support that.


It occurs to me that perhaps an alternative solution would be to have an installer where the template rendering happens on the destination server using a local templating mechanism. Then I could use hostname, etc in my templates.

joshgoebel commented 10 years ago

However it seems that flexibility in configuration is more valuable than the performance benefits of parallel execution. Though it is not clear to me that it is not possible to concurrently copy different files to each server, but perhaps capistrano doesn't support that.

Until you have 200 servers. This is definitely a problem that would require reviewing SSHKit, Cap 3, etc... and a major rethink of Sprinkle and how it works. Since simultaneous SSH is technically just a bunch of connection management it should be technically possible to do this sort of thing... but may require building directly on a SSH lib foundation vs supporting multiple "actors". Again, not sure exactly what SSHKit might bring to the table in this regard.