Difference between revisions of "Local development environment tutorial"

From TempusServa wiki
Jump to navigation Jump to search
(Translation work)
(Translation work)
 
(One intermediate revision by the same user not shown)
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 22: Line 22:
* Start Apache Tomcat in Windows Services.
* 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.
* 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:
* In TempusServa/sql are some sql files which have to be run on each of the tree databases in navicat in the following order:  


# ts_base_restore -> appbase
# ts_base_restore -> appbase
Line 28: Line 28:
# ts_test_create -> apptest
# ts_test_create -> apptest


Lav en working copy af kodebasen via TortoiseSVN.
* If the sql files fail to run properly you may have to add the following to my.ini in MariaDB 11.0/Data:<syntaxhighlight lang="ini">
 
Start mariadb i Windows Services.
 
Opret en ny connection i navicat til mariadb med host: localhost, port:3306, username:root. Navn på connection er ligegyldig.
 
Opret tre nye databaser i navicat; appbase, applive, apptest. Efterlad konfigureringen som default.
 
Start Apache Tomcat i Windows Services.
 
Indsæt TempusServa.war i Tomcat 8.5/webapps. En folder ved navn TempusServa burde blive genereret af sig selv efter et par sekunder.
 
I TempusServa/sql ligger der nogle sql filer som skal køres på de tre databaser i nacivat i følgende rækkefølge:
 
ts_base_restore -> appbase
 
ts_live_create -> applive
 
ts_test_create -> apptest
 
Muligvis skal følgende tilføjes til my.ini i MariaDB 11.0/Data, hvis sql filerne fejler at køre ordentligt:
 
max_allowed_packet = 1G
max_allowed_packet = 1G


Line 61: Line 40:


innodb_strict_mode = 0
innodb_strict_mode = 0
 
</syntaxhighlight>(Restart MariaDB in Windows Services to activate the new settings)
(genstart mariadb i windows services for at aktivere de nye indstillinger)
* 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">
Opret ny fil TempusServa.xml i Tomcat 8.5\conf\Catalina\localhost
 
Både context.xml i sfwServlets\web\META-INF og TempusServa.xml skal se sådan ud:
 
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="">
<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>
</syntaxhighlight>Remember to add your own root password to the xml's.


        <Resource name="jdbc/TempusServaLive" auth="Container" type="javax.sql.DataSource"
* 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.
            maxActive="80" maxIdle="30" maxWait="2000"
*In Netbeans Projects view, run debug file on sfwServlets\Source Packages\dk.p2e.blanket\live.java.
 
*login/password is admin/TempusServa1234.
            removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
*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.
            validationQuery="SELECT 1" validationInterval="30000" testOnBorrow="true"
 
            username="tsroot" password="TempusServaFTW!" driverClassName="org.mariadb.jdbc.Driver"
 
            url="jdbc:mariadb://localhost:3306/applive?autoReconnect=true&amp;amp;useUnicode=true&amp;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="tsroot" password="TempusServaFTW!" driverClassName="org.mariadb.jdbc.Driver"
 
            url="jdbc:mariadb://localhost:3306/apptest?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=UTF-8"
 
        />
 
</Context>
 
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 sfwServlets\Source Packages\dk.p2e.blanket\live.java
 
login/password er admin/TempusServa1234
 
Efter login får man en blank side. Gå til <nowiki>http://localhost:8080/TempusServa/Welcome.do</nowiki> 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"
 
               />
 
    <!-- A "Connector" using the shared thread pool-->
 
  <!--
 
    <Connector executor="tomcatThreadPool"
 
               port="8081" protocol="HTTP/1.1"
 
               connectionTimeout="20000"


               redirectPort="8443"


               maxParameterCount="1000"
'''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.


Hvis man vil åbne Tomcat serveren skal starte den i services og gå til <nowiki>http://localhost:8081/TempusServa</nowiki>-->
* 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">
    <Connector port="8081" protocol="HTTP/1.1"
              connectionTimeout="20000"
              redirectPort="8443"
              maxParameterCount="1000"
              />
</syntaxhighlight>(Tomcat will have to be restarted for the changes to take effect)
* To access the server from Tomcat go to http://localhost:8081/TempusServa

Latest revision as of 11: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