Fix initialization scripts for docker

This commit is contained in:
Paulo Gustavo Veiga 2022-01-23 14:55:07 -08:00
parent f25a1279a3
commit 058bb4ef1c
5 changed files with 29 additions and 14 deletions

View File

@ -5,8 +5,11 @@
FROM tomcat:9.0-jdk17-openjdk FROM tomcat:9.0-jdk17-openjdk
LABEL maintainer="Paulo Gustavo Veiga <pveiga@wisemapping.com>" LABEL maintainer="Paulo Gustavo Veiga <pveiga@wisemapping.com>"
#Build variables ... # Build variables ...
ARG WEBAPP_TARGET_DIR="/usr/local/tomcat/webapps/ROOT" ARG WEBAPP_TARGET_DIR="/usr/local/tomcat/webapps/ROOT"
# Defautl ENV configurations ...
ENV JAVA_OPTS="-XX:+PrintFlagsFinal -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80"
ENV database.base.url="/var/wisemapping" ENV database.base.url="/var/wisemapping"
# Copy wisemapping distribution ... # Copy wisemapping distribution ...

View File

@ -9,33 +9,39 @@ There are multiple ways to run WiseMapping depending on your database configurat
## Option 1: Running HSQL within the image storage ## Option 1: Running HSQL within the image storage
> docker run -it --rm -p 8888:8080 wisemapping > docker run -it --rm -p 8080:8080 veigap/wisemapping:latest>
Then, open your browser at `http://localhost:8888`. A default user is available for testing `test@wisemapping.com` and password `test`. Then, open your browser at `http://localhost:8888`. A default user is available for testing `test@wisemapping.com` and password `test`.
***This option, all changes will be lost once the image is stopped. Use it for testing only *** ***This option, all changes will be lost once the image is stopped. Use it for testing only***
## Option 2: Running HSQL with mounted directory ## Option 2: Running HSQL with mounted directory
> docker run -it --rm -p 8888:8080 wisemapping > docker run -it --rm -p 8080:8080 veigap/wisemapping:latest
## Option 3: External MySQL/PostgreSQL ## Option 3: External MySQL/PostgreSQL
### Setup database ### Setup database
Depending on the database your want to configure, you can create initialization scripts [here](https://bitbucket.org/wisemapping/wisemapping-open-source/src/develop/config/database/)
### Configure application properties ### Configure application properties
The next step is configure the WiseMapping for the database and credentials. The next step is configure the WiseMapping for the database and credentials.
Download `app.properties` configuration file and configure the required sections: Download `app.properties` configuration file and configure the required sections:
`curl https://bitbucket.org/wisemapping/wisemapping-open-source/raw/644b7078d790220c7844b732a83d45495f11d64e/wise-webapp/src/main/webapp/WEB-INF/app.properties` > $ curl https://bitbucket.org/wisemapping/wisemapping-open-source/raw/644b7078d790220c7844b732a83d45495f11d64e/wise-webapp/src/main/webapp/WEB-INF/app.properties'
### Starting the application ### Starting the application
Run the application mounting your previously configured `app.properties` Run the application mounting your previously configured `app.properties`
> docker run --mount type=bind,source=<your-file-path>/app.properties,target=/usr/local/tomcat/webapps/ROOT/classes/app.properties -it --rm -p 8888:8080 wisemapping > $ docker run --mount type=bind,source=your-file-path/app.properties,target=/usr/local/tomcat/webapps/ROOT/WEB-INF/app.properties -it --rm -p 8080:8080 veigap/wisemapping:latest
# Advanced configuration # Advanced configuration
> docker run --mount type=bind,source=/Users/veigap/repos/wisemapping-open-source/distribution/app.properties,target=/usr/local/tomcat/webapps/ROOT/classes/app.properties -it --rm -p 8888:8080 wisemapping ## Increase Tomcat memory
> docker run\
> --mount type=bind,source<your-file-path/app.properties,target=/usr/local/tomcat/webapps/ROOT/classes/app.properties
> -m 1.5GB -e JAVA_OPTS=" -XX:+PrintFlagsFinal -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80"
> -it --rm -p 8888:8080 veigap/wisemapping:latest

View File

@ -3,4 +3,5 @@
set -o set -o
set -u set -u
docker build -t wisemapping -f ./Dockerfile ../wise-webapp/target/ mvn -f ../pom.xml clean package
docker build -t veigap/wisemapping:latest -f ./Dockerfile ../wise-webapp/target/

View File

@ -29,11 +29,11 @@
<mkdir dir="target/wisemapping-mindplot"/> <mkdir dir="target/wisemapping-mindplot"/>
<exec executable="npm" dir="target"> <exec executable="npm" dir="target">
<arg value="pack"/> <arg value="pack"/>
<arg value="@wisemapping/mindplot@0.4.15"/> <arg value="@wisemapping/mindplot@5.0.1"/>
</exec> </exec>
<exec executable="tar" dir="target"> <exec executable="tar" dir="target">
<arg value="-xvzf"/> <arg value="-xvzf"/>
<arg value="wisemapping-mindplot-0.4.15.tgz"/> <arg value="wisemapping-mindplot-5.0.1.tgz"/>
<arg value="-C"/> <arg value="-C"/>
<arg value="wisemapping-mindplot"/> <arg value="wisemapping-mindplot"/>
</exec> </exec>
@ -42,11 +42,11 @@
<mkdir dir="target/wisemapping-webapp"/> <mkdir dir="target/wisemapping-webapp"/>
<exec executable="npm" dir="target"> <exec executable="npm" dir="target">
<arg value="pack"/> <arg value="pack"/>
<arg value="@wisemapping/webapp@0.4.9"/> <arg value="@wisemapping/webapp@5.0.1"/>
</exec> </exec>
<exec executable="tar" dir="target"> <exec executable="tar" dir="target">
<arg value="-xvzf"/> <arg value="-xvzf"/>
<arg value="wisemapping-webapp-0.4.9.tgz"/> <arg value="wisemapping-webapp-5.0.1.tgz"/>
<arg value="-C"/> <arg value="-C"/>
<arg value="wisemapping-webapp"/> <arg value="wisemapping-webapp"/>
</exec> </exec>

View File

@ -9,8 +9,13 @@
<property name="url" value="${database.url}"/> <property name="url" value="${database.url}"/>
<property name="username" value="${database.username}"/> <property name="username" value="${database.username}"/>
<property name="password" value="${database.password}"/> <property name="password" value="${database.password}"/>
<property name="testOnBorrow" value="${database.validation.enabled}"/> <property name="testOnBorrow" value="${database.validation.enabled:true}"/>
<property name="validationQuery" value="${database.validation.query}"/> <property name="defaultQueryTimeout" value="15"/>
<property name="maxTotal" value="100"/>
<property name="maxIdle" value="30"/>
<property name="initialSize" value="5"/>
<property name="maxWaitMillis" value="10000"/>
<property name="validationQuery" value="${database.validation.query:SELECT 1}"/>
</bean> </bean>
<!-- Optional configuration for external connexion pool --> <!-- Optional configuration for external connexion pool -->