Difference between revisions of "Local development environment tutorial"

From TempusServa wiki
Jump to navigation Jump to search
(Translation work)
(Translation work)
 
Line 2: Line 2:




'''You will need:'''
'''You will need'''


* TortoiseSVN
* TortoiseSVN
Line 14: Line 14:




'''What to do:'''
'''What to do'''


* Create a working copy of the codebase via TortoiseSVN (see https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-quick-start.html)
* Create a working copy of the codebase via TortoiseSVN (see https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-quick-start.html)
Line 40: Line 40:


innodb_strict_mode = 0
innodb_strict_mode = 0
</syntaxhighlight>(Restart MariaDB in Services to activate the new settings)
</syntaxhighlight>(Restart MariaDB in Windows Services to activate the new settings)
* Create a new file TempusServa.xml in Tomcat 8.5\conf\Catalina\localhost
* 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:<syntaxhighlight lang="xml">
* Both context.xml in your working copy in sfwServlets\web\META-INF and TempusServa.xml should look like this:<syntaxhighlight lang="xml">
Line 60: Line 60:
         />
         />
  </Context>
  </Context>
</syntaxhighlight>Remember to add your own root password to the xml's
</syntaxhighlight>Remember to add your own root password to the xml's.


* Insert mariadb-java-client-3.1.4 in Tomcat 8.5\lib
* 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.


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
'''Accessing the backend'''


I Netbeans Projects view kør debug file på sfwServlets\Source Packages\dk.p2e.blanket\live.java
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.


login/password er admin/TempusServa1234
* 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:<syntaxhighlight lang="xml">
Efter login får man en blank side. Gå til <nowiki>http://localhost:8080/TempusServa/Welcome.do</nowiki> for at starte.
    <Connector port="8081" protocol="HTTP/1.1"
 
              connectionTimeout="20000"
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.
              redirectPort="8443"
 
              maxParameterCount="1000"
I ts backenden gå til Modules -> Admin services -> Cache control -> Reload policies.
              />
 
</syntaxhighlight>(Tomcat will have to be restarted for the changes to take effect)
Derefter                                           Rebuild artifacts -> Rebuild views.
* To access the server from Tomcat go to http://localhost:8081/TempusServa
 
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"
 
               />
 
    <!-- A "Connector" using the shared thread pool-->
 
  <!--
 
    <Connector executor="tomcatThreadPool"
 
               port="8081" protocol="HTTP/1.1"
 
               connectionTimeout="20000"
 
               redirectPort="8443"
 
               maxParameterCount="1000"
 
               />
 
Hvis man vil åbne Tomcat serveren skal starte den i services og gå til <nowiki>http://localhost:8081/TempusServa</nowiki>-->

Latest revision as of 12:13, 14 July 2023

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