trac-upgrade-and-migration
Trac Upgrade and Migration
We need to perform the following tasks:
- Migrate Trac project to a new host
- Upgrade from Trac==0.12.2 to Trac==1.0.1
- Migrate tickets from old Trac project to new Trac project
Possible solutions to migrate tickets from old Trac project to new Trac project:
- Manual ticket migration
- allows for intelligent migration of tickets
- allows for important ticket proceedures to be properly documented in sphinx
- time consuming
- Export old, import new
- moves ALL data to new project (even garbage)
- ticket numbers persist
- NOT time consuming
- Research and develop a 'clone to new system' plugin
- allows for intelligent migration of tickets
- allows for important tasks to be documented in Ops Handbook
- time consuming (plugin development + manual migration)
- Put old Trac into read-only, leave it running till it dies?
- manual migration of open tickets
- simple as: chmod 000 pass_file
- operation headache, confusing to have two tracs
setup development env from hot-copy of prod
create hot-copy of trac:
create a tar archive of hot backup:
on your workstation scp tar archive:
unarchive:
create virtualenv:
install Genshi==0.6 because Trac==0.12.2 breaks with Genshi==0.7:
install Trac==0.12.2:
test setup:
open browser to http://127.0.0.1:8800
upgrade from Trac==0.12.2 to Trac==1.0.0
bring hot-copy tracd server offline
Update the Trac Code to Trac==1.0:
Upgrade the Trac environment:
test setup:
upgrade again from Trac==1.0.0 to Trac==1.0.1
bring hot-copy tracd server offline
Update the Trac Code to Trac==1.0.1:
Upgrade the Trac environment:
test setup:
dump ticket tables from hot-copy and import to new project
move to db directory:
dump each table related to tickets:
sqlite3 trac.db ".dump ticket" > trac_ticket.sql sqlite3 trac.db ".dump ticket_change" > trac_ticket_change.sql sqlite3 trac.db ".dump ticket_custom" > trac_ticket_custom.sql sqlite3 trac.db ".dump ticket_template_store" > trac_ticket_template_store.sql sqlite3 trac.db ".dump attachment" > trac_attachment.sql sqlite3 trac.db ".dump milestone" > trac_milestone.sql sqlite3 trac.db ".dump pastes" > trac_pastes.sqlcopy *.sql to the new trac project db directory
become trac user:
import the tables:
cat trac_ticket.sql | sqlite3 trac.db cat trac_ticket_change.sql | sqlite3 trac.db cat trac_ticket_custom.sql | sqlite3 trac.db cat trac_ticket_template_store.sql | sqlite3 trac.db cat trac_attachment.sql | sqlite3 trac.db cat trac_milestone.sql | sqlite3 trac.db cat trac_pastes.sql | sqlite3 trac.dbcopy files/attachments directory from hot-copy to new Trac project. Make sure owner:group is trac:trac:
trac database tables and explanations
- attachment
-
KEEP - meta data for attachment files. Also need underlying attachment directory.
- auth_cookie
-
DROP - cookie session data for logged in users
- cache
-
DROP - only record: 901198563trac.wiki.api.WikiSystem.pages
- component
-
DROP - we plan to create new components via config management
- enum
-
DROP - we plan to create new enums (priority, severity, ticket_type, resolution) via config management
- milestone
-
KEEP - we have 7 records that need to be moved, Trac defaults to Milestone 1, 2, 3, 4
- node_change
-
DROP - empty
- pastes
-
KEEP - we need to install paste plugin
- permission
-
DROP - we don't need to migrate old permissions. we need a plan to place in config management
- report
-
DROP - we don't need old reports. we might want to back them up as examples
- repository
-
DROP - empty
- revision
-
DROP - empty
- session
-
DROP - session data for when people logged in and what they did to the trac system
- session_attribute
-
DROP - session data for when people logged in and what they did to the trac system
- subtickets
-
KEEP but DROP - we might need to transform this data to work with new subticket plugin
- system
-
DROP - version numbers of plugins and modules
- ticket
-
KEEP - tickets
- ticket_change
-
KEEP - ticket history
- ticket_custom
-
DROP - ticket custom fields, lots of garbage from old plugins. We will be generating a migration from subticket to new childticket plugin that will insert into this table.
- ticket_template_store
-
KEEP - ticket templates which auto fill body message with text, discuss this
- version
-
DROP - empty
- wiki
-
DROP - discuss, we could migrate everything or we could migrate some pages
subtickets migration to child ticket plugin
dump out the data and edit with vim
sqlite3 trac.db
sqlite> .mode csv
sqlite> .out trac_subtickets.csv
sqlite> SELECT child,parent FROM subtickets;
sqlite> .exit
vim trac_subtickets.csvrun the following search and replace transformations:
%s/,/,"parent","#/g
%s/$/");/g
%s/^/INSERT INTO "ticket_custom" VALUES(/g
rename
Remarkbox
Comments