Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

owncloud (9) Versions 1.0.0

Installs and configures ownCloud, an open source personal cloud for data and file sync, share and view.

Berkshelf/Librarian
Policyfile
Knife
cookbook 'owncloud', '~> 1.0.0'
cookbook 'owncloud', '~> 1.0.0', :supermarket
knife cookbook site install owncloud
knife cookbook site download owncloud
README
Dependencies
Changelog
Quality 78%

ownCloud Cookbook

Cookbook Version GitHub Source Dependency Status Code Climate Build Status Coverage Status Inline docs

Chef cookbook to install and configure ownCloud, an open source personal cloud for data and file sync, share and view.

Requirements

Supported Platforms

  • CentOS
  • Debian
  • Scientific Linux
  • Ubuntu

The following platforms are tested with Test Kitchen:

Platform MySQL PostgreSQL SQLite NGINX
CentOS 5
CentOS 6 ✔ (travis) ✔ (travis)
CentOS 7
Debian 6
Debian 7 ✔ (travis) ✔ (travis) ✔ (travis) ✔ (travis)
Debian 8 ✔ (travis) ✔ (travis) ✔ (travis) ✔ (travis)
Ubuntu 12.04 ✔ (travis) ✔ (travis)
Ubuntu 14.04 ✔ (travis) ✔ (travis)
Ubuntu 15.04 ✔ (travis)
Scientific Linux 6 ✔ (travis) ✔ (travis)

Please, let me know if you use it successfully on any other platform.

Required Cookbooks

Required Applications

  • Chef >= 11.14.2.
  • Ruby 2.0.0 or higher.

Other Requirements

On RedHat based platforms, you need to disable or configure SELinux correctly. You can use the selinux::disabled recipe for that.

Attributes

Attribute Default Description
node['owncloud']['version'] calculated Version of ownCloud to install.
node['owncloud']['download_url'] calculated URL from where ownCloud will be downloaded.
node['owncloud']['deploy_from_git'] false Whether ownCloud should be deployed from the git repository.
node['owncloud']['git_repo'] calculated URL of the ownCloud git repository.
node['owncloud']['git_ref'] nil Git reference to deploy.
node['owncloud']['www_dir'] calculated Root directory defined in the web server where web documents are stored.
node['owncloud']['dir'] calculated Directory where ownCloud will be installed.
node['owncloud']['data_dir'] calculated Directory where ownCloud data will be stored.
node['owncloud']['server_name'] calculated Sets the server name for the ownCloud virtual host.
node['owncloud']['server_aliases'] [] Sets the server name aliases for the ownCloud virtual host.
node['owncloud']['install_postfix'] true Whether to install Postfix when a local MTA is needed.
node['owncloud']['web_server'] 'apache' Web server to use: 'apache' or 'nginx'.
node['owncloud']['php-fpm']['pool'] 'owncloud' PHP-FPM pool name to use with ownCloud.
node['owncloud']['max_upload_size'] '512M' Maximum allowed size for uploaded files.
node['owncloud']['sendfile'] calculated Whether to enable sendfile on web server. You should set to 'false' if you use NFS or SMB mounts.
node['owncloud']['ssl'] true Whether ownCloud should accept requests through TLS.
node['owncloud']['admin']['user'] 'admin' Administrator username.
node['owncloud']['admin']['pass'] calculated Administrator password.
node['owncloud']['config']['dbtype'] 'mysql' Type of database, can be 'sqlite', 'mysql' or 'pgsql'.
node['owncloud']['config']['dbname'] 'owncloud' Name of the ownCloud database.
node['owncloud']['config']['dbuser'] 'owncloud' User to access the ownCloud database.
node['owncloud']['config']['dbpassword'] calculated Password to access the ownCloud database.
node['owncloud']['config']['dbhost'] '127.0.0.1' Host running the ownCloud database.
node['owncloud']['config']['dbport'] calculated Port the ownCloud database is running at.
node['owncloud']['config']['dbtableprefix'] '' Prefix for the ownCloud tables in the database.
node['owncloud']['config']['mail_smtpmode'] 'sendmail' Mode to use for sending mail, can be 'sendmail', 'smtp', 'qmail' or 'php'.
node['owncloud']['config']['mail_smtphost'] '127.0.0.1' Host to use for sending mail, depends on mail_smtpmode if this is used.
node['owncloud']['config']['mail_smtpport'] 25 Port to use for sending mail, depends on mail_smtpmode if this is used.
node['owncloud']['config']['mail_smtptimeout'] 10 SMTP server timeout in seconds for sending mail, depends on mail_smtpmode if this is used.
node['owncloud']['config']['mail_smtpsecure'] '' SMTP connection prefix or sending mail, depends on mail_smtpmode if this is used. Can be '', 'ssl' or 'tls'.
node['owncloud']['config']['mail_smtpauth'] false Whether authentication is needed to send mail, depends on mail_smtpmode if this is used.
node['owncloud']['config']['mail_smtpauthtype'] 'LOGIN' Authentication type needed to send mail, depends on mail_smtpmode if this is used. Can be 'LOGIN', 'PLAIN' or 'NTLM'.
node['owncloud']['config']['mail_smtpname'] '' Username to use for sendmail mail, depends on mail_smtpauth if this is used.
node['owncloud']['config']['mail_smtppassword'] '' Password to use for sendmail mail, depends on mail_smtpauth if this is used.
node['owncloud']['cron']['enabled'] true Whether to enable ownCloud cron job.
node['owncloud']['cron']['min'] '*/15' Minute to run ownCloud cron at.
node['owncloud']['cron']['hour'] '*' Hour to run ownCloud cron at.
node['owncloud']['cron']['day'] '*' Day of month to run ownCloud cron at.
node['owncloud']['cron']['month'] '*' Month to run ownCloud cron at.
node['owncloud']['cron']['weekday'] '*' Weekday to run ownCloud cron at.
node['owncloud']['skip_permissions'] false Whether to skip settings the permissions of the ownCloud directory. Set this to true when using NFS synced folders.
node['owncloud']['manage_database'] calculated Whether to manage database creation.
node['owncloud']['mysql']['instance'] 'default' MySQL database instance name to run by the mysql_service LWRP from the mysql cookbook.
node['owncloud']['mysql']['data_dir'] calculated MySQL data files path.
node['owncloud']['mysql']['run_group'] calculated MySQL system group.
node['owncloud']['mysql']['run_user'] calculated MySQL system user.
node['owncloud']['mysql']['version'] nil MySQL version to install by the mysql_service LWRP. Refer to mysql cookbook platform support section.
node['owncloud']['mysql']['server_root_password'] calculated MySQL root password to access a database instance.
node['owncloud']['encrypt_attributes'] false Whether to encrypt ownCloud attributes containing credential secrets.

Some cookbook attributes are used internally to support the different platforms. Surely you want to change them if you want to support new platforms or want to improve the support of some platforms already supported.

Attribute Default Description
node['owncloud']['packages']['core'] calculated ownCloud core package names as array.
node['owncloud']['packages']['sqlite'] calculated ownCloud package names array for SQLite.
node['owncloud']['packages']['mysql'] calculated ownCloud package names array for MySQL.
node['owncloud']['packages']['pgsql'] calculated ownCloud package names array for PostgreSQL.

Recipes

owncloud::default

Installs and configures ownCloud.

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 by default, but PostgreSQL and SQLite 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:

  • node['owncloud']['admin']['pass']
  • node['owncloud']['config']['dbpassword'] (Only when using MySQL or PostgreSQL)
  • node['owncloud']['mysql']['server_root_password'] (Only when using MySQL)

When using Chef Solo, these passwords need to be set manually.

The attribute node['owncloud']['server_name'] should be set to the domain name used by the ownCloud installation. If not set, node['fqdn'] will be used instead.

By default ownCloud cookbook relies on a local Postfix installation to send emails. But a remote SMTP server can be used changing node['owncloud']['config']['mail_smtpmode'] to smtp and setting up the rest of the mail configuration attributes (see example below).

Examples

Basic ownCloud Role

name 'owncloud'
description 'Install ownCloud'
default_attributes(
  'owncloud' => {
    'server_name' => 'cloud.mysite.com'
  }
)
run_list(
  'recipe[owncloud]'
)

Using Remote SMTP Server

In this example an Amazon Simple Email Service account is used to send emails.

name 'owncloud_ses'
description 'Install ownCloud and use an AWS SES account to send emails'
default_attributes(
  'owncloud' => {
    'server_name' => 'cloud.mysite.com',
    'config' => {
      'mail_smtpmode' => 'smtp',
      'mail_smtphost' => 'email-smtp.us-east-1.amazonaws.com',
      'mail_smtpport' => 465,
      'mail_smtpsecure' => 'tls',
      'mail_smtpauth' => true,
      'mail_smtpauthtype' => 'LOGIN',
      'mail_smtpname' => 'amazon-ses-username',
      'mail_smtppassword' => 'amazon-ses-password'
    }
  }
)
run_list(
  'recipe[owncloud]'
)

Deploying from Git

The ownCloud code can be deployed from the Git repository. Git recipe must be included on the run_list.

name 'owncloud_git'
description 'Install ownCloud from Git'
default_attributes(
  'owncloud' => {
    'server_name' => 'cloud.mysite.com',
    'deploy_from_git' => true,
    'git_ref' => 'master'
  }
)
run_list(
  'recipe[git::default]',
  'recipe[owncloud]'
)

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.

The custom certificate can be read from several sources:

  • Attribute
  • Data Bag
  • Encrypted Data Bag
  • Chef Vault
  • File

This cookbook uses the ssl_certificate cookbook to create the HTTPS certificate. The namespace used is node['owncloud']. For example:

node.default['owncloud']['common_name'] = 'owncloud.example.com'
include_recipe 'owncloud'

See the ssl_certificate namespace documentation for more information.

Custom HTTPS Certificate from an Attribute

name 'owncloud_ssl_attribute'
description 'Install ownCloud with a custom SSL certificate from an Attribute'
default_attributes(
  'owncloud' => {
    'server_name' => 'cloud.mysite.com',
    'ssl' => true,
    'ssl_key' => {
      'source' => 'attribute',
      'content' => '-----BEGIN PRIVATE KEY-----[...]'
    },
    'ssl_cert' => {
      'source' => 'attribute',
      'content' => '-----BEGIN CERTIFICATE-----[...]'
    }
  }
)
run_list(
  'recipe[owncloud]'
)

Custom HTTPS Certificate from a Data Bag

name 'owncloud_ssl_data_bag'
description 'Install ownCloud with a custom SSL certificate from a Data Bag'
default_attributes(
  'owncloud' => {
    'server_name' => 'cloud.mysite.com',
    'ssl' => true,
    'ssl_key' => {
      'source' => 'data-bag',
      'bag' => 'ssl',
      'item' => 'key',
      'item_key' => 'content',
      'encrypted' => true,
      'secret_file' => '/path/to/secret/file' # optional
    },
    'ssl_cert' => {
      'source' => 'data-bag',
      'bag' => 'ssl',
      'item' => 'cert',
      'item_key' => 'content',
      'encrypted' => false
    }
  }
)
run_list(
  'recipe[owncloud]'
)

Custom HTTPS Certificate from Chef Vault

name 'owncloud_ssl_chef_vault'
description 'Install ownCloud with a custom SSL certificate from Chef Vault'
default_attributes(
  'owncloud' => {
    'server_name' => 'cloud.mysite.com',
    'ssl' => true,
    'ssl_key' => {
      'source' => 'chef-vault',
      'bag' => 'owncloud',
      'item' => 'ssl',
      'item_key' => 'key'
    },
    'ssl_cert' => {
      'source' => 'chef-vault',
      'bag' => 'owncloud',
      'item' => 'ssl',
      'item_key' => 'cert'
    }
  }
)
run_list(
  'recipe[owncloud]'
)

Custom HTTPS Certificate from File

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

name 'owncloud_ssl_file'
description 'Install ownCloud with a custom SSL certificate from file'
default_attributes(
  'owncloud' => {
    'server_name' => 'cloud.mysite.com',
    'ssl' => true,
    'ssl_key' => {
      'source' => 'file',
      'path' => '/path/to/ssl/key'
    },
    'ssl_cert' => {
      'source' => 'file',
      'path' => '/path/to/ssl/cert'
    }
  }
)
run_list(
  'recipe[owncloud]'
)

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 the web interface and the system will be updated.

Encrypted Attributes

This cookbook can use the encrypted_attributes cookbook to encrypt the secrets generated during the Chef Run. This feature is disabled by default, but can be enabled setting the node['owncloud']['encrypt_attributes'] attribute to true. For example:

include_recipe 'encrypted_attributes::users_data_bag'
node.default['owncloud']['encrypt_attributes'] = true
inclure_recipe 'owncloud'

This will create the following encrypted attributes:

  • node['owncloud']['admin']['pass']: ownCloud Admin password.
  • node['owncloud']['mysql']['server_root_password']: MySQL root user password.
  • node['owncloud']['config']['dbpassword']: MySQL ownCloud user password.

Read the chef-encrypted-attributes gem documentation to learn how to read them.

Warning: When PostgreSQL is used, the database root password will still remain unencrypted in the node['postgresql']['password']['postgres'] attribute due to limitations of the postgresql cookbook.

PostgreSQL Support

ownCloud with PostgreSQL may not work properly on some platforms. Any feedback you can provide regarding the PostgreSQL support will be greatly appreciated.

PostgreSQL Versions < 9.3

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.

Deploy with Docker

You can use the Dockerfile included in the cookbook source code to run the cookbook inside a container:

$ docker build -t chef-owncloud .
$ docker run -ti chef-owncloud

The sample Dockerfile:

FROM zuazo/chef-local:debian-7

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

EXPOSE 80

CMD ["apache2", "-D", "FOREGROUND"]

See the chef-local container documentation for more examples.

Testing

See TESTING.md.

Contributing

Please do not hesitate to open an issue with any questions or problems.

See CONTRIBUTING.md.

TODO

See TODO.md.

License and Author

Author: Raul Rodriguez (raul@onddo.com)
Author: Xabier de Zuazo (xabier@zuazo.org)
Contributor: Nacer Laradji
Contributor: LEDfan
Contributor: @avsh
Contributor: @cvl-skubriev
Contributor: Michael Sprauer
Copyright: Copyright (c) 2015, Xabier de Zuazo
Copyright: Copyright (c) 2013-2015 Onddo Labs, SL.
License: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

CHANGELOG for owncloud

This file is used to list changes made in each version of owncloud.

v1.0.0 (2015-10-08)

Upgrading from a 0.x.y Cookbook Release

Note: Please do this with caution. Make a full backup before upgrading.

If you want to upgrade the cookbook version from a 0.x release, you should change the MySQL data directory to the old path (or migrate the database by hand):

node.default['owncloud']['mysql']['data_dir'] = '/var/lib/mysql'
# [...]
include_recipe 'owncloud'

Breaking Changes on v1.0.0

New Features on v1.0.0

Fixes on v1.0.0

  • Install crontab: Fixes a CentOS error (#7181d5a).
  • OwncloudCookbook::Config library: Escape JSON backslash and quotes for PHP (#4941aea).
  • Fix postgresql_database_user[owncloud] resource duplication (#70e48e6).

Improvements on v1.0.0

  • Remove #deep_to_hash method (requires Chef 11.12) (#cadff9e).
  • Use fail instead of Chef::Application.fatal! (#2fcf112).
  • Fix all RuboCop offenses (big refactor) (#aa08214).
  • Move the ruby_block[apply config] logic to a library, including tests (#e20824b).
  • Fix the last foodcritic offenses (#bafd29b, #8cca6f9, #a6839d4).
  • Use node['platform_family'] to improve platforms support (#1e2ede8).
  • Do not use node#override (#60c46c1).
  • Use Chef::Log instead of log resource (#9fd7783).
  • Rename some resources to avoid name collisions (#0665b0f).
  • Use node['owncloud']['config']['dbhost'] attribute for the local database connections (#3269e9f).
  • Improve errors checking during ownCloud setup (#561cdec, #7a439b7).
  • Improve disabling nginx default site (#8df835f).
  • Improve PostgreSQL support on Debian platform family (#22d7d2c, #bc40c7f).

Documentation Changes on v1.0.0

Changes on Tests on v1.0.0

v0.5.0 (2015-04-08)

  • Lock cookbook versions on metadata.
  • Add option to skip setting permissions (issues #18 and #20, thanks LEDfan).
  • Install PHP 5.4 repo on Ubuntu <= 12.04 (issue #19, thanks Jason Boyles for reporting).
  • Run setup from the command line rather than HTTP request.
  • Add web services restart again, required by some SSL setups.
  • metadata: Update openssl cookbook to version 4 (issue #22, thanks LEDfan for reporting).

v0.4.2 (2014-12-12)

  • metadata: Lock to mysql cookbook ~> 5.0.

v0.4.1 (2014-11-27)

  • Fix Apache httpd 2.4 support: fixes CentOS 7 and Ubuntu 14 support (issue #16, thanks @LEDfan for reporting).
  • README:

v0.4.0 (2014-06-16)

  • Improved support for Ubuntu 13 and above
  • Support for custom x509 certificates
  • Added attribute to enable or disable web servers sendfile directive
  • Handled new config value trusted_domains
  • Added some failsafe timeout on nginx for big account
  • Patch to avoid file corruption with mod_deflate
  • Added repo with more recent PHP version for older Ubuntus (< 12.04)

v0.3.1 (2013-12-30)

  • Fixed max upload size on Nginx with SSL

v0.3.0 (2013-12-29)

  • Added attribute to define the maximum file size for uploads
  • Updated testing environment
  • Fixed compatibility issue with Chef 11.8 due to a bug on http_request resource (CHEF-4762)
  • Fixed issue when upgrading from previous ownCloud installation

v0.2.0 (2013-09-13)

  • Nginx supported as web server
  • ownCloud deployable from git

v0.1.0 (2013-08-07)

  • Initial release of owncloud

Collaborator Number Metric
            

1.0.0 failed this metric

Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

1.0.0 passed this metric

Foodcritic Metric
            

1.0.0 failed this metric

FC066: Ensure chef_version is set in metadata: owncloud/metadata.rb:1
FC069: Ensure standardized license defined in metadata: owncloud/metadata.rb:1
FC072: Metadata should not contain "attribute" keyword: owncloud/metadata.rb:1
FC075: Cookbook uses node.save to save partial node data to the chef-server mid-run: owncloud/recipes/default.rb:51
FC075: Cookbook uses node.save to save partial node data to the chef-server mid-run: owncloud/recipes/default.rb:193
Run with Foodcritic Version 12.2.1 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric
            

1.0.0 passed this metric

No Binaries Metric
            

1.0.0 passed this metric

Publish Metric
            

1.0.0 passed this metric

Supported Platforms Metric
            

1.0.0 passed this metric

Testing File Metric
            

1.0.0 passed this metric

Version Tag Metric
            

1.0.0 passed this metric