Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different versions of the same configuration file in different branches

Tags:

git

dotcloud

We are using dotCloud, a virtual host, to run some of our apps. dotCloud deploys apps directly from a git repo, and reads a configuration file called dotcloud.yml from that repo to configure and run the stack.

We have two branches (one production, one staging) that are part of the same repo, and these push to separate dotCloud instances. There is a minor difference in the dotcloud.yml file to run each of these instances.

What is the best way to manage this dotcloud.yml file? Currently we simply make sure we're making sure the dotcloud.yml is correct on each branch, but it constantly gets overwritten as we merge changes from staging to master.

like image 906
Newy Avatar asked Nov 18 '25 04:11

Newy


1 Answers

You could:

  • version a dotcloud.yml.template
  • version a dotcloud.yml.value.prod and a dotcloud.yml.value.staging with the pertinent values for each environment.
  • version a smudge script in charge of building the right dotcloud.yml file (which wouldn't be versioned anymore) depending on dotCloud instance.

You would declare that smudge script as a filter content driver in a (also versioned) .gitattribute file:

filter driver

On any git checkout, the smudge script will be called and, if it recognized the dotcloud.yml.template content, will build the right dotcloud.yml file.

like image 153
VonC Avatar answered Nov 20 '25 17:11

VonC