1

I want to setup a continuous integration pipeline for the first time. I have a website that includes a config file that points to MySQL and Redis. I would like to build a package once and then deploy it to test, UAT and live environments.

I don't want to rebuild the package after deploying it to each environment because it could cause inconsistencies between builds but I can't see an alternative because the config file would need to be different depending on which environment it was deployed to (the test server would be using a different database to live or UAT).

Does anyone have any ideas on how this would be possible?

0

You might want to look into tools like chef or puppet, as they are built for this kind of thing (provisioning). I know chef uses templates and variables in the script to substitute these. If a framework like this is unwanted you could always use a similar substitution on deploy scheme of your own or alternately expect configuration to be statically located in an externalized directory that is not effected by deploy and baked into an image for that environment or one time setup (scaling drawbacks apply).

  • I am using puppet to provision the server. The puppet files are actually in the apt package with the website files. At the moment I can pull down the package and run puppet to provision the server the only problem is the website config is also in the package which is causing me to have to rebuild for each environment. So when I do apt-get install myapplication on the live environment it doesn't read the config for the test environment. – notebox Jul 24 '15 at 8:54
  • The substitution on deploy scheme may work but I'm not sure how I would go about it in practice. – notebox Jul 24 '15 at 8:55
  • Look at ERB templates – Heath Malmstrom Jul 24 '15 at 14:11
0

I've decided the best way to do this will be to delete the config file from the websites config folder.

I will then create a different config file for each environment which will be stored in puppet. Puppet can then add the correct config file into the websites config folder on provision depending on which environment it is running on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.