Skip to content

Commit 8d4e73b

Browse files
committed
Merge branch 'release/B4.8.0_F6.4.0'
2 parents 5545798 + 455b9e6 commit 8d4e73b

File tree

7 files changed

+171
-117
lines changed

7 files changed

+171
-117
lines changed

README.md

Lines changed: 94 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ The following components are part of this system:
1212
- [Table Of Contents](#table-of-contents)
1313
- [Dependencies](#dependencies)
1414
- [Building](#building)
15-
- [Updating](#updating)
16-
- [Additional Backend Plugins](#additional-backend-plugins)
17-
- [Multiple Instances](#multiple-instances)
18-
- [SSH Firewalled Servers](#ssh-firewalled-servers)
15+
- [Updating](#updating)
16+
- [Additional Backend Plugins](#additional-backend-plugins)
17+
- [Multiple Instances](#multiple-instances)
18+
- [SSH Firewalled Servers](#ssh-firewalled-servers)
1919
- [Run Environment](#run-environment)
20+
- [Postgres service](#postgres-service)
21+
- [Mauro Data Mapper service](#mauro-data-mapper-service)
22+
- [build.yml File](#configbuildyml-file)
23+
- [runtime.yml File](#configruntimeyml-file)
2024
- [Environment Notes](#environment-notes)
2125
- [Migrating from Metadata Catalogue](#migrating-from-metadata-catalogue)
2226
- [Docker](#docker)
@@ -167,72 +171,111 @@ script once per server.
167171
168172
Some servers have the 22 SSH port firewalled for external connections. If this is the case you can change the `base_images/sdk_base/ssh/config` file,
169173
170-
* comment out the `Hostname` field thats currently active * uncomment both commented out `Hostname` and `Port` fields, this will allow git to work
171-
using the 443 port which will not be blocked.
174+
* comment out the `Hostname` field thats currently active * uncomment both commented out `Hostname` and `Port` fields, this will allow git to work using the 443 port which
175+
will not be blocked.
176+
172177
---
173178
174179
## Run Environment
175180
176-
### postgres service
181+
By adding variables to the `<service>.environment` section of the docker-compose.yml file you can pass them into the container as environment variables. These will override
182+
any existing configuration variables which are used by default. Any defaults and normally used environment variables can be found in the relevant service's Dockerfile at
183+
the `ENV` command.
177184
178-
*Please see `postgres/Dockerfile` for all defaults*
185+
### postgres service
179186
180187
* `POSTGRES_PASSWORD` - This sets the postgres user password for the service, as per the documentation at
181-
[Postgres Docker Hub](https://hub.docker.com/_/postgres), it must be set for a docker postgres container. We have set a default but you can override
182-
if desired. If you do override it, you will also need to change the `PGPASSWORD` env variable in the mauro-data-mapper section.
183-
* `DATABASE_USERNAME` - This is the username which will be created inside the Postgres instance to own the database which the MDM service will use.
184-
The username is also used by the MDM service to connect to the postgres instance, therefore if you change this you *MUST* also supply it in the
185-
environment args for the MDM service
186-
* `DATABASE_PASSWORD` - This is the password set for the `DATABASE_USERNAME`. It is the password used by the MDM service to connect to this postgres
187-
container.
188+
[Postgres Docker Hub](https://hub.docker.com/_/postgres), it must be set for a docker postgres container. We have set a default but you can override if desired. If you do
189+
override it, you will also need to change the `PGPASSWORD` env variable in the mauro-data-mapper section.
190+
* `DATABASE_USERNAME` - This is the username which will be created inside the Postgres instance to own the database which the MDM service will use. The username is also used
191+
by the MDM service to connect to the postgres instance, therefore if you change this you *MUST* also supply it in the environment args for the MDM service
192+
* `DATABASE_PASSWORD` - This is the password set for the `DATABASE_USERNAME`. It is the password used by the MDM service to connect to this postgres container.
188193
189194
### mauro-data-mapper service
190195
191-
*Please see `mauro-data-mapper/Dockerfile` for all defaults*
196+
Any grails configuration property found in any of the plugin.yml or application.yml files can be overridden through environment variables. They simply need to be provided in
197+
the "dot notation" form rather than the "YML new line" format.
198+
199+
e.g. application.yml
200+
201+
```yml
202+
database:
203+
host: localhost
204+
```
205+
206+
would be overridden by docker-compose.yml
207+
208+
```yml
209+
services:
210+
mauro-data-mapper:
211+
environment:
212+
database.host: another-host
213+
214+
```
215+
216+
However to make life simpler and to avoid too many variables in the docker-compose.yml file we have supplied 2 additional methods of overriding the defaults. This replaces all
217+
of the previous releases environment variables setting in docker-compose.yml.
218+
219+
The preference order for loaded sources of properties is
220+
221+
1. Environment Variables
222+
2. runtime.yml
223+
3. build.yml
224+
4. application.yml
225+
5. plugin.yml - there are multiple versions of these as each plugin we build may supply their own
226+
227+
#### config/build.yml File
228+
229+
The build.yml file is built into the MDM service when the image is built and is a standard grails configuration file. Therefore any properties which can be safely set at build
230+
time for the image should be set into this file. This includes any properties which may be shared between multiple instances of MDM which all start from the same image.
192231
193-
### Required to be overridden
232+
Our recommendation is that if only running 1 instance of MDM from 1 cloned repository then you should load all your properties into the build.yml file. For this reason we have
233+
supplied the build.yml file with all the properties which we either require to be overridden or expect may want to be overridden.
194234
195-
The following variables need to be overriden/set when starting up a new mauro-data-mapper image. Usually this is done in the docker-compose.yml file.
196-
It should not be done in the Dockerfile as each instance which starts up may use different values.
235+
#### config/runtime.yml File
197236
198-
* `MDM_FQ_HOSTNAME` - The FQDN of the server where the catalogue will be accessed
199-
* `MDM_PORT` - The port used to access the catalogue
200-
* `MDM_AUTHORITY_URL` - The full URL to the location of the catalogue. This is considered a unique identifier to distinguish any instance from
201-
another and therefore no 2 instances should use the same URL.
202-
* `MDM_AUTHORITY_NAME` - A unique name used to distinguish a running MDM instance.
203-
* `EMAIL_USERNAME` - To allow the catalogue to send emails this needs to be a valid username for the `EMAIL_HOST`
204-
* `EMAIL_PASSWORD` - To allow the catalogue to send emails this needs to be a valid password for the `EMAIL_HOST` and `EMAIL_USERNAME`
205-
* `EMAIL_HOST` - This is the FQDN of the mail server to use when sending emails
237+
The runtime.yml file will be loaded into the container via the docker-compose.yml file. This is intended as the replacement for environment variable overrides, where each
238+
running container might have specifically set properties which differ from a common shared image.
239+
240+
**NOTE: Do not change the environment variable `runtime.config.path` as this denotes the path inside the container where the config file will be found**
241+
242+
#### Required to be overridden
243+
244+
The following variables need to be overriden/set when starting up a new mauro-data-mapper image. Usually this is done in the docker-compose.yml file. It should not be done in
245+
the Dockerfile as each instance which starts up may use different values.
246+
247+
* `grails.cors.allowedOrigins` - Should be set to a single FQDN URL which is the host where MDM will be accessed from. If using a proxy to break SSL then the origin would be
248+
the hostname where the proxy sits, not the host of the server running the docker containers. The origin must include the protocol, i.e. https or http
249+
* `maurodatamapper.authority.name` - The full URL to the location of the catalogue. This is considered a unique identifier to distinguish any instance from another and
250+
therefore no 2 instances should use the same URL.
251+
* `maurodatamapper.authority.url` - A unique name used to distinguish a running MDM instance.
252+
* `simplejavamail.smtp.username` - To allow the catalogue to send emails this needs to be a valid username for the `simplejavamail.smtp.host`
253+
* `simplejavamail.smtp.password` - To allow the catalogue to send emails this needs to be a valid password for the `simplejavamail.smtp.host`
254+
and `simplejavamail.smtp.username`
255+
* `simplejavamail.smtp.host` - This is the FQDN of the mail server to use when sending emails
206256
207257
### Optional
208258
209-
* `PGPASSWORD` - This is the postgres user's password for the postgres server. This is an environment variable set to allow the MDM service to
210-
wait till the postgres service has completely finished starting up. It is only used to confirm the Postgres server is running and databases exist.
211-
After this it is not used again. **If you change `POSTGRES_PASSWORD` you must change this to match**
212-
* `CATALINA_OPTS` - Java Opts to be passed to Tomcat
213-
* `DATABASE_HOST` - The host of the database. If using docker-compose this should be left as `postgres` or changed to the name of the database service
214-
* `DATABASE_PORT` - The port of the database
215-
* `DATABASE_NAME` - The name of the database which the catalogue data will be stored in
216-
* `DATABASE_USERNAME` - Username to use to connect to the database. See the Postgres service environment variables for more information.
217-
* `DATABASE_PASSWORD` - Password to use to connect to the database. See the Postgres service environment variables for more information.
218-
* `EMAIL_PORT` - The port to use when sending emails
219-
* `EMAIL_TRANSPORTSTRATEGY` - The transport strategy to use when sending emails
220-
* `SEARCH_INDEX_BASE` - The directory to store the lucene index files in
221-
* `EMAILSERVICE_URL` - The url to the special email service, this will result in the alternative email system being used
222-
* `EMAILSERVICE_USERNAME` - The username for the email service needs to be valid for `EMAIL_SERVICE_URL`
223-
* `EMAILSERVICE_PASSWORD` - The password for the email service needs to be valid for `EMAIL_SERVICE_URL`
259+
* `PGPASSWORD` - This is the postgres user's password for the postgres server. This is an environment variable set to allow the MDM service to wait till the postgres service
260+
has completely finished starting up. It is only used to confirm the Postgres server is running and databases exist. After this it is not used again. **If you
261+
change `POSTGRES_PASSWORD` you must change this to match**
262+
**This can ONLY be overridden in the docker-compose.yml file**
263+
* `CATALINA_OPTS` - Java Opts to be passed to Tomcat **This can ONLY be overridden in the docker-compose.yml file**
264+
* `database.host` - The host of the database. If using docker-compose this should be left as `postgres` or changed to the name of the database service
265+
* `database.port` - The port of the database
266+
* `database.name` - The name of the database which the catalogue data will be stored in
267+
* `dataSource.username` - Username to use to connect to the database. See the Postgres service environment variables for more information.
268+
* `dataSource.password` - Password to use to connect to the database. See the Postgres service environment variables for more information.
269+
* `simplejavamail.smtp.port` - The port to use when sending emails
270+
* `simplejavamail.smtp.transportstrategy` - The transport strategy to use when sending emails
271+
* `hibernate.search.default.indexBase` - The directory to store the lucene index files in
224272
225273
### Environment Notes
226274
227-
**Database** The system is designed to use the postgres service provided in the docker-compose file, therefore there should be no need to alter any of
228-
these settings. Only make alterations if running postgres as a separate service outside of docker-compose.
229-
230-
**MDM_FQ_HOSTNAME** & **MDM_PORT** The provided values will be used to define the CORS allowed origins. The port will be used to define http or https
231-
(443), if its not 80 or 443 then it will be added to the url generated. The host must be the host used in the web url when accessing the catalogue
232-
in a web browser.
275+
**Database** The system is designed to use the postgres service provided in the docker-compose file, therefore there should be no need to alter any of these settings. Only
276+
make alterations if running postgres as a separate service outside of docker-compose.
233277
234-
**Email** The standard email properties will allow emails to be sent to a specific SMTP server. The `emailservice` properties override this and
235-
send the email to the specified email service which will then forward it onto our email SMTP server.
278+
**Email** The standard email properties will allow emails to be sent to a specific SMTP server.
236279
237280
---
238281
@@ -330,7 +373,7 @@ We recommend adding the following lines to the appropriate bash profile file:
330373
331374
```bash
332375
alias docker-compose-dev="docker-compose -f docker-compose.yml -f docker-compose.dev.yml"
333-
alias docker-compose-prod="docker-compose -f docker-compose.yml -f docker-compose.dev.yml"
376+
alias docker-compose-prod="docker-compose -f docker-compose.yml -f docker-compose.prod.yml"
334377
```
335378
This will allow you to start compose in dev mode without all the extra file definitions
336379

docker-compose.dev.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

docker-compose.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,21 @@ services:
55
shm_size: 512mb
66
environment:
77
POSTGRES_PASSWORD: postgresisawesome
8-
#DATABASE_HOST: postgres
9-
#DATABASE_PORT: 5432
10-
#DATABASE_NAME: maurodatamapper
11-
#DATABASE_USERNAME: maurodatamapperuser
12-
#DATABASE_PASSWORD:
138
volumes:
149
- postgres12:/var/lib/postgresql/data
15-
restart: on-failure:3
10+
restart: on-failure
1611
mauro-data-mapper:
12+
image: 'maurodatamapper/mauro-data-mapper:B4.8.0_F6.4.0'
1713
build:
1814
context: mauro-data-mapper
1915
args:
20-
MDM_APPLICATION_COMMIT: 4.7.0
21-
MDM_UI_COMMIT: 6.3.1
16+
MDM_APPLICATION_COMMIT: 4.8.0
17+
MDM_UI_COMMIT: 6.4.0
2218
ADDITIONAL_PLUGINS: ""
2319
MDM_UI_THEME_NAME: "default"
2420
environment:
2521
PGPASSWORD: postgresisawesome
26-
#DATABASE_PASSWORD:
27-
MDM_FQ_HOSTNAME: localhost
28-
MDM_PORT: 8082
29-
MDM_AUTHORITY_URL: "http://localhost:8082"
30-
MDM_AUTHORITY_NAME: "mdm-docker"
31-
EMAIL_USERNAME: ""
32-
EMAIL_PASSWORD: ""
33-
EMAIL_HOST: "smtp.gmail.com"
22+
runtime.config.path: /usr/local/tomcat/conf/runtime.yml
3423
ports:
3524
- "8082:8080"
3625
depends_on:
@@ -39,7 +28,8 @@ services:
3928
- lucene_index:/lucene
4029
- ./shared_volumes/logs/maurodatamapper:/usr/local/tomcat/logs
4130
- ./shared_volumes/tmp:/tmp
42-
restart: on-failure:3
31+
- ./mauro-data-mapper/config/runtime.yml:/usr/local/tomcat/conf/runtime.yml
32+
restart: on-failure
4333
# Persistence capability to systems,
4434
# Any volumes labelled below will ensure persistence when containers removed unless the volume is removed as well
4535
volumes:

mauro-data-mapper/Dockerfile

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
ARG MDM_BASE_IMAGE_VERSION=grails-4.0.6-jdk12-node-14.16-npm-7.11
3-
ARG TOMCAT_IMAGE_VERSION=9.0.27-jdk12-adoptopenjdk-openj9
3+
ARG TOMCAT_IMAGE_VERSION=9.0.27-jdk12-adoptopenjdk-openj9.R2
44

55
FROM maurodatamapper/mdm_base:$MDM_BASE_IMAGE_VERSION AS mdm-build
66
LABEL maintainer="Oliver Freeman <oliver.freeman@bdi.ox.ac.uk>"
@@ -14,6 +14,8 @@ ARG MDM_UI_FEATURE_SUBSCRIBED_CATALOGUES="true"
1414
# If the arg is passed in using a random value then it will invalidate the docker cache and force the following steps to re-run
1515
ARG CACHE_BURST=1
1616

17+
ARG MDM_UI_URL=http://jenkins.cs.ox.ac.uk/artifactory/libs-release/uk/ac/ox/softeng/maurodatamapper/mdm-ui/${MDM_UI_COMMIT}/mdm-ui-${MDM_UI_COMMIT}.tgz
18+
1719
# Uncomment if needing to bypass a SSH firewall
1820
#COPY ssh/config "/root/.ssh/config"
1921
#RUN chmod 600 "/root/.ssh/config"
@@ -22,8 +24,22 @@ ARG CACHE_BURST=1
2224
RUN cd "$MDM_APPLICATION_HOME" && git fetch && git checkout "$MDM_APPLICATION_COMMIT" && if [[ `git status` != HEAD\ detached* ]]; then git pull; fi
2325
RUN cd "$MDM_UI_HOME" && git fetch && git checkout "$MDM_UI_COMMIT" && if [[ `git status` != HEAD\ detached* ]]; then git pull; fi
2426

27+
# Copy in build.yml
28+
COPY config/build.yml $MDM_APPLICATION_HOME/grails-app/conf/build.yml
29+
2530
# Build the front and back ends
26-
RUN build_frontend.sh
31+
# If performing a default release build for the UI then download the precompiled archive
32+
# Otherwise build manually
33+
RUN if [[ ${MDM_UI_THEME_NAME} != "default" || ${MDM_UI_COMMIT} == "develop" || ${MDM_UI_COMMIT} == "main" ]]; \
34+
then build_frontend.sh; \
35+
else cd /opt && \
36+
curl -LO $MDM_UI_URL && \
37+
tar xzf mdm-ui-${MDM_UI_COMMIT}.tgz && \
38+
mkdir $MDM_UI_BUILD_HOME && \
39+
cp -r mdm-ui-${MDM_UI_COMMIT}/* $MDM_UI_BUILD_HOME; \
40+
fi;
41+
# The only way to include plugins is to build the API manually, however this actually takes very little time as we already have all the
42+
# dependencies downloaded
2743
RUN copy_in_dependencies.sh $ADDITIONAL_PLUGINS
2844
RUN build_backend.sh
2945

@@ -39,28 +55,6 @@ LABEL maintainer="Oliver Freeman <oliver.freeman@bdi.ox.ac.uk>"
3955

4056
ARG MDM_BUILD_HOME=/opt/mdm
4157

42-
ENV CATALINA_OPTS="-Xmx8g -Xms512m -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+UseCompressedOops" \
43-
DATABASE_HOST=postgres \
44-
DATABASE_PORT=5432 \
45-
DATABASE_NAME=maurodatamapper \
46-
DATABASE_USERNAME=maurodatamapperuser \
47-
DATABASE_PASSWORD=jF80LQyP4BbH \
48-
EMAIL_USERNAME="" \
49-
EMAIL_PASSWORD="" \
50-
MDM_FQ_HOSTNAME=localhost \
51-
MDM_PORT=8080 \
52-
MDM_AUTHORITY_URL="" \
53-
MDM_AUTHORITY_NAME="" \
54-
EMAIL_HOST=smtp.gmail.com \
55-
EMAIL_PORT=587 \
56-
EMAIL_TRANSPORTSTRATEGY=SMTP_TLS \
57-
SEARCH_INDEX_BASE="/lucene" \
58-
LUCENE_REBUILD_ON_START=true \
59-
EMAILSERVICE_USERNAME="" \
60-
EMAILSERVICE_PASSWORD="" \
61-
EMAILSERVICE_URL=""
62-
63-
64-
COPY config/mauro-data-mapper.xml ${CATALINA_HOME}/conf/Catalina/localhost/ROOT.xml
58+
ENV CATALINA_OPTS="-Xmx8g -Xms512m -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+UseCompressedOops"
6559

6660
COPY --from=mdm-build ${MDM_BUILD_HOME} ${CATALINA_HOME}/webapps/ROOT

mauro-data-mapper/config/build.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
# Database connection details
3+
---
4+
database:
5+
host: postgres
6+
port: 5432
7+
name: maurodatamapper
8+
dataSource:
9+
username: maurodatamapperuser
10+
password: jF80LQyP4BbH
11+
---
12+
# MDM configuration properties
13+
---
14+
maurodatamapper:
15+
authority:
16+
name: 'Mauro Data Mapper'
17+
url: http://localhost
18+
---
19+
# Standard Email configuration
20+
---
21+
simplejavamail:
22+
smtp:
23+
username: ''
24+
password: ''
25+
host: smtp.gmail.com
26+
port: 587
27+
transportstrategy: SMTP_TLS
28+
---
29+
# mdm-plugin-email-proxy Configuration
30+
---
31+
#emailServiceUrl: ''
32+
#emailServiceUsername: ''
33+
#emailServicePassword: ''
34+
---
35+
# CORS
36+
# See http://docs.grails.org/latest/guide/theWebLayer.html#cors
37+
---
38+
grails:
39+
cors:
40+
enabled: true
41+
# The following are the defaults
42+
allowedOrigins: [ '*' ]
43+
allowedMethods: [ 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD' ]
44+
allowedHeaders: [ 'origin', 'content-type', 'accept', 'authorization', 'pragma', 'cache-control' ]
45+
#exposedHeaders: null
46+
#maxAge: 1800
47+
#allowCredentials: true
48+
hibernate:
49+
search:
50+
default:
51+
indexBase: '/lucene'

0 commit comments

Comments
 (0)