nebulab/pulsar

Uploading application configuration files

Closed this issue · 4 comments

njam commented

This is more of a questions/request for best practice.

I thought I will put my application's configuration file config.ini into the apps folder of the pulsar configuration. This file contains database configuration, ip addresses etc.

I stored the files like this:

├── apps
│   ├── fuboo
│   │   ├── configs
│   │   │   ├── production
│   │   │   │   └── config.ini
│   │   │   └── staging
│   │   │       └── config.ini
│   │   ├── defaults.rb
│   │   ├── production.rb
│   │   └── staging.rb
│   └── base.rb

To upload them I use something like this in my capistrano recipe:

top.upload("apps/#{application}/configs/#{stage}", "/path/on/server")

What do you think about this, does it make sense? Do you do something similar?

What I'm not too fond of are the usages of #{application} and #{stage} in the local path. These match the actual path rather randomly, i.e. the application name could theoretically also be different from the pulsar-application path.
What do you think about this? Is this considered convention that they always match the pulsar-paths?
Or would it make sense to provide these values from within pulsar to the recipes (something like pulsar-application and pulsar-environment)?

Actually I've never thought about it; we use Chef on our servers so it's usually Chef's duty to
place configuration files that get symlinked once you deploy with Capistrano.

Opposed to doing it inside an application with Capistrano, it makes a lot of sense to do this
with pulsar since we have a separate configuration repository. That said, you'd give anyone with access
to that configuration repository access to delicate stuff too (all sorts of passwords...).

I think the "best practice" would be managing the configurations via Chef (or Puppet or whatever) and
use Capistrano recipes to symlink them.
On the other hand, if this is something everybody else would use, we could add some helpers like
load_recipes to load configuration files from directories with stage support like this:

top.upload(config_file("config.ini"), "/path/on/server")

which would hypothetically retrieve the correct file inside the correct environment to upload.

njam commented

@ppp0 @tomaszdurka what do you think? Deploying application configuration files with Puppet instead of Capistrano, seems reasonable and we could use all the hiera information already?

@njam any update on this?

njam commented

@mtylty we will try deploying the configs with puppet. Thank you very much for your feedback!