From: Grant Slater Date: Mon, 10 Feb 2014 21:34:36 +0000 (+0000) Subject: Add basic forum/fluxbb cookbook X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/7cd3afb93c1d0faa260130d3322a7d98e3b6cf01 Add basic forum/fluxbb cookbook --- diff --git a/cookbooks/forum/recipes/default.rb b/cookbooks/forum/recipes/default.rb index 58daae422..be229e75b 100644 --- a/cookbooks/forum/recipes/default.rb +++ b/cookbooks/forum/recipes/default.rb @@ -16,7 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -include_recipe "apache" +include_recipe "apache:ssl" +include_recipe "git" +include_recipe "mysql" + +passwords = data_bag_item("forum", "passwords") package "php5" package "php5-cli" @@ -24,3 +28,53 @@ package "php-apc" apache_module "php5" +apache_site "default" do + action [ :disable ] +end + +apache_site "forum.openstreetmap.org" do + template "apache.erb" +end + +directory "/srv/forum.openstreetmap.org" do + owner "forum" + group "forum" + mode 0755 +end + +git "/srv/forum.openstreetmap.org/html/" do + action :sync + repository "http://github.com/fluxbb/fluxbb.git" + revision "refs/tags/fluxbb-1.5.6" + depth 1 + user "forum" + group "forum" +end + +directory "/srv/forum.openstreetmap.org/html/cache/" do + owner "www-data" + group "www-data" + mode 0755 +end + +directory "/srv/forum.openstreetmap.org/html/img/avatars/" do + owner "www-data" + group "www-data" + mode 0755 +end + +mysql_user "forum@localhost" do + password passwords["database"] +end + +mysql_database "forum" do + permissions "forum@localhost" => :all +end + +template "/etc/cron.daily/forum-backup" do + source "backup.cron.erb" + owner "root" + group "root" + mode 0750 + variables :passwords => passwords +end diff --git a/cookbooks/forum/templates/default/apache.erb b/cookbooks/forum/templates/default/apache.erb new file mode 100644 index 000000000..0eea9db34 --- /dev/null +++ b/cookbooks/forum/templates/default/apache.erb @@ -0,0 +1,28 @@ +# DO NOT EDIT - This file is being maintained by Chef + + + ServerName forum.openstreetmap.org + ServerAlias forum.osm.org + ServerAdmin webmaster@openstreetmap.org + + CustomLog /var/log/apache2/forum.openstreetmap.org-access.log combined + ErrorLog /var/log/apache2/forum.openstreetmap.org-error.log + + DocumentRoot /srv/forum.openstreetmap.org/html/ + + + + ServerName forum.openstreetmap.org + ServerAdmin webmaster@openstreetmap.org + + SSLEngine on + SSLProtocol all -SSLv2 + SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW + SSLCertificateFile /etc/ssl/certs/openstreetmap.pem + SSLCertificateKeyFile /etc/ssl/private/openstreetmap.key + + CustomLog /var/log/apache2/forum.openstreetmap.org-access.log combined + ErrorLog /var/log/apache2/forum.openstreetmap.org-error.log + + DocumentRoot /srv/forum.openstreetmap.org + diff --git a/cookbooks/forum/templates/default/backup.cron.erb b/cookbooks/forum/templates/default/backup.cron.erb new file mode 100644 index 000000000..31fd20563 --- /dev/null +++ b/cookbooks/forum/templates/default/backup.cron.erb @@ -0,0 +1,20 @@ +#!/bin/sh +exit 0 + +# DO NOT EDIT - This file is being maintained by Chef + +T=$(mktemp -d -t -p /var/tmp forum.XXXXXXXXXX) +D=$(date +%Y-%m-%d) +B=forum-$D.tar.gz + +mkdir $T/forum-$D +mysqldump --user=forum --password=<%= @passwords["database"] %> --opt forum > $T/forum-$D/forum.sql +ln -s /srv/forum.openstreetmap.org $T/forum-$D/www + +export GZIP="--rsyncable -9" +export RSYNC_RSH="ssh -ax -c arcfour" + +nice tar --create --gzip --dereference --directory=$T --file=$T/$B forum-$D +nice rsync $T/$B backup::backup + +rm -rf $T diff --git a/roles/forum.rb b/roles/forum.rb index 83abe0d88..701c993ba 100644 --- a/roles/forum.rb +++ b/roles/forum.rb @@ -4,7 +4,13 @@ description "Role applied to all forum servers" default_attributes( :accounts => { :users => { - :lambertus => { :status => :administrator } + :lambertus => { + :status => :administrator + }, + :forum => { + :status => :role, + :members => [ :lambertus, :grant ] + } } }, :apache => {