From 787c9207d156e713ed3ee13e254fdaaaf96656b8 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Tue, 4 Sep 2012 09:29:40 +0200 Subject: [PATCH 01/25] Add vagrant files Not happy yet, but it works --- Vagrantfile | 20 + vagrant/puppet/manifests/main.pp | 199 +++++++ .../modules/default/templates/#Untitled-1# | 1 + .../modules/default/templates/httpd.conf | 4 + .../modules/default/templates/main-vhost.conf | 39 ++ .../modules/default/templates/php-fpm.conf | 503 ++++++++++++++++++ .../default/templates/php-timezone.ini | 1 + 7 files changed, 767 insertions(+) create mode 100644 Vagrantfile create mode 100644 vagrant/puppet/manifests/main.pp create mode 100644 vagrant/puppet/modules/default/templates/#Untitled-1# create mode 100644 vagrant/puppet/modules/default/templates/httpd.conf create mode 100644 vagrant/puppet/modules/default/templates/main-vhost.conf create mode 100644 vagrant/puppet/modules/default/templates/php-fpm.conf create mode 100644 vagrant/puppet/modules/default/templates/php-timezone.ini diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000000..728ff6bde1 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,20 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant::Config.run do |config| + config.vm.define :main do |main_config| + main_config.vm.box = "liip-squeeze64" + main_config.vm.box_url = "http://vagrantbox.liip.ch/liip-squeeze64.box" + main_config.vm.network :hostonly, "192.168.22.22" + main_config.vm.forward_port 3306, 13306 + main_config.vm.share_folder "v-root", "/vagrant", ".", :nfs => true + main_config.vm.provision :puppet, :module_path => "vagrant/puppet/modules" do |puppet| + puppet.manifests_path = "vagrant/puppet/manifests" + puppet.manifest_file = "main.pp" + end + end +end + diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp new file mode 100644 index 0000000000..dd44119923 --- /dev/null +++ b/vagrant/puppet/manifests/main.pp @@ -0,0 +1,199 @@ +class apt_update { + + file { "dotdeb.list": + path => "/etc/apt/sources.list.d/dotdeb.list", + ensure => file, + owner => "root", + group => "root", + content => "deb http://ftp.ch.debian.org/debian squeeze main contrib non-free\ndeb http://packages.dotdeb.org squeeze all\ndeb-src http://packages.dotdeb.org squeeze all\ndeb http://packages.dotdeb.org squeeze-php54 all\ndeb-src http://packages.dotdeb.org squeeze-php54 all", + + notify => Exec["aptGetUpdate"], + } + + + exec { "aptGetUpdate": + command => "wget -q -O - http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add - && sudo apt-get update", + path => ["/bin", "/usr/bin"] + } +} + +class apache { + package { "apache2-mpm-worker": + ensure => present, + require => Exec["aptGetUpdate"] + } + + package { "libapache2-mod-fastcgi": + ensure => present, + require => Package["apache2-mpm-worker"] + } + + service { "apache2": + ensure => running, + require => Package["apache2-mpm-worker"], + subscribe => File["main-vhost.conf", "httpd.conf", "mod_rewrite", "mod_actions", "mod_expires", "mod_fastcgi"] + } + + service { "php5-fpm": + ensure => running, + require => Package["php5-fpm"], + subscribe => File["php-fpm.conf"] + } + + + file { "main-vhost.conf": + path => '/etc/apache2/conf.d/main-vhost.conf', + ensure => file, + content => template('default/main-vhost.conf'), + require => Package["apache2-mpm-worker"] + } + + file { "httpd.conf": + path => "/etc/apache2/httpd.conf", + ensure => file, + content => template('default/httpd.conf'), + require => Package["apache2-mpm-worker"] + } + + file { "mod_rewrite": + path => "/etc/apache2/mods-enabled/rewrite.load", + ensure => "link", + target => "/etc/apache2/mods-available/rewrite.load", + require => Package["apache2-mpm-worker"] + } + + file { "mod_actions": + path => "/etc/apache2/mods-enabled/actions.load", + ensure => "link", + target => "/etc/apache2/mods-available/actions.load", + require => Package["libapache2-mod-fastcgi"] + } + + file { "mod_actions_conf": + path => "/etc/apache2/mods-enabled/actions.conf", + ensure => "link", + target => "/etc/apache2/mods-available/actions.conf", + require => Package["libapache2-mod-fastcgi"] + } + + + file { "mod_fastcgi": + path => "/etc/apache2/mods-enabled/fastcgi.load", + ensure => "link", + target => "/etc/apache2/mods-available/fastcgi.load", + require => Package["libapache2-mod-fastcgi"] + } + + file { "mod_fastcgi_conf": + path => "/etc/apache2/mods-enabled/fastcgi.conf", + ensure => "link", + target => "/etc/apache2/mods-available/fastcgi.conf", + require => Package["libapache2-mod-fastcgi"] + } + file { "mod_expires": + path => "/etc/apache2/mods-enabled/expires.load", + ensure => "link", + target => "/etc/apache2/mods-available/expires.load", + require => Package["apache2-mpm-worker"] + } +} + +class php53 { + package { "php5-fpm": + ensure => present, + require => Package["apache2-mpm-worker"] + } + + package { "php5-cli": + ensure => present, + require => Package["php5-fpm"] + } + + package { "php5-apc": + ensure => present, + require => Package["php5-fpm"] + } + + package { "php5-xdebug": + ensure => present, + require => Package["php5-fpm"] + } + + package { "php5-intl": + ensure => present, + require => Package["php5-fpm"] + } + + file { "php-fpm.conf": + path => "/etc/php5/fpm/php-fpm.conf", + ensure => file, + content => template('default/php-fpm.conf'), + require => Package["php5-fpm"] + } + + file { "php-timezone.ini": + path => "/etc/php5/cli/conf.d/30-timezone.ini", + ensure => file, + content => template('default/php-timezone.ini'), + require => Package["php5-cli"] + } + + + + +} + +class terrific { + + exec { "vendorsInstall": + cwd => "/vagrant", + command => "php composer.phar install", + path => ["/bin", "/usr/bin"], + creates => "/vagrant/vendor", + require => Exec["composerPhar"], + } + +} + +class composer { + exec { "composerPhar": + cwd => "/vagrant", + command => "curl -s http://getcomposer.org/installer | php", + path => ["/bin", "/usr/bin"], + creates => "/vagrant/composer.phar", + require => Package["php5-cli","curl" ], + } + + +} + +class groups { + group { "puppet": + ensure => present, + } +} + +class git { + package { "git": + ensure => present, + } + package { "curl": + ensure => present, + } +} + +class nfs { + package {"nfs-common": + ensure => present, + } +} + +include nfs + +include apt_update +include git +include apache +include php53 +include groups +include composer +include terrific diff --git a/vagrant/puppet/modules/default/templates/#Untitled-1# b/vagrant/puppet/modules/default/templates/#Untitled-1# new file mode 100644 index 0000000000..c3d7967943 --- /dev/null +++ b/vagrant/puppet/modules/default/templates/#Untitled-1# @@ -0,0 +1 @@ +date.timezone = UTC diff --git a/vagrant/puppet/modules/default/templates/httpd.conf b/vagrant/puppet/modules/default/templates/httpd.conf new file mode 100644 index 0000000000..cd667c3e9a --- /dev/null +++ b/vagrant/puppet/modules/default/templates/httpd.conf @@ -0,0 +1,4 @@ +User vagrant +Group vagrant + +EnableSendfile off \ No newline at end of file diff --git a/vagrant/puppet/modules/default/templates/main-vhost.conf b/vagrant/puppet/modules/default/templates/main-vhost.conf new file mode 100644 index 0000000000..17299d1c48 --- /dev/null +++ b/vagrant/puppet/modules/default/templates/main-vhost.conf @@ -0,0 +1,39 @@ + + + ServerAdmin admin@liip.ch + DocumentRoot /vagrant/web + ErrorLog /var/log/apache2/fpm-error_log + CustomLog /var/log/apache2/fpm-access_log combined env=!spammer + + + # Ensure that mod_php5 is off + + php_admin_flag engine off + + + AddType application/x-httpd-php .php + Action application/x-httpd-php /php.fcgi + Alias /php.fcgi /tmp/php-fpm.fcgi + + # If PHP-FPM is configured to listen on a Unix socket, use this: + FastCGIExternalServer /tmp/php-fpm.fcgi -socket /tmp/php-fpm.sock + # Otherwise, use this: + #FastCGIExternalServer /Library/WebServer/HOSTNAME.fcgi -host 127.0.0.1:9000 + + # Without the following directive, you'll get an Access Forbidden error + # when the path aliased by /php-fpm is not under the document root: + + Order Deny,Allow + Allow from deny + Allow from env=REDIRECT_STATUS + + + + + + + + + RewriteEngine On + + diff --git a/vagrant/puppet/modules/default/templates/php-fpm.conf b/vagrant/puppet/modules/default/templates/php-fpm.conf new file mode 100644 index 0000000000..a91fad8a5e --- /dev/null +++ b/vagrant/puppet/modules/default/templates/php-fpm.conf @@ -0,0 +1,503 @@ +;;;;;;;;;;;;;;;;;;;;; +; FPM Configuration ; +;;;;;;;;;;;;;;;;;;;;; + +; All relative paths in this configuration file are relative to PHP's install +; prefix (/usr/local/php5.4). This prefix can be dynamicaly changed by using the +; '-p' argument from the command line. + +; Include one or more files. If glob(3) exists, it is used to include a bunch of +; files from a glob(3) pattern. This directive can be used everywhere in the +; file. +; Relative path can also be used. They will be prefixed by: +; - the global prefix if it's been set (-p arguement) +; - /usr/local/php5.4 otherwise +;include=etc/fpm.d/*.conf + +;;;;;;;;;;;;;;;;;; +; Global Options ; +;;;;;;;;;;;;;;;;;; + +[global] +; Pid file +; Note: the default prefix is /usr/local/php5.4/var +; Default Value: none +pid = /var/run/php-fpm.pid + +; Error log file +; If it's set to "syslog", log is sent to syslogd instead of being written +; in a local file. +; Note: the default prefix is /usr/local/php5.4/var +; Default Value: log/php-fpm.log +error_log = /var/log/apache2/php-fpm.log + +; syslog_facility is used to specify what type of program is logging the +; message. This lets syslogd specify that messages from different facilities +; will be handled differently. +; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) +; Default Value: daemon +;syslog.facility = daemon + +; syslog_ident is prepended to every message. If you have multiple FPM +; instances running on the same server, you can change the default value +; which must suit common needs. +; Default Value: php-fpm +;syslog.ident = php-fpm + +; Log level +; Possible Values: alert, error, warning, notice, debug +; Default Value: notice +;log_level = notice + +; If this number of child processes exit with SIGSEGV or SIGBUS within the time +; interval set by emergency_restart_interval then FPM will restart. A value +; of '0' means 'Off'. +; Default Value: 0 +;emergency_restart_threshold = 0 + +; Interval of time used by emergency_restart_interval to determine when +; a graceful restart will be initiated. This can be useful to work around +; accidental corruptions in an accelerator's shared memory. +; Available Units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;emergency_restart_interval = 0 + +; Time limit for child processes to wait for a reaction on signals from master. +; Available units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;process_control_timeout = 0 + +; The maximum number of processes FPM will fork. This has been design to control +; the global number of processes when using dynamic PM within a lot of pools. +; Use it with caution. +; Note: A value of 0 indicates no limit +; Default Value: 0 +process.max = 128 + +; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. +; Default Value: yes +;daemonize = yes + +; Set open file descriptor rlimit for the master process. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit for the master process. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Specify the event mechanism FPM will use. The following is available: +; - select (any POSIX os) +; - poll (any POSIX os) +; - epoll (linux >= 2.5.44) +; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) +; - /dev/poll (Solaris >= 7) +; - port (Solaris >= 10) +; Default Value: not set (auto detection) +; events.mechanism = epoll + +;;;;;;;;;;;;;;;;;;;; +; Pool Definitions ; +;;;;;;;;;;;;;;;;;;;; + +; Multiple pools of child processes may be started with different listening +; ports and different management options. The name of the pool will be +; used in logs and stats. There is no limitation on the number of pools which +; FPM can handle. Your system will tell you anyway :) + +; Start a new pool named 'www'. +; the variable $pool can we used in any directive and will be replaced by the +; pool name ('www' here) +[www] + +; Per pool prefix +; It only applies on the following directives: +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or /usr/local/php5.4) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = www-data +group = www-data + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses on a +; specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +;listen = 127.0.0.1:9000 +listen = /tmp/php-fpm.sock + +; Set listen(2) backlog. +; Default Value: 128 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 128 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. +; Default Values: user and group are set as the running user +; mode is set to 0666 +;listen.owner = nobody +;listen.group = nobody +;listen.mode = 0666 + +; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 20 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following informations: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: ${prefix}/share/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +;access.log = log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: ouput header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = log/$pool.log.slow + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_terminate_timeout = 0 + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +;chdir = /var/www + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +;catch_workers_output = yes + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; exectute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr/local/php5.4) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com +;php_flag[display_errors] = off +php_admin_value[error_log] = /var/log/apache2/fpm-php.error.log +;php_admin_flag[log_errors] = on +;php_admin_value[memory_limit] = 32M +php_admin_flag[magic_quotes_gpc] = off +php_flag[register_globals] = Off +php_flag[allow_fopen_url] = Off +php_flag[zend.ze1_compatibility_mode] = Off +php_value[date.timezone] = UTC +php_flag[short_open_tag] = Off + + diff --git a/vagrant/puppet/modules/default/templates/php-timezone.ini b/vagrant/puppet/modules/default/templates/php-timezone.ini new file mode 100644 index 0000000000..af95699d0e --- /dev/null +++ b/vagrant/puppet/modules/default/templates/php-timezone.ini @@ -0,0 +1 @@ +date.timezone = Europe/Zurich From 46c5773f8f89822fa4f1afa6875b665df21f84b0 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Tue, 4 Sep 2012 11:09:53 +0200 Subject: [PATCH 02/25] use modphp --- vagrant/puppet/manifests/main.pp | 86 +++++-------------- .../modules/default/templates/main-vhost.conf | 36 +------- 2 files changed, 26 insertions(+), 96 deletions(-) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index dd44119923..3380c234e5 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -18,117 +18,80 @@ } class apache { - package { "apache2-mpm-worker": + package { "apache2-mpm-prefork": ensure => present, require => Exec["aptGetUpdate"] } - package { "libapache2-mod-fastcgi": + package { "libapache2-mod-php5": ensure => present, - require => Package["apache2-mpm-worker"] + require => Package["apache2-mpm-prefork"] } service { "apache2": ensure => running, - require => Package["apache2-mpm-worker"], - subscribe => File["main-vhost.conf", "httpd.conf", "mod_rewrite", "mod_actions", "mod_expires", "mod_fastcgi"] + require => Package["apache2-mpm-prefork"], + subscribe => File["main-vhost.conf", "httpd.conf", "mod_rewrite", "mod_actions"] } - service { "php5-fpm": - ensure => running, - require => Package["php5-fpm"], - subscribe => File["php-fpm.conf"] - } file { "main-vhost.conf": path => '/etc/apache2/conf.d/main-vhost.conf', ensure => file, content => template('default/main-vhost.conf'), - require => Package["apache2-mpm-worker"] + require => Package["apache2-mpm-prefork"] } file { "httpd.conf": path => "/etc/apache2/httpd.conf", ensure => file, content => template('default/httpd.conf'), - require => Package["apache2-mpm-worker"] + require => Package["apache2-mpm-prefork"] } file { "mod_rewrite": path => "/etc/apache2/mods-enabled/rewrite.load", ensure => "link", target => "/etc/apache2/mods-available/rewrite.load", - require => Package["apache2-mpm-worker"] + require => Package["apache2-mpm-prefork"] } file { "mod_actions": path => "/etc/apache2/mods-enabled/actions.load", ensure => "link", target => "/etc/apache2/mods-available/actions.load", - require => Package["libapache2-mod-fastcgi"] + require => Package["apache2-mpm-prefork"] } file { "mod_actions_conf": path => "/etc/apache2/mods-enabled/actions.conf", ensure => "link", target => "/etc/apache2/mods-available/actions.conf", - require => Package["libapache2-mod-fastcgi"] - } - - - file { "mod_fastcgi": - path => "/etc/apache2/mods-enabled/fastcgi.load", - ensure => "link", - target => "/etc/apache2/mods-available/fastcgi.load", - require => Package["libapache2-mod-fastcgi"] - } - - file { "mod_fastcgi_conf": - path => "/etc/apache2/mods-enabled/fastcgi.conf", - ensure => "link", - target => "/etc/apache2/mods-available/fastcgi.conf", - require => Package["libapache2-mod-fastcgi"] - } - file { "mod_expires": - path => "/etc/apache2/mods-enabled/expires.load", - ensure => "link", - target => "/etc/apache2/mods-available/expires.load", - require => Package["apache2-mpm-worker"] + require => Package["apache2-mpm-prefork"] } } -class php53 { - package { "php5-fpm": - ensure => present, - require => Package["apache2-mpm-worker"] - } +class php54 { + package { "php5-cli": ensure => present, - require => Package["php5-fpm"] } package { "php5-apc": ensure => present, - require => Package["php5-fpm"] + require => Package["libapache2-mod-php5"] } package { "php5-xdebug": ensure => present, - require => Package["php5-fpm"] + require => Package["libapache2-mod-php5"] } package { "php5-intl": ensure => present, - require => Package["php5-fpm"] - } - - file { "php-fpm.conf": - path => "/etc/php5/fpm/php-fpm.conf", - ensure => file, - content => template('default/php-fpm.conf'), - require => Package["php5-fpm"] + require => Package["libapache2-mod-php5"] } file { "php-timezone.ini": @@ -143,7 +106,7 @@ } -class terrific { +class symfony { exec { "vendorsInstall": cwd => "/vagrant", @@ -173,27 +136,24 @@ } } -class git { +class otherstuff { package { "git": ensure => present, } package { "curl": ensure => present, } -} - -class nfs { - package {"nfs-common": + package {"nfs-common": ensure => present, - } + } } -include nfs + include apt_update -include git +include otherstuff include apache -include php53 +include php54 include groups include composer -include terrific +include symfony diff --git a/vagrant/puppet/modules/default/templates/main-vhost.conf b/vagrant/puppet/modules/default/templates/main-vhost.conf index 17299d1c48..b26dd9e5f0 100644 --- a/vagrant/puppet/modules/default/templates/main-vhost.conf +++ b/vagrant/puppet/modules/default/templates/main-vhost.conf @@ -2,38 +2,8 @@ ServerAdmin admin@liip.ch DocumentRoot /vagrant/web - ErrorLog /var/log/apache2/fpm-error_log - CustomLog /var/log/apache2/fpm-access_log combined env=!spammer - - - # Ensure that mod_php5 is off - - php_admin_flag engine off - - - AddType application/x-httpd-php .php - Action application/x-httpd-php /php.fcgi - Alias /php.fcgi /tmp/php-fpm.fcgi - - # If PHP-FPM is configured to listen on a Unix socket, use this: - FastCGIExternalServer /tmp/php-fpm.fcgi -socket /tmp/php-fpm.sock - # Otherwise, use this: - #FastCGIExternalServer /Library/WebServer/HOSTNAME.fcgi -host 127.0.0.1:9000 - - # Without the following directive, you'll get an Access Forbidden error - # when the path aliased by /php-fpm is not under the document root: - - Order Deny,Allow - Allow from deny - Allow from env=REDIRECT_STATUS - - - - - - - - - RewriteEngine On + ErrorLog /var/log/apache2/symfony-error_log + CustomLog /var/log/apache2/symfony-access_log combined env=!spammer + RewriteEngine On From cd12875e231917c0f9df6fdae73e5a55b835ffd3 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Tue, 4 Sep 2012 11:10:08 +0200 Subject: [PATCH 03/25] Allow 192.168.22.1 as well for vagrant --- web/app_dev.php | 1 + 1 file changed, 1 insertion(+) diff --git a/web/app_dev.php b/web/app_dev.php index 5a05245a6e..9b8535ea9a 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -12,6 +12,7 @@ || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !in_array(@$_SERVER['REMOTE_ADDR'], array( '127.0.0.1', + '192.168.22.1', '::1', )) ) { From 3666ef7fe8f1bc9f6ed6402c6df97897442bbf83 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Tue, 4 Sep 2012 12:50:36 +0200 Subject: [PATCH 04/25] add .vagrant --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 93f07f37b5..e76ab0f401 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ build/ vendor bin composer.phar + +/.vagrant \ No newline at end of file From 9303e7dc62f9cb5a0215391eec048d87e96e8b76 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Thu, 6 Sep 2012 18:26:05 +0200 Subject: [PATCH 05/25] Some cleanup --- vagrant/puppet/manifests/main.pp | 10 +- .../modules/default/templates/main-vhost.conf | 4 +- .../modules/default/templates/php-fpm.conf | 503 ------------------ 3 files changed, 4 insertions(+), 513 deletions(-) delete mode 100644 vagrant/puppet/modules/default/templates/php-fpm.conf diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 3380c234e5..7f84ede00d 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -6,11 +6,9 @@ owner => "root", group => "root", content => "deb http://ftp.ch.debian.org/debian squeeze main contrib non-free\ndeb http://packages.dotdeb.org squeeze all\ndeb-src http://packages.dotdeb.org squeeze all\ndeb http://packages.dotdeb.org squeeze-php54 all\ndeb-src http://packages.dotdeb.org squeeze-php54 all", - notify => Exec["aptGetUpdate"], } - exec { "aptGetUpdate": command => "wget -q -O - http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add - && sudo apt-get update", path => ["/bin", "/usr/bin"] @@ -23,7 +21,7 @@ require => Exec["aptGetUpdate"] } - package { "libapache2-mod-php5": + package { "libapache2-mod-php5": ensure => present, require => Package["apache2-mpm-prefork"] } @@ -94,16 +92,12 @@ require => Package["libapache2-mod-php5"] } - file { "php-timezone.ini": + file { "php-timezone.ini": path => "/etc/php5/cli/conf.d/30-timezone.ini", ensure => file, content => template('default/php-timezone.ini'), require => Package["php5-cli"] } - - - - } class symfony { diff --git a/vagrant/puppet/modules/default/templates/main-vhost.conf b/vagrant/puppet/modules/default/templates/main-vhost.conf index b26dd9e5f0..b70a12f02a 100644 --- a/vagrant/puppet/modules/default/templates/main-vhost.conf +++ b/vagrant/puppet/modules/default/templates/main-vhost.conf @@ -1,9 +1,9 @@ - ServerAdmin admin@liip.ch + ServerAdmin admin@example.org DocumentRoot /vagrant/web ErrorLog /var/log/apache2/symfony-error_log - CustomLog /var/log/apache2/symfony-access_log combined env=!spammer + CustomLog /var/log/apache2/symfony-access_log combined RewriteEngine On diff --git a/vagrant/puppet/modules/default/templates/php-fpm.conf b/vagrant/puppet/modules/default/templates/php-fpm.conf deleted file mode 100644 index a91fad8a5e..0000000000 --- a/vagrant/puppet/modules/default/templates/php-fpm.conf +++ /dev/null @@ -1,503 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;; -; FPM Configuration ; -;;;;;;;;;;;;;;;;;;;;; - -; All relative paths in this configuration file are relative to PHP's install -; prefix (/usr/local/php5.4). This prefix can be dynamicaly changed by using the -; '-p' argument from the command line. - -; Include one or more files. If glob(3) exists, it is used to include a bunch of -; files from a glob(3) pattern. This directive can be used everywhere in the -; file. -; Relative path can also be used. They will be prefixed by: -; - the global prefix if it's been set (-p arguement) -; - /usr/local/php5.4 otherwise -;include=etc/fpm.d/*.conf - -;;;;;;;;;;;;;;;;;; -; Global Options ; -;;;;;;;;;;;;;;;;;; - -[global] -; Pid file -; Note: the default prefix is /usr/local/php5.4/var -; Default Value: none -pid = /var/run/php-fpm.pid - -; Error log file -; If it's set to "syslog", log is sent to syslogd instead of being written -; in a local file. -; Note: the default prefix is /usr/local/php5.4/var -; Default Value: log/php-fpm.log -error_log = /var/log/apache2/php-fpm.log - -; syslog_facility is used to specify what type of program is logging the -; message. This lets syslogd specify that messages from different facilities -; will be handled differently. -; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) -; Default Value: daemon -;syslog.facility = daemon - -; syslog_ident is prepended to every message. If you have multiple FPM -; instances running on the same server, you can change the default value -; which must suit common needs. -; Default Value: php-fpm -;syslog.ident = php-fpm - -; Log level -; Possible Values: alert, error, warning, notice, debug -; Default Value: notice -;log_level = notice - -; If this number of child processes exit with SIGSEGV or SIGBUS within the time -; interval set by emergency_restart_interval then FPM will restart. A value -; of '0' means 'Off'. -; Default Value: 0 -;emergency_restart_threshold = 0 - -; Interval of time used by emergency_restart_interval to determine when -; a graceful restart will be initiated. This can be useful to work around -; accidental corruptions in an accelerator's shared memory. -; Available Units: s(econds), m(inutes), h(ours), or d(ays) -; Default Unit: seconds -; Default Value: 0 -;emergency_restart_interval = 0 - -; Time limit for child processes to wait for a reaction on signals from master. -; Available units: s(econds), m(inutes), h(ours), or d(ays) -; Default Unit: seconds -; Default Value: 0 -;process_control_timeout = 0 - -; The maximum number of processes FPM will fork. This has been design to control -; the global number of processes when using dynamic PM within a lot of pools. -; Use it with caution. -; Note: A value of 0 indicates no limit -; Default Value: 0 -process.max = 128 - -; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. -; Default Value: yes -;daemonize = yes - -; Set open file descriptor rlimit for the master process. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit for the master process. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Specify the event mechanism FPM will use. The following is available: -; - select (any POSIX os) -; - poll (any POSIX os) -; - epoll (linux >= 2.5.44) -; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) -; - /dev/poll (Solaris >= 7) -; - port (Solaris >= 10) -; Default Value: not set (auto detection) -; events.mechanism = epoll - -;;;;;;;;;;;;;;;;;;;; -; Pool Definitions ; -;;;;;;;;;;;;;;;;;;;; - -; Multiple pools of child processes may be started with different listening -; ports and different management options. The name of the pool will be -; used in logs and stats. There is no limitation on the number of pools which -; FPM can handle. Your system will tell you anyway :) - -; Start a new pool named 'www'. -; the variable $pool can we used in any directive and will be replaced by the -; pool name ('www' here) -[www] - -; Per pool prefix -; It only applies on the following directives: -; - 'slowlog' -; - 'listen' (unixsocket) -; - 'chroot' -; - 'chdir' -; - 'php_values' -; - 'php_admin_values' -; When not set, the global prefix (or /usr/local/php5.4) applies instead. -; Note: This directive can also be relative to the global prefix. -; Default Value: none -;prefix = /path/to/pools/$pool - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = www-data -group = www-data - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on -; a specific port; -; 'port' - to listen on a TCP socket to all addresses on a -; specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -;listen = 127.0.0.1:9000 -listen = /tmp/php-fpm.sock - -; Set listen(2) backlog. -; Default Value: 128 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 128 - -; Set permissions for unix socket, if one is used. In Linux, read/write -; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. -; Default Values: user and group are set as the running user -; mode is set to 0666 -;listen.owner = nobody -;listen.group = nobody -;listen.mode = 0666 - -; List of ipv4 addresses of FastCGI clients which are allowed to connect. -; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original -; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address -; must be separated by a comma. If this value is left blank, connections will be -; accepted from any ip address. -; Default Value: any -;listen.allowed_clients = 127.0.0.1 - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = dynamic - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = 20 - -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -pm.start_servers = 2 - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 1 - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = 3 - -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -;pm.max_requests = 500 - -; The URI to view the FPM status page. If this value is not set, no URI will be -; recognized as a status page. It shows the following informations: -; pool - the name of the pool; -; process manager - static, dynamic or ondemand; -; start time - the date and time FPM has started; -; start since - number of seconds since FPM has started; -; accepted conn - the number of request accepted by the pool; -; listen queue - the number of request in the queue of pending -; connections (see backlog in listen(2)); -; max listen queue - the maximum number of requests in the queue -; of pending connections since FPM has started; -; listen queue len - the size of the socket queue of pending connections; -; idle processes - the number of idle processes; -; active processes - the number of active processes; -; total processes - the number of idle + active processes; -; max active processes - the maximum number of active processes since FPM -; has started; -; max children reached - number of times, the process limit has been reached, -; when pm tries to start more children (works only for -; pm 'dynamic' and 'ondemand'); -; Value are updated in real time. -; Example output: -; pool: www -; process manager: static -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 62636 -; accepted conn: 190460 -; listen queue: 0 -; max listen queue: 1 -; listen queue len: 42 -; idle processes: 4 -; active processes: 11 -; total processes: 15 -; max active processes: 12 -; max children reached: 0 -; -; By default the status page output is formatted as text/plain. Passing either -; 'html', 'xml' or 'json' in the query string will return the corresponding -; output syntax. Example: -; http://www.foo.bar/status -; http://www.foo.bar/status?json -; http://www.foo.bar/status?html -; http://www.foo.bar/status?xml -; -; By default the status page only outputs short status. Passing 'full' in the -; query string will also return status for each pool process. -; Example: -; http://www.foo.bar/status?full -; http://www.foo.bar/status?json&full -; http://www.foo.bar/status?html&full -; http://www.foo.bar/status?xml&full -; The Full status returns for each process: -; pid - the PID of the process; -; state - the state of the process (Idle, Running, ...); -; start time - the date and time the process has started; -; start since - the number of seconds since the process has started; -; requests - the number of requests the process has served; -; request duration - the duration in µs of the requests; -; request method - the request method (GET, POST, ...); -; request URI - the request URI with the query string; -; content length - the content length of the request (only with POST); -; user - the user (PHP_AUTH_USER) (or '-' if not set); -; script - the main script called (or '-' if not set); -; last request cpu - the %cpu the last request consumed -; it's always 0 if the process is not in Idle state -; because CPU calculation is done when the request -; processing has terminated; -; last request memory - the max amount of memory the last request consumed -; it's always 0 if the process is not in Idle state -; because memory calculation is done when the request -; processing has terminated; -; If the process is in Idle state, then informations are related to the -; last request the process has served. Otherwise informations are related to -; the current request being served. -; Example output: -; ************************ -; pid: 31330 -; state: Running -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 63087 -; requests: 12808 -; request duration: 1250261 -; request method: GET -; request URI: /test_mem.php?N=10000 -; content length: 0 -; user: - -; script: /home/fat/web/docs/php/test_mem.php -; last request cpu: 0.00 -; last request memory: 0 -; -; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: ${prefix}/share/fpm/status.html -; -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;pm.status_path = /status - -; The ping URI to call the monitoring page of FPM. If this value is not set, no -; URI will be recognized as a ping page. This could be used to test from outside -; that FPM is alive and responding, or to -; - create a graph of FPM availability (rrd or such); -; - remove a server from a group if it is not responding (load balancing); -; - trigger alerts for the operating team (24/7). -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;ping.path = /ping - -; This directive may be used to customize the response of a ping request. The -; response is formatted as text/plain with a 200 response code. -; Default Value: pong -;ping.response = pong - -; The access log file -; Default: not set -;access.log = log/$pool.access.log - -; The access log format. -; The following syntax is allowed -; %%: the '%' character -; %C: %CPU used by the request -; it can accept the following format: -; - %{user}C for user CPU only -; - %{system}C for system CPU only -; - %{total}C for user + system CPU (default) -; %d: time taken to serve the request -; it can accept the following format: -; - %{seconds}d (default) -; - %{miliseconds}d -; - %{mili}d -; - %{microseconds}d -; - %{micro}d -; %e: an environment variable (same as $_ENV or $_SERVER) -; it must be associated with embraces to specify the name of the env -; variable. Some exemples: -; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e -; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e -; %f: script filename -; %l: content-length of the request (for POST request only) -; %m: request method -; %M: peak of memory allocated by PHP -; it can accept the following format: -; - %{bytes}M (default) -; - %{kilobytes}M -; - %{kilo}M -; - %{megabytes}M -; - %{mega}M -; %n: pool name -; %o: ouput header -; it must be associated with embraces to specify the name of the header: -; - %{Content-Type}o -; - %{X-Powered-By}o -; - %{Transfert-Encoding}o -; - .... -; %p: PID of the child that serviced the request -; %P: PID of the parent of the child that serviced the request -; %q: the query string -; %Q: the '?' character if query string exists -; %r: the request URI (without the query string, see %q and %Q) -; %R: remote IP address -; %s: status (response code) -; %t: server time the request was received -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; %T: time the log has been written (the request has finished) -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; %u: remote user -; -; Default: "%R - %u %t \"%m %r\" %s" -;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - -; The log file for slow requests -; Default Value: not set -; Note: slowlog is mandatory if request_slowlog_timeout is set -;slowlog = log/$pool.log.slow - -; The timeout for serving a single request after which a PHP backtrace will be -; dumped to the 'slowlog' file. A value of '0s' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_slowlog_timeout = 0 - -; The timeout for serving a single request after which the worker process will -; be killed. This option should be used when the 'max_execution_time' ini option -; does not stop script execution for some reason. A value of '0' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_terminate_timeout = 0 - -; Set open file descriptor rlimit. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Chroot to this directory at the start. This value must be defined as an -; absolute path. When this value is not set, chroot is not used. -; Note: you can prefix with '$prefix' to chroot to the pool prefix or one -; of its subdirectories. If the pool prefix is not set, the global prefix -; will be used instead. -; Note: chrooting is a great security feature and should be used whenever -; possible. However, all PHP paths will be relative to the chroot -; (error_log, sessions.save_path, ...). -; Default Value: not set -;chroot = - -; Chdir to this directory at the start. -; Note: relative path can be used. -; Default Value: current directory or / when chroot -;chdir = /var/www - -; Redirect worker stdout and stderr into main error log. If not set, stdout and -; stderr will be redirected to /dev/null according to FastCGI specs. -; Note: on highloaded environement, this can cause some delay in the page -; process time (several ms). -; Default Value: no -;catch_workers_output = yes - -; Limits the extensions of the main script FPM will allow to parse. This can -; prevent configuration mistakes on the web server side. You should only limit -; FPM to .php extensions to prevent malicious users to use other extensions to -; exectute php code. -; Note: set an empty value to allow all extensions. -; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 - -; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from -; the current environment. -; Default Value: clean env -;env[HOSTNAME] = $HOSTNAME -;env[PATH] = /usr/local/bin:/usr/bin:/bin -;env[TMP] = /tmp -;env[TMPDIR] = /tmp -;env[TEMP] = /tmp - -; Additional php.ini defines, specific to this pool of workers. These settings -; overwrite the values previously defined in the php.ini. The directives are the -; same as the PHP SAPI: -; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. -; php_admin_value/php_admin_flag - these directives won't be overwritten by -; PHP call 'ini_set' -; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. - -; Defining 'extension' will load the corresponding shared extension from -; extension_dir. Defining 'disable_functions' or 'disable_classes' will not -; overwrite previously defined php.ini values, but will append the new value -; instead. - -; Note: path INI options can be relative and will be expanded with the prefix -; (pool, global or /usr/local/php5.4) - -; Default Value: nothing is defined by default except the values in php.ini and -; specified at startup with the -d argument -;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com -;php_flag[display_errors] = off -php_admin_value[error_log] = /var/log/apache2/fpm-php.error.log -;php_admin_flag[log_errors] = on -;php_admin_value[memory_limit] = 32M -php_admin_flag[magic_quotes_gpc] = off -php_flag[register_globals] = Off -php_flag[allow_fopen_url] = Off -php_flag[zend.ze1_compatibility_mode] = Off -php_value[date.timezone] = UTC -php_flag[short_open_tag] = Off - - From d750cae4fe74d45f7c58e72d251bc520e9354cb8 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Thu, 6 Sep 2012 18:26:18 +0200 Subject: [PATCH 06/25] Added a README about vagrant --- README.vagrant.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 README.vagrant.md diff --git a/README.vagrant.md b/README.vagrant.md new file mode 100644 index 0000000000..abfb571dd6 --- /dev/null +++ b/README.vagrant.md @@ -0,0 +1,14 @@ +# Using Symfony Standard Edition with Vagrant + +## Get Vagrant, if you don't have already + +From http://vagrantup.com/ + + +## startup vagrant + + vagrant up + +## watch site + +go to http://192.168.22.22/app_dev.php and start playing. From 1bed672c96ad40c5a7adc0f56b5c7511293b4a8e Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Thu, 6 Sep 2012 19:52:02 +0200 Subject: [PATCH 07/25] Added sqlite --- vagrant/puppet/manifests/main.pp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 7f84ede00d..957b82a6fc 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -92,6 +92,11 @@ require => Package["libapache2-mod-php5"] } + package { "php5-sqlite": + ensure => present, + require => Package["libapache2-mod-php5"] + } + file { "php-timezone.ini": path => "/etc/php5/cli/conf.d/30-timezone.ini", ensure => file, @@ -107,9 +112,9 @@ command => "php composer.phar install", path => ["/bin", "/usr/bin"], creates => "/vagrant/vendor", + logoutput => true, require => Exec["composerPhar"], } - } class composer { @@ -118,10 +123,8 @@ command => "curl -s http://getcomposer.org/installer | php", path => ["/bin", "/usr/bin"], creates => "/vagrant/composer.phar", - require => Package["php5-cli","curl" ], + require => Package["php5-cli", "curl", "git"], } - - } class groups { From a9bbc6f4591b68c1a8a450e99f6b811b92a6af49 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Thu, 6 Sep 2012 19:54:32 +0200 Subject: [PATCH 08/25] Set the timeout for composer install to 20 minutes --- vagrant/puppet/manifests/main.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 957b82a6fc..2395b645e2 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -110,6 +110,7 @@ exec { "vendorsInstall": cwd => "/vagrant", command => "php composer.phar install", + timeout => 1200, path => ["/bin", "/usr/bin"], creates => "/vagrant/vendor", logoutput => true, From 1291f88130f902871d244fb42891a1b96b544040 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Thu, 6 Sep 2012 20:22:32 +0200 Subject: [PATCH 09/25] add a note that it takes long to start up the machine the first time --- README.vagrant.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.vagrant.md b/README.vagrant.md index abfb571dd6..d4ba38bdc7 100644 --- a/README.vagrant.md +++ b/README.vagrant.md @@ -9,6 +9,8 @@ From http://vagrantup.com/ vagrant up +(this takes up to 15-20 minutes the first time, especially the "composer.phar install" part) + ## watch site go to http://192.168.22.22/app_dev.php and start playing. From 35623bffbf8c2f4d3a965c77e46dab7ddc9fa041 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Fri, 7 Sep 2012 10:39:31 +0200 Subject: [PATCH 10/25] use UTC --- vagrant/puppet/modules/default/templates/php-timezone.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vagrant/puppet/modules/default/templates/php-timezone.ini b/vagrant/puppet/modules/default/templates/php-timezone.ini index af95699d0e..c3d7967943 100644 --- a/vagrant/puppet/modules/default/templates/php-timezone.ini +++ b/vagrant/puppet/modules/default/templates/php-timezone.ini @@ -1 +1 @@ -date.timezone = Europe/Zurich +date.timezone = UTC From bdf55fbf1778e6c847819a9ef4f57e8ad3c746ed Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Fri, 7 Sep 2012 11:28:12 +0200 Subject: [PATCH 11/25] remove dummy file --- vagrant/puppet/modules/default/templates/#Untitled-1# | 1 - 1 file changed, 1 deletion(-) delete mode 100644 vagrant/puppet/modules/default/templates/#Untitled-1# diff --git a/vagrant/puppet/modules/default/templates/#Untitled-1# b/vagrant/puppet/modules/default/templates/#Untitled-1# deleted file mode 100644 index c3d7967943..0000000000 --- a/vagrant/puppet/modules/default/templates/#Untitled-1# +++ /dev/null @@ -1 +0,0 @@ -date.timezone = UTC From 8dd00c53a5ebbac5be01715553eed653f850f3eb Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Sun, 9 Sep 2012 18:38:15 +0200 Subject: [PATCH 12/25] make a 5_3 also possible --- vagrant/puppet/manifests/main.pp | 101 ++++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 2395b645e2..153c876c5e 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -1,16 +1,6 @@ class apt_update { - - file { "dotdeb.list": - path => "/etc/apt/sources.list.d/dotdeb.list", - ensure => file, - owner => "root", - group => "root", - content => "deb http://ftp.ch.debian.org/debian squeeze main contrib non-free\ndeb http://packages.dotdeb.org squeeze all\ndeb-src http://packages.dotdeb.org squeeze all\ndeb http://packages.dotdeb.org squeeze-php54 all\ndeb-src http://packages.dotdeb.org squeeze-php54 all", - notify => Exec["aptGetUpdate"], - } - exec { "aptGetUpdate": - command => "wget -q -O - http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add - && sudo apt-get update", + command => "sudo apt-get update", path => ["/bin", "/usr/bin"] } } @@ -22,8 +12,9 @@ } package { "libapache2-mod-php5": - ensure => present, - require => Package["apache2-mpm-prefork"] + ensure => latest, + require => Package["apache2-mpm-prefork"], + notify => Service["apache2"], } service { "apache2": @@ -32,8 +23,6 @@ subscribe => File["main-vhost.conf", "httpd.conf", "mod_rewrite", "mod_actions"] } - - file { "main-vhost.conf": path => '/etc/apache2/conf.d/main-vhost.conf', ensure => file, @@ -70,30 +59,30 @@ } } -class php54 { - +class php5 { package { "php5-cli": - ensure => present, - } - - package { "php5-apc": - ensure => present, - require => Package["libapache2-mod-php5"] + ensure => latest, } package { "php5-xdebug": - ensure => present, - require => Package["libapache2-mod-php5"] + ensure => latest, + require => Package["libapache2-mod-php5"], + notify => Service["apache2"] } package { "php5-intl": - ensure => present, + ensure => latest, require => Package["libapache2-mod-php5"] } + package { "php5-suhosin": + ensure => purged, + notify => Service["apache2"] + } + package { "php5-sqlite": - ensure => present, + ensure => latest, require => Package["libapache2-mod-php5"] } @@ -105,6 +94,58 @@ } } +class php54dotdeb { + file { "dotdeb.list": + path => "/etc/apt/sources.list.d/dotdeb.list", + ensure => file, + owner => "root", + group => "root", + content => "deb http://ftp.ch.debian.org/debian squeeze main contrib non-free\ndeb http://packages.dotdeb.org squeeze all\ndeb-src http://packages.dotdeb.org squeeze all\ndeb http://packages.dotdeb.org squeeze-php54 all\ndeb-src http://packages.dotdeb.org squeeze-php54 all", + notify => Exec["dotDebKeys"], + } + +#there's a conflict when you upgrade from 5.3 to 5.4 in xdebug.ini. + file { "xdebug.ini": + path => "//etc/php5/conf.d/20-xdebug.ini", + ensure => "link", + target => "/usr/share/php5/xdebug/xdebug.ini", + } + + exec { "dotDebKeys": + command => "wget -q -O - http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -", + path => ["/bin", "/usr/bin"], + notify => Exec["aptGetUpdate"], + unless => "apt-key list | grep dotdeb" + } + + package { "php5-apc": + ensure => latest, + require => Package["libapache2-mod-php5"], + notify => Service["apache2"], + } + + package { "phpapi-20090626": + ensure => purged, + } + + package { "php-apc": + ensure => purged, + } +} + +class php53debian { + package { "php-apc": + ensure => latest, + require => Package["libapache2-mod-php5"] + } + + file { "dotdeb.list": + path => "/etc/apt/sources.list.d/dotdeb.list", + ensure => absent, + notify => Exec["aptGetUpdate"], + } +} + class symfony { exec { "vendorsInstall": @@ -136,7 +177,7 @@ class otherstuff { package { "git": - ensure => present, + ensure => latest, } package { "curl": ensure => present, @@ -149,9 +190,11 @@ include apt_update +include php5 +include php54dotdeb +#include php53debian include otherstuff include apache -include php54 include groups include composer include symfony From 1ef895c9ee2e9b7e516f68b17fe0accaadf68a2e Mon Sep 17 00:00:00 2001 From: Alexander Deruwe Date: Tue, 11 Sep 2012 11:41:57 +0200 Subject: [PATCH 13/25] Simple Windows detection, for NFS setting --- Vagrantfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 728ff6bde1..da5b6451c9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,13 +4,18 @@ # -*- mode: ruby -*- # vi: set ft=ruby : +def Kernel.is_windows + processor, platform, *rest = RUBY_PLATFORM.split("-") + platform == "mingw32" +end + Vagrant::Config.run do |config| config.vm.define :main do |main_config| main_config.vm.box = "liip-squeeze64" main_config.vm.box_url = "http://vagrantbox.liip.ch/liip-squeeze64.box" main_config.vm.network :hostonly, "192.168.22.22" main_config.vm.forward_port 3306, 13306 - main_config.vm.share_folder "v-root", "/vagrant", ".", :nfs => true + main_config.vm.share_folder "v-root", "/vagrant", ".", :nfs => !Kernel.is_windows main_config.vm.provision :puppet, :module_path => "vagrant/puppet/modules" do |puppet| puppet.manifests_path = "vagrant/puppet/manifests" puppet.manifest_file = "main.pp" From 91293c82bc01a46492fcfb1ac7a9035680989c65 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Tue, 11 Sep 2012 17:22:45 +0200 Subject: [PATCH 14/25] do apt-get upgrade before install of php-cli --- vagrant/puppet/manifests/main.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 153c876c5e..0c27a2b2a2 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -63,6 +63,7 @@ package { "php5-cli": ensure => latest, + require => Exec["aptGetUpdate"], } package { "php5-xdebug": From 85edbe6a97136434d51e283d046a095d8ba89fd3 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Tue, 11 Sep 2012 16:47:02 +0200 Subject: [PATCH 15/25] don't forward mysql port --- Vagrantfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 728ff6bde1..9dc08dbe0c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,7 +9,6 @@ Vagrant::Config.run do |config| main_config.vm.box = "liip-squeeze64" main_config.vm.box_url = "http://vagrantbox.liip.ch/liip-squeeze64.box" main_config.vm.network :hostonly, "192.168.22.22" - main_config.vm.forward_port 3306, 13306 main_config.vm.share_folder "v-root", "/vagrant", ".", :nfs => true main_config.vm.provision :puppet, :module_path => "vagrant/puppet/modules" do |puppet| puppet.manifests_path = "vagrant/puppet/manifests" From 24c0c56859862aa5f44edda41f6c2ed687c7ead7 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Tue, 11 Sep 2012 17:31:54 +0200 Subject: [PATCH 16/25] try something else with that xdebug.ini --- vagrant/puppet/manifests/main.pp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 0c27a2b2a2..1c206f492f 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -102,14 +102,18 @@ owner => "root", group => "root", content => "deb http://ftp.ch.debian.org/debian squeeze main contrib non-free\ndeb http://packages.dotdeb.org squeeze all\ndeb-src http://packages.dotdeb.org squeeze all\ndeb http://packages.dotdeb.org squeeze-php54 all\ndeb-src http://packages.dotdeb.org squeeze-php54 all", - notify => Exec["dotDebKeys"], + notify => Exec["dotDebKeys"] } #there's a conflict when you upgrade from 5.3 to 5.4 in xdebug.ini. - file { "xdebug.ini": - path => "//etc/php5/conf.d/20-xdebug.ini", - ensure => "link", - target => "/usr/share/php5/xdebug/xdebug.ini", +# you don't need this, if you directly install 5.4 + file { "xdebug.ini": + path => "/etc/php5/mods-available/xdebug.ini", + ensure => file, + owner => "root", + group => "root", + source => "/usr/share/php5/xdebug/xdebug.ini", + require => Package['php5-xdebug'] } exec { "dotDebKeys": From af851504a1c30d89beffc7bef475c63f5319cc35 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 12 Sep 2012 13:49:40 +0200 Subject: [PATCH 17/25] add a comment about PHP 5.4 --- vagrant/puppet/manifests/main.pp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 1c206f492f..61d8898332 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -196,8 +196,12 @@ include apt_update include php5 -include php54dotdeb -#include php53debian +# If you want PHP 5.4 uncomment the following line, and comment out the php53debian line +# then run "vagrant provision" and you should have php 5.4 + +#include php54dotdeb +include php53debian + include otherstuff include apache include groups From a68f6463ee37b65a8df54b8404bdcc90951464b9 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 12 Sep 2012 14:00:02 +0200 Subject: [PATCH 18/25] Added php5-xhprof --- vagrant/puppet/manifests/main.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 61d8898332..eeb4379e4c 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -82,6 +82,11 @@ notify => Service["apache2"] } + package { "php5-xhprof": + ensure => latest, + require => Package["libapache2-mod-php5"] + } + package { "php5-sqlite": ensure => latest, require => Package["libapache2-mod-php5"] From ff07d112f51394799daa1c63c6d335c9756b3070 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 12 Sep 2012 14:12:52 +0200 Subject: [PATCH 19/25] xhprof is only available with PHP 5.4 --- vagrant/puppet/manifests/main.pp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index eeb4379e4c..ee8c7e5f4d 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -82,11 +82,6 @@ notify => Service["apache2"] } - package { "php5-xhprof": - ensure => latest, - require => Package["libapache2-mod-php5"] - } - package { "php5-sqlite": ensure => latest, require => Package["libapache2-mod-php5"] @@ -128,7 +123,7 @@ unless => "apt-key list | grep dotdeb" } - package { "php5-apc": + package { ["php5-apc", "php5-xhprof"]: ensure => latest, require => Package["libapache2-mod-php5"], notify => Service["apache2"], From 9e3279dfde8fdedd58b0a4772ced27885e20cd66 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 12 Sep 2012 14:21:57 +0200 Subject: [PATCH 20/25] remove mod_actions. not really needed in this setup --- vagrant/puppet/manifests/main.pp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index ee8c7e5f4d..d357d813b0 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -20,7 +20,7 @@ service { "apache2": ensure => running, require => Package["apache2-mpm-prefork"], - subscribe => File["main-vhost.conf", "httpd.conf", "mod_rewrite", "mod_actions"] + subscribe => File["main-vhost.conf", "httpd.conf", "mod_rewrite"] } file { "main-vhost.conf": @@ -43,20 +43,6 @@ target => "/etc/apache2/mods-available/rewrite.load", require => Package["apache2-mpm-prefork"] } - - file { "mod_actions": - path => "/etc/apache2/mods-enabled/actions.load", - ensure => "link", - target => "/etc/apache2/mods-available/actions.load", - require => Package["apache2-mpm-prefork"] - } - - file { "mod_actions_conf": - path => "/etc/apache2/mods-enabled/actions.conf", - ensure => "link", - target => "/etc/apache2/mods-available/actions.conf", - require => Package["apache2-mpm-prefork"] - } } class php5 { From 6741ed11552b669fb51c45239e66168155672a51 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 12 Sep 2012 14:26:31 +0200 Subject: [PATCH 21/25] clean up the manifest --- vagrant/puppet/manifests/main.pp | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index d357d813b0..8ba566cffb 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -1,13 +1,13 @@ class apt_update { exec { "aptGetUpdate": - command => "sudo apt-get update", + command => "apt-get update", path => ["/bin", "/usr/bin"] } } class apache { package { "apache2-mpm-prefork": - ensure => present, + ensure => latest, require => Exec["aptGetUpdate"] } @@ -52,27 +52,17 @@ require => Exec["aptGetUpdate"], } - package { "php5-xdebug": + package { ["php5-xdebug", "php5-intl", "php5-sqlite"]: ensure => latest, require => Package["libapache2-mod-php5"], notify => Service["apache2"] } - package { "php5-intl": - ensure => latest, - require => Package["libapache2-mod-php5"] - } - package { "php5-suhosin": ensure => purged, notify => Service["apache2"] } - package { "php5-sqlite": - ensure => latest, - require => Package["libapache2-mod-php5"] - } - file { "php-timezone.ini": path => "/etc/php5/cli/conf.d/30-timezone.ini", ensure => file, @@ -115,13 +105,10 @@ notify => Service["apache2"], } - package { "phpapi-20090626": + package { ["phpapi-20090626", "php-apc"]: ensure => purged, } - package { "php-apc": - ensure => purged, - } } class php53debian { @@ -167,14 +154,10 @@ } class otherstuff { - package { "git": + package { ["git", "curl", "nfs-common"]: ensure => latest, } - package { "curl": - ensure => present, } - package {"nfs-common": - ensure => present, } } From 5ea7e5e8bde7d7d64f034c9ea64ab32f7b42824f Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 12 Sep 2012 14:26:40 +0200 Subject: [PATCH 22/25] Added mysql (optional) --- vagrant/puppet/manifests/main.pp | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 8ba566cffb..00e8f7da6f 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -157,7 +157,36 @@ package { ["git", "curl", "nfs-common"]: ensure => latest, } +} + +class mysql { + service { "mysql": + ensure => running, + require => Package["mysql-server"], + } + + mysqldb { "symfony": + user => "symfony", + password => "Shub9aiJ" + } + + package { ["mysql-client", "mysql-server"]: + ensure => latest, } + + package { ["php5-mysql"]: + ensure => latest, + require => Package["libapache2-mod-php5", "mysql-client"], + notify => Service["apache2"], + } + +} + +define mysqldb( $user, $password ) { + exec { "create-${name}-db": + unless => "/usr/bin/mysql -u${user} -p${password} ${name}", + command => "/usr/bin/mysql -uroot -p$mysql_password -e \"CREATE DATABASE ${name}; GRANT ALL ON ${name}.* TO ${user}@localhost IDENTIFIED BY '$password'; GRANT ALL ON ${name}.* TO ${user}@'%' IDENTIFIED BY '$password'; GRANT ALL ON ${name}.* TO root@'%'; FLUSH PRIVILEGES;\"", + require => Service["mysql"], } } @@ -176,3 +205,7 @@ include groups include composer include symfony + +# If you want the mysql package and server, uncomment the following line +# then run "vagrant provision" +#include mysql From 905dba8e3d8f77bcfe27f7eef1d1ab3f91287f21 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 12 Sep 2012 14:37:25 +0200 Subject: [PATCH 23/25] put the includes on top to make them more visible and update the README.vagrant --- README.vagrant.md | 20 ++++++++++++++++ vagrant/puppet/manifests/main.pp | 40 +++++++++++++++++--------------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/README.vagrant.md b/README.vagrant.md index d4ba38bdc7..709bdd27b0 100644 --- a/README.vagrant.md +++ b/README.vagrant.md @@ -14,3 +14,23 @@ From http://vagrantup.com/ ## watch site go to http://192.168.22.22/app_dev.php and start playing. + +## PHP 5.4 + +If you want PHP 5.4, open the file `vagrant/puppet/manifests/main.pp` and uncomment the line +`include php54dotdeb` and comment out `include php53debian` so that it looks like this + +```` +include php54dotdeb +#include php53debian +```` + +## Mysql + +If you want to use Mysql, open the file `vagrant/puppet/manifests/main.pp` and uncomment the line +`include mysql` so that it looks like this + +```` +include mysql +```` + diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index 00e8f7da6f..bd46e03a2a 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -1,3 +1,24 @@ +include apt_update +include php5 + +# If you want PHP 5.4 uncomment the following line, and comment out the php53debian line +# then run "vagrant provision" and you should have php 5.4 + +#include php54dotdeb +include php53debian + +include otherstuff +include apache +include groups +include composer +include symfony + +# If you want the mysql package and server, uncomment the following line +# then run "vagrant provision" + +#include mysql + + class apt_update { exec { "aptGetUpdate": command => "apt-get update", @@ -190,22 +211,3 @@ } } - - -include apt_update -include php5 -# If you want PHP 5.4 uncomment the following line, and comment out the php53debian line -# then run "vagrant provision" and you should have php 5.4 - -#include php54dotdeb -include php53debian - -include otherstuff -include apache -include groups -include composer -include symfony - -# If you want the mysql package and server, uncomment the following line -# then run "vagrant provision" -#include mysql From 52f58f6af5e2dae6666267e297f9ab2f5dc522de Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Wed, 12 Sep 2012 14:57:22 +0200 Subject: [PATCH 24/25] add the mysql credentials to the readme --- README.vagrant.md | 2 ++ vagrant/puppet/manifests/main.pp | 1 + 2 files changed, 3 insertions(+) diff --git a/README.vagrant.md b/README.vagrant.md index 709bdd27b0..c99de223e2 100644 --- a/README.vagrant.md +++ b/README.vagrant.md @@ -34,3 +34,5 @@ If you want to use Mysql, open the file `vagrant/puppet/manifests/main.pp` and u include mysql ```` +The database is named `symfony`, the user is `symfony` and the password `Shub9aiJ` + diff --git a/vagrant/puppet/manifests/main.pp b/vagrant/puppet/manifests/main.pp index bd46e03a2a..ca015b7c60 100644 --- a/vagrant/puppet/manifests/main.pp +++ b/vagrant/puppet/manifests/main.pp @@ -15,6 +15,7 @@ # If you want the mysql package and server, uncomment the following line # then run "vagrant provision" +# The database is named `symfony`, the user is `symfony` and the password `Shub9aiJ` #include mysql From bc95c76f703a1405689e41339f55820b41a35467 Mon Sep 17 00:00:00 2001 From: Bastian Widmer Date: Wed, 27 Mar 2013 13:02:42 +0100 Subject: [PATCH 25/25] Fixing Vagrantbox Path --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index e05e71aa4c..5827aa4998 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,7 +12,7 @@ end Vagrant::Config.run do |config| config.vm.define :main do |main_config| main_config.vm.box = "liip-squeeze64" - main_config.vm.box_url = "http://vagrantbox.liip.ch/liip-squeeze64.box" + main_config.vm.box_url = "http://vagrantbox-public.liip.ch/liip-squeeze64.box" main_config.vm.network :hostonly, "192.168.22.22" main_config.vm.share_folder "v-root", "/vagrant", ".", :nfs => !Kernel.is_windows main_config.vm.provision :puppet, :module_path => "vagrant/puppet/modules" do |puppet|