Difference between pages "E-Boks doc2mail" and "Moving database from live to test"

From TempusServa wiki
(Difference between pages)
Jump to navigation Jump to search
old>Admin
 
old>Admin
 
Line 1: Line 1:
== Option: Database creation ==
I can there is no database allready please perform the following steps (assuming no db is sandbox)


== Install components ==
  mysql -uUSERNAME -pPASSWORD
Before you start ensure Java 8 is the default


=== Certificate ===
  CREATE DATABASE IF NOT EXISTS sandboxbase;
Ensure you have a valid certificate
  CREATE DATABASE IF NOT EXISTS sandboxtest;
  CREATE DATABASE IF NOT EXISTS sandboxlive;
  CREATE USER 'sandboxroot'@'localhost' IDENTIFIED BY 'TempusServaFTW!';
  GRANT ALL PRIVILEGES ON sandboxlive.* TO 'sandboxroot'@'localhost';
  GRANT ALL PRIVILEGES ON sandboxtest.* TO 'sandboxroot'@'localhost';
  GRANT ALL PRIVILEGES ON sandboxbase.* TO 'sandboxroot'@'localhost';


  sudo nano /mnt/sda/certs/doc2mail.pke


Copy paste contents of the certificate 
== Database transfer ==
Choose ONE of the options below that best suits your requirements.


  sudo chmod 777 /mnt/sda/certs/doc2mail.pke
=== Database transfer: Different MySQL server / Same schema name ===
Export data from LIVE server


=== Binaries ===
  mysqldump -uUSERNAME -pPASSWORD --databases tsbase tslive tstest > dump.sql
Download OneTooX implementation


  cd /mnt/sda/deploy
Import data to TEST server
  sudo wget https://www.tempusserva.dk/install/doc2mail/doc2mail.zip
  unzip doc2mail.zip
  sudo mv lib doc2mail
  cd doc2mail
  sudo chmod 777 *


== Test setup ==
  mysql -uUSERNAME -pPASSWORD --force < dump.sql
Update the parameters below
* i: Location of a test PDF
* t: Name of the document type
* r: A real CPR number


Execute the following command
=== Database transfer: Same MySQL server / Different schema name ===


  java -cp .:/mnt/sda/deploy/doc2mail/* dk.doc2mail.client.FileUploaderClient --address "https://privat.doc2mail.dk/delivery/FileUploader.asmx" --certificate "/mnt/sda/certs/doc2mail.pke" -i "/tmp/eboks_test.pdf" --title "Oplysningsskemaet" -d ebokskmdprint -u "domainX\userY" -t "tempus serva" --ss "Oplysningsskema" --testmode 3 -r 1234561234 --rt CPR
Export data from LIVE server


A success messag will look something like
  mysqldump -uUSERNAME -pPASSWORD tsbase > dumpBase.sql
  mysqldump -uUSERNAME -pPASSWORD tslive > dumpLive.sql
  mysqldump -uUSERNAME -pPASSWORD tstest > dumpTest.sql


  <uploadStatus>
Import data to TEST server (assuming name is 'sandbox')
    <deliveryInformation>
        <destination>5</destination>
        <errorCode>0</errorCode>
        <id>148069122</id>
        <mailPriority>B</mailPriority>
        <responseInfo>No response</responseInfo>
        <status>OK</status>
        <succeeded>true</succeeded>
    </deliveryInformation>
    <message>OK</message>
    <success>true</success>
    <time>3379</time>
  </uploadStatus>


== Server configuration ==
  mysql -uUSERNAME -pPASSWORD sandboxbase < dumpBase.sql
Make the following substitutions
  mysql -uUSERNAME -pPASSWORD sandboxlive < dumpLive.sql
* i: @@DOCUMENT@@
  mysql -uUSERNAME -pPASSWORD sandboxtest < dumpTest.sql
* title: @@TITLE@@
* r:@@CPR@@
* testmode: 0


The connection string should look something like
== Configuration changes ==
Important information:
The following script will updata the database '''tslive''', for the sandbox copy example please '''USE sandboxlive;'''.


  java -cp .:/mnt/sda/deploy/doc2mail/* dk.doc2mail.client.FileUploaderClient --address "https://privat.doc2mail.dk/delivery/FileUploader.asmx" --certificate "/mnt/sda/certs/doc2mail.pke" -i "@@DOCUMENT@@" --title "@@TITLE@@" -d ebokskmdprint -u "domainX\userY" -t "tempus serva" --ss "Oplysningsskema" --testmode 0 -r @@CPR@@ --rt CPR
Run the following commands '''before''' you start the server


Finally copy this value to the server configuration parameter: '''eboksIntegrationTemplate'''
  mysql -uUSERNAME -pPASSWORD
 
  USE tslive;
  UPDATE systempolicy SET PolicyValue = 'false' WHERE PolicyName='serviceAutostart';
  UPDATE systempolicy SET PolicyValue = 'true' WHERE PolicyName='smtpTestMode';
  UPDATE systempolicy SET PolicyValue = 'localhost' WHERE PolicyName='smtpServer';
  UPDATE systempolicy SET PolicyValue = 'localhost' WHERE PolicyName='applicationServer';
  UPDATE systempolicy SET PolicyValue = 'http://localhost' WHERE PolicyName='applicationURL';
  UPDATE systempolicy SET PolicyValue = '' WHERE PolicyName LIKE 'folder%';
  UPDATE systempolicy SET PolicyValue = 'C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps' WHERE PolicyName='applicationBasePath';
 
Note:
The following changes can be replaced by setting the values in the application deployment descriptor, starting from version 2500
 
== Rebuild views ==
Ensure that views exist by rebuilding them
 
  Designer > Modules > Admin services > RebuildViews
 
 
== Troubleshooting ==
 
=== Server not started ===
* Check application server log files for information
* Tomcat
** Check xml descriptor is found in [TOMCAT]/conf/Catalina/localhost
** Check war file is unpacked correctly in [TOMCAT]/webapps
 
=== Cannot select fieldtype when adding or editing fields ===
# Run the following SQL command
 
  USE tsbase;
  DROP VIEW IF EXISTS viewdatatypeselector;
  CREATE VIEW viewdatatypeselector AS
    SELECT
      systemdatatype.FeltTypeID AS `FeltTypeID`,
      concat(systemdatatypepackage.TypePrefix,': ',systemdatatype.FeltType) AS `FeltType`
    FROM systemdatatype
    JOIN systemdatatypepackage
      ON systemdatatype.PackageID = systemdatatypepackage.PackageID
    WHERE systemdatatype.IsSelectable = 1)
    ORDER BY systemdatatypepackage.SortOrder, systemdatatype.FeltType;
 
# Repeat the "Rebuild views above"

Revision as of 12:23, 3 October 2013

Option: Database creation

I can there is no database allready please perform the following steps (assuming no db is sandbox)

 mysql -uUSERNAME -pPASSWORD
 CREATE DATABASE IF NOT EXISTS sandboxbase; 
 CREATE DATABASE IF NOT EXISTS sandboxtest;
 CREATE DATABASE IF NOT EXISTS sandboxlive;
 CREATE USER 'sandboxroot'@'localhost' IDENTIFIED BY 'TempusServaFTW!';
 GRANT ALL PRIVILEGES ON sandboxlive.* TO 'sandboxroot'@'localhost';
 GRANT ALL PRIVILEGES ON sandboxtest.* TO 'sandboxroot'@'localhost';
 GRANT ALL PRIVILEGES ON sandboxbase.* TO 'sandboxroot'@'localhost';


Database transfer

Choose ONE of the options below that best suits your requirements.

Database transfer: Different MySQL server / Same schema name

Export data from LIVE server

 mysqldump -uUSERNAME -pPASSWORD --databases tsbase tslive tstest > dump.sql

Import data to TEST server

 mysql -uUSERNAME -pPASSWORD --force < dump.sql

Database transfer: Same MySQL server / Different schema name

Export data from LIVE server

 mysqldump -uUSERNAME -pPASSWORD tsbase > dumpBase.sql
 mysqldump -uUSERNAME -pPASSWORD tslive > dumpLive.sql
 mysqldump -uUSERNAME -pPASSWORD tstest > dumpTest.sql

Import data to TEST server (assuming name is 'sandbox')

 mysql -uUSERNAME -pPASSWORD sandboxbase < dumpBase.sql
 mysql -uUSERNAME -pPASSWORD sandboxlive < dumpLive.sql
 mysql -uUSERNAME -pPASSWORD sandboxtest < dumpTest.sql

Configuration changes

Important information: The following script will updata the database tslive, for the sandbox copy example please USE sandboxlive;.

Run the following commands before you start the server

 mysql -uUSERNAME -pPASSWORD
 USE tslive;
 UPDATE systempolicy SET PolicyValue = 'false' WHERE PolicyName='serviceAutostart';
 UPDATE systempolicy SET PolicyValue = 'true' WHERE PolicyName='smtpTestMode';
 UPDATE systempolicy SET PolicyValue = 'localhost' WHERE PolicyName='smtpServer';
 UPDATE systempolicy SET PolicyValue = 'localhost' WHERE PolicyName='applicationServer';
 UPDATE systempolicy SET PolicyValue = 'http://localhost' WHERE PolicyName='applicationURL';
 UPDATE systempolicy SET PolicyValue =  WHERE PolicyName LIKE 'folder%';
 UPDATE systempolicy SET PolicyValue = 'C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps' WHERE PolicyName='applicationBasePath';

Note: The following changes can be replaced by setting the values in the application deployment descriptor, starting from version 2500

Rebuild views

Ensure that views exist by rebuilding them

 Designer > Modules > Admin services > RebuildViews


Troubleshooting

Server not started

  • Check application server log files for information
  • Tomcat
    • Check xml descriptor is found in [TOMCAT]/conf/Catalina/localhost
    • Check war file is unpacked correctly in [TOMCAT]/webapps

Cannot select fieldtype when adding or editing fields

  1. Run the following SQL command
 USE tsbase;
 DROP VIEW IF EXISTS viewdatatypeselector;
 CREATE VIEW viewdatatypeselector AS
   SELECT
     systemdatatype.FeltTypeID AS `FeltTypeID`,
     concat(systemdatatypepackage.TypePrefix,': ',systemdatatype.FeltType) AS `FeltType` 
   FROM systemdatatype 
   JOIN systemdatatypepackage 
     ON systemdatatype.PackageID = systemdatatypepackage.PackageID 
   WHERE systemdatatype.IsSelectable = 1)
   ORDER BY systemdatatypepackage.SortOrder, systemdatatype.FeltType;
  1. Repeat the "Rebuild views above"