Fix distribution creation

This commit is contained in:
Paulo Gustavo Veiga 2022-01-22 23:50:20 -08:00
parent 5923d514b7
commit 19354f4ec1
16 changed files with 49 additions and 482 deletions

View File

@ -1,47 +1,23 @@
# Dockerizing WiseMapping: Dockerfile for building WiseMapping images
# Based on ubuntu:latest, installs WiseMapping (http://ww.wisemapping.org)
FROM ubuntu:latest
MAINTAINER Paulo Gustavo Veiga <pveiga@wisemapping.com>
# Based info setup ...
FROM tomcat:9.0-jdk17-openjdk
LABEL maintainer="Paulo Gustavo Veiga <pveiga@wisemapping.com>"
ENV DEBIAN_FRONTEND noninteractive
ENV MYSQL_ROOT_PASSWORD password
ENV WISE_VERSION 4.0.2
#Build variables ...
ARG WEBAPP_TARGET_DIR="/usr/local/tomcat/webapps/ROOT"
ENV database.base.url="/var/wisemapping"
# Install utilities
RUN apt-get install -y zip
# Copy wisemapping distribution ...
COPY wisemapping.war /tmp
RUN mkdir ${WEBAPP_TARGET_DIR}
RUN cd ${WEBAPP_TARGET_DIR} && jar -xvf /tmp/wisemapping.war
RUN rm /tmp/wisemapping.war
# Prepare distribution
COPY target/wisemapping-v${WISE_VERSION}.zip .
RUN unzip wisemapping-v${WISE_VERSION}.zip
# Change logger to
RUN cp ${WEBAPP_TARGET_DIR}/WEB-INF/classes/log4j-stdout.properties ${WEBAPP_TARGET_DIR}/WEB-INF/classes/log4j.properties
# Install MySQL
RUN echo mysql-server mysql-server/root_password password ${MYSQL_ROOT_PASSWORD} | debconf-set-selections;\
echo mysql-server mysql-server/root_password_again password ${MYSQL_ROOT_PASSWORD} | debconf-set-selections;\
apt-get install -y mysql-server
RUN service mysql start && \
mysql -uroot -p${MYSQL_ROOT_PASSWORD} < /wisemapping-v${WISE_VERSION}/config/database/mysql/create-database.sql && \
mysql -uwisemapping -Dwisemapping -ppassword < /wisemapping-v${WISE_VERSION}/config/database/mysql/create-schemas.sql && \
mysql -uwisemapping -Dwisemapping -ppassword < /wisemapping-v${WISE_VERSION}/config/database/mysql/apopulate-schemas.sql
# Install Java 8
RUN apt-get install -y software-properties-common && \
add-apt-repository ppa:webupd8team/java && \
apt-get update
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections;\
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections;\
sudo apt-get install -y oracle-java8-installer
# Configure instance
COPY docker-conf/app.properties wisemapping-v4.0.1/webapps/wisemapping/WEB-INF/app.properties
# Clean up
RUN apt-get clean
RUN rm wisemapping-v${WISE_VERSION}.zip
EXPOSE 8080
CMD "sh" "-c" "service mysql start;cd wisemapping-v${WISE_VERSION};./start.sh"
# Copy default HSQL DB for testing ...
RUN mkdir -p /var/wisemapping/db
COPY db/ /var/wisemapping/db

View File

@ -1,36 +0,0 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>editor</id>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>core-js/target/classes/core.js</source>
<outputDirectory>/js</outputDirectory>
</file>
<file>
<source>mindplot/target/classes/mindplot-min.js</source>
<outputDirectory>/js</outputDirectory>
</file>
</files>
<fileSets>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>wise-editor/src/main/webapp</directory>
<includes>
<include>css/**/*</include>
<include>images/**/*</include>
<include>icons/**/*</include>
<include>js/editor.js</include>
<include>js/less*.js</include>
<include>js/mootools*.js</include>
<include>html/editor.html</include>
<include>html/*</include>
<include>samples/*</include>
<include>index.html</include>
</includes>
</fileSet>
</fileSets>
</assembly>

6
distribution/build-image.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
set -o
set -u
docker build -t wisemapping -f ./Dockerfile ../wise-webapp/target/

View File

@ -1,159 +0,0 @@
##################################################################################
# Database Configuration
##################################################################################
# MariaDB configuration properties
database.url=jdbc:mariadb://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
database.driver=org.mariadb.jdbc.Driver
database.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
database.username=wisemapping
database.password=mappingwise
database.validation.enabled=true
database.validation.query=SELECT 1
# MySQL 5.X configuration properties
#database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
#database.driver=com.mysql.jdbc.Driver
#database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
#database.username=wisemapping
#database.password=password
#database.validation.enabled=true
#database.validation.query=SELECT 1
## PostgreSQL configuration properties
#database.url=jdbc:mariadb://localhost:3306/wisemapping
#database.driver=org.mariadb.jdbc.Driver
#database.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
#database.username=wisemapping
#database.password=password
#database.validation.query=
#database.validation.enabled=false
# HSQL Configuration properties
#database.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping
#database.driver=org.hsqldb.jdbc.JDBCDriver
#database.hibernate.dialect=org.hibernate.dialect.HSQLDialect
#database.username=sa
#database.password=
#database.validation.enabled=false
#database.validation.query=
##################################################################################
# Mail configuration. Must be configured to enable user registration confirmation.
##################################################################################
#------------------------
# Plain SMTP Server Configuration
#------------------------
mail.smtp.port=25
mail.smtp.host=localhost
mail.username=root
mail.password=
mail.smtp.auth=false
mail.smtp.starttls.enable=false
mail.smtp.quitwait=false
#------------------------
# GMAIL SMTP Configuration
#------------------------
#mail.smtp.port=587
#mail.smtp.host=smtp.gmail.com
#mail.username=<gmail-user-account>
#mail.password=<gmail-password>
#mail.smtp.auth=true
#mail.smtp.starttls.enable=true
#mail.smtp.quitwait=false
#------------------------
# Emails configuration
#------------------------
# Required: "from" email account that will appear in the emails sent from the sender.
mail.serverSendEmail=root@localhost
# Optional: Support account that the users could use to contact you. This address will appear in emails and in some places in the site.
mail.supportEmail=root@localhost
# Optional: Unexpected errors will be reported to this address.
mail.errorReporterEmail=
##################################################################################
# Users Registration Configuration
##################################################################################
# Enable captcha confirmation
google.recaptcha2.enabled = true
# ReCaptcha is the default captcha. Public and private keys are required.
# More Info: http://www.google.com/recaptcha .
google.recaptcha2.siteKey = 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
google.recaptcha2.secretKey = 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
##################################################################################
# Site configuration
##################################################################################
# Site administration user. This user will have special permissions for operations such as removing users, set password
# etc.
admin.user = admin@wisemapping.org
# Base URL where WiseMapping is deployed. By default, It will be automatically inferred.
# If you are planning to put wisemapping behind an Apache using an Apache Proxy setup, you must enable this property.
site.static.js.url = /static
# Site Homepage URL. This will be used as URL for homepage location.
site.homepage = c/home
##################################################################################
# Google Analytics Settings
##################################################################################
google.analytics.enabled=false
google.analytics.account=UA-XXXX
##################################################################################
# Google Ads enable
##################################################################################
google.ads.enabled=false
#######################################################################################
# Authentication Configuration Section
#######################################################################################
# Two type of security are supported:
# - db: User are stored in the database. Registration is required in advance.
# - ldap: Authentication takes place using a LDAP. In this case, security.ldap.* must be configured.
security.type=db
# LDAP Configuration properties.
security.ldap.server=ldap://localhost:389
# If anonymous password is required, change the wisemapping-security-ldap.xml removing the
security.ldap.server.user=cn=pveiga,dc=wisemapping,dc=com
security.ldap.server.password=password
security.ldap.basedn=dc=wisemapping,dc=com
# This will be concatenated as part of the DN. In this case, I will be "ou=people".
# In case this need to be changed, modify the wisemapping-security-ldap.xml.
security.ldap.subDn=ou=people
# Attribute used as authentication login (Eg: in this case, the user email will be used)
security.ldap.auth.attribute=mail
security.ldap.lastName.attribute=sn
security.ldap.firstName.attribute=givenName
# Enable OpenId Authentication.
security.openid.enabled=false
# REST Documentation
#
# This properties are used for REST API Documentation( http://localhost:8080/wisemapping/doc/rest/index.html)
# Change the URL for proper documentation console setup.
documentation.services.basePath=http://localhost:8080/service
documentation.services.version=3.0.1

View File

@ -1,65 +0,0 @@
#!/bin/bash
set -e
set -u
WISE_VERSION=$1
BASE_DIR=`pwd`
TARGET_DIR=$BASE_DIR/target
JETTY_DIR=$TARGET_DIR/wisemapping-$WISE_VERSION
WISE_WEBAPP_DIR=$JETTY_DIR/webapps/wisemapping
JETTY_VERSION=8.1.16.v20140903
JETTY_DIST_DIR=jetty-distribution-${JETTY_VERSION}
JETTY_ZIP=${JETTY_DIST_DIR}.zip
# Clean ...
mvn -o -f $BASE_DIR/../pom.xml clean
[ ! -e target ] && mkdir target
rm -fr ${JETTY_DIR}
rm -fr ${TARGET_DIR}/${JETTY_DIST_DIR}
# Prepare resources ..
mvn -o -f $BASE_DIR/../pom.xml package -Dmaven.test.skip=true
if [ ! -f ./target/${JETTY_ZIP} ]
then
echo "Download Jetty"
wget http://download.eclipse.org/jetty/${JETTY_VERSION}/dist/${JETTY_ZIP} -P $TARGET_DIR
fi
echo "Unzip Jetty ...:"
unzip ${TARGET_DIR}/${JETTY_ZIP} -d ${TARGET_DIR}/ > /dev/null
mv ${TARGET_DIR}/${JETTY_DIST_DIR} ${JETTY_DIR}
# Clean unsed files ...
rm -rf $JETTY_DIR/webapps/*
rm -rf $JETTY_DIR/contexts/*
rm -rf $JETTY_DIR/javadoc
# Now, start wise-webapps customization ...
echo "Unzip wisemappig.war ..."
mkdir $WISE_WEBAPP_DIR
unzip $BASE_DIR/../wise-webapp/target/wisemapping.war -d $WISE_WEBAPP_DIR >/dev/null
# DB Configuration ...
sed 's/\${database.base.url}\/db\/wisemapping/webapps\/wisemapping\/WEB-INF\/database\/wisemapping/' $WISE_WEBAPP_DIR/WEB-INF/app.properties > $WISE_WEBAPP_DIR/WEB-INF/app.properties2
mv $WISE_WEBAPP_DIR/WEB-INF/app.properties2 $WISE_WEBAPP_DIR/WEB-INF/app.properties
mkdir $WISE_WEBAPP_DIR/WEB-INF/database
cp -r $BASE_DIR/../wise-webapp/target/db/* $WISE_WEBAPP_DIR/WEB-INF/database/
cp $BASE_DIR/wisemapping.xml $JETTY_DIR/contexts/
# Distribute scripts
cp -r $BASE_DIR/../config/ $TARGET_DIR/wisemapping-$WISE_VERSION/config
cp ./start.sh ${JETTY_DIR}/
cp -r $BASE_DIR/service $TARGET_DIR/wisemapping-$WISE_VERSION/service
# Store version
echo $1 > $WISE_WEBAPP_DIR/version
git rev-parse HEAD >> $WISE_WEBAPP_DIR/version
# Zip all ...
cd $TARGET_DIR
zip -r wisemapping-$WISE_VERSION.zip wisemapping-$WISE_VERSION
cd ..

View File

@ -1,72 +0,0 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: wisemapping
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: wisemapping
# Description: www.wisemapping.com
### END INIT INFO
set -e
set -u
#environmental variables
JAVA_HOME="/usr/lib/jvm/java7"
JDK_HOME=$JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
WISE_HOME="/opt/wisemapping"
PID_FILE="$WISE_HOME/.pid"
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
preInitChecks() {
MYSQL_STATUS=`pgrep mysql`
if [ -z $MYSQL_STATUS ]; then
service mysql start >/dev/null 2>&1
fi
}
wiseStatus() {
echo `pgrep -f "$WISE_HOME/start.jar"`
}
case "${1:-''}" in
'start')
#preInitChecks
cd $WISE_HOME
echo "Starting Wisemapping..."
java -Xmx256m -Dorg.apache.jasper.compiler.disablejsr199=true -jar $WISE_HOME/start.jar > $WISE_HOME/logs/start.log 2>&1 &
PID=$!
cd - >/dev/null 2>&1
echo "proccess id: $PID"
echo "$PID" > $PID_FILE
;;
'stop')
if [ ! -f $PID_FILE ]; then
PID=$(wiseStatus)
else
PID=`cat $PID_FILE`
rm $PID_FILE >/dev/null 2>&1
fi
kill $PID
echo "Wisemapping stopped"
;;
'restart')
set +e; $SELF stop; set -e
$SELF start
;;
'status')
STATUS=$(wiseStatus)
if [ -n "$STATUS" ]; then
echo "Wisemapping server is running, pid: $STATUS"
else
echo "Wisemapping is stopped"
fi
;;
*)
echo "Usage: $SELF start|stop|restart|status"
exit 1
;;
esac

View File

@ -1,4 +0,0 @@
#!/bin/sh
java -Xmx256m -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar

View File

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- ==================================================================
Configure and deploy the wisemapping web application in $(jetty.home)/webapps/wisemapping
Note. If this file did not exist or used a context path other that /wisemapping
then the default configuration of jetty.xml would discover the wisemapping
webapplication with a WebAppDeployer. By specifying a context in this
directory, additional configuration may be specified and hot deployments
detected.
===================================================================== -->
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/wisemapping</Set>
<Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/webapps/wisemapping
</Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- <Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="overrideDescriptor"><SystemProperty name="jetty.home" default="."/>/contexts/wisemapping.d/override-web.xml</Set> -->
<!-- virtual hosts
<Set name="virtualHosts">
<Array type="String">
<Item>www.myVirtualDomain.com</Item>
<Item>localhost</Item>
<Item>127.0.0.1</Item>
</Array>
</Set>
-->
<!-- disable cookies
<Get name="sessionHandler">
<Get name="sessionManager">
<Set name="usingCookies" type="boolean">false</Set>
</Get>
</Get>
-->
<Get name="securityHandler">
<Set name="loginService">
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties
</Set>
<!-- To enable reload of realm when properties change, uncomment the following lines -->
<!-- changing refreshInterval (in seconds) as desired -->
<!--
<Set name="refreshInterval">5</Set>
<Call name="start"></Call>
-->
</New>
</Set>
<Set name="checkWelcomeFiles">true</Set>
</Get>
<!-- Non standard error page mapping -->
<!--
<Get name="errorHandler">
<Call name="addErrorPage">
<Arg type="int">500</Arg>
<Arg type="int">599</Arg>
<Arg type="String">/dump/errorCodeRangeMapping</Arg>
</Call>
</Get>
-->
</Configure>

View File

@ -1,24 +0,0 @@
version: "3.3"
services:
db:
image: mysql:5.5
volumes:
- /opt/wisemapping-db:/var/lib/mysql
- ./mysql-init/:/docker-entrypoint-initdb.d
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wisemapping
MYSQL_USER: wisemapping
MYSQL_PASSWORD: password
ports:
- 3306:3306
restart: unless-stopped
web:
depends_on:
- db
image: tomcat:9
volumes:
- ../wise-webapp/target/wisemapping.war:/usr/local/tomcat/webapps/ROOT.war
ports:
- "8082:8080"
restart: unless-stopped

View File

@ -132,6 +132,17 @@
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.3.15</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
@ -268,6 +279,12 @@
<artifactId>fluent-hc</artifactId>
<version>4.5.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>

View File

@ -0,0 +1,7 @@
# Debug level
log4j.rootLogger=INFO,stdout
# Stdout logger
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p %c - %m%n

View File

@ -1,3 +1,4 @@
# Log levels
log4j.rootLogger=INFO, stdout, R
log4j.logger.com.wisemapping=DEBUG,R
log4j.logger.org.springframework=INFO,R
@ -5,13 +6,13 @@ log4j.logger.org.hibernate=INFO,R
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=TRACE,R
log4j.logger.org.hibernate.SQL=DEBUG,R
# Stdout logger <20>
# Stdout logger
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p %c - %m%n
# File Writer Logger <20>
# File Writer Logger
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=wisemapping.log