Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported to Windows #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 59 additions & 26 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
# == Class: pentaho::config


class pentaho::config {

# JOE
if $::osfamily == 'Windows' {
$exec_provider = 'cygwin'
} else {
$exec_provider = 'posix'
}

if $caller_module_name != $module_name {
fail("Use of private class ${name} by ${caller_module_name}")
}

exec { "/bin/mkdir -p ${pentaho::pentaho_solutions_path}" :
# TODO: I added command when I error trialed. JOE
command => "/bin/mkdir -p ${pentaho::pentaho_solutions_path}",
unless => "/usr/bin/stat ${pentaho::pentaho_solutions_path}",
provider => $exec_provider,
} ->
exec { "/bin/cp -r ${pentaho::temp_folder}/biserver-ce/pentaho-solutions ${pentaho::pentaho_solutions_path}" :
unless => "/usr/bin/stat ${pentaho::pentaho_solutions_path}/pentaho-solutions",
# I get this errors for some reason on one Windows server:
# Notice: /Stage[main]/Pentaho::Config/Exec[/bin/cp -r 'c:/Temp/biserver-ce/pentaho-solutions' 'e:/Fast2/pentaho']/returns: /bin/cp: cannot stat ΓÇÿc:/Temp/biserver-ce/pentaho-solutionsΓÇÖ: No such file or directory
exec { "/bin/cp -r '${pentaho::temp_folder}/biserver-ce/pentaho-solutions' '${pentaho::pentaho_solutions_path}'":
unless => "/usr/bin/stat '${pentaho::pentaho_solutions_path}/pentaho-solutions'",
provider => $exec_provider,
}


if !$pentaho::install_samples {
# Remove samples.
file { "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/default-content/samples.zip":
ensure => absent,
subscribe => Exec["/bin/cp -r '${pentaho::temp_folder}/biserver-ce/pentaho-solutions' '${pentaho::pentaho_solutions_path}'"],
}
}

Augeas {
require => Exec["/bin/cp -r ${pentaho::temp_folder}/biserver-ce/pentaho-solutions ${pentaho::pentaho_solutions_path}"],
require => Exec["/bin/cp -r '${pentaho::temp_folder}/biserver-ce/pentaho-solutions' '${pentaho::pentaho_solutions_path}'"],
}
# Specify the hibernate file to use
$hibernate_file = $pentaho::db_type ? {
'mysql' => 'mysql5.hibernate.cfg.xml',
'pgsql' => 'postgresql.hibernate.cfg.xml',
}
augeas { 'config_file' :
lens => 'Xml.lns',
incl => "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/hibernate/hibernate-settings.xml",
changes => [
"set settings/config-file/#text system/hibernate/${hibernate_file}",
],
unless $::osfamily == 'Windows' {
augeas { 'config_file' :
lens => 'Xml.lns',
incl => "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/hibernate/hibernate-settings.xml",
changes => [
"set settings/config-file/#text system/hibernate/${hibernate_file}",
],
}
}

# Specify delegate class
Expand All @@ -34,16 +59,18 @@
'pgsql' => 'org.quartz.impl.jdbcjobstore.PostgreSQLDelegate',
}

augeas { 'quartz_properties' :
lens => 'simplevars.lns',
incl => "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/quartz/quartz.properties",
changes => [
"set org.quartz.jobStore.driverDelegateClass ${delegate_class}",
],
unless $::osfamily == 'Windows' {
augeas { 'quartz_properties' :
lens => 'simplevars.lns',
incl => "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/quartz/quartz.properties",
changes => [
"set org.quartz.jobStore.driverDelegateClass ${delegate_class}",
],
}
}

File {
require => Exec["/bin/cp -r ${pentaho::temp_folder}/biserver-ce/pentaho-solutions ${pentaho::pentaho_solutions_path}"],
require => Exec["/bin/cp -r '${pentaho::temp_folder}/biserver-ce/pentaho-solutions' '${pentaho::pentaho_solutions_path}'"],
}

file { "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/jackrabbit/repository.xml" :
Expand All @@ -59,14 +86,20 @@
content => template('pentaho/log4j/log4j_osgi.xml.erb'),
}

# Fixing incorrect permissions
$directories = ["${pentaho::pentaho_solutions_path}/pentaho-solutions/system/osgi", "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/logs", "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/logs/audit", "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/jackrabbit", $pentaho::log_directory]

file { $directories :
ensure => directory,
owner => $pentaho::applicationserver_user,
group => $pentaho::applicationserver_group,
mode => '0755',
unless $::osfamily == 'Windows' {
# Fixing incorrect permissions
$directories = ["${pentaho::pentaho_solutions_path}/pentaho-solutions/system/osgi", "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/logs", "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/logs/audit", "${pentaho::pentaho_solutions_path}/pentaho-solutions/system/jackrabbit", $pentaho::log_directory]

# For settings advanced Windows permissions you need the acl module. http://stackoverflow.com/questions/25087069/puppet-and-windows-directory-permissions
file { $directories :
ensure => directory,
owner => $pentaho::applicationserver_user,
group => $pentaho::applicationserver_group,
# Group need write support because else the Puppet agent wont be able to create subdirectories. JOE
# mode => '0775',
mode => '0755',

}
}

}
13 changes: 12 additions & 1 deletion manifests/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,21 @@
$db_collate = $pentaho::params::db_collate,
) inherits pentaho::params {

# JOE*
/*
if $::osfamily == 'Windows' {
$mysql_service = Service['MySQL']
} else {
$mysql_service = Class['mysql::server']
}
*/
$mysql_service = Class['mysql::server']

file { "${pentaho::temp_folder}/quartz.sql" :
ensure => file,
source => "puppet:///modules/pentaho/${pentaho::version}/${pentaho::db_type}/create_quartz.sql",
before => Mysql::Db['quartz'],
source_permissions => ignore,
}

case $pentaho::db_type {
Expand All @@ -98,7 +109,7 @@
charset => $db_charset,
collate => $db_collate,
sql => "${pentaho::temp_folder}/quartz.sql",
require => Class['mysql::server'],
require => $mysql_service,
} ->
mysql::db { 'repository' :
user => $hibernate_db_user,
Expand Down
8 changes: 8 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
# (string) The log directory
# Default: /var/log/pentaho
#
# [*install_samples*]
# (boolean) If to install samples reports and mondrian datasources in /public. Controls if samples.zip is copied to default-content.
# Default: true
#
#
# === Examples
#
# include pentaho
Expand Down Expand Up @@ -124,9 +129,12 @@
$jackrabbit_db_password = $pentaho::params::jackrabbit_db_password,
$pentaho_solutions_path = $pentaho::params::pentaho_solutions_path,
$pentaho_source_url = $pentaho::params::pentaho_source_url,
$pentaho_source_checksum = $pentaho::params::pentaho_source_checksum,
$h2driver_source_url = $pentaho::params::h2driver_source_url,
$temp_folder = $pentaho::params::temp_folder,
$log_directory = $pentaho::params::log_directory,
$manage_tomcat_web_xml = $pentaho::params::manage_tomcat_web_xml,
$install_samples = $pentaho::params::install_samples,
) inherits pentaho::params {

include ::stdlib
Expand Down
20 changes: 18 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# == Class: pentaho::params
class pentaho::params {

# JOE
if $::osfamily == 'Windows' {
$default_temp_folder = 'c:/Temp'
} else {
$default_temp_folder = '/var/tmp'
}

$version = '5.1'

# Application Server
$applicationserver_base = '/usr/share/tomcat'
$applicationserver_user = 'tomcat'
Expand Down Expand Up @@ -30,8 +37,14 @@
$country = 'US'
$pentaho_solutions_path = '/opt/pentaho'
$pentaho_source_url = 'http://downloads.sourceforge.net/project/pentaho/Business%20Intelligence%20Server/5.1/biserver-ce-5.1.0.0-752.zip?r=&ts=1410402175&use_mirror=iweb'
$temp_folder = '/var/tmp'
$pentaho_source_checksum = false
$temp_folder = $default_temp_folder
$log_directory = '/var/log/pentaho'

# Tomcat
$manage_tomcat_web_xml = true

$install_samples = true

case $::osfamily {
'RedHat' : {
Expand All @@ -40,6 +53,9 @@
'Debian' : {
$postgresql_jdbc_driver_package = 'libpostgresql-jdbc-java'
}
'Windows' : {
warning('Experimental support for Windows.')
}
default : { fail("The ${::osfamily} operating system is not supported with the pentaho module") }
}

Expand Down
17 changes: 12 additions & 5 deletions manifests/setup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@

if 'mysql' in $pentaho::manage_jdbc_drivers {

package { 'mysql-connector-java' :
ensure => installed,
# Ubuntu fix -JOE
# http://stackoverflow.com/questions/18128966/where-is-the-mysql-jdbc-jar-file-in-ubuntu
case $::osfamily {
'RedHat' : {
package { 'mysql-connector-java': ensure => installed, }
}
'Debian' : {
package { 'libmysql-java' : ensure => installed, }
}
default : { fail("Installation of MySQL JDBC drivert for ${::osfamily} not implemented.") }
}->
file { "${pentaho::applicationserver_base}/lib/mysql-connector-java.jar" :
ensure => 'link',
target => '/usr/share/java/mysql-connector-java.jar',
}

}

if 'pgsql' in $pentaho::manage_jdbc_drivers {
Expand All @@ -40,15 +47,15 @@

}

# Comment away this to improve speed. -JOE
archive { 'pentaho' :
ensure => present,
extension => 'zip',
checksum => false,
checksum => $pentaho::pentaho_source_checksum,
follow_redirects => true,
url => $pentaho::pentaho_source_url,
target => $pentaho::temp_folder,
src_target => $pentaho::temp_folder,
timeout => 0,
}

}
78 changes: 45 additions & 33 deletions manifests/webapp.pp
Original file line number Diff line number Diff line change
@@ -1,49 +1,61 @@
# == Class: pentaho::webapp
class pentaho::webapp {

# JOE
if $::osfamily == 'Windows' {
$exec_provider = 'cygwin'
} else {
$exec_provider = 'posix'
}

if $caller_module_name != $module_name {
fail("Use of private class ${name} by ${caller_module_name}")
}

exec { "/bin/cp -r ${pentaho::temp_folder}/biserver-ce/tomcat/webapps/pentaho* ${pentaho::applicationserver_base}/webapps/" :
exec { "/bin/cp -r ${pentaho::temp_folder}/biserver-ce/tomcat/webapps/pentaho* '${pentaho::applicationserver_base}/webapps/'" :
unless => "/usr/bin/stat ${pentaho::applicationserver_base}/webapps/pentaho",
provider => $exec_provider,
} ->
file { "${pentaho::applicationserver_base}/webapps/pentaho/META-INF/context.xml" :
ensure => file,
content => template("pentaho/context/${pentaho::db_type}/context.xml.erb"),
content => template("pentaho/context/${pentaho::db_type}/context.xml.erb"),
}

Augeas {
require => File["${pentaho::applicationserver_base}/webapps/pentaho/META-INF/context.xml"],
}
augeas { 'base_solution' :
lens => 'Xml.lns',
incl => "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml",
changes => [
"set web-app/context-param[1]/param-value/#text ${pentaho::pentaho_solutions_path}/pentaho-solutions",
],
}
augeas { 'listen_address' :
lens => 'Xml.lns',
incl => "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml",
changes => [
"set web-app/context-param[3]/param-value/#text http://${pentaho::listen_ip}:8080/pentaho",
],
}
augeas { 'rm_hsqldb_autostartup' :
lens => 'Xml.lns',
incl => "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml",
changes => [
"rm /files${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml/web-app/context-param[10]",
],
}
augeas { 'rm_hsqldb_listener' :
lens => 'Xml.lns',
incl => "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml",
changes => [
"rm /files${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml/web-app/listener[3]",
],
}
unless $::osfamily == 'Windows' {
Augeas {
require => File["${pentaho::applicationserver_base}/webapps/pentaho/META-INF/context.xml"],
}
if $pentaho::manage_tomcat_web_xml {
augeas { 'base_solution' :
lens => 'Xml.lns',
incl => "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml",
changes => [
"set web-app/context-param[1]/param-value/#text ${pentaho::pentaho_solutions_path}/pentaho-solutions",
],
}
augeas { 'listen_address' :
lens => 'Xml.lns',
incl => "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml",
changes => [
"set web-app/context-param[3]/param-value/#text http://${pentaho::listen_ip}:8080/pentaho",
],
}
augeas { 'rm_hsqldb_autostartup' :
lens => 'Xml.lns',
incl => "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml",
changes => [
"rm /files${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml/web-app/context-param[10]",
],
}
augeas { 'rm_hsqldb_listener' :
lens => 'Xml.lns',
incl => "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml",
changes => [
"rm /files${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/web.xml/web-app/listener[3]",
],
}
}
}

file { "${pentaho::applicationserver_base}/webapps/pentaho/WEB-INF/classes/log4j.xml" :
ensure => file,
Expand Down
2 changes: 1 addition & 1 deletion templates/context/mysql/context.xml.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/pentaho" docbase="webapps/pentaho/">
<Context path="/pentaho" docBase="webapps/pentaho/">
<Resource validationQuery="select 1" url="jdbc:mysql://<%= @db_host %>:<%= @db_port %>/hibernate" driverClassName="com.mysql.jdbc.Driver"
password="<%= @hibernate_db_password %>" username="<%= @hibernate_db_user %>" maxWait="10000" maxIdle="5" maxActive="20"
factory="org.apache.commons.dbcp.BasicDataSourceFactory" type="javax.sql.DataSource"
Expand Down
2 changes: 1 addition & 1 deletion templates/context/pgsql/context.xml.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/pentaho" docbase="webapps/pentaho/">
<Context path="/pentaho" docBase="webapps/pentaho/">
<Resource validationQuery="select 1" url="jdbc:postgresql://<%= @db_host %>:<%= @db_port %>/hibernate" driverClassName="org.postgresql.Driver" password="<%= @hibernate_db_password %>"
username="<%= @hibernate_db_user %>" maxWait="10000" maxIdle="5" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory"
type="javax.sql.DataSource" auth="Container" name="jdbc/Hibernate"/>
Expand Down