Skip to content

Commit abca6a3

Browse files
committed
Update the Docker image to take into account the change of the
implementation of the JCR from Jackrabbit 2 to Jackrabbit Oak. The Docker image will embed a JCR migration script that will be used to migrate existing JCR of previous versions of the container. By the way, the Silverpeas global configuration file, config.properties, isn't anymore overridden by a the running of a new version of a container; it will be check whether there is an already existing config.properties file.
1 parent 9e67a60 commit abca6a3

File tree

4 files changed

+48
-6
lines changed

4 files changed

+48
-6
lines changed

Dockerfile.template

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:focal
1+
FROM ubuntu:jammy
22

33
MAINTAINER Miguel Moquillon "miguel.moquillon@silverpeas.org"
44

@@ -11,8 +11,8 @@ ENV TERM=xterm
1111
# Installation of LibreOffice, ImageMagick, Ghostscript, and then
1212
# the dependencies required to run SWFTools and PDF2JSON
1313
RUN apt-get update \
14-
&& apt-get install -y tzdata \
15-
&& apt-get install -y \
14+
&& apt-get install -y --no-install-recommends tzdata \
15+
&& apt-get install -y --no-install-recommends \
1616
apt-utils \
1717
iputils-ping \
1818
curl \
@@ -104,6 +104,13 @@ RUN wget -nc https://www.silverpeas.org/files/silverpeas-${SILVERPEAS_VERSION}-w
104104
&& rm *.zip \
105105
&& mkdir -p /root/.m2
106106

107+
# Install the JCR migration script
108+
COPY src/oak-migrate.zip /opt/
109+
RUN mkdir /opt/oak-migration \
110+
&& unzip /opt/oak-migrate.zip -d /opt/oak-migration/ \
111+
&& chmod +x /opt/oak-migration/oak-migrate.sh \
112+
&& rm /opt/oak-migrate.zip
113+
107114
# Copy the Maven settings.xml required to install Silverpeas by fetching the software bundles from
108115
# the Silverpeas Nexus Repository
109116
COPY src/settings.xml /root/.m2/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ To build an image for a given version of Silverpeas 6, say 6.1:
3535

3636
$ ./build.sh -v 6.1
3737

38-
This will checkout the tag 6.1 and then build the image from the `Dockerfile` at this tag.
38+
This will checkout the tag 6.1 and then build the image from the tagged `Dockerfile`.
3939

40-
By default, the image is created with as default locale `en_US.UTF-8`. To specify another locale, for example `fr_FR.UTF-8`, just do:
40+
By default, the image is created with `en_US.UTF-8` as the default locale. To specify another locale, for example `fr_FR.UTF-8`, just do:
4141

4242
$ ./build.sh -l fr_FR.UTF-8
4343

@@ -55,7 +55,7 @@ For doing, an excerpt of a Docker compose descriptor `docker-compose.yml` is pro
5555

5656
$ docker compose up
5757

58-
to launch both the PostgreSQL and Silverpeas services. At creation of the Silverpeas service, Silverpeas will be automatically reconfigured to use the PostgreSQL database as defined in the `.env` file.
58+
to create and then to launch both the PostgreSQL and Silverpeas services. At creation of the Silverpeas service, Silverpeas will be automatically reconfigured to use the PostgreSQL database as defined in the `.env` file.
5959

6060
To stop the services:
6161

src/oak-migrate.zip

43.3 MB
Binary file not shown.

src/run.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ set -e
66
# of Silverpeas
77
#
88

9+
# Creates the Silverpeas global configuration file config.properties from the environment variables
10+
# set in the Docker image
911
pre_install() {
12+
if [ -f ${SILVERPEAS_HOME}/configuration/config.properties ]; then
13+
echo "The configuration file ${SILVERPEAS_HOME}/configuration/config.properties already exists. Does nothing"
14+
return
15+
fi
16+
1017
dbtype=${DB_SERVERTYPE:-POSTGRESQL}
1118
dbserver=${DB_SERVER:-database}
1219
dbport=${DB_PORT}
@@ -27,11 +34,13 @@ EOF
2734
fi
2835
}
2936

37+
# Start Silverpeas
3038
start_silverpeas() {
3139
echo "Start Silverpeas..."
3240
exec ${JBOSS_HOME}/bin/standalone.sh -b 0.0.0.0 -c standalone-full.xml
3341
}
3442

43+
# Stop Silverpeas
3544
stop_silverpeas() {
3645
echo "Stop Silverpeas..."
3746
./silverpeas stop
@@ -41,6 +50,31 @@ stop_silverpeas() {
4150
fi
4251
}
4352

53+
# Migrate the JCR from Apache Jackrabbit 2 to Apache Jackrabbit Oak
54+
# For doing we have to find out where the JCR home directory is located.
55+
migrate_jcr() {
56+
jcr_home=`grep "JCR_HOME[ ]*=" ${SILVERPEAS_HOME}/configuration/config.properties | cut -d '=' -f 2`
57+
if [ "Z${jcr_home}" = "Z" ]; then
58+
jcr_home="$SILVERPEAS_HOME}/data/jcr"
59+
else
60+
data_home=`grep "SILVERPEAS_DATA_HOME=" ${SILVERPEAS_HOME}/configuration/config.properties | cut -d '=' -f 2`
61+
if [ "Z${data_home}" = "Z" ]; then
62+
data_home="$SILVERPEAS_HOME}/data"
63+
else
64+
data_home=`sed -e "s/{env./{/g" <<< "${data_home}"`
65+
data_home=`eval echo -e "${data_home}"`
66+
fi
67+
jcr_home=`sed -e "s/SILVERPEAS_DATA_HOME/data_home/g" <<< "${jcr_home}"`
68+
jcr_home=`eval echo -e "${jcr_home}"`
69+
fi
70+
71+
jcr_dir=`dirname ${jcr_home}`
72+
if [ -d "${jcr_dir}/jackrabbit" ] && [ ! -d "${jcr_dir}/jcr/segmentstore" ]; then
73+
echo "Migrate the JCR from Apache Jackrabbit 2 to Apache Jackrabbit Oak..."
74+
/opt/oak-migration/oak-migrate.sh "${jcr_dir}/jackrabbit" "${jcr_dir}/jcr"
75+
fi
76+
}
77+
4478
trap 'stop_silverpeas' SIGTERM
4579

4680
if [ -f ${SILVERPEAS_HOME}/bin/.install ]; then
@@ -51,6 +85,7 @@ if [ -f ${SILVERPEAS_HOME}/bin/.install ]; then
5185
./silverpeas install
5286
if [ $? -eq 0 ]; then
5387
rm ${SILVERPEAS_HOME}/bin/.install
88+
migrate_jcr
5489
else
5590
echo "Error while setting up Silverpeas"
5691
echo

0 commit comments

Comments
 (0)