-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 8.2.4 tigase/_server/tigase-server#14
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM openjdk:11-jre-slim | ||
MAINTAINER "Tigase, Inc." <support@tigase.net> | ||
|
||
# Create directory structure, download Tigase XMPP Server -dist-max package and unpack it | ||
# At the same time remove setting JAVA_HOME from etc/tigase.conf as variable is already set | ||
# Then move content of etc/ directory to etc.orig/ to be able to use volume to host configuration. | ||
# Additionally we are removing docs/ and downloaded package to reduce size. | ||
ARG TYPE="" | ||
ENV TYPE ${TYPE} | ||
|
||
RUN mkdir /home/tigase \ | ||
&& cd /home/tigase \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends wget curl \ | ||
&& wget -nv https://github.com/tigase/tigase-server/releases/download/tigase-server-8.2.4/tigase-server-8.2.4-b11735-dist${TYPE}.tar.gz \ | ||
&& apt-get remove -y wget \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& tar -zxf tigase-server-8.2.4-b11735-dist${TYPE}.tar.gz \ | ||
&& ln -s `find . -name 'tigase-server-*' -maxdepth 1 -type d` tigase-server \ | ||
&& rm -rf tigase-server/docs/ \ | ||
&& rm -rf tigase-server-8.2.4-b11735-dist${TYPE}.tar.gz \ | ||
&& sed -i -e 's/JAVA_HOME/#JAVA_HOME/' tigase-server/etc/tigase.conf \ | ||
&& mv tigase-server/etc tigase-server/etc.orig | ||
|
||
# Add statup scripts and make them executable | ||
# We need custom scripts to make sure that database is upgraded | ||
# and that Tigase will NOT be launched as background service! | ||
ADD scripts/start.sh /start.sh | ||
RUN chmod 755 /start.sh | ||
|
||
# Set TIGASE_HOME variable | ||
ENV TIGASE_HOME /home/tigase/tigase-server | ||
|
||
# Set ports of the container which can be exposed | ||
EXPOSE 5222 5223 5269 5277 5280 5281 5290 5291 8080 9050 9070 | ||
|
||
# Set possible volume (directories which can be mounted from the docker host machine) | ||
# like etc/, conf/, certs/, logs/, data/ | ||
VOLUME ["/home/tigase/tigase-server/etc", "/home/tigase/tigase-server/conf", "/home/tigase/tigase-server/certs", "/home/tigase/tigase-server/logs", "/home/tigase/tigase-server/data"] | ||
|
||
# Define script which should be executed on container startup | ||
CMD ["/bin/bash", "/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
if [[ ! -z "$COPY_CONFIG_SRC" ]]; then | ||
echo "Copying config from $COPY_CONFIG_SRC ..." | ||
cp -L -r -n -v "$COPY_CONFIG_SRC/config.tdsl" /home/tigase/tigase-server/etc | ||
echo "--------------------------------------" | ||
fi | ||
|
||
cp -r -n /home/tigase/tigase-server/etc.orig/* /home/tigase/tigase-server/etc/ | ||
|
||
echo "Checking if database is already available: ${DB_HOST}:${DB_PORT}"; | ||
if [ -n "${DB_HOST}" ] && [ -n "${DB_PORT}" ] ; then | ||
/home/tigase/tigase-server/scripts/wait-for-it.sh "${DB_HOST}":"${DB_PORT}" -t 30 | ||
fi | ||
if grep -q "config-type.*setup" "/home/tigase/tigase-server/etc/config.tdsl" ; then | ||
echo "Running in setup mode, skipping schema upgrade..."; | ||
else | ||
echo "Upgrading database schema..."; | ||
ADDITIONAL_PARAMS="" | ||
if [[ ! -z "$ADMIN_JID" && ! -z "$ADMIN_PASSWORD" ]]; then | ||
ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --adminJID=\"$ADMIN_JID\" --adminJIDpass=\"$ADMIN_PASSWORD\""; | ||
fi | ||
if [[ ! -z "$DB_ROOT_USER" && ! -z "$DB_ROOT_PASS" ]]; then | ||
ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS -R \"${DB_ROOT_USER}\" -A \"${DB_ROOT_PASS}\""; | ||
fi | ||
if [[ ! -z "$DB_LOG_LEVEL" ]]; then | ||
ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS -L \"${DB_LOG_LEVEL}\""; | ||
fi | ||
/home/tigase/tigase-server/scripts/tigase.sh upgrade-schema /home/tigase/tigase-server/etc/tigase.conf "$ADDITIONAL_PARAMS" | ||
fi | ||
|
||
echo "Starting Tigase XMPP Server..."; | ||
/home/tigase/tigase-server/scripts/tigase.sh run /home/tigase/tigase-server/etc/tigase.conf |