EditingAllNodes - noahgibbs/madscience GitHub Wiki
By default, there's a top code block (surrounded with <% %>) where we load keys and secrets out of files in ~/.deploy_credentials. You can leave this alone unless you need to add more secrets.
The "ruby_apps" top-level entry is the first thing you'll probably want to modify. It's a hash of hashes, with each app's name as the key to a hash of data about it. Unrecognized keys in the app's data are ignored.
Example:
"ruby_apps": {
"rebuilding_rails": {
"rails": "false",
"git": "[email protected]:noahgibbs/rebuilding_rails.git",
"user": "www",
"server_names": "rebuilding-rails.com",
"redirect_hostnames": ["www.rebuilding-rails.com"]
}
}
These keys are used:
- git: the git URL for your app.
- user: the user to run your app as.
- rails: if set to the string "false", no migrations nor asset building will be done for this app.
- packages: extra Ubuntu packages to install. These can be names of standard Ubuntu packages or two-element arrays of name/version pairs.
- server_names: an array of strings specifying DNS names the server will respond as.
- redirect_hostnames: an array of strings that will redirect to your first server name.
- env_vars: a hash of environment variables - keys are the variable name, values are the variable value. Useful for storing secrets.
- unicorn_arguments, log_run_arguments, chpst_arguments, extra_code, extra_log_code: these arguments customize how your application is started. You'll want to review chapter 4 to see how these are used.
The "static_sites" entry is used to set up HTML and JavaScript sites. These will be cloned and served as web sites, but won't run a back-end server.
It's a hash of hashes just like ruby_apps.
Example:
"codefolio_octopress": {
"root": "public",
"user": "www",
"server_names": "codefol.io",
"git": "[email protected]:noahgibbs/codefolio_octopress.git",
"redirect_hostnames": ["angelbob.com", "www.angelbob.com", "blog.angelbob.com", "www.codefol.io"]
}
These keys are used:
- git: the git URL for your site.
- root: the document root inside the repo, commonly "public".
- user: the user to clone your site as.
- server_names: an array of strings specifying DNS names the server will respond as.
- redirect_hostnames: an array of strings that will redirect to your first server name.
Users allows you to specify application-specific users to be created. You can just mention these in your app or site specifications, but this allows you to create users that neither an app nor a site runs as. The top-level entry for users is named "users" and it can be a hash of user names to (ignored) attributes or just an array of strings.
The "run_list" entry is a Chef run list. It lists which Chef cookbooks are invoked, and in what order. In later chapters you'll see examples of adding Chef cookbooks to your site configuration. When that happens, you'll usually need to add that cookbook to the run list.
You may also need to add a top-level configuration entry in the JSON file for that cookbook, as the default all_nodes.json.erb does for nginx, rvm and others.
Other entries are passed to Chef as attributes of the server. Cookbooks that Chef uses can pull values from them and configure themselves, as nginx and rvm do by default.