From 1ad3f8f645dc1486eac234e3bf8d0bb0c87f53f6 Mon Sep 17 00:00:00 2001 From: "Elizabeth K. Joseph" Date: Fri, 16 Jan 2015 10:37:21 -0800 Subject: [PATCH] Initial commit of Zanata-specific sections Running of Zanata requires installation of Zanata war file itself, two modules and a config file. Set Wildfly to be version 8.1.0, the current one tested and confirmed working with Zanata. Co-Authored-By: stephane Change-Id: I1dc8407cf16a7543357691fd6a1d053afda298d5 --- manifests/init.pp | 145 +++++++++ manifests/mysql.pp | 50 +++ manifests/wildfly.pp | 8 +- templates/standalone.xml.erb | 582 +++++++++++++++++++++++++++++++++++ 4 files changed, 782 insertions(+), 3 deletions(-) create mode 100644 manifests/init.pp create mode 100644 manifests/mysql.pp create mode 100644 templates/standalone.xml.erb diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..b6c346e --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,145 @@ +# Copyright 2014 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: zanata +# + +class zanata( + $mysql_host = 'localhost', + $mysql_port = '3306', + $zanata_db_name = 'zanata', + $zanata_db_username = 'zanata', + $zanata_db_password, + + $zanata_wildfly_version = '8.1.0', + $zanata_wildfly_install_url = 'https://download.jboss.org/wildfly/8.1.0.Final/wildfly-8.1.0.Final.tar.gz', + + $zanata_hibernate_url = 'https://sourceforge.net/projects/zanata/files/wildfly/wildfly-8.1.0.Final-module-hibernate-main-4.2.15.Final.zip', + $zanata_mojarra_url = 'https://sourceforge.net/projects/zanata/files/wildfly/wildfly-8.1.0.Final-module-mojarra-2.1.28.zip', + $zanata_url = 'https://sourceforge.net/projects/zanata/files/webapp/zanata-war-3.6.0.war', + + $zanata_default_from_address = '', + $zanata_storage_dir = '/home/wildfly/zanata', + + +) { + + $zanata_file = inline_template('<%= File.basename(@zanata_url) %>') + $zanata_hibernate_file = inline_template('<%= File.basename(@zanata_hibernate_url) %>') + $zanata_mojarra_file = inline_template('<%= File.basename(@zanata_mojarra_url) %>') + + class { 'zanata::wildfly': + wildfly_version => $zanata_wildfly_version, + wildfly_install_source => $zanata_wildfly_install_url, + } + + package { [ + 'libmysql-java', + 'unzip' + ]: + ensure => present, + } + + file { $zanata_storage_dir: + ensure => 'directory', + owner => 'wildfly', + group => 'wildfly' + } + + exec { 'download_zanata': + command => "/usr/bin/wget ${zanata_url}", + cwd => '/home/wildfly', + creates => "/home/wildfly/${zanata_file}", + user => 'wildfly', + timeout => 600, + require => [ + Package['wget'], + ] + } + + file { '/opt/wildfly/standalone/deployments/ROOT.war': + ensure => present, + source => "/home/wildfly/${zanata_file}", + owner => 'wildfly', + require => [ + Exec['download_zanata'], + ] + } + + exec { 'download_hibernate': + command => "/usr/bin/wget ${zanata_hibernate_url}", + cwd => '/home/wildfly', + creates => "/home/wildfly/${zanata_hibernate_file}", + user => 'wildfly', + timeout => 600, + require => [ + Package['wget'], + ] + } + + exec { 'unzip_hibernate': + command => "/usr/bin/unzip -o ${zanata_hibernate_file} -d /opt/wildfly/", + cwd => '/home/wildfly', + user => 'wildfly', + require => [ + Exec['download_hibernate'], + Package['unzip'], + ] + } + + exec { 'download_mojarra': + command => "/usr/bin/wget ${zanata_mojarra_url}", + cwd => '/home/wildfly', + creates => "/home/wildfly/${zanata_mojarra_file}", + user => 'wildfly', + timeout => 600, + require => [ + Package['wget'], + ] + } + + exec { 'unzip_mojarra': + command => "/usr/bin/unzip -o ${zanata_mojarra_file} -d /opt/wildfly/", + cwd => '/home/wildfly', + user => 'wildfly', + require => [ + Exec['download_mojarra'], + Package['unzip'], + ] + } + + file { '/opt/wildfly/standalone/deployments/mysql-connector-java.jar': + ensure => 'link', + target => '/usr/share/java/mysql-connector-java.jar', + require => [ + Package['libmysql-java'], + ], + } + + file { '/opt/wildfly/standalone/configuration/standalone.xml': + ensure => present, + notify => Service['wildfly'], + owner => wildfly, + group => wildfly, + content => template('zanata/standalone.xml.erb'), + require => [ + Class['zanata::wildfly'], + Mysql::Db[$zanata_db_name], + File['/opt/wildfly/standalone/deployments/ROOT.war'], + Exec['unzip_mojarra'], + Exec['unzip_hibernate'], + ], + } + +} diff --git a/manifests/mysql.pp b/manifests/mysql.pp new file mode 100644 index 0000000..2e9102b --- /dev/null +++ b/manifests/mysql.pp @@ -0,0 +1,50 @@ +# Copyright 2014 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: zanata::mysql +# +class zanata::mysql( + $mysql_root_password = '', + $mysql_host = 'localhost', + $mysql_bind_address = '127.0.0.1', + $mysql_port = '3306', + $db_name = 'zanata', + $db_username = 'zanata', + $db_password, + +) { + + class { 'mysql::server': + config_hash => { + 'root_password' => $mysql_root_password, + 'default_engine' => 'InnoDB', + 'bind_address' => $mysql_bind_address, + 'port' => $mysql_port, + } + } + + include mysql::server::account_security + + mysql::db { $db_name: + user => $db_username, + password => $db_password, + host => $mysql_host, + grant => ['all'], + charset => 'utf8', + require => [ + Class['mysql::server'], + Class['mysql::server::account_security'], + ], + } +} diff --git a/manifests/wildfly.pp b/manifests/wildfly.pp index 07f5131..2989b08 100644 --- a/manifests/wildfly.pp +++ b/manifests/wildfly.pp @@ -15,9 +15,8 @@ # == Class: zanata::wildfly # class zanata::wildfly( - $wildfly_version = '8.2.0', - $wildfly_install_source = 'http://download.jboss.org/wildfly/8.2.0.Final/wildfly-8.2.0.Final.tar.gz', - $wildfly_install_file = 'wildfly-8.2.0.Final.tar.gz', + $wildfly_version = '8.1.0', + $wildfly_install_source = 'https://download.jboss.org/wildfly/8.1.0.Final/wildfly-8.1.0.Final.tar.gz', ) { include wildfly @@ -25,10 +24,13 @@ class zanata::wildfly( ensure => present, } + $wildfly_install_file = inline_template('<%= File.basename(@wildfly_install_source) %>') + class { 'wildfly::install': version => $wildfly_version, install_source => $wildfly_install_source, install_file => $wildfly_install_file, + config => 'standalone.xml', java_home => '/usr/lib/jvm/java-7-openjdk-amd64/jre/', require => Package['openjdk-7-jre-headless'], } diff --git a/templates/standalone.xml.erb b/templates/standalone.xml.erb new file mode 100644 index 0000000..a4726e8 --- /dev/null +++ b/templates/standalone.xml.erb @@ -0,0 +1,582 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + jdbc:mysql://<%= @mysql_host %>:<%= @mysql_port %>/zanata?characterEncoding=UTF-8 + com.mysql.jdbc.Driver + mysql-connector-java.jar + + 0 + 20 + FailingConnectionOnly + + + <%= @zanata_db_username %> + <% if @zanata_db_password != '' -%> + <%= @zanata_db_password %> + <% end -%> + + + NOWARN + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + false + NIO + 102400 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jms.queue.DLQ + jms.queue.ExpiryQueue + 5000 + 2 + 10485760 + 2097152 + BLOCK + 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + true + + + + true + + + + + + + + + + + + <% if @zanata_default_from_address != '' -%> + + <% end -%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${jboss.bind.address:127.0.0.1} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +