]> git.openstreetmap.org Git - chef.git/commitdiff
Setup apache for the GPS tile server
authorTom Hughes <tom@compton.nu>
Wed, 16 Oct 2013 18:20:16 +0000 (19:20 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 16 Oct 2013 18:21:46 +0000 (19:21 +0100)
cookbooks/gps-tile/files/default/html/clientaccesspolicy.xml [new file with mode: 0644]
cookbooks/gps-tile/files/default/html/crossdomain.xml [new file with mode: 0644]
cookbooks/gps-tile/files/default/html/robots.txt [new file with mode: 0644]
cookbooks/gps-tile/recipes/default.rb
cookbooks/gps-tile/templates/default/apache.erb [new file with mode: 0644]
cookbooks/gps-tile/templates/default/update.init.erb [new file with mode: 0644]

diff --git a/cookbooks/gps-tile/files/default/html/clientaccesspolicy.xml b/cookbooks/gps-tile/files/default/html/clientaccesspolicy.xml
new file mode 100644 (file)
index 0000000..d60ec1d
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<access-policy>
+  <cross-domain-access>
+    <policy>
+      <allow-from http-request-headers="*">
+        <domain uri="*"/>
+      </allow-from>
+      <grant-to>
+        <resource path="/" include-subpaths="true"/>
+      </grant-to>
+    </policy>
+  </cross-domain-access>
+</access-policy>
diff --git a/cookbooks/gps-tile/files/default/html/crossdomain.xml b/cookbooks/gps-tile/files/default/html/crossdomain.xml
new file mode 100644 (file)
index 0000000..f90443e
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
+<cross-domain-policy>
+    <allow-access-from domain="*" />
+</cross-domain-policy>
+       
diff --git a/cookbooks/gps-tile/files/default/html/robots.txt b/cookbooks/gps-tile/files/default/html/robots.txt
new file mode 100644 (file)
index 0000000..1f53798
--- /dev/null
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /
index c0779f076f019ec4463fa657114c5a544066e21d..51f0fd41196c584e3b90f5fecf32421288b4e192 100644 (file)
@@ -44,7 +44,7 @@ git "/srv/gps-tile.openstreetmap.org/import" do
   group "gpstile"
 end
 
   group "gpstile"
 end
 
-execute "import-make" do
+execute "/srv/gps-tile.openstreetmap.org/import/src/Makefile" do
   action :nothing
   command "make"
   cwd "/srv/gps-tile.openstreetmap.org/import/src"
   action :nothing
   command "make"
   cwd "/srv/gps-tile.openstreetmap.org/import/src"
@@ -61,7 +61,7 @@ git "/srv/gps-tile.openstreetmap.org/datamaps" do
   group "gpstile"
 end
 
   group "gpstile"
 end
 
-execute "datamaps-make" do
+execute "/srv/gps-tile.openstreetmap.org/datamaps/Makefile" do
   action :nothing
   command "make"
   cwd "/srv/gps-tile.openstreetmap.org/datamaps"
   action :nothing
   command "make"
   cwd "/srv/gps-tile.openstreetmap.org/datamaps"
@@ -78,8 +78,29 @@ git "/srv/gps-tile.openstreetmap.org/updater" do
   group "gpstile"
 end
 
   group "gpstile"
 end
 
-directory "/srv/gps-tile.openstreetmap.org/html" do
+template "/etc/init.d/gps-update" do
+  source "update.init.erb"
+  owner "root"
+  group "root"
+  mode 0755
+end
+
+#service "gps-update" do
+#  action [ :enable, :start ]
+#  supports :restart => true
+#  subscribes :restart, "git[/srv/gps-tile.openstreetmap.org/updater]"
+#end
+
+remote_directory "/srv/gps-tile.openstreetmap.org/html" do
+  source "html"
   owner "gpstile"
   group "gpstile"
   mode 0755
   owner "gpstile"
   group "gpstile"
   mode 0755
+  files_owner "gpstile"
+  files_group "gpstile"
+  mode 0644
+end
+
+apache_site "gps-tile.openstreetmap.org" do
+  template "apache.erb"
 end
 end
diff --git a/cookbooks/gps-tile/templates/default/apache.erb b/cookbooks/gps-tile/templates/default/apache.erb
new file mode 100644 (file)
index 0000000..7572327
--- /dev/null
@@ -0,0 +1,34 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+<VirtualHost *:80>
+  # Basic server configuration
+  ServerName <%= node[:fqdn] %>
+  ServerAlias gps-tile.openstreetmap.org
+  ServerAlias *.gps-tile.openstreetmap.org
+  ServerAdmin webmaster@openstreetmap.org
+
+  # Configure location of static files
+  DocumentRoot /srv/gps-tile.openstreetmap.org/html
+
+  # Configure the CGI script that serves the tiles
+  ScriptAlias /lines /srv/gps-tile.openstreetmap.org/updater/tile
+
+  # Temporary redirect for old CGI location
+  RedirectPermanent /gps-lines/tile /lines
+
+  # Setup logging
+  CustomLog /var/log/apache2/access.log combined
+  ErrorLog /var/log/apache2/error.log
+  BufferedLogs on
+
+  # Always set Access-Control-Allow-Origin so that simple CORS requests
+  # will always work and can be cached
+  Header set Access-Control-Allow-Origin "*"
+</VirtualHost>
+
+<Directory /srv/gps-tile.openstreetmap.org/html>
+  Options None
+  AllowOverride None
+  Order allow,deny
+  Allow from all
+</Directory>
diff --git a/cookbooks/gps-tile/templates/default/update.init.erb b/cookbooks/gps-tile/templates/default/update.init.erb
new file mode 100644 (file)
index 0000000..724ecb1
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+start() {
+  start-stop-daemon --start --chuid gpstile --chdir /srv/gps-tile.openstreetmap.org --background --make-pidfile --pidfile /var/run/gps-update.pid --exec /src/gps-tile.openstreetmap.org/updater/update
+}
+
+stop() {
+  start-stop-daemon --stop --retry 300 --pidfile /var/run/gps-update.pid
+}
+
+case "$1" in
+  start)
+    start
+    ;;
+  stop)
+    stop
+    ;;
+  restart)
+    stop || exit $?
+    start
+    ;;
+esac