Skip to content

Deployment

mfarrar edited this page Oct 24, 2014 · 7 revisions

The Supermarket cookbook [lives in its own repo] (https://github.com/opscode-cookbooks/supermarket).

Deploying with Chef

  1. Clone the Supermarket cookbook.
$ git clone https://github.com/opscode-cookbooks/supermarket.git
  1. Upload the supermarket cookbook to your Chef server.
$ knife cookbook upload supermarket -o path-to-supermarket-chef-repo
  1. Bootstrap a server as a new node.
$ knife bootstrap someserver.com -u some-user -N some-node
  1. Change the defaults in chef/data_bags/apps/supermarket.json and upload this databag to your Chef server. Supermarket Configuration Docs
$ knife data bag from file apps path-to-supermarket-repo/chef/data_bags
  1. Add the supermarket cookbook to your newly bootstraped nodes run list.
$ knife node run_list add some-node 'recipe[supermarket]'
  1. Override any default attributes found in chef/cookbooks/supermarket/attributes/default.rb in a role or environment as needed.

  2. SSH into your node and run chef-client this will deploy supermarket.

$ ssh some-user@someserver.com
$ chef-client
  1. Configure authentication with Chef identity

Testing The Deployment

  1. Using the knife-supermarket plugin, try to upload a new cookbook to your Supermarket.

Make sure your knife.rb has knife[:supermarket_site] set to the url of your supermarket server.

knife[:supermarket_site] = 'https://supermarket.example.com'

For safety's sake, use a new cookbook. (You don't accidently want to upload a company cookbook to supermarket.getchef.com!)

$ berks cookbook my-face
...
$ knife supermarket share my-face Other
Generating metadata for my-face from /var/folders/m6/y11btst14nx39fkfnbhh2zp00000gn/T/chef-my-face-build20140922-6969-klaeqt/my-face/metadata.rb
Making tarball my-face.tgz
Upload complete!
  1. Make sure you can see the cookbook you just uploaded.
$ knife supermarket show my-face
average_rating:     
category:           Other
created_at:         2014-09-22T19:37:57.205Z
deprecated:         false
description:        Installs/Configures my-face
external_url:       
foodcritic_failure: 
latest_version:     http://supermarket.example.com/api/v1/cookbooks/my-face/versions/0.1.0
maintainer:         echohack
metrics:
  downloads:
    total:    0
    versions:
      0.1.0: 0
  followers: 0
name:               my-face
updated_at:         2014-09-22T19:37:57.179Z
versions:           http://supermarket.example.com/api/v1/cookbooks/my-face/versions/0.1.0
  1. Add your supermarket server to your Berksfile and add the cookbook you just uploaded as a dependency of another cookbook. Then berks install.

my-other-face > Berksfile

source 'https://supermarket.example.com'
source 'https://supermarket.getchef.com'

metadata

my-other-face > metadata.rb

name 'my-other-face'
maintainer 'my-other-face'
maintainer_email 'my-other-face@example.com'
license 'All rights reserved'
description 'Installs/Configures my-other-face.'
long_description 'Installs/Configures my-other-face.'
version '0.0.1'

depends 'my-face', '~> 0.0.1'

$ berks install

Feature Flags

There are various feature flags within Supermarket to enable/disable different features within Supermarket. When enabled, set to "true", those features will be present in the app.

Here is the list of feature flags and what they do:

  • TOOLS_ENABLED, default true - displays the UI for adding, viewing and managing Tools
  • JOIN_CCLA_ENABLED, default true - displays the UI for requesting to join and managing requests to join an Organization
  • NO_CRAWL, default false - adds the meta tag for robots/spiders to not crawl and index Supermarket