How to correctly dump metadata other RT environment?

Hi guys!

I’m trying to move all customizations I did in our productive environment
to our test environment (on a clean, fresh installation).
I do not want to transfer the complete database because I dont need the
tickets (and all the other stuff like transactions, etc.). So I thought
the right way is to use the rt-dump-metadata program.
If I try to import the metadata-file through rt-setup-database into the
test-environment I get errors and the configuration is not transferred
successfully!

Could someone of you give me an explanation, what the definite steps for
moving this metadata are?
My approach was the following:

Export:
rt4/sbin/rt-dump-metadata -a -s > metadata.xml

Import:
rt4-devel/sbin/rt-setup-database --action drop
rt4-devel/sbin/rt-setup-database --action create,schema
rt4-devel/sbin/rt-setup-database --action insert --datafile
…/rt4/metadata.xml

Did I miss a step? I don’t know if I have to do --action acl,coredata
first or not. However, I get many different errors.

I’m using two completely separated instances of RT 4.2.7 with MySQL 5.5.38
on Debian 7

Would be fine, if someone has some input for me! I will try the
recommended steps and get the definite error messages for you
afterwards…

Greetings,

Markus Wildbolz

Hi Markus

I was very interested to see answers on this because I have the same issue.

For me, there are two parts:

  1.  Take everything from production except Tickets and Transactions
    
  2.  Restore anything in Dev/Test that has not made it to production yet (test queues, group rights, etc) so we don't have to re-create it all through the browser
    

I wrote a quick script (steps outlined below), but it feels very kludge-y so I’m sure there is a better way!

Bear in mind that I am taking this list from a script, so you’ll obviously have to adjust the commands and I’ve likely mis-typed the syntax of a few.

  •     Run MySQL dump files of production:
    

mysqldump -uroot -pPASSWORD -hPRODUCTION_HOST rt4 --ignore-table=rt4.Tickets --ignore-table=rt4.AttachmentsIndex --ignore-table rt4.sessions > production.sql
mysqldump -uroot -pPASSWORD -hPRODUCTION_HOST --no-data rt4 Tickets >> production.sql
mysqldump -uroot -pPASSWORD -hPRODUCTION_HOST --no-data rt4 sessions >> production.sql

  •     Drop Test rt4 database
    
  •     Create Test rt4 database
    
  •     Import the production dump
    

mysql -uroot -pPASSWORD -Drt4 < production.sql

  •     Run a select on the Queues table to get all the CorrespondAddress values from the database.  Alter these addresses for Test (here we use the same addresses, with "test" appended) and run an Update loop to change them.
    
  •     Remove the old RT logs, Apache logs, and sphinx indexes
    
  •     Run the RT Validator to clean out anything related to the (now missing) Tickets:
    

/opt/rt4/sbin/rt-validator -c --resolve --force

  •     Add the Sphinx table back in
    

/opt/rt4/sbin/rt-setup-fulltext-index --dba root --dba-password PASSWORD --maxmatches=10000 --url=‘sphinx://127.0.0.1:3312/rt’ --table=‘AttachmentsIndex’

  •     Re-run the LDAP user import to get any updates to users/groups
    

/opt/rt4/local/plugins/RT-Extension-LDAPImport/bin/rtldapimport --import --debug > /opt/rt4/var/log/rt_ldapimport.log 2>&1

  •     We change the title bar to red in Test so we can see at a glance which environment we are in while using the browser interface.  The lines are too long to post here unless someone is very interested.  In short, we check for existing theme mods to not overwrite something else, then create a small initialdata file with just the new @Attributes entry, then import that with the rt-setup-database command
    
  •     I keep a separate directory of initialdata files (containing all customizations made to Test but not yet in production) and import those too.
    

This works, but after a new import I often have to stop apache, start the built-in server to log in once, then restart apache.

  •      BrentFrom: rt-users [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Markus.Wildbolz@eu.magna.com
    

Sent: Tuesday, October 07, 2014 7:46 AM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] How to correctly dump metadata other RT environment?

Hi guys!

I’m trying to move all customizations I did in our productive environment to our test environment (on a clean, fresh installation).
I do not want to transfer the complete database because I dont need the tickets (and all the other stuff like transactions, etc.). So I thought the right way is to use the rt-dump-metadata program.
If I try to import the metadata-file through rt-setup-database into the test-environment I get errors and the configuration is not transferred successfully!

Could someone of you give me an explanation, what the definite steps for moving this metadata are?
My approach was the following:

Export:
rt4/sbin/rt-dump-metadata -a -s > metadata.xml

Import:
rt4-devel/sbin/rt-setup-database --action drop
rt4-devel/sbin/rt-setup-database --action create,schema
rt4-devel/sbin/rt-setup-database --action insert --datafile …/rt4/metadata.xml

Did I miss a step? I don’t know if I have to do --action acl,coredata first or not. However, I get many different errors.

I’m using two completely separated instances of RT 4.2.7 with MySQL 5.5.38 on Debian 7

Would be fine, if someone has some input for me! I will try the recommended steps and get the definite error messages for you afterwards…

Greetings,

Markus Wildbolz

Hi,

There is a possible similar topic here: Reproducible RT Configuration management

Please join that converstaion if you have any idea!

Thanks,

Akos