Local development environment tutorial

From TempusServa wiki
Jump to navigation Jump to search

This tutorial's goal is to explain how to set up the TS-nocode platform and database on a Windows PC.


You will need

  • TortoiseSVN
  • Apache Tomcat 8.5
  • Netbeans 8.2 running JDK 1.8
  • MariaDB 11
  • Navicat for MariaDB
  • TempusServa.war
  • mariadb-java-client-3.1.4


What to do

  • Create a working copy of the codebase via TortoiseSVN (see https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-quick-start.html)
  • Start MariaDB in Windows Services
  • Create a new connection in Navicat with the following parameters: host: localhost, port:3306, username:root. Connection name doesn't matter.
  • Create three new databases in Navicat; tsbase, tslive, and tstest. Configuration should be left as default.
  • Start Apache Tomcat in Windows Services.
  • Put TempusServa.war in Tomcat 8.5/webapps. A folder with the name TempusServa should be generated automatically after a couple of seconds.
  • In TempusServa/sql are some sql files which have to be run on each of the tree databases in navicat in the following order:
  1. ts_base_restore -> appbase
  2. ts_live_create -> applive
  3. ts_test_create -> apptest
  • If the sql files fail to run properly you may have to add the following to my.ini in MariaDB 11.0/Data:
    max_allowed_packet = 1G
    
    innodb-default-row-format = dynamic
    
    innodb-lock-wait-timeout = 1200
    
    innodb_log_file_size = 2G
    
    innodb_log_buffer_size = 1G
    
    innodb_strict_mode = 0
    
    (Restart MariaDB in Windows Services to activate the new settings)
  • Create a new file TempusServa.xml in Tomcat 8.5\conf\Catalina\localhost
  • Both context.xml in your working copy in sfwServlets\web\META-INF and TempusServa.xml should look like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context antiJARLocking="true" path="">
            <Resource name="jdbc/TempusServaLive" auth="Container" type="javax.sql.DataSource"
                maxActive="80" maxIdle="30" maxWait="2000"
                removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
                validationQuery="SELECT 1" validationInterval="30000" testOnBorrow="true"
                username="root" password="*yourPassword*" driverClassName="org.mariadb.jdbc.Driver"
                url="jdbc:mariadb://localhost:3306/tslive?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"
            />
            <Resource name="jdbc/TempusServaTest" auth="Container" type="javax.sql.DataSource"
                maxActive="5" maxIdle="3" maxWait="10000"
                logAbandoned="true"
                validationQuery="SELECT 1" validationInterval="30000" testOnBorrow="true"
                username="root" password="*yourPassword*" driverClassName="org.mariadb.jdbc.Driver"
                url="jdbc:mariadb://localhost:3306/tstest?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"
            />
     </Context>
    
    Remember to add your own root password to the xml's.
  • Insert mariadb-java-client-3.1.4 in Tomcat 8.5\lib.
  • In Netbeans, open the following projects and build them afterwards: p2eShared, p2eSolution, p2eTemplate, sfwServlets.
  • In Netbeans Projects view, run debug file on sfwServlets\Source Packages\dk.p2e.blanket\live.java.
  • login/password is admin/TempusServa1234.
  • Login might not work due to being redirected to a https connection if securotyssllogin and -pages in the systempolicy table in tslive are not set to false.
  • If views are missing, go to the backend and then Modules -> Admin services -> Cache control -> Reload policies. Then Rebuild artifacts -> Rebuild views. This should create the missing views in the database.


Accessing the backend

If you start the server from Netbeans, you will not have access to the backend. To do this you will need to start the server by running Tomcat in Windows Services. A good idea is to have both servers running at the same time on two different ports.

  • To change the used port in Tomcat go to Apache Software Foundation\Tomcat 8.5\conf\Server.xml.
  • Set the port to for example 8081 at the following spots in the xml file:
        <Connector port="8081" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443"
                   maxParameterCount="1000"
                   />
    
    (Tomcat will have to be restarted for the changes to take effect)
  • To access the server from Tomcat go to http://localhost:8081/TempusServa