Local development environment tutorial

From TempusServa wiki
Revision as of 10:28, 14 July 2023 by Nun (talk | contribs) (Translation work)
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 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

Indsæt mariadb-java-client-3.1.4 i Tomcat 8.5\lib

I Netbeans åben følgende projekter og build dem til sidst: p2eShared, p2eSolution, p2eTemplate, sfwServlets

I Netbeans Projects view kør debug file på sfwServlets\Source Packages\dk.p2e.blanket\live.java

login/password er admin/TempusServa1234

Efter login får man en blank side. Gå til http://localhost:8080/TempusServa/Welcome.do for at starte.

visse applive tables mangler. applive referencen til appbase er i øjeblikket tsbase og skal ændres til at hedde appbase. Den findes i systempolicy tabellen i applive. I den tabel skal securotyssllogin og -pages sættes til false, ellers bliver man re-directed til en https side, som ikke loader.

I ts backenden gå til Modules -> Admin services -> Cache control -> Reload policies.

Derefter                                           Rebuild artifacts -> Rebuild views.

views burde blive oprettet i applive databasen.

lav _file tables ved at skrive command=sync i url i front-end

Hvis man starter serveren i netbeans, kan man debugge koden, men man har ikke adgang til back-enden. Hvis man derimod starter via Tomcat i services, kan man ikke se koden, men man har adgang til backenden. En god ide er at starte begge servere i to forskellige porte, så man har det bedste fra begge verdener. Man ændrer tomcat port i Apache Software Foundation\Tomcat 8.5\conf\Server.xml

Jeg sætter den til 8081 i modsætning til i Netbeans, hvor den er 8080. Jeg ved ikke hvad forskellen er mellem de to porte.

<Connector port="8081" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443"

               maxParameterCount="1000"

               />