Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

docker_deploy (6) Versions 0.4.3

Installs/Configures docker_deploy

Policyfile
Berkshelf
Knife
cookbook 'docker_deploy', '= 0.4.3', :supermarket
cookbook 'docker_deploy', '= 0.4.3'
knife supermarket install docker_deploy
knife supermarket download docker_deploy
README
Dependencies
Changelog
Quality 0%

docker_deploy-cookbook

Cookbook for simple project deployments using Docker. Includes container rotation and deletion after N deployments.
Wrapper for docker ruby API with knife-container like container deployment.

Supported Platforms

Docker 1.3.3-1.4.1

Create image

docker_deploy_image "image_name" do
  tag "latest"
  base_image "chef/ubuntu-14.04"
  base_image_tag "latest"
  chef_environment "_default"
  docker_build_commands ([
    'RUN apt-get update'
  ])
  first_boot ({
    "runit" => {
      'sv_bin' => '/opt/chef/embedded/bin/sv',
      'chpst_bin' => '/opt/chef/embedded/bin/chpst',
      'service_dir' => '/opt/chef/service',
      'sv_dir' => '/opt/chef/sv'
    },
    'chef_client' => {
      'init_style' => 'runit'
    },
    "tags" => [
      "docker",
      "container"
    ],
    "run_list" => [
      'recipe[runit::default]'
    ]
  })
  encrypted_data_bag_secret encrypted_data_bag_secret
  validation_key validation_key
  chef_admin_user "admin"
  chef_admin_key data_bag['private_key']
  action :build_if_missing
end

Actions

:pull

  • Pull image by name and tag. Replace existing image if the source is updated.

:pull_if_missing

  • Pull only if an image of the same name and tag does not already exist.

:try_pull

  • Same as pull but silently skip this step if the image cannot be pulled.

:try_pull_if_missing

  • Same as pull_if_missing but silently skip this step if the image cannot be pulled.

:build

  • Build image and replace existing image of the same name and tag.

:build_if_missing

  • Build image if an image of the same name and tag does not already exist.

:push

  • Push image. Push to local registry only so far.

Create container

docker_deploy_container "container_name" do
  base_image "image_name"
  base_image_tag "latest"
  node_name "sample_service"
  port_bindings ({
    "8081/tcp" => [
      {
        "HostIp" => "0.0.0.0",
        "HostPort" => "8081"
      }
    ],
    "8080/tcp" => [
      {
        "HostIp" => "0.0.0.0",
        "HostPort" => "8080"
      }
    ]
  })
  binds ([
    "/test:/test"
  ])
  env ([
    "TEST=env"
  ])
  container_create_options ({
    "ExposedPorts" => {
      "8081/tcp" => {},
      "8080/tcp" => {}
    }
  })
  container_start_options ({
    "Privileged" => true
  })
  chef_secure_dir "/var/chef/sample"
  encrypted_data_bag_secret encrypted_data_bag_secret
  validation_key validation_key
  keep_releases 2
  stop_conflicting true
  action :create_and_rotate
end

Actions

:create

  • Create and replace existing container of the same name.
    • There are checks in place to attempt to detect identical container configurations and only create and replace an existing container as needed.

:create_if_missing

  • Create only if a container of the same name does not already exist.

:create_and_rotate

  • Rotate containers by common node_name.
    • Create new container with unique name of format base_name-random_string to avoid name conflict.
    • Stop but keep N containers with the same node_name.
    • Older containers with the same node_name are deleted in order of earliest time stopped.
    • Images of deleted containers are also removed if not used by any other container.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

0.1.0

Initial release of docker_deploy

Foodcritic Metric
            

0.4.3 failed this metric

FC015: Consider converting definition to a LWRP: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/definitions/docker_build.rb:1
FC015: Consider converting definition to a LWRP: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/definitions/docker_run.rb:1
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/container.rb:259
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/container.rb:263
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/container.rb:267
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/image.rb:156
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/image.rb:160
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/image.rb:164
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/image.rb:168
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/image.rb:172
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/image.rb:176
FC017: LWRP does not notify when updated: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/image.rb:180
FC021: Resource condition in provider may not behave as expected: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/providers/image.rb:84
FC048: Prefer Mixlib::ShellOut: /tmp/cook/c8f7cfbd735c892c58d09a3c/docker_deploy/libraries/default.rb:68