]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/dev/recipes/default.rb
Fix typo in prometheus readme
[chef.git] / cookbooks / dev / recipes / default.rb
index 7fd25945c49c44c388e2dfdad91124f317c73024..ed190970d91ebee15bce62781364bf32bf794037 100644 (file)
@@ -94,7 +94,10 @@ end
 package "apache2-suexec-pristine"
 
 php_fpm "default" do
-  template "fpm-default.conf.erb"
+  pm_max_children 10
+  pm_start_servers 4
+  pm_min_spare_servers 2
+  pm_max_spare_servers 6
 end
 
 php_fpm "www" do
@@ -155,11 +158,27 @@ search(:accounts, "*:*").each do |account|
 
   next unless File.directory?("#{user_home}/public_html")
 
-  port = 7000 + account["uid"].to_i
-
   php_fpm name do
-    template "fpm.conf.erb"
-    variables :user => name, :port => port
+    user name
+    group name
+    pm_max_children 10
+    pm_start_servers 4
+    pm_min_spare_servers 2
+    pm_max_spare_servers 6
+    pm_max_requests 10000
+    request_terminate_timeout 1800
+    environment "HOSTNAME" => "$HOSTNAME",
+                "PATH" => "/usr/local/bin:/usr/bin:/bin",
+                "TMP" => "/tmp",
+                "TMPDIR" => "/tmp",
+                "TEMP" => "/tmp"
+    php_values "max_execution_time" => "300",
+               "memory_limit" => "128M",
+               "post_max_size" => "32M",
+               "upload_max_filesize" => "32M"
+    php_admin_values "sendmail_path" => "/usr/sbin/sendmail -t -i -f #{name}@errol.openstreetmap.org",
+                     "open_basedir" => "/home/#{name}/:/tmp/:/usr/share/php/"
+    php_flags "display_errors" => "on"
   end
 
   ssl_certificate "#{name}.dev.openstreetmap.org" do
@@ -170,7 +189,7 @@ search(:accounts, "*:*").each do |account|
   apache_site "#{name}.dev.openstreetmap.org" do
     template "apache.user.erb"
     directory "#{user_home}/public_html"
-    variables :user => name, :port => port
+    variables :user => name
   end
 
   template "/etc/sudoers.d/#{name}" do
@@ -239,9 +258,7 @@ if node[:postgresql][:clusters][:"12/main"]
 
     if details[:repository]
       site_aliases = details[:aliases] || []
-      secret_key_base = details[:secret_key_base] || SecureRandom.base64(96)
-
-      node.normal[:dev][:rails][name][:secret_key_base] = secret_key_base
+      secret_key_base = persistent_token("dev", "rails", name, "secret_key_base")
 
       postgresql_database database_name do
         cluster "12/main"
@@ -428,8 +445,6 @@ if node[:postgresql][:clusters][:"12/main"]
         action :drop
         cluster "12/main"
       end
-
-      node.normal[:dev][:rails].delete(name)
     end
   end
 
@@ -476,7 +491,7 @@ remote_directory "/srv/ooc.openstreetmap.org/html" do
   mode "755"
   files_owner "root"
   files_group "root"
-  files_mode 0o644
+  files_mode "644"
 end
 
 ssl_certificate "ooc.openstreetmap.org" do