Commit eb6c2868 authored by Matthieu FAURE's avatar Matthieu FAURE

Merge branch '16-refactor-code-for-managed-services-apache-php' into 'master'

Resolve "Refactor code for managed services : apache php"

Closes #16

See merge request !9
parents 9ffb12d2 86ef47ee
Pipeline #6743 passed with stages
in 14 minutes and 40 seconds
......@@ -6,9 +6,14 @@ fixtures:
stdlib: "puppetlabs/stdlib"
archive: "puppet/archive"
redis: "puppet-redis"
apt: "puppetlabs-apt" # for Redis
apt: "puppetlabs-apt" # for Redis + PHP
augeasproviders_core: "herculesteam-augeasproviders_core" # for Redis
augeasproviders_sysctl: "herculesteam-augeasproviders_sysctl" # for Redis
epel: "stahnma-epel" # for Redis
mariadb: "puppetlabs-mysql"
translate: "puppetlabs/translate" # for Mysql
translate: "puppetlabs/translate" # for Mysql + concat
apache: "puppetlabs-apache"
concat: "puppetlabs-concat" # for Apache
php: "puppet-php"
zyprepo: "puppet-zypprepo" # for PHP
inifile: "puppetlabs-inifile" # for PHP
# @summary Install Apache, PHP-FPM and PHP extensions required for Nextcloud
#
# Install Apache, PHP-FPM and PHP extensions required for Nextcloud
#
# @example
# include nextcloud::apache
class nextcloud::apache {
$_fastcgi_socket = 'fcgi://127.0.0.1:9000'
# ProxyPassMatch: see https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html#examples
$_my_custom_fragment = "ProxyPassMatch ^/.*\\.php(/.*)?\$ ${_fastcgi_socket}${nextcloud::nc_install_dir}/ enablereuse=on"
# PHP + modules
class { 'php::globals':
php_version => $nextcloud::php_version,
}
-> class { 'php':
extensions => {
apcu => {},
bz2 => {},
ctype => {},
curl => {},
dom => {},
# exif => {}, # already installed
gd => {},
iconv => {},
imagick => {},
intl => {},
json => {},
# fileinfo => {}, # already installed
# libxml => {}, # already installed
mbstring => {},
# openssl => {}, # already installed
mysql => {},
posix => {},
# session => {}, # already installed
simplexml => {},
xmlreader => {},
xmlwriter => {},
zip => {},
# zlib => {}, # already installed
},
}
# Apache
class { 'apache::mod::proxy': }
class { 'apache::mod::proxy_fcgi': }
apache::vhost { $nextcloud::apache_hostname:
docroot => $nextcloud::nc_install_dir,
port => $nextcloud::apache_port,
default_vhost => $nextcloud::apache_default_vhost,
override => 'all',
custom_fragment => $_my_custom_fragment,
require => Class[php],
}
}
......@@ -58,54 +58,7 @@ class nextcloud (
# Install Apache + PHP-FPM and configure vhost
if $manage_apache {
$_fastcgi_socket = 'fcgi://127.0.0.1:9000'
# ProxyPassMatch: see https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html#examples
$_my_custom_fragment = "ProxyPassMatch ^/.*\\.php(/.*)?\$ ${_fastcgi_socket}${nc_install_dir}/ enablereuse=on"
# PHP + modules
class { 'php::globals':
php_version => $php_version,
}
-> class { 'php':
extensions => {
apcu => {},
bz2 => {},
ctype => {},
curl => {},
dom => {},
# exif => {}, # already installed
gd => {},
iconv => {},
imagick => {},
intl => {},
json => {},
# fileinfo => {}, # already installed
# libxml => {}, # already installed
mbstring => {},
# openssl => {}, # already installed
mysql => {},
posix => {},
# session => {}, # already installed
simplexml => {},
xmlreader => {},
xmlwriter => {},
zip => {},
# zlib => {}, # already installed
},
}
# Apache
class { 'apache::mod::proxy': }
class { 'apache::mod::proxy_fcgi': }
apache::vhost { $apache_hostname:
docroot => $nc_install_dir,
port => $apache_port,
default_vhost => $apache_default_vhost,
override => 'all',
custom_fragment => $_my_custom_fragment,
require => Class[php],
}
include nextcloud::apache
}
# Install Redis
......
require 'spec_helper'
describe 'nextcloud::apache' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
let(:pre_condition) do
"
class { 'nextcloud':
db_password => 'S3cr#TPassw0rdz',
nc_admin_username => 'ncadmin',
nc_admin_password => 'ncadminPassword',
manage_apache => true,
}
"
end
it { is_expected.to compile }
it { is_expected.to contain_class('php') }
it { is_expected.to contain_class('apache::mod::proxy') }
it { is_expected.to contain_class('apache::mod::proxy_fcgi') }
it { is_expected.to contain_apache__vhost('nextcloud.example.org') }
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment