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 apache_conf "php#{node[:php][:version]}-fpm" do
44 ssl_certificate "forum.openstreetmap.org" do
45 domains ["forum.openstreetmap.org", "forum.osm.org"]
46 notifies :reload, "service[apache2]"
49 apache_site "forum.openstreetmap.org" do
53 directory "/srv/forum.openstreetmap.org" do
59 git "/srv/forum.openstreetmap.org/html/" do
61 repository "http://github.com/openstreetmap/openstreetmap-forum.git"
62 revision "openstreetmap-1.5.10"
66 notifies :reload, "service[apache2]"
69 remote_file "#{cache_dir}/air3_v0.8.zip" do
70 action :create_if_missing
71 source "https://grant.dev.openstreetmap.org/forum/air3_v0.8.zip" # Workaround OpenSSL chain of trust bug in chef https://fluxbb.org/resources/styles/air3/releases/0.8/air3_v0.8.zip
72 checksum "df547e3ac9596c1e6d9eedcb108559f84a28669763e24114ca6cdcbf118caf6c"
79 execute "#{cache_dir}/air3_v0.8.zip" do
81 command "unzip -o -qq #{cache_dir}/air3_v0.8.zip Air3.css 'Air3/*'"
82 cwd "/srv/forum.openstreetmap.org/html/style"
85 subscribes :run, "remote_file[#{cache_dir}/air3_v0.8.zip]", :immediately
88 directory "/srv/forum.openstreetmap.org/html/cache/" do
94 directory "/srv/forum.openstreetmap.org/html/img/avatars/" do
100 template "/srv/forum.openstreetmap.org/html/config.php" do
101 source "config.php.erb"
105 variables :passwords => passwords
108 mysql_user "forum@localhost" do
109 password passwords["database"]
112 mysql_database "forum" do
113 permissions "forum@localhost" => :all
116 template "/etc/cron.daily/forum-backup" do
117 source "backup.cron.erb"
121 variables :passwords => passwords