-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from followfung/master
Updates readme
- Loading branch information
Showing
2 changed files
with
119 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,141 @@ | ||
lits_vm Cookbook | ||
# lits_vm Cookbook | ||
============= | ||
This cookbook will configures a base VM for installing applications. | ||
This cookbook configures a server to install applications on. Currently only tested on CentOS 7.x, but should work on RHEL 7.x as well. | ||
|
||
Attributes | ||
---------- | ||
## Requirements | ||
### Platforms | ||
- CentOS 7.x | ||
|
||
#### lits_vm::default | ||
* `node['lits_vm']['additional_packages']` - Additional packges to install using the default package manager, default: `nil` | ||
* `node['lits_vm']['permit_root_login']` - Whether or not to allow root user login, default: `no` | ||
* `node['lits_vm']['components']` - Components to install. See the recipes folder for available components, default: `[]` | ||
### Chef | ||
- Chef 12.1+ | ||
|
||
Usage | ||
----- | ||
### Cookbooks | ||
- apt | ||
- chef_nginx | ||
- chef-sugar | ||
- elasticsearch | ||
- firewall | ||
- java | ||
- nodejs | ||
- php | ||
- ssh-hardening | ||
- sshd | ||
- sudo | ||
- tar | ||
- users | ||
- yum-epel | ||
- yum-webtatic | ||
- mysql (~> 6.1.2) | ||
- database (~> 4.0.9) | ||
- mysql2_chef_gem (~> 1.0.2) | ||
|
||
#### lits_vm::default | ||
## Attributes | ||
* `node['lits_vm']['packages']` - Packages that the cookbook will install using the default package manager, default `[curl, git]` | ||
* `node['lits_vm']['enable_webtatic']` - Enables the Webtatic repository on EL systems (for recent versions of PHP), default `false` | ||
* `node['lits_vm']['firewall']['allow_ports']` - Defines which ports are open on the firewall, default `{}` | ||
|
||
Just include `lits_vm` in your node's `run_list`: | ||
## Resource/Provider | ||
None. | ||
|
||
## Recipes | ||
### default | ||
Include the default recipe in a run list. The default recipe does the following: | ||
* Configures the ssh daemon | ||
* Configures users and superusers using data bags (See https://supermarket.chef.io/cookbooks/users) | ||
* Configures firewall | ||
* Enables repositories if needed | ||
* Installs specified packages | ||
* Installs Node.js (TODO: make this optional and disabled by default) | ||
|
||
### elasticsearch | ||
This recipe installs elasticsearch (requires Java). | ||
|
||
### ffmpeg | ||
This recipe installs ffmpeg. | ||
|
||
### java | ||
This recipe installs Java. | ||
|
||
### mysql | ||
This recipe installs and configures MySQL databases using data bags. | ||
A sample mysql_service data bag would look like: | ||
```json | ||
{ | ||
"name":"my_node", | ||
"run_list": [ | ||
"recipe[lits_vm]" | ||
"bag_type" : "mysql_service", | ||
"id" : "mysql_service_default", | ||
"name" : "default", | ||
"bind_address" : "127.0.0.1", | ||
"version" : "5.5", | ||
"initial_root_password" : "a super secure password", | ||
"databases" : [ | ||
{ "name" : "default" } | ||
], | ||
"users" : [ | ||
{ | ||
"username" : "mysql_user", | ||
"password" : "a super secure password", | ||
"databases" : ["default"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Recipes | ||
------- | ||
|
||
#### install_mysql.rb | ||
|
||
This recipe installs a MySQL instance, and will look into the `node['mysql']['databases']` for instructions on how to configure databases. | ||
|
||
### nginx | ||
This recipe installs and configures Nginx using data bags. | ||
A sample nginx_site data bag would look like: | ||
```json | ||
{ | ||
"mysql" : { | ||
"service_name": "default", | ||
"initial_root_password": "a secure password", | ||
"databases" : { | ||
"MY_DATABASE" : { | ||
"user" : "my_database_user", | ||
"password" : "a secure password" | ||
"bag_type" : "nginx_site", | ||
"id" : "nginx_site_blank", | ||
"name" : "blank", | ||
"blocks" : { | ||
"server" : [ | ||
{ | ||
"config" : [ | ||
{ "directive" : "listen", "value" : "80 default" }, | ||
{ "directive" : "server_name", "value" : "_" }, | ||
{ "directive" : "return", "value" : "444" } | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
#### install_nginx.rb | ||
|
||
This recipe installs nginx, and will look into the `node['nginx']['sites_enabled']` array to enable nginx sites. | ||
### php | ||
This recipe installs and configures PHP and PHP-FPM using data bags. | ||
A sample fpm_pool data bag would look like: | ||
```json | ||
{ | ||
"bag_type" : "fpm_pool", | ||
"id" : "fpm_pool_default", | ||
"name" : "default_pool", | ||
"listen": "/var/run/php-fpm.default_pool.sock", | ||
"process_manager": "ondemand", | ||
"max_children": 10, | ||
"additional_config": { | ||
"env[PATH]": "/usr/local/bin:/usr/bin:/bin", | ||
"php_admin_value[date.timezone]": "\"America/Toronto\"", | ||
"php_value[pdo_mysql.default_socket]": "/var/run/mysql-default/mysqld.sock" | ||
} | ||
} | ||
``` | ||
|
||
*Note*: The cookbook looks for a template in this cookbook's template folder named `SITE_NAME.nginx.erb` | ||
## Usage | ||
Just include the `lits_vm` recipe at the beginning of your run list. | ||
|
||
#### Role example: | ||
```json | ||
{ | ||
"nginx" : { | ||
"sites_enabled" : { | ||
"SITE_NAME" : { | ||
"root_directory" : "mysite", | ||
"server_name" : "my.domain.com" | ||
} | ||
} | ||
} | ||
{ | ||
"name": "my_server", | ||
"description": "Sets up my server", | ||
"chef_type": "role", | ||
"json_class": "Chef::Role", | ||
"run_list": [ | ||
"recipe[lits_vm]" | ||
] | ||
} | ||
``` | ||
|
||
License and Authors | ||
------------------- | ||
## License and Authors | ||
* Patrick Fung (<patrick@makestuffdostuff.com>) |