Build web application server from Source

This short tutorial shows how to build Teedy. Finally you will get a ready-to-deploy dms.war java archive file. 

 Pre-Requisites 

 sudo add-apt-repository ppa:openjdk-r/ppa

sudo apt update

sudo apt install openjdk-11-jdk maven npm jetty11

 

sudo ln -s /usr/bin/nodejs /usr/bin/node

npm install -g grunt-cli

npm install -g npm@latest 

 Building  

 Additional steps are included in the following bash script. 

 

 Adjust code for GDPR (data privacy → add some custom URLs to satisfy german TMG) 

 adjusting hibernate pool size to allow more connections 

 some CSS fix for bigger preview images 

 

 #!/bin/bash

BASE="/opt/teedy"

 

#altes Repo löschen

#rm -rf /opt/teedy/

 

#clone

git clone https://github.com/sismics/docs.git ${BASE}

cd ${BASE}/

 

#to update existing repo:

git stash

git pull

 

#GDPR adjustments

sed -i 's/<li>v{{ app.current_version }}<\/li>/<li><a href\="https:\/\/stadtfabrikanten.org\/impressum">Impressum<\/a><\/li><li><a href\="https:\/\/stadtfabrikanten.org\/datenschutz">Datenschutz<\/a><\/li><li>v{{ app.current_version }}<\/li>/g' ${BASE}/docs-web/src/main/webapp/src/share.html

sed -i 's/<li>v{{ app.current_version }}<\/li>/<li><a href\="https:\/\/stadtfabrikanten.org\/impressum">Impressum<\/a><\/li><li><a href\="https:\/\/stadtfabrikanten.org\/datenschutz">Datenschutz<\/a><\/li><li>v{{ app.current_version }}<\/li>/g' ${BASE}/docs-web/src/main/webapp/src/index.html

 

#CSS fix

sed -i 's/42px/100px/g' ${BASE}/docs-web/src/main/webapp/src/style/main.less

 

#Adjust hibernate.pool_size from 10 to 50

sed -i 's/\"hibernate.connection.pool_size\", \"10\"/\"hibernate.connection.pool_size\", \"50\"/g' ${BASE}/docs-core/src/main/java/com/sismics/util/jpa/EMF.java

 

#Building

cd ${BASE}/

mvn clean -DskipTests install

 

cd ${BASE}/docs-web

mvn -Pprod -DskipTests clean install

 

#Apply

JETTY_WEBAPPS_DIR="/opt/jetty-home-11.0.15/jetty-base/webapps"

service jetty11 stop

mv ${JETTY_WEBAPPS_DIR}/dms.war ${JETTY_WEBAPPS_DIR}/dms.war.bak

cp /opt/teedy/docs-web/target/docs-web-1.*-SNAPSHOT.war ${JETTY_WEBAPPS_DIR}/dms.war

chown jetty:adm ${JETTY_WEBAPPS_DIR}/dms.war

 

systemctl restart jetty11

journalctl -f -u jetty11.service