Package: bakercm
BakerCM is a decentralized configuration management based on files. BakerCM is an out of the box tool to auto-configure an environment using recipe files.Why Should I Use This?BakerCM is a configuration management that doesn’t need a centralized server to configure environments. BakerCM is the lightweight tool built on Python (version 3) that configures files from templates.Secondly, BakerCM can encrypt and decrypt values using secret sections in recipes files. BakerCM cares about the security of values to decrypt it in the right environment, so your configuration files can live openly with your source code and your secrets values will still safe.Finally, recipe files can be stored and download from the most used versioning control servers like Github, Bitbucket or another server of files where configuration files can be versioned and BakerCM will care to set up your environment using the right version.FeaturesConfigure dynamic values in template files per environmentEncrypt and decrypt values to keep it safeMove or copy files in a file systemChange permission, owner, and group of filesManage versions of recipe files from most used versioning control serversCustomization of BakerCM settingsInstallationBakerCM must be installed on the environment that you want to self-configure. It is easy once you have Python installed.$pipinstallbakercmUsing BakerCreate a recipe like simple.cfg[appdb:template]template=app.conf.tpl[appdb:variables]HOST=dev.host.dbPORT=9000Create a template app.conf.tpldatabase:engine:'postgres'host:'{{ HOST }}'port:'{{ PORT }}'Run BakerCM$bakerrun--pathsimple.cfgDone! File configured.SecretsSecret section keeps the encrypted values in recipes. It’s work like other variables but instead of plaintext values are encrypted and will be decrypted only when a recipe will run to set a template in an environment.Secret section in a recipe...[appdb:secrets]PASSWORD=cfce1f5e82798a7fca808d8acae50baa\c092ca0bbc873e99d0a2318efa381355\6e9b48...In a template, secrets are like other variablesdatabase:...password:'{{ PASSWORD }}'To encrypt and decrypt values is necessary to generate a secret key runninggenkeycommand passing a keypass.$bakergenkeymyKeyPassTo encrypt value to save in recipes you can useencryptcommand.$bakerencryptvalueToEncryptor to encrypt all values in secret section from a recipe$bakerencrypt--filerecipe-to-encrypt.cfgFile System OperationsTo change file options on file system you can add options on recipes, in template section. Look options supported in template section:[appdb:template]template=/path/to/template.conf.tpl# Template location, it can be a URL toopath=/path/to/save/replaced/config.conf# Target location to save replaced file,# you also can rename the fileuser=owner# Set what user will be the file ownergroup=group-of-onwer# Set group that this file will belongmode=0755# Set permission of file using the number formatAll options above works fine for Unix OS like. For Windows, the optionsuser,group,modeare not supported yet.Remote RecipesRemote recipes are files stored in a versioning server and BakerCM gets them to configure an environment. It’s very useful when you want to store your environment configurations and versioning it, and BakerCM will care to manage any environment you want with the right configuration.Repository settingsRepository should be set in settings to Baker know where recipes are stored. For that, change~/.bakercfile with repository settings.REPOSITORY='https://raw.githubusercontent.com/lucasb/BakerCM/'# Repository urlREPOSITORY_TYPE='github'# Repository pattern like: 'github', 'bitbucket' or 'custom'# if authorization is necessary to read files from repository you can# add authorization in this setting.REPOSITORY_AUTH='Basic YmFrZXI6YmFrZXJjbQ=='# if REPOSITORY_TYPE='custom', REPOSITORY_CUSTOM_PATTERN should be set#                using special keys: repository, path, ext and versionREPOSITORY_CUSTOM_PATTERN='%(repository)s/%(path)s.%(ext)s/%(version)s'Remote recipes commandsTo get a recipe from a repository use commandpullwith name argument,nameformat is <path>:<version>, where the path is the location in the repository to recipe file and version of the recipe.$bakerpullexample/dev2:0.4.2to force donwload of recipe use option -f$bakerpull-fexample/dev:0.4.2To list all recipes and versions saved in an environment use commandrecipes.$bakerrecipesRECIPE_ID        REMOTE         VERSION        FILENAME        CREATED
af33908tg        example/dev2   0.4.2          dev2.cfg        2018-06-03 06:18To remove some recipe stored locally use commandrmwithRECIPE_ID.$bakerrmaf33908tgAlso, you can use commandrunto pull a recipe and run it usingnameargument.$bakerrunexample/dev2:0.4.2OptionsTo know more about BakerCM options just run--help-h, for a help with a specific command the same option works.$baker-husage: baker [-h] [-v] [--verbose] <COMMAND> ...

Baker is a decentralized configuration management based on files. <:::>

optional arguments:
  -h, --help     show this help message and exit
  -v, --version  show program's version number and exit
  --verbose      increase output verbosity

commands:
  <COMMAND>      Run 'baker COMMAND --help' for more info on a command
    configs      list of configs
    encrypt      encrypt values using secret key
    genkey       generate a secret key from a key pass
    pull         pull a recipe with configurations
    recipes      list recipes locally
    rm           remove recipes locally
    run          run configurations from a recipeSettingsYou can customize BakerCM options via settings. For that you need to create a.bakercon your HOME directory:$vim~/.bakercDEBUG=False# Verbose mode, the default is falseENCODING=utf-8# Encode of files and secretsRECIPE_CASE_SENSITIVE=False# The default config keys are case insensitiveREPOSITORY=None# Repository url including protocol http/httpsREPOSITORY_TYPE=None# Repository pattern like: 'github', 'bitbucket' or 'custom'REPOSITORY_AUTH=None# Authorization to read files from repository. Value is set as a header.# e.g.: 'Basic YmFrZXI6YmFrZXJjbQ=='REPOSITORY_CUSTOM_PATTERN=None# Custom repository url for others pattern.# e.g.: '%(repository)s/%(path)s.%(ext)s/%(version)s'STORAGE_RECIPE=~/.baker/recipes/# Remote recipes are storageSTORAGE_RECIPE_INDEX=~/.baker/index# Baker index itemsSTORAGE_RECIPE_META=~/.baker/meta# Baker matadataSTORAGE_KEY_PATH=~/.baker/baker.key# Store secret key to encrypt and decrypt secret valuesSTORAGE_TEMPLATES=~/.baker/templates/# Remote templates are storageTEMPLATE_EXT=tpl# Extension for template files. Set 'None' for no extensionTo list all settings (customized and defaults) for BakerCM.$bakerconfigs--allOthersEscape variablesHow to escape variables in a template:escape-conn:'{{\connection }}'Multiple templates for a recipeMultiple template management is possible in one recipe. For that use different name for each template file that you want to configure. Using the format<name>:<section>.[name1:template]...[name1:variable]...[name2:template]...[name2:secrets]