Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Preparation for Zanata 4 version upgrade
There are some different changes in standalone.xml between
Zanata version 3 and 4. A version flag is implemented to
rollout the right version from template dir. For backwards
compatibility Zanata version 3 and 4 are supported yet.
Wildfly 9 stuff is removed because we have still Wildfly 10
running. That simplifies the manifest. Switch download URLs
to github, so there is also a standard to fetch files.

Change-Id: I5ada09cad7a19296802b22c2c3488ca547f2f14e
hint: http://docs.zanata.org/en/release/release-notes/#400
  • Loading branch information
eumel8 committed Nov 27, 2017
1 parent 1619f29 commit e1fb24b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 713 deletions.
100 changes: 9 additions & 91 deletions manifests/init.pp
Expand Up @@ -20,24 +20,17 @@
$zanata_db_password,
$mysql_host = 'localhost',
$mysql_port = '3306',
$zanata_main_version = 3,
$zanata_db_name = 'zanata',
$zanata_db_username = 'zanata',

# For wildfly < 10 the zanata_url below is expected to be a url to a built
# war for wildfly >=10 the expectation is that it is the url to one of the
# published zipfiles that can be overlaid atop the wildfly installation
# dir.
$zanata_wildfly_version = '9.0.1',
$zanata_wildfly_install_url = 'https://repo1.maven.org/maven2/org/wildfly/wildfly-dist/9.0.1.Final/wildfly-dist-9.0.1.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',
# The default here is to a war file and can be used with wildfly < 10.
# If using wildfly >= 10 an example url would be:
# https://github.com/zanata/zanata-server/releases/download/server-3.9.6/zanata-3.9.6-wildfly.zip
$zanata_url = 'https://sourceforge.net/projects/zanata/files/webapp/zanata-war-3.7.3.war',
$zanata_wildfly_version = '10.1.0',
$zanata_wildfly_install_url = 'https://repo1.maven.org/maven2/org/wildfly/wildfly-dist/10.1.0.Final/wildfly-dist-10.1.0.Final.tar.gz',

$zanata_url = 'https://github.com/zanata/zanata-server/releases/download/server-3.9.6/zanata-3.9.6-wildfly.zip',
# newer repo,e.g. https://github.com/zanata/zanata-platform/releases/download/platform-4.2.1/zanata-4.2.1-wildfly.zip
# This should be a sha1 of whatever file is hosted at the url above.
$zanata_checksum = '59f1ac35cce46ba4e46b06a239cd7ab4e10b5528',
$zanata_checksum = 'cb7a477f46a118a337b59b9f4004ef7e6c77a1a8',

$zanata_storage_dir = '/home/wildfly/zanata',

Expand All @@ -58,8 +51,6 @@
$zanata_file = inline_template('<%= File.basename(@zanata_url) %>')
$zanata_ext = inline_template('<%= File.extname(@zanata_url) %>')
$wildfly_file = inline_template('<%= File.basename(@zanata_wildfly_install_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,
Expand All @@ -77,79 +68,7 @@
}
include '::archive'

if ($zanata_ext == '.war') {
# This implies the old wildfly <10 install method of installing wildfly
# then manually injecting deps and the war into the wildfly install.
# You need to make sure you provide a .war file url for zanata when
# using wildfly < 10.
package { 'libmysql-java':
ensure => present,
}

# The mysql driver name differs based on the version of the package. Ensure
# we set it correctly when writing the standalone.xml config file below.
# Note that this isn't the name used by files on disk, rather it is some
# java class lookup name used in the standalone.xml configuration file.
if ($::operatingsystem == 'Ubuntu') and ($::operatingsystemrelease >= '16.04') {
$mysql_driver_name = 'mysql-connector-java.jar_com.mysql.jdbc.Driver_5_1'
}
else {
$mysql_driver_name = 'mysql-connector-java.jar'
}

file { '/opt/wildfly/standalone/deployments/mysql-connector-java.jar':
ensure => 'link',
target => '/usr/share/java/mysql-connector-java.jar',
require => [
Package['libmysql-java'],
Class['zanata::wildfly'],
],
}

archive { '/opt/wildfly/standalone/deployments/ROOT.war':
ensure => present,
user => 'wildfly',
source => $zanata_url,
checksum_type => 'sha1',
checksum => $zanata_checksum,
require => [
Class['wildfly::install'],
]
}

archive { "/home/wildfly/${zanata_hibernate_file}":
ensure => present,
user => 'wildfly',
source => $zanata_hibernate_url,
extract => true,
extract_path => '/opt/wildfly/',
require => Package['unzip'],
}

archive { "/home/wildfly/${zanata_mojarra_file}":
ensure => present,
user => 'wildfly',
source => $zanata_mojarra_url,
extract => true,
extract_path => '/opt/wildfly/',
require => Package['unzip'],
}

file { '/opt/wildfly/standalone/configuration/standalone.xml':
ensure => present,
notify => Service['wildfly'],
owner => wildfly,
group => wildfly,
content => template('zanata/wildfly-9-standalone.xml.erb'),
require => [
Class['zanata::wildfly'],
Archive['/opt/wildfly/standalone/deployments/ROOT.war'],
Archive["/home/wildfly/${zanata_mojarra_file}"],
Archive["/home/wildfly/${zanata_hibernate_file}"],
],
}
}
elsif ($zanata_ext == '.zip') {
if ($zanata_ext == '.zip') {
# This implies the newer wildfly >= 10 install method where we install
# wildfly, then unpack the zanata zip file into that install dir which
# gives us all of our deps. You need to make sure you provide a .zip file
Expand Down Expand Up @@ -180,7 +99,6 @@
require => Archive["/tmp/${zanata_file}"],
}

# TODO make this handle wildfly >= 10.
file { '/opt/wildfly/standalone/configuration/standalone.xml':
ensure => present,
notify => Service['wildfly'],
Expand All @@ -195,7 +113,7 @@
}
}
else {
fail('zanata_url must be for a .war or .zip file.')
fail('zanata_url must be for a .zip file.')
}
}

Expand Down
4 changes: 2 additions & 2 deletions manifests/wildfly.pp
Expand Up @@ -15,8 +15,8 @@
# == Class: zanata::wildfly
#
class zanata::wildfly(
$wildfly_version = '9.0.1',
$wildfly_install_source = 'https://repo1.maven.org/maven2/org/wildfly/wildfly-dist/9.0.1.Final/wildfly-dist-9.0.1.Final.tar.gz',
$wildfly_version = '10.1.0',
$wildfly_install_source = 'https://repo1.maven.org/maven2/org/wildfly/wildfly-dist/10.1.0.Final/wildfly-dist-10.1.0.Final.tar.gz',
) {

$javahome = '/usr/lib/jvm/default-java/jre/'
Expand Down
39 changes: 36 additions & 3 deletions templates/wildfly-10-standalone.xml.erb
Expand Up @@ -32,15 +32,45 @@
<extension module="org.wildfly.extension.security.manager" />
<extension module="org.wildfly.extension.undertow" />
</extensions>

<system-properties>
<% if @zanata_main_version.to_i < 4 -%>
<property name="javamelody.storage-directory" value="<%= @zanata_storage_dir %>/stats"/>
<property name="hibernate.search.default.indexBase" value="<%= @zanata_storage_dir %>/indexes"/>
<property name="ehcache.disk.store.dir" value="<%= @zanata_storage_dir %>/ehcache"/>
<property name="jboss.as.management.blocking.timeout" value="1000"/>
<% else -%>
<property name="javamelody.storage-directory" value="<%= @zanata_storage_dir %>/stats"/>
<property name="hibernate.search.default.indexBase" value="<%= @zanata_storage_dir %>/indexes"/>
<property name="jboss.as.management.blocking.timeout" value="1000"/>
<property name="zanata.security.authpolicy.internal" value="zanata.internal"/>
<property name="zanata.security.authpolicy.openid" value="zanata.openid"/>
<% if @zanata_admin_users != '' -%>
<property name="zanata.security.adminusers" value="<%= @zanata_admin_users %>"/>
<% else -%>
<property name="zanata.security.adminusers" value="admin"/>
<% end -%>
<property name="zanata.file.directory" value="<%= @zanata_storage_dir %>/files"/>
<property name="zanata.email.defaultfromaddress" value="<%= @zanata_default_from_address %>"/>
<% if @zanata_smtp_host != '' -%>
<property name="zanata.smtp.host" value="<%= @zanata_smtp_host %>" />
<% end -%>
<% if @zanata_smtp_port != '' -%>
<property name="zanata.smtp.port" value="<%= @zanata_smtp_port %>" />
<% end -%>
<% if @zanata_smtp_username != '' -%>
<property name="zanata.smtp.username" value="<%= @zanata_smtp_username %>" />
<% end -%>
<% if @zanata_smtp_password != '' -%>
<property name="zanata.smtp.password" value="<%= @zanata_smtp_password %>" />
<% end -%>
<% if @zanata_smtp_tls != '' -%>
<property name="zanata.smtp.tls" value="<%= @zanata_smtp_tls %>" />
<% end -%>
<% if @zanata_smtp_ssl != '' -%>
<property name="zanata.smtp.ssl" value="<%= @zanata_smtp_ssl %>" />
<% end -%>
<% end -%>
</system-properties>


<management>
<security-realms>
<security-realm name="ManagementRealm">
Expand Down Expand Up @@ -455,6 +485,7 @@
</subsystem>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<% if @zanata_main_version.to_i < 4 -%>
<% if @zanata_openid_provider_url == '' -%>
<simple name="java:global/zanata/security/auth-policy-names/internal" value="zanata.internal"/>
<% end -%>
Expand Down Expand Up @@ -484,6 +515,8 @@
<% if @zanata_smtp_ssl != '' -%>
<simple name="java:global/zanata/smtp/ssl" value="<%= @zanata_smtp_ssl %>" />
<% end -%>
<% end -%>

</bindings>
<remote-naming />
</subsystem>
Expand Down

0 comments on commit e1fb24b

Please sign in to comment.