| 96 | | * Tool: [https://github.com/tahoe-lafs/trac2gitea trac2gitea] |
| | 98 | * Requirements: |
| | 99 | * Code: [https://github.com/tahoe-lafs/MoveOffTrac MoveOffTrac] and [https://github.com/tahoe-lafs/trac2gitea trac2gitea] submodule |
| | 100 | * Credentials: |
| | 101 | * SSH key to access Trac data on Linode server |
| | 102 | * API token to write content under the Forgejo org/owner |
| | 103 | * Steps: |
| | 104 | 1 On Trac server (the export is scripted in `helpers/trac_dump.sh` in [https://github.com/tahoe-lafs/MoveOffTrac MoveOffTrac]): |
| | 105 | 1. Activate the Python environment if needed |
| | 106 | 2. Launch a `trac-admin <path/to/project>` shell and run the `hotcopy <dump_dir>` command |
| | 107 | 3. Purge session from the hotcopy with `trac-admin <dump_dir>` and `session purge ...` |
| | 108 | 4. Purge db backup from `rm -rf <dump_dir>/db/trac-backup*` |
| | 109 | 5. Purge log files from the hotcopy `rm -f <dump_dir>/log/*` |
| | 110 | 6. Compact the DB with `sqlite3 <dump_dir>/db/trac.db 'VACUUM;'` |
| | 111 | 7. Copy trac.htdigest to <dump_dir> |
| | 112 | 8. Copy trac public_html to <dump_dir> |
| | 113 | 9. Archive the Trac data `tar -czvf <dump_file> <dump_dir>` |
| | 114 | 2. On a workstation: |
| | 115 | 1. Checkout [https://github.com/tahoe-lafs/MoveOffTrac MoveOffTrac] and [https://github.com/tahoe-lafs/trac2gitea trac2giteam] submodule (e.g. in `~/MoveOffTrac`) |
| | 116 | 1. Restore the dump with `tar -C trac/project -xzvf <dump_file> --strip-components=1` |
| | 117 | 2. Adapt or patch the configuration with `patch trac/project/conf/trac.ini < helpers/trac.ini.patch` if needed |
| | 118 | 3. Launch a `docker-compose run --rm trac bash -c "trac-admin project"` session and run `permission add <username_here> admin` if needed |
| | 119 | 4. Start the server with `docker-compose run --rm --service-ports trac` |
| | 120 | 5. Open a browser on http://localhost:8000/project/ and verify the service (including the login if needed) |
| | 121 | 6. Edit the WikiStart page to replace link: `/~trac/` -> `../chrome/site/` or transform them as attachment if needed |
| | 122 | 3. On the Forgejo server: |
| | 123 | 1. Checkout [https://github.com/tahoe-lafs/MoveOffTrac MoveOffTrac] and [https://github.com/tahoe-lafs/trac2gitea trac2giteam] submodule (e.g. in `~/MoveOffTrac`) |
| | 124 | 2. Create an empty repository and (e.g. `trac`) and disable unwanted features (e.g. Unit/Code) |
| | 125 | 3. Create an empty Wiki home page in the repository prepared above |
| | 126 | 4. Build trac2gitea using the instructions provided (in [https://github.com/tahoe-lafs/trac2gitea trac2gitea]) |
| | 127 | 5. Transfer the Trac project directory from the workstation (previous sextion) (e.g.: in `~/MoveOffTrac/trac/project`) |
| | 128 | 6. Remote: migrate the Trac project to Forgejo: |
| | 129 | {{{ |
| | 130 | export TOKEN=<token> |
| | 131 | export OWNER=tahoe-lafs |
| | 132 | export REPO=trac |
| | 133 | sudo ./trac2gitea/trac2gitea --app-ini /var/lib/forgejo/custom/conf/app.ini --db-only trac/project /var/lib/forgejo $OWNER $REPO |
| | 134 | sudo ./trac2gitea/trac2gitea --app-ini /var/lib/forgejo/custom/conf/app.ini --wiki-only --wiki-token=$TOKEN --wiki-dir=/tmp/$REPO trac/project /var/lib/forgejo $OWNER $REPO |
| | 135 | }}} |
| | 136 | 7. Remote: `systemctl start forgejo.service` |