Version information
This version is compatible with:
- Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >= 3.0.0 < 5.0.0
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'shoekstra-owncloud', '0.5.2'
Learn more about managing modules with a PuppetfileDocumentation
ownCloud
Table of Contents
- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with ownCloud
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Overview
The ownCloud module eases installation and initial configuration of ownCloud.
Module Description
ownCloud is a software system for what is commonly termed "file hosting" and is very similar to the widely-used Dropbox, with the primary difference being that ownCloud is free and open-source, allowing anyone to install and operate it without charge on a private server.
This module provides a simple way to install ownCloud, and optionally include Apache and virtual host configuration, database creation, and an autoconfigured ownCloud instance ready for you to log into. It preconfigures the ownCloud instance using the automatic configuration method.
Setup
What owncloud affects
-
ownCloud configuration files and directories
-
package/service/configuration files for Apache
-
Apache module and virtual hosts
-
MySQL database and user creation (does not install a MySQL server)
- WARNING: If module is set to manage Apache (enabled by default), any existing Apache configuration not Puppet managed may be purged.
Setup Requirements
In order to use the PuppetLabs MySQL module to create the database on a separate database server, you will need to have exported resources functionality.
If Apache is not installed, the default behaviour of this module is to install it. If you're already managing an Apache install with Puppet (or want to amend any of the Apache related configuration), set manage_apache
to false and ensure the php, rewrite and ssl mods are enabled, e.g.:
class { '::apache':
...
default_vhost => false,
mpm_module => 'prefork',
purge_configs => false,
}
include '::apache::mod::php', '::apache::mod::rewrite', '::apache::mod::ssl'
class { '::owncloud':
...
manage_apache => false,
}
Beginning with ownCloud
To install ownCloud with the default parameters:
class { 'owncloud': }
The defaults are determined by your operating system (e.g. Debian systems have one set of defaults, and RedHat systems have another). These defaults will work well in a testing environment, but are not suggested for production as they result in:
- An 'owncloud' database and user being created (password 'owncloud')
- Apache installed, with a default vhost of "owncloud.$::domain"
- ownCloud configured to use MySQL as the database backend (does not install a MySQL server)
- ownCloud data directory (where user files are kept) located at $documentroot/data (this should be moved out of the document root before being put on the Internet)
Install on a single server
To install ownCloud on a single server, (using the PuppetLabs MySQL module to install MySQL and create a 'owncloud' database):
class { '::mysql::server':
override_options => {
'mysqld' => { 'bind-address' => '0.0.0.0' }
},
restart => true,
root_password => 'sup3rt0ps3cr3t',
}
class { '::owncloud':
...
db_user => 'owncloud',
db_pass => 'p4ssw0rd',
}
Install on separate database and web server
To install ownCloud on a web server with a separate MySQL database server, on your web server:
class { '::owncloud':
...
db_host => 'mysqlserver.local',
db_name => 'owncloud',
db_user => 'owncloud',
db_pass => 'p4ssw0rd',
}
The ownCloud module does not install or configure the database server itself, this would need to be deployed by manually or, for example, with something similar to:
class { '::mysql::server':
override_options => {
'mysqld' => { 'bind-address' => '0.0.0.0' }
},
restart => true,
root_password => 'sup3rt0ps3cr3t',
}
When $db_host is not set to 'localhost', the web server will export any mysql:db resources for a database server to collect. To collect these exported databases, include the following simple wrapper class on your MySQL server:
include '::owncloud::database'
A complete example with with database installed on a different server would look like:
node 'mysqlserver.local' {
class { '::mysql::server':
override_options => {
'mysqld' => { 'bind-address' => '0.0.0.0' }
},
restart => true,
root_password => 'sup3rt0ps3cr3t',
}
include '::owncloud::database'
}
node 'webserver.local' {
class { '::owncloud':
...
db_host => 'mysqlserver.local',
db_name => 'owncloud',
db_user => 'owncloud',
db_pass => 'p4ssw0rd',
}
}
Install and configure Apache to use SSL
To configure the Apache vhost to use SSL, you need to set ssl
to true
and define the absolute paths for the ssl_cert
and ssl_key
parameters. This module does not distribute certificate or key files to the server, you will need to take care of this yourself.
class { '::owncloud':
...
ssl => true,
ssl_cert => '/path/to/file.crt',
ssl_key => '/path/to/file.key',
}
When configured to use SSL, any non HTTPS traffic to the HTTP port (defaults to 80) will be redirected to the HTTPS port (defaults to 443).
Install and manage only ownCloud
To install and configure ownCloud with no additional modules:
class { '::owncloud':
...
manage_apache => false,
manage_db => false,
manage_vhost => false,
}
Deploying your web server with this configuration will result in:
- ownCloud repository added to your system
- ownCloud package installed (with any absent dependencies, such as Apache, PHP modules, etc.)
- ownCloud auto configured and ready for access on http://$default_vhost/owncloud
Usage
The owncloud
class
The owncloud
class configures all possible options for this module. With default parameters it will
- create the required database (either locally or export the
mysql::db
resource to be collected later on the database server (usinginclude ::owncloud::database
)) - install Apache and configure a vhost (either HTTP or HTTP and HTTPS)
- install the ownCloud application using the autoconfigure method
Parameters
admin_pass
Optionally set the admin password in the ownCloud configuration.
admin_user
Optionally set the admin user in the ownCloud configuration (using admin_pass
as the password). If not set, OwnCloud will ask for admin credentials upon first connection.
datadirectory
Sets the directory user data will be stored in. It is not recommended to keep this in the default location (as a sub directory of the application document root) and it should be moved out of the document root before making your ownCloud instance accessible via the internet. Defaults to /var/www/owncloud/data
on Debian based systems and /var/www/html/owncloud/data
on RedHat based systems.
db_host
Sets the database server that ownCloud should use. If this is not 'localhost' and manage_db
is set to true, the module will publish the mysql:db
resource for collection by another node (typically your database server, collecting with Mysql::Db <<| tag == 'owncloud' |>>
, if using the PuppetLabs MySQL module). Defaults to 'localhost'.
db_name
Set the database name in the ownCloud configuration and the database to create if manage_db
is set to true. Defaults to 'owncloud'.
db_table_prefix
Set the database table prefix in the ownCloud configuration. Defaults to ''.
db_user
Set the database user in the ownCloud configuration and the database user to create (using db_pass
as the password) if manage_db
is set to true. Defaults to 'owncloud'.
db_pass
Set the database password in the ownCloud configuration. Defaults to 'owncloud'.
db_type
Set the database type in the ownCloud configuration. Currently the only supported backend database is MySQL. Defaults to 'mysql'.
http_port
Set the HTTP port to a non standard port. Defaults to '80'.
https_port
Set the HTTPS port to a non standard port. Defaults to '443'.
manage_apache
Set to true for the module to install Apache using the PuppetLabs Apache module. Typically this is managed elsewhere in your node definition, but if you are installing ownCloud on a dedicated webserver then setting manage_apache
to true will configure Apache as required. Defaults to 'true'.
manage_db
Set to true for the module to create the database and database user for you, using the db_name
, db_user
, db_pass
and db_type
values. Enabling this will not install the database server, this must be done separately. Defaults to 'true'.
manage_phpmysql
Set to true for the module to install the PHP MySQL bindings using the PuppetLabs MySQL module; this is required on some distributions until the package is installed by the ownCloud package. Defaults to 'true'.
manage_repo
Set to true for the module to install the official ownCloud repository. Defaults to 'true'.
manage_skeleton
Set to true for the module to manage the skeleton directory. This is could be a feature in the future, but for the moment this removes the demo files from the skeleton directory in ${documentroot}/core/skeleton/{documents,music,photo}
. Defaults to 'true'.
manage_vhost
Set to true for the module to install the Apache virtual host using the PuppetLabs Apache module. It is possible to have manage_apache
set to false and manage_vhost
set to true to only install the vhost if you manage Apache separately. Defaults to 'true'.
ssl
Set to true to enable HTTPS. When enabled, HTTP requests will be redirected to HTTPS. Must at least set the ssl_cert
and ssl_key
parameters to use SSL. Defaults to 'false'.
ssl_ca
Set the path of the CA certificate file, must use the absolute path.
ssl_cert
Set the path of the certificate file, must use the absolute path.
ssl_chain
Set the path of the certificate chain file, must use the absolute path.
ssl_key
Set the path of the certificate key file, must use the absolute path.
trusted_domains
Optional array to set the default trusted domains for OwnCloud. Use domain names without protocol. Default is unset, which will take the first domain used to connect to OwnCloud as a trusted domain name.
url
Configures the virtual host to install if manage_apache
or manage_vhost
are set to true. At this time there is no support for Apache server aliases. Defaults to owncloud.${::domain}
Reference
Classes
Public Classes
owncloud
: Guides the installation of ownCloud (including database creation and user data directory if specified).owncloud::database
: Installs the ownCloud database; include this on your database server if it is separate to the web server (not required if database and application run on same server).
Private Classes
owncloud::apache
: Installs and configures Apache whenmanage_apache
is set totrue
.owncloud::config
: Configures ownCloud using autoconfig.php (and creates/exports a database).owncloud::install
: Installs ownCloud (using the ownCloud repository).owncloud::params
: Manages ownCloud operating system specific parameters.
Limitations
-
This module does not install a database server. An example has been provided on how to do this using PuppetLabs MySQL module.
-
This module has been tested on the following Operating Systems:
- CentOS 6
- CentOS 7
- Debian 7
- Debian 8
- Fedora 19
- Fedora 20
- Ubuntu 12.04 Precise
- Ubuntu 14.04 Trusty
Development
In the pipeline:
- Add support for additional operating systems.
- Add support for PostgreSQL.
At this time only one instance of ownCloud can be configured per host. It would be easy enough to change to a define to make a multi-tenant ownCloud server, but wasn't a requirement when writing this and can only see this being implemented if someone wants to add this functionality via a pull request.
Pull requests are welcome, please see the contributing guidelines.
0.5.2 (2016-03-23)
- Added option to specify admin credentials (#27)
- Added option to specify trusted domains (#27)
- Updated Centos 6/7 repository to now point to https://download.owncloud.org. (#30)
- Updated/Fixed spec tests (#30)
0.5.0 (2016-01-02)
- Added
$db_table_prefix parameter
, configures a database table prefix - Added support for Puppet 4.x
- Added SSL cipers and accepted protocols (#22)
- Increased supported version of EPEL puppet module
- Installs PHP MySQL bindings using the PuppetLabs MySQL puppet module if
$manage_phpmysql
istrue
([#14](https://github.com/shoekstra/puppet-owncloud/iss ues/14)) - Removes default vhost (000-default.conf) on Debian-based systems if
$manage_apache
istrue
0.4.3 (2015-12-13)
- Fix compilation errors on CentOS systems
0.4.2 (2015-12-13)
- Install owncloud-server instead of owncloud, removes Apache dependency (#21)
- Fixed puppet-lint warning
0.4.1 (2015-07-19)
- Fixed missing PHP5 package on CentOS 6
- Fixed missing PHP5 package on Precise (#8)
- Fixed old dependency versions (#13, #16)
- Removed support for Debian 6 and Fedora 19 (no longer supported by ownCloud)
0.4.0 (2015-03-27)
- Added support for Debian 6, 7, 8
- Fixed Apache HTTP -> HTTPS redirect
- Fixed MySQL database export for RedHat family OSes
- Fixed spec tests to pass when tests are done with FUTURE_PARSER=yes and STRICT_VARIABLES=yes
0.3.1 (2015-03-13)
- Fixed puppet-lint
top-scope variable being used without an explicit namespace
warning
0.3.0 (2015-03-13)
- Added support for CentOS 6, 7 and Fedora 19, 20
- Added support for Apache 2.4
0.2.0 (2015-01-11)
- Added the ability to configure an SSL enabled vhost
- Added
owncloud::database
wrapper to collect exportedmysql::db
resource - Moved Apache related configuration to
owncloud::apache
to resolve some dependency issues
0.1.1 (2014-10-31)
- Corrected puppetlabs-mysql module dependency version
- Fixed exec path
- Fixed puppet-lint scope warnings
- Removed inheritance in classes
0.1.0 (2014-08-28)
- First release
Dependencies
- ckhall/remi (>= 0.0.2 < 0.1.0)
- puppetlabs/apache (>= 1.0.1 < 2.0.0)
- puppetlabs/apt (>= 2.0.0 < 3.0.0)
- puppetlabs/mysql (>= 2.3.1 < 4.0.0)
- puppetlabs/stdlib (>= 2.4.0 < 5.0.0)
- stahnma/epel (>= 1.0.0 < 2.0.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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.