From 3c9f230513c759ff6927a9c050b7fb3d04a08ffe Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Tue, 14 May 2019 15:24:12 +0200 Subject: [PATCH 1/6] add Dockerfile --- .dockerignore | 3 +++ Dockerfile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ entrypoint.sh | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 entrypoint.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4cb9249 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.gradle/ +build/ +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..053ca21 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,49 @@ +# First step: build the war file +FROM gradle:5.4 as builder + +WORKDIR /home/gradle/dhconvalidator +USER root:root +COPY . . +RUN gradle war + +# step 2: run the application server +FROM jetty:alpine + +#base_url=http://adho.org/dhconvalidator-2018 +#paperProviderClass=org.adho.dhconvalidator.conftool.ConfToolClient +#userProviderClass=org.adho.dhconvalidator.conftool.ConfToolClient +ENV dhconvalidator_base_url=http://localhost:8080/dhconv, \ + dhconvalidator_conftool_login_url=https://www.conftool.pro/dh2018/ \ + dhconvalidator_conftool_rest_url=https://www.conftool.pro/dh2018/rest.php \ + dhconvalidator_conftool_shared_pass=quae4EeCh8iepaisoay2gei9wai3Eiz5uyaig1Daisie5ho4caxab8ahraeChaiz \ + dhconvalidator_defaultSubmissionLanguage=ENGLISH \ + dhconvalidator_encodingDesc='' \ + dhconvalidator_html_address_generation=true \ + dhconvalidator_html_to_xml_link=true \ + dhconvalidator_image_min_resolution_height=50 \ + dhconvalidator_image_min_resolution_width=800 \ + dhconvalidator_logConversionStepOutput=false \ + dhconvalidator_oxgarage_url=http://www.tei-c.org/ege-webservice/ \ + dhconvalidator_paperProviderClass=org.adho.dhconvalidator.demo.DemoPaperProvider \ + dhconvalidator_performSchemaValidation=true \ + dhconvalidator_publicationStmt='Name, Institution
StreetCityCountryName
' \ + dhconvalidator_showOnlyAcceptedPapers=false \ + dhconvalidator_showOnlyAcceptedUsers=false \ + dhconvalidator_tei_image_location=/Pictures \ + dhconvalidator_templateFileDE=template/DH_template_DH2018_en \ + dhconvalidator_templateFileEN=template/DH_template_DH2018_en \ + dhconvalidator_templateFileES=template/DH_template_DH2018_es \ + dhconvalidator_userProviderClass=org.adho.dhconvalidator.demo.DemoUserProvider + +COPY --from=builder /home/gradle/dhconvalidator/build/libs/*.war /tmp/ +COPY entrypoint.sh /entrypoint.sh + +USER root:root +RUN mkdir -p ${JETTY_BASE}/webapps/ROOT \ + && unzip /tmp/*.war -d ${JETTY_BASE}/webapps/ROOT \ + && chown -R jetty:jetty ${JETTY_BASE}/webapps/ROOT + +USER jetty:jetty + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["java","-jar","/usr/local/jetty/start.jar"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..34a81ca --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +cat < ${JETTY_BASE}/webapps/ROOT/dhconvalidator.properties +#base_url=http://adho.org/dhconvalidator-2018 +base_url=${dhconvalidator_base_url} +conftool_login_url=${dhconvalidator_conftool_login_url} +conftool_rest_url=${dhconvalidator_conftool_rest_url} +conftool_shared_pass=${dhconvalidator_conftool_shared_pass} +defaultSubmissionLanguage=${dhconvalidator_defaultSubmissionLanguage} +encodingDesc=${dhconvalidator_encodingDesc} +html_address_generation=${dhconvalidator_html_address_generation} +html_to_xml_link=${dhconvalidator_html_to_xml_link} +image_min_resolution_height=${dhconvalidator_image_min_resolution_height} +image_min_resolution_width=${dhconvalidator_image_min_resolution_width} +logConversionStepOutput=${dhconvalidator_logConversionStepOutput} +oxgarage_url=${dhconvalidator_oxgarage_url} +#paperProviderClass=org.adho.dhconvalidator.conftool.ConfToolClient +paperProviderClass=${dhconvalidator_paperProviderClass} +performSchemaValidation=${dhconvalidator_performSchemaValidation} +publicationStmt=${dhconvalidator_publicationStmt} +showOnlyAcceptedPapers=${dhconvalidator_showOnlyAcceptedPapers} +showOnlyAcceptedUsers=${dhconvalidator_showOnlyAcceptedUsers} +tei_image_location=${dhconvalidator_tei_image_location} +templateFileDE=${dhconvalidator_templateFileDE} +templateFileEN=${dhconvalidator_templateFileEN} +templateFileES=${dhconvalidator_templateFileES} +#userProviderClass=org.adho.dhconvalidator.conftool.ConfToolClient +userProviderClass=${dhconvalidator_userProviderClass} +version=1.22 +EOF + +# run the command given in the Dockerfile at CMD +exec /docker-entrypoint.sh \ No newline at end of file From adf77ae9dcbb37a6d8ce7dc1a7ea5f8270531e8a Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Fri, 17 May 2019 17:20:57 +0200 Subject: [PATCH 2/6] adjust some defaults --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 053ca21..220a767 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ FROM jetty:alpine #base_url=http://adho.org/dhconvalidator-2018 #paperProviderClass=org.adho.dhconvalidator.conftool.ConfToolClient #userProviderClass=org.adho.dhconvalidator.conftool.ConfToolClient -ENV dhconvalidator_base_url=http://localhost:8080/dhconv, \ +ENV dhconvalidator_base_url=http://localhost:8080/dhconv \ dhconvalidator_conftool_login_url=https://www.conftool.pro/dh2018/ \ dhconvalidator_conftool_rest_url=https://www.conftool.pro/dh2018/rest.php \ dhconvalidator_conftool_shared_pass=quae4EeCh8iepaisoay2gei9wai3Eiz5uyaig1Daisie5ho4caxab8ahraeChaiz \ @@ -23,14 +23,14 @@ ENV dhconvalidator_base_url=http://localhost:8080/dhconv, \ dhconvalidator_image_min_resolution_height=50 \ dhconvalidator_image_min_resolution_width=800 \ dhconvalidator_logConversionStepOutput=false \ - dhconvalidator_oxgarage_url=http://www.tei-c.org/ege-webservice/ \ + dhconvalidator_oxgarage_url=https://oxgarage.tei-c.org/ege-webservice/ \ dhconvalidator_paperProviderClass=org.adho.dhconvalidator.demo.DemoPaperProvider \ dhconvalidator_performSchemaValidation=true \ dhconvalidator_publicationStmt='Name, Institution
StreetCityCountryName
' \ dhconvalidator_showOnlyAcceptedPapers=false \ dhconvalidator_showOnlyAcceptedUsers=false \ dhconvalidator_tei_image_location=/Pictures \ - dhconvalidator_templateFileDE=template/DH_template_DH2018_en \ + dhconvalidator_templateFileDE=template/DH_template_DH2018_de \ dhconvalidator_templateFileEN=template/DH_template_DH2018_en \ dhconvalidator_templateFileES=template/DH_template_DH2018_es \ dhconvalidator_userProviderClass=org.adho.dhconvalidator.demo.DemoUserProvider From fbfd7d6cfcee9a930775d011484db28a4055949d Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Fri, 17 May 2019 17:21:34 +0200 Subject: [PATCH 3/6] add some comments --- entrypoint.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 34a81ca..c8eef06 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,11 @@ +# this is a Docker entrypoint script that will be executed +# for each start of a container based on that image. +# +# the purpose here is simply to overwrite the settings in +# `dhconvalidator.properties` with parameters provided +# on the command line, e.g. +# `docker run -e dhconvalidator_base_url=http://my.dhconvalidator.base.url …` + #!/bin/sh cat < ${JETTY_BASE}/webapps/ROOT/dhconvalidator.properties @@ -29,5 +37,5 @@ userProviderClass=${dhconvalidator_userProviderClass} version=1.22 EOF -# run the command given in the Dockerfile at CMD -exec /docker-entrypoint.sh \ No newline at end of file +# run the original jetty entrypoint script (from the jetty base image) +exec /docker-entrypoint.sh From f5facaa8745b892c38f9d9e050d188396ff8396f Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Mon, 20 May 2019 10:20:18 +0200 Subject: [PATCH 4/6] add information for running with Docker --- README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 856fe9e..cb37e8c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [ADHO/dhconvalidator](https://github.com/ADHO/dhconvalidator) The goal of the DHConvalidator is a simplification of the creation of a -consistent [TEI] (http://www.tei-c.org) text base of Digital Humanities +consistent [TEI](http://www.tei-c.org) text base of Digital Humanities (DH) conference abstracts for further processing like the generation of the book of abstracts. The idea was to offer the user the possibility to edit the final version of the submission with her tool of choice @@ -12,8 +12,8 @@ starting with two of the most popular systems Libre Office and Microsoft Word. The DHConvalidator works together with the conference management tool -[ConfTool] (http://www.conftool.net/) and uses [OxGarage] -(http://www.tei-c.org/oxgarage/) to do the bulk conversion. +[ConfTool](http://www.conftool.net/) and +uses [OxGarage](https://oxgarage.tei-c.org/) to do the bulk conversion. The submission of the final version is composed of four steps after logging in: @@ -40,8 +40,8 @@ create a WAR file yourself and extract it to a Servlet container (Jetty Copy the dhconvalidator.properties.example to dhconvalidator.properties and edit it as needed: - Set the ConfTool REST interface settings like URL and shared password. -- Set the OxGarage webservice URL (Note that the dhconvalidator -- TEI/Stylesheets profile must be installed for the OxGarage webservice) +- Set the OxGarage webservice URL (Note that the dhconvalidator + TEI/Stylesheets profile must be installed for the OxGarage webservice) - Edit settings for validation, min resolution, publication statement - and so on. @@ -57,3 +57,54 @@ the host site: To avoid cross site scripting issues the domain should be the same as the domain of the host site. + +## Docker + +### Building the image + +With Docker installed, simply enter +```bash +docker build -t dhconvalidator . +``` + +### Running a container + +To run the 'dhconvalidator' image you created in the step above enter +```bash +docker run -d --rm -p8080:8080 --name dhconvalidator dhconvalidator +``` +This will spin up a container with the default settings, making +the DHConvalidator instance available at `http://localhost:8080/dhconv`. + +#### Parameters (and default values) available to the Docker container + +* dhconvalidator_base_url=`http://localhost:8080/dhconv` +* dhconvalidator_conftool_login_url=`https://www.conftool.pro/dh2018/` +* dhconvalidator_conftool_rest_url=`https://www.conftool.pro/dh2018/rest.php` +* dhconvalidator_conftool_shared_pass=`some_password` +* dhconvalidator_defaultSubmissionLanguage=`ENGLISH` +* dhconvalidator_encodingDesc=`''` +* dhconvalidator_html_address_generation=`true` +* dhconvalidator_html_to_xml_link=`true` +* dhconvalidator_image_min_resolution_height=`50` +* dhconvalidator_image_min_resolution_width=`800` +* dhconvalidator_logConversionStepOutput=`false` +* dhconvalidator_oxgarage_url=`https://oxgarage.tei-c.org/ege-webservice/` +* dhconvalidator_paperProviderClass=`org.adho.dhconvalidator.demo.DemoPaperProvider` +* dhconvalidator_performSchemaValidation=`true` +* dhconvalidator_publicationStmt=`'Name, Institution
StreetCityCountryName
'` +* dhconvalidator_showOnlyAcceptedPapers=`false` +* dhconvalidator_showOnlyAcceptedUsers=`false` +* dhconvalidator_tei_image_location=`/Pictures` +* dhconvalidator_templateFileDE=`template/DH_template_DH2018_de` +* dhconvalidator_templateFileEN=`template/DH_template_DH2018_en` +* dhconvalidator_templateFileES=`template/DH_template_DH2018_es` +* dhconvalidator_userProviderClass=`org.adho.dhconvalidator.demo.DemoUserProvider` + +You can overwrite the default settings via environment variables, e.g. +```bash +docker run -d --rm -p8080:8080 --name dhconvalidator -e dhconvalidator_base_url=http://my.dhconvalidator.base.url dhconvalidator +``` +will set the base url to `http://my.dhconvalidator.base.url`. + + \ No newline at end of file From e38743a0f0afe426b87fd5d529748b7391c387b0 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Tue, 21 May 2019 09:27:48 +0200 Subject: [PATCH 5/6] fix entrypoint script --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index c8eef06..e1f7fa7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,5 @@ +#!/bin/sh + # this is a Docker entrypoint script that will be executed # for each start of a container based on that image. # @@ -6,8 +8,6 @@ # on the command line, e.g. # `docker run -e dhconvalidator_base_url=http://my.dhconvalidator.base.url …` -#!/bin/sh - cat < ${JETTY_BASE}/webapps/ROOT/dhconvalidator.properties #base_url=http://adho.org/dhconvalidator-2018 base_url=${dhconvalidator_base_url} From 2599373ea9687fb1135e8a9913360ed61462a667 Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Tue, 21 May 2019 09:28:18 +0200 Subject: [PATCH 6/6] provide information about docker-compose and a dedicated OxGarage side kick --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cb37e8c..e5d9ad6 100644 --- a/README.md +++ b/README.md @@ -107,4 +107,31 @@ docker run -d --rm -p8080:8080 --name dhconvalidator -e dhconvalidator_base_url= ``` will set the base url to `http://my.dhconvalidator.base.url`. - \ No newline at end of file +### Docker-compose with OxGarage sidekick + +`docker-compose` allows you to easily run your own dedicated OxGarage +instance as a sidekick to the DHConvalidator. + +``` +version: '3' + +services: + dhconvalidator: + image: dhconvalidator + restart: always + ports: + - "8080:8080" + environment: + dhconvalidator_base_ur: http://localhost:8080 + dhconvalidator_oxgarage_url: http://oxgarage:8080/ege-webservice/ + oxgarage: + image: teic/oxgarage + restart: always + environment: + WEBSERVICE_URL: http://localhost:8080/ege-webservice/ + volumes: + - /your/path/to/TEI/P5:/usr/share/xml/tei/odd:ro + - /your/path/to/Stylesheets:/usr/share/xml/tei/stylesheet:ro +``` +NB: You need to provide your own copy of the TEI sources and Stylesheets! (see +https://github.com/TEIC/oxgarage for more details on how to run that container) \ No newline at end of file