Skip to content

Best practice for multiple environments

Steve Brasier edited this page Sep 16, 2021 · 2 revisions

This page describes the suggested process to follow if you know you will need multiple environments. We use site here to refer to the site name containing environments e.g. site-dev and site-prod.

  • Clone the repo to e.g. slurm-app-site-dev.
  • Checkout a branch site-dev.
  • Create a new environment site-common.
  • If you want to share secrets between environments, activate this common environment and run the generate passwords here. The advantage of this is that images build in one environment will boot in another.
  • Create a new environment site-dev, and link to the site-common inventory in the ansible.cfg.
  • Do as much configuration as possible in site-common, including using terraform modules there.
  • Consider whether you want node names to be the same between environments. With working DNS this means that (if you have used common secrets) you can build images in one environment (e.g. staging and boot them into a cluster in another (e.g. prod). However it does make it less clear what you're working on!
  • When ready to create the next environment (e.g. prod):
    • Clone the repo to e.g. slurm-app-site-prod
    • Checkout the site-dev branch then a new site-prod branch.
    • Make the necessary changes

Having the environments in separate clones makes it easier to do operations in multiple environments at once.

Clone this wiki locally