From f25a1279a3cf2ecb7a3a5b1f2edea4460b1de100 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 23 Jan 2022 00:56:30 -0800 Subject: [PATCH] Extract conexion datapool Please enter the commit message for your changes. Lines starting --- README.md | 4 +- distribution/README.md | 87 +++++-------------- wise-webapp/src/main/webapp/WEB-INF/web.xml | 1 + .../main/webapp/WEB-INF/wisemapping-dao.xml | 16 ---- .../webapp/WEB-INF/wisemapping-datasource.xml | 22 +++++ 5 files changed, 47 insertions(+), 83 deletions(-) create mode 100644 wise-webapp/src/main/webapp/WEB-INF/wisemapping-datasource.xml diff --git a/README.md b/README.md index 0fa06a84..de5f7cb9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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. -WiseMapping is based on the same code product supporting http://www.wisemapping.com. +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]. ## Compiling and Running diff --git a/distribution/README.md b/distribution/README.md index e0b6590c..8b469073 100644 --- a/distribution/README.md +++ b/distribution/README.md @@ -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`. -``` -docker volume create --name maven-repo-wisemapping -``` +***This option, all changes will be lost once the image is stopped. Use it for testing only *** -Then we can run the following command from the project root: +## Option 2: Running HSQL with mounted directory -``` -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 -``` +> docker run -it --rm -p 8888:8080 wisemapping -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 -- 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 +### Starting the application -> 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=/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. -In the example provided the important bits are: +# Advanced configuration -- `/opt/wisemapping-db`: this is where the mysql database files will be stored in your machine. -- 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. +> 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 \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/web.xml b/wise-webapp/src/main/webapp/WEB-INF/web.xml index c155be16..9f1ef2d2 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/web.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/web.xml @@ -25,6 +25,7 @@ contextConfigLocation /WEB-INF/wisemapping-aop.xml + /WEB-INF/wisemapping-datasource.xml /WEB-INF/wisemapping-dao.xml /WEB-INF/wisemapping-service.xml /WEB-INF/wisemapping-model.xml diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml index bfb9b5a0..6a4681be 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml @@ -4,22 +4,6 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - - - - - - - - - - - - - - - - diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-datasource.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-datasource.xml new file mode 100644 index 00000000..417f7052 --- /dev/null +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-datasource.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + +