]> git.openstreetmap.org Git - chef.git/blob - cookbooks/dmca/recipes/default.rb
Merge remote-tracking branch 'tigerfell/pr257'
[chef.git] / cookbooks / dmca / recipes / default.rb
1 #
2 # Cookbook:: dmca
3 # Recipe:: default
4 #
5 # Copyright:: 2018, OpenStreetMap Foundation
6 #
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
10 #
11 #     https://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19
20 include_recipe "apache"
21 include_recipe "php::fpm"
22
23 apache_module "proxy"
24 apache_module "proxy_fcgi"
25
26 package "composer"
27
28 git "/srv/dmca.openstreetmap.org" do
29   action :sync
30   repository "https://github.com/openstreetmap/dmca-website.git"
31   revision "main"
32   depth 1
33   notifies :run, "execute[/srv/dmca.openstreetmap.org/composer.json]", :immediately
34 end
35
36 execute "/srv/dmca.openstreetmap.org/composer.json" do
37   action :nothing
38   command "composer install --no-dev"
39   cwd "/srv/dmca.openstreetmap.org/"
40   environment "COMPOSER_HOME" => "/srv/dmca.openstreetmap.org/"
41 end
42
43 ssl_certificate "dmca.openstreetmap.org" do
44   domains ["dmca.openstreetmap.org", "dmca.osm.org"]
45   notifies :reload, "service[apache2]"
46 end
47
48 php_fpm "dmca.openstreetmap.org" do
49   php_admin_values "open_basedir" => "/srv/dmca.openstreetmap.org/:/usr/share/php/:/tmp/",
50                    "disable_functions" => "exec,shell_exec,system,passthru,popen,proc_open"
51   prometheus_port 11201
52 end
53
54 apache_site "dmca.openstreetmap.org" do
55   template "apache.erb"
56   directory "/srv/dmca.openstreetmap.org"
57   variables :aliases => ["dmca.osm.org"]
58 end