Install ownCloud - KeegMitch/Operations-Engineering-group-c GitHub Wiki
Make sure you have configured everything here
RT Ticket: #840
echo 'deb https://download.opensuse.org/repositories/isv:/ownCloud:/server:/10.14.0/Ubuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/isv:ownCloud:server:10.14.0.list
sudo curl -fsSL https://download.opensuse.org/repositories/isv:ownCloud:server:10.14.0/Ubuntu_20.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/isv_ownCloud_server_10.14.0.gpg >/dev/null
sudo apt update
sudo apt install owncloud-complete-files
Create owncloud module on the mgmt server
sudo mkdir /etc/puppetlabs/code/modules/owncloud
cd /etc/puppetlabs/code/modules/owncloud
sudo mkdir /etc/puppetlabs/code/modules/owncloud/manifests
# create these files:
sudo touch owncloud/manifests/init.pp
sudo touch owncloud/manifests/install.pp
sudo touch owncloud/manifests/dbconfig.pp
sudo touch owncloud/manifests/apache.pp
- Inside the init.pp file should be this:
class owncloud {
include owncloud::install,owncloud::apache,owncloud::dbconfig
}
- Add this into
install.pp:
class owncloud::install {
# Install Owncloud package(s)
package { 'owncloud-complete-files' :
ensure => present,
}
}
- Add the owncloud module into the app node on
site.pp

- Apply the puppet agent to the
appserver

- Inside the
apache.ppfile, add this code:
class owncloud::apache {
# Define virtual host for Owncloud
file { 'owncloud.conf':
path => '/etc/apache2/sites-available/owncloud.conf',
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => "
<VirtualHost *:80>
ServerName app-c
DirectoryIndex index.php index.html
DocumentRoot /var/www/owncloud
<Directory /var/www/owncloud>
Options +FollowSymlinks -Indexes
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>
</VirtualHost>
",
}
# Below code doesn't work properly, do the following commands manually:
# sudo sed -i "s#html#owncloud#" /etc/apache2/sites-available/000-default.conf
# sudo a2ensite owncloud
# sudo a2enmod dir env headers mime rewrite setenvif
# sudo systemctl restart apache2
# Add sed command to replace html with owncloud in 000-default.conf
# exec { 'replace_html_with_owncloud':
# command => "sudo sed -i 's#html#owncloud#' /etc/apache2/sites-available/000-default.conf",
# path => '/usr/bin:/usr/sbin:/bin',
# refreshonly => true,
# }
# Enable owncloud site
# exec { 'enable_owncloud_site':
# command => 'sudo a2ensite owncloud',
# path => '/usr/bin:/usr/sbin:/bin',
# refreshonly => true,
# notify => Exec['restart_apache_service'],
#}
# Restart Apache service when necessary
# exec { 'restart_apache_service':
# command => 'sudo systemctl restart apache2',
# path => '/usr/bin:/usr/sbin:/bin',
# refreshonly => true,
# }
}
Apply the puppet agent on the app, test_puppet_agent, the restart apache using sudo systemctl restart apache2
Connect to the public ip address of your app server, you should have this output:
In our example: http://13.75.139.57

-
Create an admin account/Login as username "admin" and enter a password
-
Under the "configure the database" section:

Note: Screenshot above it is NOT app-c:5432, it seemed to work with db-c hostname, but it might work with the private ip address as well, we've had issues with this, but it works now


Note: couldn't really get this to work properly so just did this manually Reference
in dbconfig.pp :
class owncloud::dbconfig {
# Ensure transaction-isolation level is set and performance_schema is on
exec { 'configure_mysql_settings':
command => "sudo sed -i '/\\[mysqld\\]/atransaction-isolation = READ-COMMITTED\\nperformance_schema = on' /etc/mysql/mariadb.conf.d/50-server.cnf",
path => '/usr/bin:/usr/sbin:/bin',
refreshonly => true,
notify => Exec['restart_mysql_service'],
}
# Start MariaDB service
exec { 'start_mysql_service':
command => 'sudo systemctl start mariadb',
path => '/usr/bin:/usr/sbin:/bin',
refreshonly => true,
notify => Exec['configure_database'],
}
# config using the db-c host name (or private ip of db server)
exec { 'configure_owncloud_database':
command => "mysql -u root -e \"CREATE DATABASE IF NOT EXISTS owncloud; \
CREATE USER IF NOT EXISTS 'owncloud'@'db-c' IDENTIFIED BY 'password_here'; \
GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'db-c' WITH GRANT OPTION; \
FLUSH PRIVILEGES;\"",
path => '/usr/bin:/usr/sbin:/bin',
refreshonly => true,
}
# Restart MariaDB service when necessary
exec { 'restart_mysql_service':
command => 'sudo systemctl restart mariadb',
path => '/usr/bin:/usr/sbin:/bin',
refreshonly => true,
}
}
- Apply puppet agent and restart apache2