5 # Copyright:: 2014, OpenStreetMap Foundation
 
   7 # Licensed under the Apache License, Version 2.0 (the "License");
 
   8 # you may not use this file except in compliance with the License.
 
   9 # You may obtain a copy of the License at
 
  11 #     https://www.apache.org/licenses/LICENSE-2.0
 
  13 # Unless required by applicable law or agreed to in writing, software
 
  14 # distributed under the License is distributed on an "AS IS" BASIS,
 
  15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16 # See the License for the specific language governing permissions and
 
  17 # limitations under the License.
 
  20 include_recipe "accounts"
 
  21 include_recipe "apache"
 
  23 include_recipe "mysql"
 
  24 include_recipe "php::fpm"
 
  26 cache_dir = Chef::Config[:file_cache_path]
 
  28 passwords = data_bag_item("forum", "passwords")
 
  38 apache_module "rewrite"
 
  40 ssl_certificate "forum.openstreetmap.org" do
 
  41   domains ["forum.openstreetmap.org", "forum.osm.org"]
 
  42   notifies :reload, "service[apache2]"
 
  45 php_fpm "forum.openstreetmap.org" do
 
  46   php_admin_values "open_basedir" => "/srv/forum.openstreetmap.org/html/:/usr/share/php/:/tmp/",
 
  47                    "disable_functions" => "exec,shell_exec,system,passthru,popen,proc_open"
 
  51 apache_site "forum.openstreetmap.org" do
 
  55 directory "/srv/forum.openstreetmap.org" do
 
  61 git "/srv/forum.openstreetmap.org/html/" do
 
  63   repository "http://github.com/openstreetmap/openstreetmap-forum.git"
 
  64   revision "openstreetmap-1.5.10"
 
  68   notifies :reload, "service[apache2]"
 
  71 remote_file "#{cache_dir}/air3_v0.8.tar.gz" do
 
  72   action :create_if_missing
 
  73   source "https://github.com/natrius/air3/archive/refs/tags/v0.8.tar.gz"
 
  80 archive_file "#{cache_dir}/air3_v0.8.tar.gz" do
 
  82   destination "/srv/forum.openstreetmap.org/html/style"
 
  87   subscribes :extract, "remote_file[#{cache_dir}/air3_v0.8.tar.gz]", :immediately
 
  90 directory "/srv/forum.openstreetmap.org/html/cache/" do
 
  96 directory "/srv/forum.openstreetmap.org/html/img/avatars/" do
 
 102 template "/srv/forum.openstreetmap.org/html/config.php" do
 
 103   source "config.php.erb"
 
 107   variables :passwords => passwords
 
 110 mysql_user "forum@localhost" do
 
 111   password passwords["database"]
 
 114 mysql_database "forum" do
 
 115   permissions "forum@localhost" => :all
 
 118 template "/etc/cron.daily/forum-backup" do
 
 119   source "backup.cron.erb"
 
 123   variables :passwords => passwords