Skip to content

Commit

Permalink
README documentation updated, improved and separated into multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
zuazo committed Oct 6, 2015
1 parent 5299b22 commit 505a194
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .kitchen.cloud.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
driver:
ssh_key: <%= ENV['SSH_AGENT_PID'].nil? ? ENV['EC2_SSH_KEY_PATH'] : nil %>
ssh_key: <%= ENV['SSH_AGENT_PID'].nil? ? ENV['SSH_KEY_PATH'] : nil %>

provisioner:
name: chef_solo
Expand Down
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Contributing
============

1. [Fork the repository on Github](https://help.github.com/articles/fork-a-repo).
2. Create a named feature branch (`$ git checkout -b my-new-feature`).
3. Write tests for your change (if applicable).
4. Write your change and its documentation.
5. [Run the tests](https://github.com/zuazo/owncloud-cookbook/blob/master/TESTING.md), ensuring they all pass (`$ bundle exec rake`).
6. Commit your change (`$ git commit -am 'Add some feature'`).
7. Push to the branch (`$ git push origin my-new-feature`).
8. [Submit a Pull Request using Github](https://help.github.com/articles/creating-a-pull-request).
119 changes: 56 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ownCloud Cookbook
Requirements
============

## Platform:
## Supported Platforms

* CentOS
* Debian
Expand All @@ -34,22 +34,21 @@ The following platforms are tested with Test Kitchen:
| Ubuntu 15.04 || | ✔ (travis) ||
| Scientific Linux 6 | ✔ (travis) | | ✔ (travis) | |

## Cookbooks:

* apache2
* apt
* cron
* database
* encrypted_attributes
* mysql
* nginx
* openssl
* php
* php-fpm
* postfix
* postgresql
* ssl_certificate
* yum-webtatic
## Required Cookbooks

* [apache2](https://supermarket.chef.io/cookbooks/apache2/)
* [apt](https://supermarket.chef.io/cookbooks/apt/)
* [cron](https://supermarket.chef.io/cookbooks/cron/)
* [database](https://supermarket.chef.io/cookbooks/database/)
* [encrypted_attributes](https://supermarket.chef.io/cookbooks/encrypted_attributes/)
* [mysql](https://supermarket.chef.io/cookbooks/mysql/)
* [nginx](https://supermarket.chef.io/cookbooks/nginx/)
* [openssl](https://supermarket.chef.io/cookbooks/openssl/)
* [php](https://supermarket.chef.io/cookbooks/php/)
* [php-fpm](https://supermarket.chef.io/cookbooks/php-fpm/)
* [postfix](https://supermarket.chef.io/cookbooks/postfix/)
* [postgresql](https://supermarket.chef.io/cookbooks/postgresql/)
* [ssl_certificate](https://supermarket.chef.io/cookbooks/ssl_certificate/)

## Required Applications

Expand Down Expand Up @@ -138,7 +137,7 @@ Usage

Add `recipe[owncloud]` to your node's run list or role, or include it in another cookbook.

The back-end database will be [MySQL](http://www.mysql.com/) by default, but [PostgreSQL](http://www.postgresql.org/) and [SQLite](http://www.sqlite.org/) databases can aslo be used. Database type can be set on `node['owncloud']['config']['dbtype']`, supported values are `mysql`, `pgsql` and `sqlite`.
The back-end database will be [MySQL](http://www.mysql.com/) by default, but [PostgreSQL](http://www.postgresql.org/) and [SQLite](http://www.sqlite.org/) databases can also be used. Database type can be set on `node['owncloud']['config']['dbtype']`, supported values are `mysql`, `pgsql` and `sqlite`.

On the first run, several passwords will be automatically generated and stored in the node:

Expand All @@ -154,7 +153,7 @@ By default ownCloud cookbook relies on a local *Postfix* installation to send em

## Examples

### Basic owncloud role
### Basic ownCloud Role

```ruby
name 'owncloud'
Expand All @@ -169,7 +168,7 @@ run_list(
)
```

### Using remote SMTP server
### Using Remote SMTP Server

In this example an [Amazon Simple Email Service](http://aws.amazon.com/ses/) account is used to send emails.

Expand Down Expand Up @@ -218,7 +217,7 @@ run_list(

## The HTTPS Certificate

OwnCloud will accept HTTPS requests when `node['owncloud']['ssl']` is set to `true`. By default the cookbook will create a self-signed certificate, but a custom one can also be used.
ownCloud will accept HTTPS requests when `node['owncloud']['ssl']` is set to `true`. By default the cookbook will create a self-signed certificate, but a custom one can also be used.

The custom certificate can be read from several sources:

Expand All @@ -237,7 +236,7 @@ include_recipe 'owncloud'

See the [`ssl_certificate` namespace documentation](https://supermarket.chef.io/cookbooks/ssl_certificate#namespaces) for more information.

### Custom HTTPS certificate from an Attribute
### Custom HTTPS Certificate from an Attribute

```ruby
name 'owncloud_ssl_attribute'
Expand All @@ -261,7 +260,7 @@ run_list(
)
```

### Custom HTTPS certificate from a Data Bag
### Custom HTTPS Certificate from a Data Bag

```ruby
name 'owncloud_ssl_data_bag'
Expand Down Expand Up @@ -292,7 +291,7 @@ run_list(
)
```

### Custom HTTPS certificate from Chef Vault
### Custom HTTPS Certificate from Chef Vault

```ruby
name 'owncloud_ssl_chef_vault'
Expand Down Expand Up @@ -320,9 +319,9 @@ run_list(
)
```

### Custom HTTPS certificate from file
### Custom HTTPS Certificate from File

This is usefull if you create the certificate on another cookbook.
This is useful if you create the certificate on another cookbook.

```ruby
name 'owncloud_ssl_file'
Expand All @@ -346,14 +345,14 @@ run_list(
)
```

Upgrading application
=====================
Upgrading the Application
=========================

If new owncloud version is released and you has notified in web user interface about update available, then you must re-run chef-client on owncloud server.

Cookbook recipes will download latest release version and install it to server.

Then you must proceed with update in web interface and system will be updated.
Then you must proceed with update in the web interface and the system will be updated.

Encrypted Attributes
====================
Expand Down Expand Up @@ -385,53 +384,47 @@ ownCloud with PostgreSQL may not work properly on some platforms. [Any feedback

If you are using PostgreSQL version `< 9.3`, you may need to adjust the `shmmax` and `shmall` kernel parameters to configure the shared memory. You can see [the example used for the integration tests](https://github.com/zuazo/owncloud-cookbook/tree/master/test/cookbooks/owncloud_test/recipes/postgresql_memory.rb).

Testing
=======
Deploy with Docker
==================

## Requirements
You can use the *Dockerfile* included in the [cookbook source code](https://github.com/zuazo/owncloud-cookbook) to run the cookbook inside a container:

You must have VirtualBox(https://www.virtualbox.org/) and Vagrant(http://www.vagrantup.com/) installed.
$ docker build -t chef-owncloud .
$ docker run -ti chef-owncloud

Install gem dependencies with bundler:
The sample *Dockerfile*:

```bash
$ gem install bundler
$ bundle install
```
```Dockerfile
FROM zuazo/chef-local:debian-7

## Running the tests
COPY . /tmp/owncloud
RUN berks vendor -b /tmp/owncloud/Berksfile $COOKBOOK_PATH
RUN chef-client -r "recipe[owncloud]"

```bash
$ bundle exec kitchen test
```

### Running the tests in the cloud
EXPOSE 80

You can run the tests in the cloud instead of using vagrant. First, you must set the following environment variables:
CMD ["apache2", "-D", "FOREGROUND"]
```

* `AWS_ACCESS_KEY_ID`
* `AWS_SECRET_ACCESS_KEY`
* `AWS_KEYPAIR_NAME`: EC2 SSH public key name. This is the name used in Amazon EC2 Console's Key Pairs section.
* `EC2_SSH_KEY_PATH`: EC2 SSH private key local full path. Only when you are not using an SSH Agent.
* `DIGITAL_OCEAN_CLIENT_ID`
* `DIGITAL_OCEAN_API_KEY`
* `DIGITAL_OCEAN_SSH_KEY_IDS`: DigitalOcean SSH numeric key IDs.
* `DIGITAL_OCEAN_SSH_KEY_PATH`: DigitalOcean SSH private key local full path. Only when you are not using an SSH Agent.
See the [chef-local container documentation](https://hub.docker.com/r/zuazo/chef-local/) for more examples.

Then, you must configure test-kitchen to use `.kitchen.cloud.yml` configuration file:
Testing
=======

$ export KITCHEN_LOCAL_YAML='.kitchen.cloud.yml'
$ bundle exec kitchen test
See [TESTING.md](https://github.com/zuazo/owncloud-cookbook/blob/master/TESTING.md).

Contributing
============

1. Fork the repository on Github
2. Create a named feature branch (like `add_component_x`)
3. Write you change
4. Write tests for your change (if applicable)
5. Run the tests, ensuring they all pass
6. Submit a Pull Request using Github
Please do not hesitate to [open an issue](https://github.com/zuazo/owncloud-cookbook/issues/new) with any questions or problems.

See [CONTRIBUTING.md](https://github.com/zuazo/owncloud-cookbook/blob/master/CONTRIBUTING.md).

TODO
====

See [TODO.md](https://github.com/zuazo/owncloud-cookbook/blob/master/TODO.md).


License and Author
==================
Expand All @@ -442,7 +435,7 @@ License and Author
| **Author:** | [Xabier de Zuazo](https://github.com/zuazo) (<xabier@zuazo.org>)
| **Contributor:** | [Nacer Laradji](https://github.com/laradji)
| **Contributor:** | [LEDfan](https://github.com/LEDfan)
| **Contributor:** | [avsh](https://github.com/avsh)
| **Contributor:** | [@avsh](https://github.com/avsh)
| **Contributor:** | [@cvl-skubriev](https://github.com/cvl-skubriev)
| **Contributor:** | [Michael Sprauer](https://github.com/MichaelSp)
| **Copyright:** | Copyright (c) 2015, Xabier de Zuazo
Expand Down
111 changes: 111 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
Testing
=======

## Required Gems

* `yard`
* `vagrant`
* `foodcritic`
* `rubocop`
* `berkshelf`
* `should_not`
* `chefspec`
* `test-kitchen`
* `kitchen-vagrant`
* `chef-encrypted-attributes`

### Required Gems for Guard

* `guard`
* `guard-foodcritic`
* `guard-rubocop`
* `guard-rspec`
* `guard-kitchen`

More info at [Guard Readme](https://github.com/guard/guard#readme).

## Installing the Requirements

You must have [VirtualBox](https://www.virtualbox.org/) and [Vagrant](http://www.vagrantup.com/) installed.

You can install gem dependencies with bundler:

$ gem install bundler
$ bundle install --without travis

## Generating the Documentation

$ bundle exec rake doc

## Running the Syntax Style Tests

$ bundle exec rake style

## Running the Unit Tests

$ bundle exec rake unit

## Running the Integration Tests

$ bundle exec rake integration:vagrant

Or:

$ bundle exec kitchen list
$ bundle exec kitchen test
[...]

### Running Integration Tests in Docker

You need to have [Docker installed](https://docs.docker.com/installation/).

$ wget -qO- https://get.docker.com/ | sh

Then use the `integration:docker` rake task to run the tests:

$ bundle exec rake integration:docker

### Running Integration Tests in the Cloud

#### Requirements

* `kitchen-digitalocean`
* `kitchen-ec2`

You can run the tests in the cloud instead of using vagrant. First, you must set the following environment variables:

* `AWS_ACCESS_KEY_ID` (See [`kitchen-ec2` gem documentation](https://github.com/test-kitchen/kitchen-ec2#authenticating-with-aws)).
* `AWS_SECRET_ACCESS_KEY` (See [`kitchen-ec2` gem documentation](https://github.com/test-kitchen/kitchen-ec2#authenticating-with-aws)).
* `AWS_SSH_KEY_ID`: EC2 SSH public key name. This is the name used in Amazon EC2 Console's Key Pars section (See [`kitchen-ec2` gem documentation](https://github.com/test-kitchen/kitchen-ec2#authenticating-with-aws)).
* `DIGITALOCEAN_ACCESS_TOKEN` (See [`kitchen-digitalocean` gem documentation](https://github.com/test-kitchen/kitchen-digitalocean#installation-and-setup)).
* `DIGITALOCEAN_SSH_KEY_IDS`: DigitalOcean SSH numeric key IDs (See [`kitchen-digitalocean` gem documentation](https://github.com/test-kitchen/kitchen-digitalocean#installation-and-setup)).
* `SSH_KEY_PATH`: EC2 SSH private key local full path. Only when you are not using an SSH Agent.

Then use the `integration:cloud` rake task to run the tests:

$ bundle exec rake integration:cloud

## Using Vagrant with the Vagrantfile

### Vagrantfile Requirements

* ChefDK: https://downloads.chef.io/chef-dk/
* Berkhelf and Omnibus vagrant plugins:
```
$ vagrant plugin install vagrant-berkshelf vagrant-omnibus
```
* The path correctly set for ChefDK:
```
$ export PATH="/opt/chefdk/bin:${PATH}"
```
### Vagrantfile Usage

$ vagrant up

To run Chef again on the same machine:

$ vagrant provision

To destroy the machine:

$ vagrant destroy
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TODO
====

* [ ] Document the libraries.

0 comments on commit 505a194

Please sign in to comment.