Scap/Scap3 config deployment

From Wikitech

Scap3 can be used to deploy a service's configuration files.

What happens on the deployment server

  • Looks for environment-specific ./scap/config-files.yaml with target files in the format:
/path/to/target:
  template: env-specific-template.yaml.j2
  remote_vars: /optional/remote/variable/file.yaml
  • Looks for environment-specific ./scap/vars.yaml that includes variables used to render the template. These variables will be overridden by any conflicting variables in the file specified by remote_vars
  • Variables from any environment-specific vars.yaml file are combined with variables from the root vars.yaml file.
  • A json file is created at [repo]/.git/config-files/[revision].json that contains the final path to any environment-specific templates as well as a final list of combined variables.

What happens on targets

  • Download the file from [deployment-server]/[repo]/.git/config-files/[revision].json
  • Loop through the config files, and render each template using the variables from the downloaded json file and the variables from the (now) local remote_vars file
  • Links rendered file (in [repo]/.git/config-files/[path]) to final location