Merge branch 'develop'

main
Paulo Gustavo Veiga 2024-04-06 02:48:31 -07:00
commit bf0b7fd2b4
7 changed files with 58 additions and 183 deletions

107
README.md
View File

@ -1,93 +1,84 @@
# Overview
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 an open-source web-based mind mapping tool that harnesses the potential of Mind Maps by blending together open standards technologies like SVG and React. It is built upon the foundation of the code supporting http://www.wisemapping.com, ensuring reliability and continuity in its development.
## Compiling and Running
# Compile and Development
### Prerequisites
The following section describes the steps to check out, compile, and start WiseMapping locally. If you are interested in deploying it, I recommend using the already published images https://hub.docker.com/r/wisemapping/wisemapping.
The following products must be installed:
## Prerequisites
* JDK 21 or higher
* Maven 3.x or higher ([http://maven.apache.org/])
* Maven v3.x or higher ([http://maven.apache.org/])
* Yarn v1 or higher
* Node v18 or higher
### Compiling
## Option 1: Quick Start with Docker Compose
WiseMapping uses Maven as packaging and project management. It's composed of 5 maven sub-modules:
The following command line will start WiseMapping locally using HSQLDB in memory for development purposes:
* wise-ui: React font-end fetcher
* wise-api: Springboot Backend API
```
$ mvn -f wise-api/pom.xml package
$ docker compose build
$ docker compose up
```
The full compilation of the project can be performed executing within <project-dir>:
Application will start at http://localhost/c/login. You can login using *test@wisemapping.org* and password *test*
`mvn clean install`
## Option 2: Start UI and API independently
Once this command is executed, the file <project-dir>/wise-webapp/target/wisemapping*.war will be generated.
### Compile and Start API
### Local Development
The previously generated war can be deployed locally executing within the directory <project-dir>/wise-webapp the following command:
```
$ mvn -f wise-api/pom.xml package
$ cd wise-api
$ mvn spring-boot:run
```
`cd wise-api;spring-boot:run`
## Compile and Start Frontend
This will start the application on the URL: [http://localhost:8080/] using file based database.
You need to checkout https://github.com/wisemapping/wisemapping-frontend first. Then, follow the next steps:
User: test@wisemapping.org
Password: test
```
$ export NODE_OPTIONS=--openssl-legacy-provider
$ export APP_CONFIG_TYPE="file:dev"
### Local Development + UI Integration
$ cd wisemapping-frontend
$ yarn install
$ yarn build
In order to reduce the life-cycle to develop UI backend testing, you can do the following hack:
$ cd packages/webapp; yarn start
```
Application will start at http://localhost:3000/c/login. You can login using *test@wisemapping.org* and password *test*
* Clone [wisemapping-open-source](https://github.com/wisemapping/wisemapping-open-source/) and [wisemapping-frontend](https://github.com/wisemapping/wisemapping-frontend/) at the same top level directory
* Compile `wisemapping-frontend`. Details for compilation can be found in the `wisemapping-frontend` readme.
* Compile `wisemapping-open-source`
# Supportability Matrix
A quick and dirty solution to share changes in the UI is to manually compile the dist. This will make the loader file available without the need to publish:
## Supported Databases
`yarn --cwd wisemapping-frontend build;cp -r wisemapping-frontend/packages/mindplot/dist/* wisemapping-open-source/wise-ui/target/wisemapping-mindplot/package/dist;cp -r wisemapping-frontend/packages/webapp/dist/* wisemapping-open-source/wise-ui/target/wisemapping-webapp/package/dist`
* MySQL v8 or higher
* PostgreSQL v15 or higher
* Hsqldb v2.7 or higher
# Configuration
### Compiling and running with docker-compose
WiseMapping backend is based on SpringBoot v3 and it's highly customizable. Additional documentation can be found [here](https://docs.spring.io/spring-boot/3.3/reference/features/external-config.html)
Check out the [docker section](./docker/README.)
The perfered option is to extended by overwriting [application.yaml](https://github.com/wisemapping/wisemapping-open-source/blob/develop/wise-api/src/main/resources/application.yml)
### Test reports
```
$ java -jar target/wisemapping-api.jar --spring.config.additional-location=../../wise-conf/app.yml
```
Individual test result reports can be found in wisemapping-open-source/wise-webapp/target/failsafe-reports/index.html
Test coverage report of unit and integration test can be found in wisemapping-open-source/wise-webapp/target/site/jacoco and wisemapping-open-source/wise-webapp/target/site/jacoco-it folders. Coverage report is generated in the verify phase of [lifecicle](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#introduction-to-the-build-lifecyclea) using [jacoco](https://www.jacoco.org/jacoco/trunk/doc/maven.html)
For example, this [example](https://github.com/wisemapping/wisemapping-open-source/blob/develop/config/database/postgresql/app-postgresql.yaml) configure PostgreSQL as database.
# Members
## Google authorization
You must configure the following wisemapping properties (app.properties) in order to get google authorization working
* `security.oauth2.google.callbackUrl`: url where google will redirect after user authentication, tipically {frontendBaseUrl}/c/registration-google. Also, this url must be defined in google app configuration
* `security.oauth2.google.clientId`: client id from google app
* `security.oauth2.google.clientSecret`: client secret from google app
You must create a Google Application in [Google Cloud](https://console.cloud.google.com) and complete all the information required by Google. Here are the most important properties.
Oauth consent screen
* Authorized domains: wisemapping domain (ex: wisemapping.com), and you can add domains of other environments if needed
* Permissions
* `https://www.googleapis.com/auth/userinfo.profile`
* `https://www.googleapis.com/auth/userinfo.email`
* Test users: emails for testing, those can be used before the application is validated by Google
After that, in Credentials, you must create an `Oauth Client Id` credential
* Authorized JavaScript origins: list of authorized domains from which to redirect to Google. Ex: `https://wisemaping.com`, `https://wisemapping-testing.com:8080`
* Authorized redirect URIs: list of allowed urls to which google will redirect after authenticating . Ex: `https://wisemaping.com/c/registration-google`, `https://wisemapping-testing.com:8080/c/registration-google`
After credential was created, Google will show you the clientId and clientSecret to configure your application. For productive applications, you must **publish** your application, this is a validation process with Google.
## Members
### Founders
## Founders
* Paulo Veiga <pveiga@wisemapping.com>
* Pablo Luna <pablo@wisemapping.com>
### Past Individual Contributors
## Past Individual Contributors
* Ignacio Manzano
* Ezequiel Bergamaschi <ezequielbergamaschi@gmail.com>
@ -95,5 +86,5 @@ After credential was created, Google will show you the clientId and clientSecret
## License
The source code is Licensed under the WiseMapping Open License, Version 1.0 (the “License”);
You may obtain a copy of the License at: [https://bitbucket.org/wisemapping/wisemapping-open-source/src/develop/license.md](https://bitbucket.org/wisemapping/wisemapping-open-source/src/develop/LICENSE.md)
You may obtain a copy of the License at: [https://github.com/wisemapping/wisemapping-open-source/blob/develop/LICENSE.md](https://github.com/wisemapping/wisemapping-open-source/blob/develop/LICENSE.md)

View File

@ -3,6 +3,7 @@ version: '3'
services:
wise-api:
container_name: wise-api
hostname: wise-api
image: wise-api:latest
build:
context: ./wise-api

View File

@ -55,8 +55,8 @@ logging:
# Application Configuration.
app:
site:
ui-base-url: https://localhost:8080
api-base-url: https://api.wisemapping.com
ui-base-url: http://localhost
api-base-url: http://localhost
api:
http-basic-enabled: false
# analytics:

View File

@ -3,21 +3,17 @@ FROM node:18.12.1-buster-slim AS builder
# Set the working directory in the container
WORKDIR /app
ARG VERSION="5.1.2"
ARG VERSION="6.0.1"
## Install dependencies
# Install dependencies
RUN mkdir webapp && npm pack @wisemapping/webapp@${VERSION} && tar -xvzf wisemapping-webapp-${VERSION}.tgz -C webapp
RUN mkdir mindplot && npm pack @wisemapping/mindplot@${VERSION} && tar -xvzf wisemapping-mindplot-${VERSION}.tgz -C mindplot
ADD index.html .
# Use Nginx as the production server
FROM nginx:latest
LABEL maintainer="Paulo Gustavo Veiga <pveiga@wisemapping.com>"
## Copy the built React app to Nginx's web server directory
COPY --from=builder /app/index.html /usr/share/nginx/html/
COPY --from=builder /app/webapp/package/dist/* /usr/share/nginx/html/webapp/
COPY --from=builder /app/mindplot/package/dist/* /usr/share/nginx/html/mindplot/
COPY --from=builder /app/webapp/package/dist/* /usr/share/nginx/html/
ADD nginx.conf .
COPY nginx.conf /etc/nginx/conf.d/default.conf

View File

@ -1,52 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<base href="/static/webapp/"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8"/>
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap"
as="style" onload="this.onload=null;this.rel='stylesheet'" crossorigin>
<script>
window.serverconfig = {
apiBaseUrl: '${requestScope['site.baseurl']}',
analyticsAccount: '${requestScope['google.analytics.account']}',
clientType: 'rest',
recaptcha2Enabled: ${requestScope['google.recaptcha2.enabled']},
recaptcha2SiteKey: '${requestScope['google.recaptcha2.siteKey']}',
googleOauth2Url: '${requestScope['security.oauth2.google.url']}'
};
<%-- Hack to force view selection on react to move all the UI to react --%>
window.errorMvcView = '${requestScope['exception']!=null?(fn:indexOf(requestScope['exception'],'SecurityException') gt 1?'securityError':'unexpectedError'):''}';
/*
${requestScope['exception']}
*/
</script>
<script type="text/javascript">
function downloadJsAtOnload() {
setTimeout(function downloadJs() {
var element = document.createElement("script");
element.setAttribute("data-ad-client", "ca-pub-4996113942657337");
element.async = true;
element.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
document.body.appendChild(element);
}, 50);
};
window.addEventListener("load", downloadJsAtOnload, false);
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="text/javascript" src="/webapp/vendors.bundle.js" crossorigin="anonymous" async></script>
<script type="text/javascript" src="/webapp/app.bundle.js" crossorigin="anonymous" async></script>
</body>
</html>

View File

@ -3,6 +3,8 @@ server {
gzip on;
charset UTF-8;
server_name wise-ui;
# Change base URL to match the host URL.
sub_filter '<base>' '<base href="http://$host/">';
location / {
# This would be the directory where your React app's static files are stored at
@ -18,7 +20,7 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8080/api/;
proxy_pass http://wise-api:8080/api/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;

View File

@ -1,63 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.wisemapping</groupId>
<artifactId>wise-ui</artifactId>
<packaging>war</packaging>
<name>WiseMapping Frontend</name>
<parent>
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>5.1.0-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<target>
<!-- Download and unzip mindplot npm package -->
<mkdir dir="target/wisemapping-mindplot"/>
<exec executable="npm" dir="target" failonerror="true">
<arg value="pack"/>
<arg value="@wisemapping/mindplot@5.1.2"/>
</exec>
<exec executable="tar" dir="target" failonerror="true">
<arg value="-xvzf"/>
<arg value="wisemapping-mindplot-5.1.2.tgz"/>
<arg value="-C"/>
<arg value="wisemapping-mindplot"/>
</exec>
<!-- Download and unzip webapp npm package -->
<mkdir dir="target/wisemapping-webapp"/>
<exec executable="npm" dir="target" failonerror="true">
<arg value="pack"/>
<arg value="@wisemapping/webapp@5.1.2"/>
</exec>
<exec executable="tar" dir="target" failonerror="true">
<arg value="-xvzf"/>
<arg value="wisemapping-webapp-5.1.2.tgz"/>
<arg value="-C"/>
<arg value="wisemapping-webapp"/>
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>