Project

General

Profile

Helper Scripts » History » Version 11

Enis Nuredini, 23.08.2023 11:19

1 1 Enis Nuredini
h1. Helper Scripts
2
3 5 Enis Nuredini
h2. Backup project folder and both DBs
4
5
*tear_down_project.py*  
6 1 Enis Nuredini
Functionality: Creating backup file from project folder and databases (data and typo3). Transfering files to /scratch/tmp/365/. Comprimising all files in one tar. Deleting all created files during this process (except the summary tar file).
7 2 Enis Nuredini
8 1 Enis Nuredini
Requirement: User should have ssh keys for the affected server hosts.
9
10
Configuration: In the top of the script the project and database host can be written. Path to the ssh keys is set as default.
11
12 11 Enis Nuredini
Executed from: Own host
13 7 Enis Nuredini
14 5 Enis Nuredini
h2. Transfer specific records from DB1 to DB2
15
16 6 Enis Nuredini
*table_groupmember_reference_transfer.py* 
17 3 Enis Nuredini
Functionality: User given argument will be searched in configured column (default: reference) from table (default: GroupMember). All found records are transfered from source DB to target DB. If record with given argument exists on target DB then UPDATE statement is executed, otherwise INSERT statement.
18
19
Requirement: Table structure from source and target DB must be identical. Date and datetime defaults, if nothing given in source record needs to be NULL, otherwise mysql outputs an error.
20
21
Configuration: DB-users, hostnames and affected table or column can be set inside the script.
22 7 Enis Nuredini
23 8 Enis Nuredini
h2. Guide to synchronize fileadmin files and transfer tables
24 7 Enis Nuredini
25
*set_project_live.py - table_data_transfer.py*
26 10 Enis Nuredini
Functionality: Numbered listing of all existing files and folders in fileadmin (depth level: 1). Ability to choose the paths which the user wants to synchronize with rsync. rsync with dry-run will be executed. Paths are filtered by existing files or folders that needs to be synced. Final rsync without dry-run will start and for every rsync user is asked if it should be executed. After fileadmin sync is finished the next script for table transfer will start automatically.  User is asked to give a comma seperated list of tables which should be transfered (overwrite) the tables on the target host.  DB dump from source and target host will be created. Affected target host tables will be truncated and overwritten with the source host table data.
27 7 Enis Nuredini
28
Requirement: Both scripts needs to be in same folder and located in source server host, where the to transfered project is. Used DB-Users should have access to the databases. Source host should have ssh access to target host.
29
30
Configuration: Target_hostname (default: w22a), DB-users and DB-hosts (wdb16.math.uzh.ch, wdb22.math.uzh.ch) can be defined inside the script. In this example the source host was: w16