<commit_before># puppet-owncloud


Source Hosted on Github: AGPLv3
 <br> hgkamath/puppet-owncloud  [https://github.com/hgkamath/puppet-owncloud ]
 <br> puppetforge: [https://forge.puppetlabs.com/hgkamath/owncloud]
 <br> modified source originally from: LeonB/puppet-owncloud

Feel free to pull and improve or contribute. My own understanding of puppet is minimal.

This puppet module is to deploy owncloud in fedora or fedora-like distributions.  I had trouble with other puppet deployments because paths and otherthings can be different. Also many are based on the nginx web-server

*note*: 
It is very difficult to get apache to work well with php-fpm. The redirection and proxy directives are undergoing some change and is in development with serveral bugs as for 2013. That could be, perhaps, one of the main reasons for sysadms to prefer nginx, the high performance of the simpler nginx being the other consideration. The advantage of Apache is that it is ubiquitous and usually already installed and configured.  nginx is a lightweight speed web-server nginx that does not have its own internal php engine, unlike apache which has modphp. php-fpm seems to be the prefered way owncloud was designed around in order for owncloud to be able to proxy and scale up. 

Made to work with
* Fedora-20
* php-fpm-5.5.9-1.fc20.x86_64
* owncloud-5.0.14a-2.fc20.noarch
* httpd-2.4.6-6.fc20.x86_64
* mariadb-server-5.5.35-3.fc20.x86_64

Other relavant puppet modules
* ├── puppetlabs-apache (v0.8.1)
* ├── puppetlabs-mysql (v2.1.0)
* ├── thias-php (v0.3.8)

## desired software requirements and functionalities
* to work with apache server
* to work with php-fpm
* to have a separate owncloud server that worked on a fedora based system
* will create the user owncloud
* will itself configure/create the mysql database 'owncloud' accesible via a mysql-user owncloud
* will itself configure the apache vhost and have it run as user 'owncloud' on port 8080
* will itself configure the mysql database with user access owncloud
* will itself configure the php-fpm to run as user 'owncloud' on port 9006
* will change ownership permission on relavant directories

## File and Directories
* /etc/owncloud is where fedora puts owncloud configuration files by default. /usr/share/owncloud/config is a symbolic link to here.
* /usr/share/owncloud is the rpm installs, need to be owncloud readable
* /var/lib/owncloud is the owncloud root directory 
* /var/lib/owncloud/data is the owncloud data directory
* /var/lib/owncloud/data.log /var/lib/httpd , /var/lib/php-fpm are log directories
* creates an apache vhost in configuration file /etc/httpd/conf.d/25-owncloud.conf on port 8080

## Invitation for improvements
Troubles that need ironing out, handled manually as of creation of this git-repo.
* there is trouble between owncloud-4 and owncloud-5
* the config hash sometimes does not match with a pre-existing owncloud database
* some file directory permissioning
* owncloud upgrades tend to rewrite the /etc/owncloud directory and change permissions
* owncloud files need to be owned by user 'owncloud'
* maybe something needs to be done about the owncloud local apps directory /var/lib/owncloud/apps
* Some things need to be parametrized out, like fpm port, whether owncloud should be hosted at the url root folder or under a subdirectory/sublocation/subdomains.
* harmonize/parametrize nginx/apache configuration
* harmonize/parametrize rpm/deb systems

## Configuration
Include in manifest the following
```
package { 'httpd':
  ensure => installed,
}
service { 'httpd':
  enable => true,
  ensure => running,
  require => Package['httpd']
}
apache::mod { 'unixd': }
apache::mod { 'access_compat': }
apache::mod { 'filter': }
apache::mod { 'slotmem_shm': }
apache::mod { 'proxy_fcgi': }
apache::mod { 'systemd': }

class { 
  '::mysql::server': 
  old_root_password => '',
  root_password => '<PASSWORD>'
}

class { 'owncloud::server':
  mysql_password => '<PASSWORD>',
}
# owncloud puppet module will make its own apache vhost
# owncloud puppet module will make its own mysql database

```

Other customization or param modification can be made in  
```
manifest/server/params.pp
manifest/server/config.pp
templates/apache_vhost/subdirectory.erb
```

After the above application of the puppet manifest, there may be minor tweaking required such as
* file and directory ownership and permissions
* If and whether owncloud is able to create/re-associate the owncloud database
* The Owncloud config having the config hash of the mysql database<commit_msg>owncloud v6<commit_after># puppet-owncloud


Source Hosted on Github: AGPLv3
 <br> hgkamath/puppet-owncloud  [https://github.com/hgkamath/puppet-owncloud ]
 <br> puppetforge: [https://forge.puppetlabs.com/hgkamath/owncloud]
 <br> modified source originally from: LeonB/puppet-owncloud

Feel free to pull and improve or contribute. My own understanding of puppet is minimal.

This puppet module is to deploy owncloud in fedora or fedora-like distributions.  I had trouble with other puppet deployments because paths and otherthings can be different. Also many are based on the nginx web-server

*note*: 
It is very difficult to get apache to work well with php-fpm. The redirection and proxy directives are undergoing some change and is in development with serveral bugs as for 2013. That could be, perhaps, one of the main reasons for sysadms to prefer nginx, the high performance of the simpler nginx being the other consideration. The advantage of Apache is that it is ubiquitous and usually already installed and configured.  nginx is a lightweight speed web-server nginx that does not have its own internal php engine, unlike apache which has modphp. php-fpm seems to be the prefered way owncloud was designed around in order for owncloud to be able to proxy and scale up. 

Made to work with
* Fedora-20
* httpd-2.4.9-2.fc20.x86_64
* mariadb-server-5.5.37-1.fc20.x86_64
* owncloud-6.0.3-1.fc20.noarch
* php-fpm-5.5.13-3.fc20.x86_64

Other relavant puppet modules
* ├── puppetlabs-apache (v0.8.1)
* ├── puppetlabs-mysql (v2.1.0)
* ├── thias-php (v0.3.8)

## Usable versions
* 0.2   : httpd-2.4.9-2 , mariadb-server-5.5.37-1 , owncloud-6.0.3-1   , php-fpm-5.5.13-3 
* 0.1.4 : httpd-2.4.6-6 , mariadb-server-5.5.35-3 , owncloud-5.0.14a-2 , php-fpm-5.5.9-1  

## desired software requirements and functionalities
* to work with apache server
* to work with php-fpm
* to have a separate owncloud server that worked on a fedora based system
* will create the user owncloud
* will itself configure/create the mysql database 'owncloud' accesible via a mysql-user owncloud
* will itself configure the apache vhost and have it run as user 'owncloud' on port 8080
* will itself configure the mysql database with user access owncloud
* will itself configure the php-fpm to run as user 'owncloud' on port 9006
* will change ownership permission on relavant directories

## File and Directories
* /etc/owncloud is where fedora puts owncloud configuration files by default. /usr/share/owncloud/config is a symbolic link to here.
* /usr/share/owncloud is the rpm installs, need to be owncloud readable
* /var/lib/owncloud is the owncloud root directory 
* /var/lib/owncloud/data is the owncloud data directory
* /var/lib/owncloud/data.log /var/lib/httpd , /var/lib/php-fpm are log directories
* creates an apache vhost in configuration file /etc/httpd/conf.d/25-owncloud.conf on port 8080

## Invitation for improvements
Troubles that need ironing out, handled manually as of creation of this git-repo.
* there is trouble between owncloud-4 and owncloud-5
* the config hash sometimes does not match with a pre-existing owncloud database
* some file directory permissioning
* owncloud upgrades tend to rewrite the /etc/owncloud directory and change permissions
* owncloud files need to be owned by user 'owncloud'
* maybe something needs to be done about the owncloud local apps directory /var/lib/owncloud/apps
* Some things need to be parametrized out, like fpm port, whether owncloud should be hosted at the url root folder or under a subdirectory/sublocation/subdomains.
* harmonize/parametrize nginx/apache configuration
* harmonize/parametrize rpm/deb systems

## Configuration
Include in manifest the following
```
package { 'httpd':
  ensure => installed,
}
service { 'httpd':
  enable => true,
  ensure => running,
  require => Package['httpd']
}
apache::mod { 'unixd': }
apache::mod { 'access_compat': }
apache::mod { 'filter': }
apache::mod { 'slotmem_shm': }
apache::mod { 'proxy_fcgi': }
apache::mod { 'systemd': }

class { 
  '::mysql::server': 
  old_root_password => '',
  root_password => '<PASSWORD>'
}

class { 'owncloud::server':
  mysql_password => '<PASSWORD>',
  # $path => '/usr/share/owncloud',
  # $data_dir => '/var/lib/owncloud',
  # $user           => 'owncloud',
  # $passwordsalt   => <PASSWORD>,
  # $mysql_database => 'owncloud',
  # $mysql_user     => 'owncloud',
  # $mysql_host     => 'localhost',
  # $apache_vhost   => false,         
}
# owncloud puppet module can make its own apache vhost if apache_vhost is set to true
# owncloud puppet module will make its own mysql database
### explanation of options
# path: root directory containing owncloud php files
# data_dir : root directory containing the data files that owncloud manages
# user : username of the php-fpm process running owncloud
# mysql_password : is the password owncloud server uses to access mysql database
# mysql_user : username of owncloud user account inside the mysql database
# mysql_host : is the hostname of the server hosting the mysql server
# apache_vhost : is a boolean, if false it means you want to configure your own vhost, else if true means you want to the module to generate a vhost

```

Other customization or param modification can be made directly to 
```
manifest/server/params.pp
manifest/server/config.pp
templates/apache_vhost/subdirectory.erb
```

After the above application of the puppet manifest, there may be minor tweaking required such as
* file and directory ownership and permissions
* If and whether owncloud is able to create/re-associate the owncloud database
* The Owncloud config having the config hash of the mysql database
{'fraction_non_alphanumeric': 0.08164265412133687, 'fraction_numerical': 0.01783789081642654, 'mean_word_length': 4.314583333333333, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 36, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, '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': '3449322', 'n_tokens_mistral': 3152, 'n_tokens_neox': 2966, 'n_words': 1263}