cookbook 'application_static', '= 0.2.0'
application_static (2) Versions 0.2.0 Follow1
Installs/Configures application_static
cookbook 'application_static', '= 0.2.0', :supermarket
knife supermarket install application_static
knife supermarket download application_static
application_static cookbook
This is the simple chef cookbook to quick host static web sites with nginx. Based on excellent application cookbook, which is only providing LWRPs, this cookbook actually has recipe.
So after defining it with Berkshelf/Librarian, you have to provide as minimal config as possible, to make your sites up and running.
config
Let's imagine you have several static websites, you want to host, each in it's own repository:
example1.com -> github.com/my-sites/example1.com
example2.com -> bitbucket.org/my-sites/example2.com
...
To get them running, you should do 3 simple steps.
1. adding cookbook
First thing todo, is adding application_static cookbook to your chef installation.
Berkshelf example:
ruby
cookbook "application_static", github: "allnightlong/application_static"
2. create role
Then create appropriate role:
json
{
"name": "static_sites",
"override_attributes": {
"nginx": {
"default_site_enabled": false,
"install_method": "repo"
},
"application_static": {
"apps": [
{
"name": "example1.com",
"url": "git@github.com:my-sites/example1.com",
"enabled": true
},
{
"name": "example2.com",
"url": "hg@bitbucket.org/my-sites/example2.com",
"enabled": true
}
],
"deploy_key" : "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEA38rGcWTe5Iux2MtIgmbl08P0f3KZfJBCIvKES9oFFglqAbI7\n...........\n5qJkpABldGtXpWxrllpFvWDGSWdv8WYJW308dXIp2C5LjE3saTuhBTgain7GDs6P\np5lXlrB0zUGU92likbgEvIFN0lzkpYt02ccxTCCU6bIa9pTI3IBK\n-----END RSA PRIVATE KEY-----"
}
},
"run_list": [
"recipe[nginx]",
"recipe[application_static]"
]
}
Note that you shouldn't really store private key in role file, in favor of databags or even better encrypted databags.
Also, if you getting troubles with multiline private key, use this tip.
3. apply role
knife node run_list add NODE_NAME role[static_sites]
That's basically it. After adding this role to node's run-list, you sites should be up and running.
This cookbook was tested on Ubuntu 14.04 LTS, but there is nothing os/platform/version specific, so it should work on any environment.
Dependent cookbooks
application >= 0.0.0 |
nginx >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Foodcritic Metric
0.2.0 failed this metric
FC031: Cookbook without metadata file: /tmp/cook/d30d57cf231a0b5edbf3ec5d/application_static/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/d30d57cf231a0b5edbf3ec5d/application_static/metadata.rb:1
0.2.0 failed this metric
FC045: Consider setting cookbook name in metadata: /tmp/cook/d30d57cf231a0b5edbf3ec5d/application_static/metadata.rb:1