Skip to content
Permalink
Browse files

Prepared for 5.2.0 release

  • Loading branch information...
phax committed Jul 17, 2019
1 parent 2489d43 commit bab60d3c33c757e012d158163395a9378941dd8a
@@ -0,0 +1,48 @@
#
# Copyright (C) 2015-2019 Philip Helger (www.helger.com)
# philip[at]helger[dot]com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Use an official Tomcat runtime as a base image
FROM tomcat:9-jre11

# Special encoded slash handling for SMP
# Use non-blocking random
ENV CATALINA_OPTS="$CATALINA_OPTS -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Djava.security.egd=file:/dev/urandom"

# Install vim
RUN apt-get update \
&& apt-get install -y vim \
&& rm -rf /var/lib/apt/lists/*

# Remove predefined Tomcat webapps
RUN rm -r $CATALINA_HOME/webapps/ROOT \
&& rm -r $CATALINA_HOME/webapps/docs \
&& rm -r $CATALINA_HOME/webapps/examples

# Set arguments and labels after initial cleanup was performed :)
ARG SMP_VERSION
# Set to environment to be persistent
ENV SMP_VERSION=${SMP_VERSION:-5.2.0}
LABEL vendor="Philip Helger"
LABEL version=$SMP_VERSION

# Download, unzip and copy result to Tomcat webapps dir
WORKDIR /home/git
RUN echo Downloading phoss SMP $SMP_VERSION \
&& wget -nv https://github.com/phax/phoss-smp/releases/download/phoss-smp-parent-pom-$SMP_VERSION/phoss-smp-webapp-mongodb-$SMP_VERSION.war -O smp.zip \
&& unzip smp.zip -d smp/ \
&& cp -r smp/ $CATALINA_HOME/webapps/ROOT \
&& rm smp.zip
@@ -36,12 +36,12 @@ RUN rm -r $CATALINA_HOME/webapps/ROOT \
# Minimum version for this layout is 5.0.1
ARG SMP_VERSION
# Set to environment to be persistent
ENV SMP_VERSION=${SMP_VERSION:-5.1.2}
ENV SMP_VERSION=${SMP_VERSION:-5.2.0}
LABEL vendor="Philip Helger"
LABEL version=$SMP_VERSION

# Download, unzip and copy result to Tomcat webapps dir
# Note: Up to and including v5.1.2 the tag and file were called "peppol-smp-server-*" instead of "phoss-smp-*"
# Note: Up to and including v5.2.0 the tag and file were called "peppol-smp-server-*" instead of "phoss-smp-*"
WORKDIR /home/git
RUN echo Downloading phoss SMP $SMP_VERSION \
&& wget -nv https://github.com/phax/phoss-smp/releases/download/phoss-smp-parent-pom-$SMP_VERSION/phoss-smp-webapp-sql-$SMP_VERSION.war -O smp.zip \
@@ -36,12 +36,12 @@ RUN rm -r $CATALINA_HOME/webapps/ROOT \
# Minimum version for this layout is 5.0.1
ARG SMP_VERSION
# Set to environment to be persistent
ENV SMP_VERSION=${SMP_VERSION:-5.1.2}
ENV SMP_VERSION=${SMP_VERSION:-5.2.0}
LABEL vendor="Philip Helger"
LABEL version=$SMP_VERSION

# Download, unzip and copy result to Tomcat webapps dir
# Note: Up to and including v5.1.2 the tag and file were called "peppol-smp-server-*" instead of "phoss-smp-*"
# Note: Up to and including v5.2.0 the tag and file were called "peppol-smp-server-*" instead of "phoss-smp-*"
WORKDIR /home/git
RUN echo Downloading phoss SMP $SMP_VERSION \
&& wget -nv https://github.com/phax/phoss-smp/releases/download/phoss-smp-parent-pom-$SMP_VERSION/phoss-smp-webapp-xml-$SMP_VERSION.war -O smp.zip \
@@ -36,7 +36,7 @@ RUN rm -r $CATALINA_HOME/webapps/ROOT \
# Minimum version for this layout is 5.0.1
ARG SMP_VERSION
# Set to environment to be persistent
ENV SMP_VERSION=${SMP_VERSION:-5.1.2}
ENV SMP_VERSION=${SMP_VERSION:-5.2.0}
LABEL vendor="Philip Helger"
LABEL version=$SMP_VERSION

@@ -1,20 +1,26 @@
# phoss SMP Docker configuration

This folder contains the Docker configuration file for phoss SMP.
It is based on the official `tomcat:9-jre11` image since v5.2.0.
This folder contains the Docker configuration files for phoss SMP.
It is based on the official `tomcat:9-jre11` image since v5.1.2.
It was previously based on the official `tomcat:8.5` image.

Prebuild images are available from https://hub.docker.com/r/phelger/smp/

**Note:** The SMP comes pretty unconfigured

Note: the `Dockerfile-release-binary-xml` builds the latest release with the XML backend.
Note: the `Dockerfile-release-binary-xml` builds the latest release from binaries with XML backend.

Note: the `Dockerfile-release-binary-sql` builds the latest release with the SQL backend
Note: the `Dockerfile-release-binary-sql` builds the latest release from binaries with SQL backend

Note: the `Dockerfile-release-from-source-xml` build the latest release from GitHub with XML backend
Note: the `Dockerfile-release-binary-mongodb` builds the latest release from binaries with MongoDB backend (since v5.2.0)

Note: the `Dockerfile-snapshot-from-source-xml` build the latest snapshot from GitHub with XML backend
Note: the `Dockerfile-release-from-source-xml` build the latest release from GitHub sources with XML backend

Note: the `Dockerfile-snapshot-from-source-xml` build the latest snapshot from GitHub sources with XML backend

Note: the `Dockerfile-snapshot-from-source-sql` build the latest snapshot from GitHub sources with SQL backend

Note: the `Dockerfile-snapshot-from-source-mongodb` build the latest snapshot from GitHub sources with MongoDB backend

## Release Binary, XML Backend

@@ -48,6 +54,23 @@ docker rm phoss-smp-release-binary-sql
It exposes port 8888 where Tomcat is running successfully.
Open `http://localhost:8888` in your browser.


## Release Binary, MongoDB backend

Use an existing binary release, with the MongoDB backend.

To build the SMP image with MongoDB backend use the following command:

```
docker build -t phoss-smp-release-binary-mongodb -f Dockerfile-release-binary-mongodb .
docker run -d --name phoss-smp-release-binary-mongodb -p 8888:8080 phoss-smp-release-binary-mongodb
docker stop phoss-smp-release-binary-mongodb
docker rm phoss-smp-release-binary-mongodb
```

It exposes port 8888 where Tomcat is running successfully.
Open `http://localhost:8888` in your browser.

## Release from source, XML Backend

Build the SMP from source with the XML backend using the tag of the last release.
@@ -62,7 +85,7 @@ docker rm phoss-smp-release-from-source-xml
It exposes port 8888 where Tomcat is running successfully.
Open `http://localhost:8888` in your browser.

## Latest version from source, XML Backend
## Latest snapshot version from source, XML Backend

Build the SMP from source with the XML backend using the HEAD version of the master branch (SNAPSHOT version).

@@ -79,10 +102,11 @@ Open `http://localhost:8888` in your browser.
# Misc Docker related stuff

## Version change
To change the version build of release versions you can specify the version on the commandline when building:

To change the version build of binary release versions you can specify the version on the commandline when building:

```
docker build --build-arg SMP_VERSION=5.1.2 -t phoss-smp-release-binary-xml-5.1.2 -f Dockerfile-release-binary-xml .
docker build --build-arg SMP_VERSION=5.2.0 -t phoss-smp-release-binary-xml-5.2.0 -f Dockerfile-release-binary-xml .
```

Note: since the file system layout changed between 5.0.0 and 5.0.1, the current version is only applicable to versions ≥ 5.0.1
@@ -94,9 +118,9 @@ Note: up to and including v5.1.1 the variable `SMP_VERSION` was called `VERSION`
Running a pre-build image (XML backend only):

```
docker run -d --name phoss-smp-release-binary-xml-5.1.2 -p 8888:8080 phelger/smp:5.1.2
docker stop phoss-smp-release-binary-xml-5.1.2
docker rm phoss-smp-release-binary-xml-5.1.2
docker run -d --name phoss-smp-release-binary-xml-5.2.0 -p 8888:8080 phelger/smp:5.2.0
docker stop phoss-smp-release-binary-xml-5.2.0
docker rm phoss-smp-release-binary-xml-5.2.0
```

It exposes port 8888 where Tomcat is running successfully.
@@ -106,17 +130,17 @@ Open `http://localhost:8888` in your browser.

Short explanation on docker running
* `-d` - run in daemon mode
* `--name phoss-smp` - internal nice name for `docker ps` etc.
* `--name phoss-smp` - internal nice name for `docker ps`, `docker logs` etc.
* `-p 8888:8080` - proxy container port 8080 to host port 8888
* `phoss-smp` - the tag to be run

Upon successful completion opening http://localhost:8888 in your browser should show you the start page of phoss SMP.

Default credentials are in the Wiki at https://github.com/phax/phoss-smp/wiki/Running#default-login

The data directory inside the Docker image, where the data is stored is usually `/home/git/conf`.
The data directory inside the Docker image where the data is usually stored is `/home/git/conf`.

To check the log file use `docker logs phoss-smp`. There is no catalina.out file - only a catalina.out.yyyy-mm-dd.
To check the log file use `docker logs phoss-smp`. There is no `catalina.out` file - only a `catalina.out.yyyy-mm-dd`.

To open a shell in the docker image use `docker exec -it phoss-smp-snapshot-from-source-xml bash` where `phoss-smp-snapshot-from-source-xml` is the name of the machine.

@@ -133,6 +157,8 @@ docker push phelger/smp:latest
docker logout
```

See file `build-release-latest.cmd` for the effectice build script.

## SMP file storage

### Referencing configuration files
@@ -16,29 +16,91 @@
@REM

@echo off
set XVER=5.1.2
set XVER=5.2.0

@REM --------------- Building -----------------------

docker pull tomcat:9-jre11
if errorlevel 1 goto end

@REM --------------- XML -----------------------

docker build --build-arg SMP_VERSION=%XVER% -t phoss-smp-release-binary-xml-%XVER% -f Dockerfile-release-binary-xml .
if errorlevel 1 goto end

@REM legacy names

docker tag phoss-smp-release-binary-xml-%XVER% phelger/smp:%XVER%
if errorlevel 1 goto end

docker tag phoss-smp-release-binary-xml-%XVER% phelger/smp:latest
if errorlevel 1 goto end

@REM new names

docker tag phoss-smp-release-binary-xml-%XVER% phelger/phoss-smp-xml:%XVER%
if errorlevel 1 goto end

docker tag phoss-smp-release-binary-xml-%XVER% phelger/phoss-smp-xml:latest
if errorlevel 1 goto end

@REM --------------- SQL -----------------------

docker build --build-arg SMP_VERSION=%XVER% -t phoss-smp-release-binary-sql-%XVER% -f Dockerfile-release-binary-sql .
if errorlevel 1 goto end

docker tag phoss-smp-release-binary-sql-%XVER% phelger/phoss-smp-sql:%XVER%
if errorlevel 1 goto end

docker tag phoss-smp-release-binary-sql-%XVER% phelger/phoss-smp-sql:latest
if errorlevel 1 goto end

@REM --------------- MongoDB -----------------------

docker build --build-arg SMP_VERSION=%XVER% -t phoss-smp-release-binary-mongodb-%XVER% -f Dockerfile-release-binary-mongodb .
if errorlevel 1 goto end

docker tag phoss-smp-release-binary-mongodb-%XVER% phelger/phoss-smp-mongodb:%XVER%
if errorlevel 1 goto end

docker tag phoss-smp-release-binary-mongodb-%XVER% phelger/phoss-smp-mongodb:latest
if errorlevel 1 goto end

@REM --------------- Pushing -----------------------

docker login
if errorlevel 1 goto end

@REM --------------- XML -----------------------

docker push phelger/smp:%XVER%
if errorlevel 1 goto end

docker push phelger/smp:latest
if errorlevel 1 goto end

docker push phelger/phoss-smp-xml:%XVER%
if errorlevel 1 goto end

docker push phelger/phoss-smp-xml:latest
if errorlevel 1 goto end

@REM --------------- SQL -----------------------

docker push phelger/phoss-smp-sql:%XVER%
if errorlevel 1 goto end

docker push phelger/phoss-smp-sql:latest
if errorlevel 1 goto end

@REM --------------- MongoDB -----------------------

docker push phelger/phoss-smp-mongodb:%XVER%
if errorlevel 1 goto end

docker push phelger/phoss-smp-mongodb:latest
if errorlevel 1 goto end

docker logout
if errorlevel 1 goto end

@@ -116,7 +116,7 @@
lineinfile: dest="{{tomcat_dir}}/conf/catalina.properties" regexp="^peppol.pd.client.properties.path=" line="peppol.pd.client.properties.path={{tomcat_dir}}/conf/pdclient.properties"

- name: Clone the phoss SMP Server in {{ sources_dir }}/phoss-smp
git: repo=https://github.com/phax/phoss-smp.git dest={{ sources_dir }}/phoss-smp version=phoss-smp-parent-pom-5.1.2
git: repo=https://github.com/phax/phoss-smp.git dest={{ sources_dir }}/phoss-smp version=phoss-smp-parent-pom-5.2.0
register: smp_result

- name: Build SMP Server from {{ sources_dir }}/phoss-smp
@@ -127,7 +127,7 @@
chdir: "{{ sources_dir }}/phoss-smp"

- name: Deploy SMP Server to tomcat
copy: src="{{ sources_dir }}/phoss-smp/phoss-smp-webapp-xml/target/phoss-smp-webapp-xml-5.1.2.war" dest="{{tomcat_dir}}/webapps/ROOT.war"
copy: src="{{ sources_dir }}/phoss-smp/phoss-smp-webapp-xml/target/phoss-smp-webapp-xml-5.2.0.war" dest="{{tomcat_dir}}/webapps/ROOT.war"

- name: Copy SMP Keystore to tomcat
copy: src="{{smp_keystore}}" dest="{{smp_keystore_path}}" mode=0600 backup=yes

0 comments on commit bab60d3

Please sign in to comment.
You can’t perform that action at this time.