Showing with 281 additions and 18 deletions.
  1. +25 −0 .sync.yml
  2. +61 −5 .travis.yml
  3. +21 −1 CHANGELOG.md
  4. +54 −0 README.md
  5. +2 −2 manifests/params.pp
  6. +15 −8 manifests/repo/debian.pp
  7. +3 −1 manifests/repo/ubuntu.pp
  8. +1 −1 metadata.json
  9. +3 −0 spec/acceptance/nodesets/docker/ubuntu-16.04.yml
  10. +47 −0 spec/acceptance/php56_spec.rb
  11. +31 −0 spec/acceptance/php_spec.rb
  12. +18 −0 spec/spec_helper_acceptance.rb
25 changes: 25 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
---
.travis.yml:
docker_sets:
- set: docker/ubuntu-16.04
options:
script: 'bundle exec rspec spec/acceptance/php56_spec.rb'
- set: docker/ubuntu-14.04
options:
script: 'bundle exec rspec spec/acceptance/php56_spec.rb'
- set: docker/centos-7
options:
script: 'bundle exec rspec spec/acceptance/php56_spec.rb'
- set: docker/debian-8
options:
script: 'bundle exec rspec spec/acceptance/php56_spec.rb'
- set: docker/ubuntu-16.04
options:
script: 'bundle exec rspec spec/acceptance/php_spec.rb'
- set: docker/ubuntu-14.04
options:
script: 'bundle exec rspec spec/acceptance/php_spec.rb'
- set: docker/centos-7
options:
script: 'bundle exec rspec spec/acceptance/php_spec.rb'
- set: docker/debian-8
options:
script: 'bundle exec rspec spec/acceptance/php_spec.rb'
secure: "GOhttACuJt+3s38m4WnW5RuTgwqaAoeEQnNT+X1Ukn7KdcIk4KV8NzYU/CC0VIm8lUOnBWYJKEC4ixX/J/4Wbxox2RAoKMQrO++L0DB1zTCJnq9SfoUBMaQhXvLu+PbxAR0p3P47ozra0C+pOWDpOaxT9ecufrPQt9W9Z4aY/bs="
66 changes: 61 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,75 @@ matrix:
include:
- rvm: 2.1.9
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=12
env: PUPPET_VERSION="~> 4.0" CHECK="test" PARALLEL_TEST_PROCESSORS=12
- rvm: 2.4.3
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
env: PUPPET_VERSION="~> 5.0" CHECK="test_with_coveralls"
- rvm: 2.5.0
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
env: PUPPET_VERSION="~> 5.0" CHECK="test_with_coveralls"
- rvm: 2.4.3
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=rubocop
env: PUPPET_VERSION="~> 5.0" CHECK="rubocop"
- rvm: 2.4.3
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
env: PUPPET_VERSION="~> 5.0" CHECK="build" DEPLOY_TO_FORGE=yes
- rvm: 2.4.3
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04
script: 'bundle exec rspec spec/acceptance/php56_spec.rb'
services: docker
sudo: require
- rvm: 2.4.3
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04
script: 'bundle exec rspec spec/acceptance/php56_spec.rb'
services: docker
sudo: require
- rvm: 2.4.3
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7
script: 'bundle exec rspec spec/acceptance/php56_spec.rb'
services: docker
sudo: require
- rvm: 2.4.3
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8
script: 'bundle exec rspec spec/acceptance/php56_spec.rb'
services: docker
sudo: require
- rvm: 2.4.3
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04
script: 'bundle exec rspec spec/acceptance/php_spec.rb'
services: docker
sudo: require
- rvm: 2.4.3
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04
script: 'bundle exec rspec spec/acceptance/php_spec.rb'
services: docker
sudo: require
- rvm: 2.4.3
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7
script: 'bundle exec rspec spec/acceptance/php_spec.rb'
services: docker
sudo: require
- rvm: 2.4.3
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8
script: 'bundle exec rspec spec/acceptance/php_spec.rb'
services: docker
sudo: require
branches:
only:
- master
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v5.3.0](https://github.com/voxpupuli/puppet-php/tree/v5.3.0) (2018-03-06)

[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v5.2.0...v5.3.0)

**Implemented enhancements:**

- mark Ubuntu 16.04 as supported and fix its tests [\#221](https://github.com/voxpupuli/puppet-php/issues/221)
- Using the new facts hash instead of the global var in repo/debian.pp [\#425](https://github.com/voxpupuli/puppet-php/pull/425) ([c33s](https://github.com/c33s))
- Add Acceptance tests [\#414](https://github.com/voxpupuli/puppet-php/pull/414) ([bastelfreak](https://github.com/bastelfreak))

**Fixed bugs:**

- Fix Archlinux support [\#423](https://github.com/voxpupuli/puppet-php/pull/423) ([bastelfreak](https://github.com/bastelfreak))
- Fix wrongly named parameters for apt::source/key [\#420](https://github.com/voxpupuli/puppet-php/pull/420) ([bitcrush](https://github.com/bitcrush))
- manage software-properties-common on ubuntu [\#419](https://github.com/voxpupuli/puppet-php/pull/419) ([bastelfreak](https://github.com/bastelfreak))

**Merged pull requests:**

- add examples for php-fpm/nginx [\#424](https://github.com/voxpupuli/puppet-php/pull/424) ([bastelfreak](https://github.com/bastelfreak))
- add tests for php5.6 [\#418](https://github.com/voxpupuli/puppet-php/pull/418) ([bastelfreak](https://github.com/bastelfreak))

## [v5.2.0](https://github.com/voxpupuli/puppet-php/tree/v5.2.0) (2018-02-14)

[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v5.1.0...v5.2.0)
Expand Down Expand Up @@ -52,7 +73,6 @@ These should not affect the functionality of the module.

**Merged pull requests:**

- release 5.1.0 [\#394](https://github.com/voxpupuli/puppet-php/pull/394) ([bastelfreak](https://github.com/bastelfreak))
- Proposed fix for failing parallel spec tests [\#386](https://github.com/voxpupuli/puppet-php/pull/386) ([wyardley](https://github.com/wyardley))
- update dependencies in metadata [\#379](https://github.com/voxpupuli/puppet-php/pull/379) ([mmoll](https://github.com/mmoll))
- Bump metadata.json version to 5.0.1-rc [\#377](https://github.com/voxpupuli/puppet-php/pull/377) ([dhollinger](https://github.com/dhollinger))
Expand Down
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,60 @@ By default, php-fpm is set up to run as Apache. If you need to customize that us
}
```

### PHP with one FPM pool per user

This will create one vhost. $users is an array of people having php files at
$fqdn/$user. This codesnipped uses voxpupuli/php and voxpupuli/nginx to create
the vhost and one php fpm pool per user. This was tested on Archlinux with
nginx 1.13 and PHP 7.2.3.

```puppet
$users = ['bob', 'alice']
class { 'php':
ensure => 'present',
manage_repos => false,
fpm => true,
dev => false,
composer => false,
pear => true,
phpunit => false,
fpm_pools => {},
}
include nginx
nginx::resource::server{$facts['fqdn']:
www_root => '/var/www',
autoindex => 'on',
}
nginx::resource::location{'dontexportprivatedata':
server => $facts['fqdn'],
location => '~ /\.',
location_deny => ['all'],
}
$users.each |$user| {
# create one fpm pool. will be owned by the specific user
# fpm socket will be owned by the nginx user 'http'
php::fpm::pool{$user:
user => $user,
group => $user,
listen_owner => 'http',
listen_group => 'http',
listen_mode => '0660',
listen => "/var/run/php-fpm/${user}-fpm.sock",
}
nginx::resource::location { "${name}_root":
ensure => 'present',
server => $facts['fqdn'],
location => "~ .*${user}\/.*\.php$",
index_files => ['index.php'],
fastcgi => "unix:/var/run/php-fpm/${user}-fpm.sock",
include => ['fastcgi.conf'],
}
}
```

### Alternative examples using Hiera
Alternative to the Puppet DSL code examples above, you may optionally define your PHP configuration using Hiera.

Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@
$config_root_ini = '/etc/php/conf.d'
$config_root_inifile = '/etc/php/php.ini'
$common_package_names = []
$common_package_suffixes = ['cli', 'common']
$common_package_suffixes = []
$cli_inifile = '/etc/php/php.ini'
$dev_package_suffix = undef
$fpm_pid_file = '/run/php-fpm/php-fpm.pid'
$fpm_config_file = '/etc/php/php-fpm.conf'
$fpm_error_log = '/var/log/php-fpm/error.log'
$fpm_error_log = 'syslog'
$fpm_inifile = '/etc/php/php.ini'
$fpm_package_suffix = 'fpm'
$fpm_pool_dir = '/etc/php/php-fpm.d'
Expand Down
23 changes: 15 additions & 8 deletions manifests/repo/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# [*dotdeb*]
# Enable special dotdeb handling
#
# [*sury*]
# Enable special sury handling
#
class php::repo::debian(
$location = 'http://packages.dotdeb.org',
$release = 'wheezy-php56',
Expand All @@ -30,6 +33,7 @@
'source' => 'http://www.dotdeb.org/dotdeb.gpg',
},
$dotdeb = true,
$sury = true,
) {

if $caller_module_name != $module_name {
Expand Down Expand Up @@ -70,22 +74,25 @@
}
}

if ($php::globals::php_version == '7.1') {
if ($sury and $php::globals::php_version == '7.1') {
# Required packages for PHP 7.1 repository
ensure_packages(['lsb-release', 'ca-certificates'], {'ensure' => 'present'})

# Add PHP 7.1 key + repository
apt::key { 'php::repo::debian-php71':
key => 'DF3D585DB8F0EB658690A554AC0E47584A7A714D',
key_source => 'https://packages.sury.org/php/apt.gpg',
id => 'DF3D585DB8F0EB658690A554AC0E47584A7A714D',
source => 'https://packages.sury.org/php/apt.gpg',
}

::apt::source { 'source_php_71':
location => 'https://packages.sury.org/php/',
release => $::lsbdistcodename,
repos => 'main',
include_src => false,
require => [
location => 'https://packages.sury.org/php/',
release => $facts['os']['distro']['codename'],
repos => 'main',
include => {
'src' => $include_src,
'deb' => true,
},
require => [
Apt::Key['php::repo::debian-php71'],
Package['apt-transport-https', 'lsb-release', 'ca-certificates']
],
Expand Down
4 changes: 3 additions & 1 deletion manifests/repo/ubuntu.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@
'7.0' => 'ondrej/php'
}

::apt::ppa { "ppa:${version_repo}": }
::apt::ppa { "ppa:${version_repo}":
package_manage => true,
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-php",
"version": "5.2.0",
"version": "5.3.0",
"author": "Vox Pupuli",
"summary": "Generic PHP module that supports many platforms",
"license": "MIT",
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/nodesets/docker/ubuntu-16.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ HOSTS:
docker_preserve_image: true
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'systemctl mask getty@tty1.service getty-static.service'
- 'apt-get update'
- 'apt-get install -y net-tools wget locales apt-transport-https'
- 'locale-gen en_US.UTF-8'
- 'echo LANG=en_US.UTF-8 > /etc/default/locale'
CONFIG:
trace_limit: 200
masterless: true
Expand Down
47 changes: 47 additions & 0 deletions spec/acceptance/php56_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'spec_helper_acceptance'

describe 'with specific php version' do
case default[:platform]
when %r{ubuntu}
packagename = 'php5.6-fpm'
when %r{el}
# ell = Enterprise Linux = CentOS....
packagename = 'php-fpm'
when %r{debian}
packagename = 'php5-fpm'
end

context 'with params' do
it 'works with 5.6' do
pp = <<-EOS
class { 'php::globals':
php_version => '5.6',
}
-> class { 'php':
ensure => 'present',
manage_repos => true,
fpm => true,
dev => true,
composer => true,
pear => true,
phpunit => false,
}
EOS

# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe package(packagename) do
it { is_expected.to be_installed }
end
describe service(packagename) do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end
describe command('php --version') do
its(:stdout) { is_expected.to match %r{5\.6} }
end
end
end
31 changes: 31 additions & 0 deletions spec/acceptance/php_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'spec_helper_acceptance'

describe 'php with default settings' do
context 'default parameters' do
it 'works with defaults' do
pp = 'include php'
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

case default[:platform]
when %r{ubuntu-16.04}
packagename = 'php7.0-fpm'
when %r{ubuntu-14.04}
packagename = 'php5-fpm'
when %r{el}
packagename = 'php-fpm'
when %r{debian}
packagename = 'php5-fpm'
end
describe package(packagename) do
it { is_expected.to be_installed }
end

describe service(packagename) do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end
end
end
Loading