Difference between revisions of "Codeunit/FormEvent/InstanceCreator"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
m (24 revisions imported)
 
(15 intermediate revisions by one other user not shown)
Line 3: Line 3:


So you will need
So you will need
* A template for the context file
* Template for the context file
* Shared TempusServa.war file
* MySQL dump files  
* MySQL dump files  
** tsbase
** tsbase
Line 9: Line 10:
** tstest
** tstest


== Sample context.xml ==
You also need to make sure that the instance creating the other instances have '''full access to the database''' (create users and databases).
 
== context template ==
 
The context template path must be configured in '''InstanceCreator.contextTemplateFile'''


   <?xml version="1.0" encoding="UTF-8"?>
   <?xml version="1.0" encoding="UTF-8"?>
Line 39: Line 44:
* @DOCBASE@
* @DOCBASE@
* @APPLICATION@
* @APPLICATION@
== Database template ==
From the baseline system build dump copies of the databases.
You will need to use strict naming of the files:
* base.sql
* live.sql
* test.sql
We recommend dumping the files using mysqldump
  mysqldump --skip-add-locks -uroot -pPASSWORD demobase > /mnt/sda/template/base.sql
  mysqldump --skip-add-locks -uroot -pPASSWORD demolive > /mnt/sda/template/live.sql
  mysqldump --skip-add-locks -uroot -pPASSWORD demotest > /mnt/sda/template/test.sql
After dumping the files you can clean out unwanted dato in an editor


== Configuration ==
== Configuration ==
In the form attatch the foollowing codeunit  
In the form attatch the following codeunit  


   dk.tempusserva.solution.creator.InstanceCreator
   dk.tempusserva.solution.creator.InstanceCreator
Line 47: Line 68:
Now setup
Now setup
* locations of the templates
* locations of the templates
** InstanceCreator.sqlTemplateFolder  
** InstanceCreator.sqlTemplateFolder: Folder of '''base.sql live.sql''' and '''test.sql'''
** InstanceCreator.contextTemplateFile  
** InstanceCreator.contextTemplateFile: Position of the context template
* mapped field names
* mapped field names
** InstanceCreator.fieldSolutionName  
** InstanceCreator.fieldSolutionName  
Line 62: Line 83:
Using the attuned form will create a new instance.
Using the attuned form will create a new instance.


The requirement is that the intance information is there AND status is in create (as defined per "")
The requirement is that the intance information is there AND status is in create (as defined per '''StatusCreateNow''')
* instance name
* instance name
* admin name
* admin name
Line 68: Line 89:


After an instance is created and status will now be either
After an instance is created and status will now be either
* succes (as defined per "")
* succes (as defined per '''StatusCompleted''')
* error (as defined per "")
* error (as defined per '''StatusFailSetup''')
 
If the operation succeds you instance will be available in a minute or two.

Latest revision as of 11:51, 10 December 2021

What is it

The instance creator lets you build new TS application instances from a template, that is a MYSQL dump of an existing database.

So you will need

  • Template for the context file
  • Shared TempusServa.war file
  • MySQL dump files
    • tsbase
    • tslive
    • tstest

You also need to make sure that the instance creating the other instances have full access to the database (create users and databases).

context template

The context template path must be configured in InstanceCreator.contextTemplateFile

 <?xml version="1.0" encoding="UTF-8"?>
 <Context docBase="@DOCBASE@" swallowOutput="true">
 <Resource name="jdbc/TempusServaLive" auth="Container" type="javax.sql.DataSource"
               maxActive="80" maxIdle="30" maxWait="2000"
               removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
               username="@USERNAME@" password="@PASSWORD@" driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/@DBLIVE@?autoReconnect=true"
 />
 <Resource name="jdbc/TempusServaTest" auth="Container" type="javax.sql.DataSource"
               maxActive="5" maxIdle="3" maxWait="10000"
               logAbandoned="true"
               username="@USERNAME@" password="@PASSWORD@" driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/@DBTEST@?autoReconnect=true"
 />
 </Context>


The following tags are required

  • @DBLIVE@
  • @DBTEST@

The following tags are recommended

  • @USERNAME@
  • @PASSWORD@

The following tags are optional

  • @DOCBASE@
  • @APPLICATION@

Database template

From the baseline system build dump copies of the databases.

You will need to use strict naming of the files:

  • base.sql
  • live.sql
  • test.sql

We recommend dumping the files using mysqldump

  mysqldump --skip-add-locks -uroot -pPASSWORD demobase > /mnt/sda/template/base.sql
  mysqldump --skip-add-locks -uroot -pPASSWORD demolive > /mnt/sda/template/live.sql
  mysqldump --skip-add-locks -uroot -pPASSWORD demotest > /mnt/sda/template/test.sql

After dumping the files you can clean out unwanted dato in an editor

Configuration

In the form attatch the following codeunit

  dk.tempusserva.solution.creator.InstanceCreator

Now setup

  • locations of the templates
    • InstanceCreator.sqlTemplateFolder: Folder of base.sql live.sql and test.sql
    • InstanceCreator.contextTemplateFile: Position of the context template
  • mapped field names
    • InstanceCreator.fieldSolutionName
    • InstanceCreator.fieldAdminName
    • InstanceCreator.fieldAdminEmail
    • InstanceCreator.fieldAdminPassword
  • status references
    • InstanceCreator.StatusCreateNow
    • InstanceCreator.StatusCompleted: Must be accessible from StatusCreateNow
    • InstanceCreator.StatusFailSetup: Must be accessible from StatusCreateNow

Usage

Using the attuned form will create a new instance.

The requirement is that the intance information is there AND status is in create (as defined per StatusCreateNow)

  • instance name
  • admin name
  • admin email

After an instance is created and status will now be either

  • succes (as defined per StatusCompleted)
  • error (as defined per StatusFailSetup)

If the operation succeds you instance will be available in a minute or two.