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

XDOCKER-51: Expose configuration options to configure an XWiki cluster #24

Open
wants to merge 12 commits 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ nbproject
.sonar-ide.properties
.clover
*~
.DS_Store
3 changes: 3 additions & 0 deletions 10/mysql-tomcat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ COPY tomcat/setenv.sh /usr/local/tomcat/bin/
# Setup the XWiki Hibernate configuration
COPY xwiki/hibernate.cfg.xml /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml

# Configure JGroups.
COPY jgroups/* /usr/local/tomcat/webapps/ROOT/WEB-INF/observation/remote/jgroups

# Set a specific distribution id in XWiki for this docker packaging.
RUN sed -i 's/<id>org.xwiki.platform:xwiki-platform-distribution-war/<id>org.xwiki.platform:xwiki-platform-distribution-docker/' \
/usr/local/tomcat/webapps/ROOT/META-INF/extension.xed
Expand Down
77 changes: 77 additions & 0 deletions 10/mysql-tomcat/jgroups/udp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<!--
Default stack using IP multicasting. It is similar to the "udp"
stack in stacks.xml, but doesn't use streaming state transfer and flushing
author: Bela Ban
-->

<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.3.xsd">
<UDP
bind_addr="match-interface:eth0,match-interface:en0,site_local,loopback"

mcast_port="${jgroups.udp.mcast_port:45588}"
tos="8"
ucast_recv_buf_size="5M"
ucast_send_buf_size="640K"
mcast_recv_buf_size="5M"
mcast_send_buf_size="640K"
max_bundle_size="64K"
ip_ttl="${jgroups.udp.ip_ttl:8}"
enable_diagnostics="true"
thread_naming_pattern="cl"

thread_pool.enabled="true"
thread_pool.min_threads="2"
thread_pool.max_threads="8"
thread_pool.keep_alive_time="5000" />

<PING />
<FD_SOCK/>
<FD_ALL/>
<VERIFY_SUSPECT timeout="1500" />
<BARRIER />
<pbcast.NAKACK2 xmit_interval="500"
xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="30000"
use_mcast_xmit="false"
discard_delivered_msgs="true"/>
<UNICAST3 xmit_interval="500"
xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="60000"
conn_expiry_timeout="0"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="4M"/>
<pbcast.GMS print_local_addr="true" join_timeout="3000"
view_bundling="true"/>
<UFC max_credits="2M"
min_threshold="0.4"/>
<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K" />
<RSVP resend_interval="2000" timeout="10000"/>
<pbcast.STATE_TRANSFER />
<!-- pbcast.FLUSH /-->
</config>
20 changes: 20 additions & 0 deletions 10/mysql-tomcat/xwiki/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function other_starts() {
function xwiki_replace() {
sed -i s~"\#\? \?$2 \?=.*"~"$2=$3"~g "$1"
}
# $1 - the setting/property to set
# $2 - the new value
function xwiki_replace_example() {
sed -i s~"\#-# Example:\? \?$1 \?=.*"~"$1=$2"~g "/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.properties"
}

# $1 - the setting/property to set
# $2 - the new value
Expand Down Expand Up @@ -104,6 +109,17 @@ function restoreConfigurationFile() {
fi
}

function enableClustering() {
echo 'Setting clustering...'
xwiki_set_properties 'observation.remote.enabled' 'true'
if [ $CLUSTER_CHANNEL ]; then
echo "Setting cluster channel to $CLUSTER_CHANNEL"
xwiki_replace_example 'observation.remote.channels' "$CLUSTER_CHANNEL"
else
xwiki_replace_example 'observation.remote.channels' 'udp'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it needed to replace an example in the config file? This feels weird :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In xwiki.properties there is no field of
"# observation.remote.channels"
So I didn't find anything to replace. So I replaced the Example

fi
}

function configure() {
echo 'Configuring XWiki...'

Expand Down Expand Up @@ -138,6 +154,10 @@ function configure() {
xwiki_set_properties 'solr.remote.url' "http://$INDEX_HOST:$INDEX_PORT/solr/xwiki"
fi

if [ $CLUSTER ]; then
enableClustering
fi

# If the files already exist then copy them to the XWiki's WEB-INF directory. Otherwise copy the default config
# files to the permanent directory so that they can be easily modified by the user. They'll be synced at the next
# start.
Expand Down
3 changes: 3 additions & 0 deletions 10/postgres-tomcat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ COPY tomcat/setenv.sh /usr/local/tomcat/bin/
# Setup the XWiki Hibernate configuration
COPY xwiki/hibernate.cfg.xml /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml

# Configure JGroups.
COPY jgroups/* /usr/local/tomcat/webapps/ROOT/WEB-INF/observation/remote/jgroups

# Set a specific distribution id in XWiki for this docker packaging.
RUN sed -i 's/<id>org.xwiki.platform:xwiki-platform-distribution-war/<id>org.xwiki.platform:xwiki-platform-distribution-docker/' \
/usr/local/tomcat/webapps/ROOT/META-INF/extension.xed
Expand Down
77 changes: 77 additions & 0 deletions 10/postgres-tomcat/jgroups/udp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<!--
Default stack using IP multicasting. It is similar to the "udp"
stack in stacks.xml, but doesn't use streaming state transfer and flushing
author: Bela Ban
-->

<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.3.xsd">
<UDP
bind_addr="match-interface:eth0,match-interface:en0,site_local,loopback"

mcast_port="${jgroups.udp.mcast_port:45588}"
tos="8"
ucast_recv_buf_size="5M"
ucast_send_buf_size="640K"
mcast_recv_buf_size="5M"
mcast_send_buf_size="640K"
max_bundle_size="64K"
ip_ttl="${jgroups.udp.ip_ttl:8}"
enable_diagnostics="true"
thread_naming_pattern="cl"

thread_pool.enabled="true"
thread_pool.min_threads="2"
thread_pool.max_threads="8"
thread_pool.keep_alive_time="5000" />

<PING />
<FD_SOCK/>
<FD_ALL/>
<VERIFY_SUSPECT timeout="1500" />
<BARRIER />
<pbcast.NAKACK2 xmit_interval="500"
xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="30000"
use_mcast_xmit="false"
discard_delivered_msgs="true"/>
<UNICAST3 xmit_interval="500"
xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="60000"
conn_expiry_timeout="0"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="4M"/>
<pbcast.GMS print_local_addr="true" join_timeout="3000"
view_bundling="true"/>
<UFC max_credits="2M"
min_threshold="0.4"/>
<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K" />
<RSVP resend_interval="2000" timeout="10000"/>
<pbcast.STATE_TRANSFER />
<!-- pbcast.FLUSH /-->
</config>
20 changes: 20 additions & 0 deletions 10/postgres-tomcat/xwiki/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function other_starts() {
function xwiki_replace() {
sed -i s~"\#\? \?$2 \?=.*"~"$2=$3"~g "$1"
}
# $1 - the setting/property to set
# $2 - the new value
function xwiki_replace_example() {
sed -i s~"\#-# Example:\? \?$1 \?=.*"~"$1=$2"~g "/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.properties"
}

# $1 - the setting/property to set
# $2 - the new value
Expand Down Expand Up @@ -104,6 +109,17 @@ function restoreConfigurationFile() {
fi
}

function enableClustering() {
echo 'Setting clustering...'
xwiki_set_properties 'observation.remote.enabled' 'true'
if [ $CLUSTER_CHANNEL ]; then
echo "Setting cluster channel to $CLUSTER_CHANNEL"
xwiki_replace_example 'observation.remote.channels' "$CLUSTER_CHANNEL"
else
xwiki_replace_example 'observation.remote.channels' 'udp'
fi
}

function configure() {
echo 'Configuring XWiki...'

Expand Down Expand Up @@ -138,6 +154,10 @@ function configure() {
xwiki_set_properties 'solr.remote.url' "http://$INDEX_HOST:$INDEX_PORT/solr/xwiki"
fi

if [ $CLUSTER ]; then
enableClustering
fi

# If the files already exist then copy them to the XWiki's WEB-INF directory. Otherwise copy the default config
# files to the permanent directory so that they can be easily modified by the user. They'll be synced at the next
# start.
Expand Down
3 changes: 3 additions & 0 deletions 11/mysql-tomcat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ COPY tomcat/setenv.sh /usr/local/tomcat/bin/
# Setup the XWiki Hibernate configuration
COPY xwiki/hibernate.cfg.xml /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml

# Configure JGroups.
COPY jgroups/* /usr/local/tomcat/webapps/ROOT/WEB-INF/observation/remote/jgroups

# Set a specific distribution id in XWiki for this docker packaging.
RUN sed -i 's/<id>org.xwiki.platform:xwiki-platform-distribution-war/<id>org.xwiki.platform:xwiki-platform-distribution-docker/' \
/usr/local/tomcat/webapps/ROOT/META-INF/extension.xed
Expand Down
77 changes: 77 additions & 0 deletions 11/mysql-tomcat/jgroups/udp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<!--
Default stack using IP multicasting. It is similar to the "udp"
stack in stacks.xml, but doesn't use streaming state transfer and flushing
author: Bela Ban
-->

<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.3.xsd">
<UDP
bind_addr="match-interface:eth0,match-interface:en0,site_local,loopback"

mcast_port="${jgroups.udp.mcast_port:45588}"
tos="8"
ucast_recv_buf_size="5M"
ucast_send_buf_size="640K"
mcast_recv_buf_size="5M"
mcast_send_buf_size="640K"
max_bundle_size="64K"
ip_ttl="${jgroups.udp.ip_ttl:8}"
enable_diagnostics="true"
thread_naming_pattern="cl"

thread_pool.enabled="true"
thread_pool.min_threads="2"
thread_pool.max_threads="8"
thread_pool.keep_alive_time="5000" />

<PING />
<FD_SOCK/>
<FD_ALL/>
<VERIFY_SUSPECT timeout="1500" />
<BARRIER />
<pbcast.NAKACK2 xmit_interval="500"
xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="30000"
use_mcast_xmit="false"
discard_delivered_msgs="true"/>
<UNICAST3 xmit_interval="500"
xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="60000"
conn_expiry_timeout="0"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="4M"/>
<pbcast.GMS print_local_addr="true" join_timeout="3000"
view_bundling="true"/>
<UFC max_credits="2M"
min_threshold="0.4"/>
<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K" />
<RSVP resend_interval="2000" timeout="10000"/>
<pbcast.STATE_TRANSFER />
<!-- pbcast.FLUSH /-->
</config>
20 changes: 20 additions & 0 deletions 11/mysql-tomcat/xwiki/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function other_starts() {
function xwiki_replace() {
sed -i s~"\#\? \?$2 \?=.*"~"$2=$3"~g "$1"
}
# $1 - the setting/property to set
# $2 - the new value
function xwiki_replace_example() {
sed -i s~"\#-# Example:\? \?$1 \?=.*"~"$1=$2"~g "/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.properties"
}

# $1 - the setting/property to set
# $2 - the new value
Expand Down Expand Up @@ -104,6 +109,17 @@ function restoreConfigurationFile() {
fi
}

function enableClustering() {
echo 'Setting clustering...'
xwiki_set_properties 'observation.remote.enabled' 'true'
if [ $CLUSTER_CHANNEL ]; then
echo "Setting cluster channel to $CLUSTER_CHANNEL"
xwiki_replace_example 'observation.remote.channels' "$CLUSTER_CHANNEL"
else
xwiki_replace_example 'observation.remote.channels' 'udp'
fi
}

function configure() {
echo 'Configuring XWiki...'

Expand Down Expand Up @@ -138,6 +154,10 @@ function configure() {
xwiki_set_properties 'solr.remote.url' "http://$INDEX_HOST:$INDEX_PORT/solr/xwiki"
fi

if [ $CLUSTER ]; then
enableClustering
fi

# If the files already exist then copy them to the XWiki's WEB-INF directory. Otherwise copy the default config
# files to the permanent directory so that they can be easily modified by the user. They'll be synced at the next
# start.
Expand Down
Loading