<commit_before># apache2-git-site-cookbook

This cookbook configures a git-backed site on an apache2 vhost, allowing easy
deployments without having to use ftp or capistrano.

A site can be redeployed by merging changes into a specified branch (default:
the node's environment name)

The git repository will be re-synced every chef run, and can be configured
from node attributes. Multiple sites can be created by listing additional sites
in the attribute hash. A new user will be created for each site, and by default
the files will be owned by this user, and the apache group.

## Suggestions

Use the [s3fs cookbook](https://supermarket.getchef.com/cookbooks/s3fs) to
mount persistent storage for use between your web instances, if necessary.

## Supported Platforms

Ubuntu, possibly other unices. (Untested)

## Dependencies

Cookbooks:
- git
- apache2

Recipes included
- git::default
- apache2::default

## Attributes

<table>
  <tr>
    <th>Type</th>
    <th>Description</th>
    <th>Default</th>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites-path']</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>Root directory to contain cloned sites</td>
    <td colspan="3"><tt>node/var/www</tt></td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites']</tt></td>
  </tr>
  <tr>
    <td>Hash</td>
    <td>Hash of site definitions</td>
    <td colspan="3"><tt>nodeEmpty hash</tt></td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites']{hash_key}</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>Site ID</td>
    <td>None</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites']{hash_value}</tt></td>
  </tr>
  <tr>
    <td>Hash</td>
    <td>Hash of site parameters</td>
    <td>None</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['documentroot']</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>Document root relative to the root of the git repostitory</td>
    <td>htdocs</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['repository']</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>URL for the git repository to be cloned</td>
    <td>None (required)</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['branch']</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>Git branch to be checked out</td>
    <td>node['environment']</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['site-user']</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>User that the checked-out files will be owned by</td>
    <td>www-#{site-id}</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['site-group']</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>Group that the checked-out files will be owned by. Must already exist, and apache user should be a member.</td>
    <td>node['apache']['group']</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['servername']</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>Vhost server name</td>
    <td>None (required)</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['serveradmin']</tt></td>
  </tr>
  <tr>
    <td>String</td>
    <td>Server admin</td>
    <td>webmaster@#{['apache2-git-site']['sites'][site_id]['servername']}</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['serveraliases']</tt></td>
  </tr>
  <tr>
    <td>String Array</td>
    <td>Vhost server aliases</td>
    <td>Empty array</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['default-options']</tt></td>
  </tr>
  <tr>
    <td>String Array</td>
    <td>Default apache options for documentroot directory</td>
    <td>['FollowSymLinks', 'MultiViews', 'ExecCgi']</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['aliases']</tt></td>
  </tr>
  <tr>
    <td>Hash Array {"path": "root"}</td>
    <td>An array of hashes that define aliases, where 'path' is the alias path, and 'root' is the alias root relative to the checkout directory</td>
    <td>Empty array</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['extra-config']</tt></td>
  </tr>
  <tr>
    <td>String Array</td>
    <td>An array of additional configuration lines to be added to the apache virtual host configuration file. For example, adding rewrite rules or specifying a custom log.</td>
    <td>Empty array</td>
  </tr>
  <tr>
    <td colspan="3"><tt>node['apache2-git-site']['sites'][site_id]['sync-notify-commands']</tt></td>
  </tr>
  <tr>
    <td>String Array</td><commit_msg>Further readme prettification<commit_after># apache2-git-site-cookbook

This cookbook configures a git-backed site on an apache2 vhost, allowing easy
deployments without having to use ftp or capistrano.

A site can be redeployed by merging changes into a specified branch (default:
the node's environment name)

The git repository will be re-synced every chef run, and can be configured
from node attributes. Multiple sites can be created by listing additional sites
in the attribute hash. A new user will be created for each site, and by default
the files will be owned by this user, and the apache group.

## Suggestions

Use the [s3fs cookbook](https://supermarket.getchef.com/cookbooks/s3fs) to
mount persistent storage for use between your web instances, if necessary.

## Supported Platforms

Ubuntu, possibly other unices. (Untested)

## Dependencies

Cookbooks:
- git
- apache2

Recipes included
- git::default
- apache2::default

## Attributes

<table>
  <tr>
    <th>Type</th>
    <th>Description</th>
    <th>Default</th>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites-path']*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>Root directory to contain cloned sites</td>
    <td colspan="3">- *node/var/www</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites']*</td>
  </tr>
  <tr>
    <td>Hash</td>
    <td>Hash of site definitions</td>
    <td colspan="3">- *nodeEmpty hash</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites']{hash_key}*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>Site ID</td>
    <td>None</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites']{hash_value}*</td>
  </tr>
  <tr>
    <td>Hash</td>
    <td>Hash of site parameters</td>
    <td>None</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['documentroot']*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>Document root relative to the root of the git repostitory</td>
    <td>htdocs</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['repository']*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>URL for the git repository to be cloned</td>
    <td>None (required)</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['branch']*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>Git branch to be checked out</td>
    <td>node['environment']</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['site-user']*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>User that the checked-out files will be owned by</td>
    <td>www-#{site-id}</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['site-group']*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>Group that the checked-out files will be owned by. Must already exist, and apache user should be a member.</td>
    <td>node['apache']['group']</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['servername']*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>Vhost server name</td>
    <td>None (required)</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['serveradmin']*</td>
  </tr>
  <tr>
    <td>String</td>
    <td>Server admin</td>
    <td>webmaster@#{['apache2-git-site']['sites'][site_id]['servername']}</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['serveraliases']*</td>
  </tr>
  <tr>
    <td>String Array</td>
    <td>Vhost server aliases</td>
    <td>Empty array</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['default-options']*</td>
  </tr>
  <tr>
    <td>String Array</td>
    <td>Default apache options for documentroot directory</td>
    <td>['FollowSymLinks', 'MultiViews', 'ExecCgi']</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['aliases']*</td>
  </tr>
  <tr>
    <td>Hash Array {"path": "root"}</td>
    <td>An array of hashes that define aliases, where 'path' is the alias path, and 'root' is the alias root relative to the checkout directory</td>
    <td>Empty array</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['extra-config']*</td>
  </tr>
  <tr>
    <td>String Array</td>
    <td>An array of additional configuration lines to be added to the apache virtual host configuration file. For example, adding rewrite rules or specifying a custom log.</td>
    <td>Empty array</td>
  </tr>
  <tr>
    <td colspan="3">- *node['apache2-git-site']['sites'][site_id]['sync-notify-commands']*</td>
  </tr>
  <tr>
    <td>String Array</td>
{'fraction_non_alphanumeric': 0.20889830508474577, 'fraction_numerical': 0.008686440677966102, 'mean_word_length': 3.6622222222222223, 'pattern_counts': {'":': 2, '<': 431, '<?xml version=': 0, '>': 431, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6008337', 'n_tokens_mistral': 3637, 'n_tokens_neox': 3548, 'n_words': 831}