Extract conexion datapool
Please enter the commit message for your changes. Lines startingmain
parent
19354f4ec1
commit
f25a1279a3
|
@ -1,7 +1,7 @@
|
||||||
# Overview
|
# Overview
|
||||||
|
|
||||||
WiseMapping is a free web based *mind map* product. The goal of this project is to provide a high quality product that can be deployed by enterprises, educational and academic institutions.
|
Wise Mapping is the web mind mapping open source tool that leverages the power of Mind Maps mixing open standards technologies such as SVG and React.
|
||||||
WiseMapping is based on the same code product supporting http://www.wisemapping.com.
|
WiseMapping is based on the same code product supporting [http://www.wisemapping.com].
|
||||||
|
|
||||||
## Compiling and Running
|
## Compiling and Running
|
||||||
|
|
||||||
|
|
|
@ -1,84 +1,41 @@
|
||||||
This is an approach to compiling and installing wisemapping using docker and docker-compose.
|
# What is WiseMapping ?
|
||||||
|
|
||||||
In this way you can run the app without installing specific java, maven, tomcat and mysql versions in the host machine just for this project.
|
Wise Mapping is the web mind mapping open source tool that leverages the power of Mind Maps mixing open standards technologies such as SVG and React.
|
||||||
|
WiseMapping is based on the same code product supporting [http://www.wisemapping.com].
|
||||||
|
|
||||||
# Prerequisites
|
# How to use this image.
|
||||||
|
|
||||||
Make sure you have [docker](https://docs.docker.com/engine/install/) and [docker-compose](https://docs.docker.com/compose/install/) installed. You might also want to [run docker without sudo](https://docs.docker.com/engine/install/linux-postinstall/) if you are on linux.
|
There are multiple ways to run WiseMapping depending on your database configuration preference
|
||||||
|
|
||||||
# Compile wisemapping using docker
|
## Option 1: Running HSQL within the image storage
|
||||||
|
|
||||||
This is not required to run the app using docker. You might skip this section if you already have the `war` file or if you want to compile it by yourself.
|
> docker run -it --rm -p 8888:8080 wisemapping
|
||||||
|
|
||||||
We create a volume so the downloaded packages can be reused across different containers (a new container is created each time we run the image). This is run only once.
|
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 ***
|
||||||
docker volume create --name maven-repo-wisemapping
|
|
||||||
```
|
|
||||||
|
|
||||||
Then we can run the following command from the project root:
|
## Option 2: Running HSQL with mounted directory
|
||||||
|
|
||||||
```
|
> docker run -it --rm -p 8888:8080 wisemapping
|
||||||
docker run -it --rm --name wisemapping-compile \
|
|
||||||
-v maven-repo-wisemapping:/root/.m2 \
|
|
||||||
-v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3-jdk-11 \
|
|
||||||
mvn clean install -DskipTests
|
|
||||||
```
|
|
||||||
|
|
||||||
After that, you can find the result of the compilation in `wise-webapp/target/wisemapping.war`.
|
## Option 3: External MySQL/PostgreSQL
|
||||||
|
|
||||||
# Run using docker-compose
|
### Setup database
|
||||||
|
|
||||||
## Edit config
|
### Configure application properties
|
||||||
|
|
||||||
### app.properties
|
The next step is configure the WiseMapping for the database and credentials.
|
||||||
|
Download `app.properties` configuration file and configure the required sections:
|
||||||
|
|
||||||
First of all, edit your `wise-webapp/src/main/webapp/WEB-INF/app.properties` to configure the app to use mysql.
|
`curl https://bitbucket.org/wisemapping/wisemapping-open-source/raw/644b7078d790220c7844b732a83d45495f11d64e/wise-webapp/src/main/webapp/WEB-INF/app.properties`
|
||||||
|
|
||||||
- Uncomment the `MySQL 5.X configuration properties` section
|
### Starting the application
|
||||||
- Change the `database.url` line to this: `database.url=jdbc:mysql://db/wisemapping?useUnicode=yes&characterEncoding=UTF-8` (the host is "db" instead of "localhost")
|
|
||||||
- Change the default username and password
|
|
||||||
- Comment the `HSQL Configuration properties` section
|
|
||||||
|
|
||||||
> Any time you make any config modification, you will have to re-compile the project, using the docker build shown before or any other method.
|
Run the application mounting your previously configured `app.properties`
|
||||||
|
|
||||||
### docker-compose.yml
|
> 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
|
||||||
|
|
||||||
Review the `docker-compose.yml` file and edit it with your settings.
|
# Advanced configuration
|
||||||
In the example provided the important bits are:
|
|
||||||
|
|
||||||
- `/opt/wisemapping-db`: this is where the mysql database files will be stored in your machine.
|
> 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
|
||||||
- Change the default password for the database to match your app.properties password. Please don't keep "password"!
|
|
||||||
- You might want to remove the `ports:` section in the db service if you don't want your db exposed to the outside.
|
|
||||||
|
|
||||||
```
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
```
|
|
||||||
|
|
||||||
- You might want to change the port mapping for web (by default it will run in port 8082)
|
|
||||||
|
|
||||||
```
|
|
||||||
ports:
|
|
||||||
- "8082:8080"
|
|
||||||
```
|
|
||||||
|
|
||||||
- Change `../wise-webapp/target/wisemapping.war` if you want to store the war file anywhere else in your machine. If you leave the default, the war file deployed will be overriden each time you build the app. You might not want that behavior.
|
|
||||||
|
|
||||||
## Running
|
|
||||||
|
|
||||||
Once the configs are ready, from this folder, run `docker-compose -p wise-webapp up -d` to run the web and the database containers as daemons. They will start automatically whith the machine.
|
|
||||||
|
|
||||||
You can check your docker running containers with `docker ps`.
|
|
||||||
|
|
||||||
To stop them you can run `docker-compose down` from this directory (doing this, they won't start automatically anymore).
|
|
||||||
|
|
||||||
Check out docker and docker-compose docs for more container management utilities.
|
|
||||||
|
|
||||||
## Areas for improvement
|
|
||||||
|
|
||||||
- Create a Dockerfile to build wise-webapp using an `app.properties` file mounted from this directory (make building easier).
|
|
||||||
- Simplify this documentation, simplify the process
|
|
||||||
- Allow to pass configuration as environment variables form docker-compose
|
|
||||||
|
|
||||||
If any of this can be improved, please submit a patch or issue.
|
|
|
@ -25,6 +25,7 @@
|
||||||
<param-name>contextConfigLocation</param-name>
|
<param-name>contextConfigLocation</param-name>
|
||||||
<param-value>
|
<param-value>
|
||||||
/WEB-INF/wisemapping-aop.xml
|
/WEB-INF/wisemapping-aop.xml
|
||||||
|
/WEB-INF/wisemapping-datasource.xml
|
||||||
/WEB-INF/wisemapping-dao.xml
|
/WEB-INF/wisemapping-dao.xml
|
||||||
/WEB-INF/wisemapping-service.xml
|
/WEB-INF/wisemapping-service.xml
|
||||||
/WEB-INF/wisemapping-model.xml
|
/WEB-INF/wisemapping-model.xml
|
||||||
|
|
|
@ -4,22 +4,6 @@
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<bean id="wiseDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
|
||||||
<property name="driverClassName" value="${database.driver}"/>
|
|
||||||
<property name="url" value="${database.url}"/>
|
|
||||||
<property name="username" value="${database.username}"/>
|
|
||||||
<property name="password" value="${database.password}"/>
|
|
||||||
<property name="testOnBorrow" value="${database.validation.enabled}"/>
|
|
||||||
<property name="validationQuery" value="${database.validation.query}"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!--Uncomment this lines for production environments -->
|
|
||||||
<!--<bean id="wiseDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">-->
|
|
||||||
<!--<property name="jndiName">-->
|
|
||||||
<!--<value>java:comp/env/jdbc/wisemapping</value>-->
|
|
||||||
<!--</property>-->
|
|
||||||
<!--</bean>-->
|
|
||||||
|
|
||||||
<bean id="mindmapSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
|
<bean id="mindmapSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
|
||||||
<property name="dataSource" ref="wiseDataSource"/>
|
<property name="dataSource" ref="wiseDataSource"/>
|
||||||
<property name="annotatedClasses">
|
<property name="annotatedClasses">
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
|
<bean id="wiseDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
||||||
|
<property name="driverClassName" value="${database.driver}"/>
|
||||||
|
<property name="url" value="${database.url}"/>
|
||||||
|
<property name="username" value="${database.username}"/>
|
||||||
|
<property name="password" value="${database.password}"/>
|
||||||
|
<property name="testOnBorrow" value="${database.validation.enabled}"/>
|
||||||
|
<property name="validationQuery" value="${database.validation.query}"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Optional configuration for external connexion pool -->
|
||||||
|
<!-- <bean id="wiseDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" >-->
|
||||||
|
<!-- <property name="jndiName">-->
|
||||||
|
<!-- <value>java:comp/env/jdbc/wisemapping</value>-->
|
||||||
|
<!-- </property>-->
|
||||||
|
<!-- </bean>-->
|
||||||
|
</beans>
|
Loading…
Reference in New Issue