Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ChefConf 2017 - Habitat In Production

ChefConf 2017 - Habitat In Production

The Habitat Supervisor is responsible for deploying, managing, and choreographing running Habitat services. This session will explore a number of the operational concerns that the supervisor enables. See how to manage secrets, store configuration changes in version control systems, update running applications, and choreograph application upgrades. This is the talk for anyone who is ready to run Habitat services in a production environment.

https://github.com/fnichol/talk-chefconf2017-habitat-in-production

Fletcher Nichol

June 13, 2017
Tweet

More Decks by Fletcher Nichol

Other Decks in Technology

Transcript

  1. Habitat? is a runtime system for your apps or other

    services provides realtime service configuration is a reactive system packages software with a deterministic build system distributed build service loves your apps
  2. Concepts 1. Topologies 2. Service Bindings 3. Update Strategies 4.

    Release Channels 5. Keys 6. Service Configuration
  3. Key 2. Ring hab ring key generate beyonce hab svc

    load abahab/webacus hab sup run --ring beyonce hab config apply --ring beyonce webacus.default $ver $config.toml
  4. Key 3. Service hab svc key generate webacus.default prod hab

    svc load abahab/webacus hab sup run --org prod hab config apply \ webacus.default@prod \ $ver \ $config.toml
  5. Key 3. Service (With Ring) hab ring key generate beyonce

    hab svc key generate webacus.default prod hab svc load abahab/webacus hab sup run --org prod --ring beyonce hab config apply \ --ring beyonce \ webacus.default@prod \ $ver \ $config.toml
  6. Key 4. User (Future) hab user key generate fnichol hab

    svc key generate webacus.default prod hab svc load abahab/webacus hab sup run --org prod # encrypt config with fnichol key for webacus.default@prod hab config apply \ webacus.default@prod \ $ver \ $encrypted_config.toml
  7. Configuration 1. Environment HAB_WEBACUS='maths_api = "http://maths.api" [app] port = 8080

    ' export HAB_WEBACUS hab svc load abahab/webacus hab sup run
  8. Configuration 2. File mkdir -p /hab/svc/webacus cat <<__EOF__ > /hab/svc/webacus/user.toml

    maths_api = "http://maths.api" [app] port = 8080 __EOF__ hab svc load abahab/webacus hab sup run
  9. Configuration 3. Config Apply (1) cat <<__EOF__ > /tmp/webacus.toml maths_api

    = "http://maths.api" [app] port = 8080 __EOF__ hab svc load abahab/webacus hab sup run hab config apply webacus.default $ver /tmp/webacus.toml
  10. Configuration 3. Config Apply (2) hab svc load abahab/webacus hab

    sup run cat <<__EOF__ | hab config apply webacus.default $ver maths_api = "http://maths.api" [app] port = 8080 __EOF__
  11. Service Group Config cat <<__EOF__ > webacus.default.toml maths_api = "http://maths.api"

    [app] port = 8080 __EOF__ git add webacus.default.toml git commit -m "Add webacus.default.toml"
  12. Seed Ring (Pseudo Code) find . -name '*.toml' | while

    read -r config_toml; do service_group="${config_toml%.toml}" hab apply \ --ring beyonce \ "$service_group" \ $(date +'%s') \ "$config_toml" done
  13. VCS Post-Merge Hook (Pseudo Code) git diff --name-only "$GIT_SHAS" |

    while read -r config_toml; do service_group="${config_toml%.toml}" hab apply \ --ring beyonce \ "$service_group" \ $(date +'%s') \ "$config_toml" done