This repository has been archived by the owner on Dec 2, 2020. It is now read-only.
forked from mattheath/puppet-php
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathinit.pp
169 lines (141 loc) · 4.54 KB
/
init.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Class: php
#
# This module installs a full phpenv & php-build driven php stack
#
# Usage:
#
# include php
#
class php {
require php::config
require homebrew
include wget
include stdlib
include autoconf
include libtool
include pkgconfig
include pcre
include libpng
include openssl
# Get rid of any pre-installed packages
package { ['phpenv', 'php-build']: ensure => absent; }
file {
[
$php::config::root,
$php::config::logdir,
$php::config::datadir,
$php::config::pluginsdir,
$php::config::cachedir,
$php::config::extensioncachedir,
]:
ensure => directory
}
# Ensure we only have config files managed by Boxen
# to prevent any conflicts by shipping a (nearly) empty
# dir, and recursively purging
file { $php::config::configdir:
ensure => directory,
recurse => true,
purge => true,
force => true,
source => 'puppet:///modules/php/empty-conf-dir',
}
file {
[
"${php::config::root}/phpenv.d",
"${php::config::root}/phpenv.d/install",
"${php::config::root}/shims",
"${php::config::root}/versions",
"${php::config::root}/libexec",
]:
ensure => directory,
require => Exec['phpenv-setup-root-repo'];
"${boxen::config::envdir}/phpenv.sh":
source => 'puppet:///modules/php/phpenv.sh' ;
}
# Resolve dependencies
ensure_packages( [ 'libevent', 'gmp', 'icu4c', 'jpeg', 'mcrypt', 'curl', ] )
# Install freetype version 2.4.11 due to conflict with GD
# See https://github.com/boxen/puppet-php/issues/25
homebrew::formula { 'freetypephp':
source => 'puppet:///modules/php/brews/freetype.rb',
before => Package['boxen/brews/freetypephp'],
}
package { 'boxen/brews/freetypephp':
ensure => '2.4.11',
}
# Need autoconf version less than 2.59 for php 5.3 (ewwwww)
homebrew::formula { 'autoconf213':
source => 'puppet:///modules/php/brews/autoconf213.rb',
before => Package['boxen/brews/autoconf213'],
}
package { 'boxen/brews/autoconf213':
ensure => '2.13-boxen1',
}
# PHP 5.5 drops support for Bison 2.3 which is shipped with OSX
# Therefore need a later version, which we'll again sandbox just for this
homebrew::formula { 'bisonphp26':
source => 'puppet:///modules/php/brews/bison26.rb',
before => Package['boxen/brews/bisonphp26'],
}
package { 'boxen/brews/bisonphp26':
ensure => '2.6.4-boxen1',
}
# Install dupe version of zlib as tapping homebrew dupes appears to have
# broken. I've also tried to build a specific zlib module, but this also
# will not currently install via brew within boxen
#
# See https://github.com/boxen/puppet-homebrew/issues/14
#
# Note: this will work for newly installed versions of PHP, but will NOT
# work for versions of PHP installed prior to this. The best solution you
# have is to remove those versions manually and Boxen will re-install
homebrew::formula { 'zlibphp':
source => 'puppet:///modules/php/brews/zlib.rb',
before => Package['boxen/brews/zlibphp'] ;
}
package { 'boxen/brews/zlibphp':
ensure => '1.2.8-boxen1',
}
# Set up phpenv
$git_init = 'git init .'
$git_remote = 'git remote add origin https://github.com/phpenv/phpenv.git'
$git_fetch = 'git fetch -q origin'
$git_revision = $php::config::phpenv['revision']
$git_reset = "git reset --hard ${git_revision}"
exec { 'phpenv-setup-root-repo':
command => "${git_init} && ${git_remote} && ${git_fetch} && ${git_reset}",
cwd => $php::config::root,
creates => "${php::config::root}/bin/phpenv",
require => [
File[$php::config::root],
Class['git'],
]
}
exec { "ensure-phpenv-version-${git_revision}":
command => "${git_fetch} && git reset --hard ${git_revision}",
unless => "git rev-parse HEAD | grep ${git_revision}",
cwd => $php::config::root,
require => Exec['phpenv-setup-root-repo']
}
# Cache the PHP src repository we'll need this for extensions
# and at some point building versions #todo
repository { "${php::config::root}/php-src":
source => 'php/php-src',
}
# Shared PEAR data directory - used for downloads & cache
file { "${php::config::datadir}/pear":
ensure => directory,
owner => $::boxen_user,
group => 'staff',
require => File[$php::config::datadir],
}
# Kill off the legacy PHP-FPM daemon as we're moving to per version instances
file { '/Library/LaunchDaemons/dev.php-fpm.plist':
ensure => 'absent',
require => Service['dev.php-fpm']
}
service { 'dev.php-fpm':
ensure => stopped,
}
}