All Projects → tracboat → tracboat

tracboat / tracboat

Licence: GPL-3.0 license
Trac to GitLab migration toolbox

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to tracboat

trac-to-gitlab
Easily migrate your Trac instance to Gitlab
Stars: ✭ 22 (-31.25%)
Mutual labels:  gitlab, trac
MigrateGitlabToGogs
Migrate repositories from Gitlab to Gogs or Gitea
Stars: ✭ 49 (+53.13%)
Mutual labels:  gitlab, migration
gitlab to gitea
Gitlab to Gitea migration script.
Stars: ✭ 54 (+68.75%)
Mutual labels:  gitlab, migration
react-unleash-flags
React Component for Gitlab or Unleash Feature Flags
Stars: ✭ 36 (+12.5%)
Mutual labels:  gitlab
draftjs exporter
Library to convert Draft.js ContentState to HTML
Stars: ✭ 77 (+140.63%)
Mutual labels:  exporter
daru-io
daru-io is a plugin gem to the existing daru gem, which aims to add support to Importing DataFrames from / Exporting DataFrames to multiple formats.
Stars: ✭ 21 (-34.37%)
Mutual labels:  exporter
yoda
GitHub extension for agile project management, using the issues subsystem.
Stars: ✭ 86 (+168.75%)
Mutual labels:  exporter
network exporter
ICMP & MTR & TCP Port & HTTP Get - Network Prometheus exporter
Stars: ✭ 162 (+406.25%)
Mutual labels:  exporter
git-the-lines
A Discord bot that prints out the lines referenced in a GitHub, GitLab, or BitBucket snippet link
Stars: ✭ 37 (+15.63%)
Mutual labels:  gitlab
gitlabform
🏗 Specialized "configuration as a code" tool for GitLab
Stars: ✭ 332 (+937.5%)
Mutual labels:  gitlab
sqlize
sql migration schema generate from models
Stars: ✭ 47 (+46.88%)
Mutual labels:  migration
prometheus exporter base
Base library for Rust Prometheus exporters
Stars: ✭ 30 (-6.25%)
Mutual labels:  exporter
git-squash
Locally squash commits on a branch without resolving any conflicts (a'la squash and merge)
Stars: ✭ 123 (+284.38%)
Mutual labels:  gitlab
harmonica
Kotlin Database Migration Tool. This tool makes it really easy to create table, index, add columns, and so on, with Kotlin DSL.
Stars: ✭ 123 (+284.38%)
Mutual labels:  migration
genshin-audio-exporter
Export audio files from Genshin Impact game data into different audio formats.
Stars: ✭ 83 (+159.38%)
Mutual labels:  exporter
pgcapture
A scalable Netflix DBLog implementation for PostgreSQL
Stars: ✭ 94 (+193.75%)
Mutual labels:  migration
MergeRequestsCI
👀 UI to see all GitLab merge requests of your teams in one place
Stars: ✭ 14 (-56.25%)
Mutual labels:  gitlab
yii2-console-migration
yii2命令行中使用migration备份和还原数据库
Stars: ✭ 35 (+9.38%)
Mutual labels:  migration
slab
gitlab API를 사용해 귀찮은 일을 덜어주는 slack 봇.
Stars: ✭ 14 (-56.25%)
Mutual labels:  gitlab
session
Aplus Framework Session Library
Stars: ✭ 170 (+431.25%)
Mutual labels:  gitlab
image

TracBoat

Build status Coverage report Codacy License

A life boat to escape the Trac ocean liner.

TracBoat is a toolbox for exporting whole Trac instances, saving them and migrating them to other platforms.

Features

  • Export Trac projects along with issues, issue changelogs (with attachments) and wiki pages (with attachments)
  • Create GitLab users, projects and namespaces involved in the migration process
  • Export Trac projects to local files (in json, toml, Python literal or Python pickle formats)
  • Migrate Trac projects directly from remote instances as well as from previously created export files
  • Migrate Trac projects to a live GitLab instance
  • Migrate Trac projects to a mocked GitLab on the file system to check for correctness

Installation

If you want to install from source, doing it in a virtualenv is highly recommended. After having this repo cloned, just type:

$ cd tracboat
$ virtualenv -p python2.7 VENV
$ source VENV/bin/activate
$ pip install -r requirements/dist.txt
$ pip install -e .

Alternatively with pipenv

$ cd tracboat
$ pip install pipenv
$ pipenv install -e .
$ pipenv run tracboat

Dependencies

Getting started

Every command line option can be specified as an environment variable, so the following command:

$ tracboat users --trac-uri=https://mytrac/xmlrpc --no-ssl-verify

...is exactly the same as the following:

$ export TRACBOAT_TRAC_URI=https://mytrac/xmlrpc
$ export TRACBOAT_SSL_VERIFY=0
$ tracboat users

Another way to conveniently configure tracboat is with a configuration file in TOML format. Providing a file

$ cat mytrac.toml
[tracboat]
trac_uri = "https://mytrac/xmlrpc"
ssl_verify = false
$ tracboat --config-file=mytrac.toml users

Please note that when a value is specified more that once, the priority order considered is the following:

  1. command line option;
  2. environment variable;
  3. configuration file;
  4. default value.

If you are very curious about how to play with command line options, have a look to the click documentation.

Collecting Trac users

$ tracboat users --trac-uri=http://localhost/xmlrpc

Export a Trac instance

$ tracboat export --trac-uri=http://localhost/xmlrpc --format=json --out-file=myproject.json

Migrate to GitLab

$ cat awesomemigration.toml
[tracboat]
from_export_file = "myexportedtracproject.json"
gitlab_project_name = "migrated/myproject"
# see below to choose the right version
gitlab_version = "10.5"
gitlab_db_password = "Բարեւ աշխարհ"
$ tracboat --config-file=awesomemigration.toml migrate

GitLab version compatibility

Not all versions of GitLab need a specific model. You can refer to the table below to choose the correct model for your GitLab version.

Tracboat model Compatible GitLab version
11.0 11.0, 11.1, 11.2
10.5 10.5, 10.6, 10.7, 10.8
10.4 10.4
10.3 10.3
10.2 10.2
9.5 9.5
9.4 9.4
9.3 9.3
9.0 9.0
8.17 8.17
8.16 8.16
8.15 8.15
8.13 8.13
8.7 8.7
8.5 8.5
8.4 8.4

If your GitLab version is not in the table, it has not been tested yet. Try with the first model lower than your version, and report any issue you encounter.

e.g. for GitLab 9.2, try 9.0 model

Migrating users

During a migration we need to map Trac usernames to GitLab user accounts to keep all associations between issues, changelog entries and wiki pages and their authors. By default, all Trac usernames are mapped to a single GitLab user, the so called fallback user. This way you'll end up with a migrated project where all activity looks like it come from a single user. Not so fancy, but definitely handy if you just care about content. You can specify a custom fallback username with the proper option:

$ cat config.toml
[tracboat]
fallback_user = "[email protected]"

As usual, the same behaviour can be obtained via command line option or environment variable. So doing this:

$ export [email protected]
$ tracboat migrate

...is the same as doing this:

$ tracboat migrate [email protected]
Mapping users

When you want your Trac users mapped to a GitLab user (and to the corresponding account) you need to specify a custom user mapping, or an association between a Trac username and a GitLab account. You can use a key-value section in the configuration file:

$ cat config.toml
[tracboat.usermap]
    tracuser1 = "[email protected]"
    tracuser2 = "[email protected]"
    tracuser3 = "[email protected]"

In this case, every action that in the Trac project belongs to tracuser1, in the migrated GitLab project will end up as being authored by [email protected].

You can add extra mappings using the --umap command line option, so doing like this:

$ tracboat migrate --umap tracuser1 [email protected] --umap tracuser2 [email protected] ...

...obtains exactly the same behaviour as with the configuration file above. Remember that for repeated values, command line takes precedence over configuration file.

Custom user attributes

If a user doesn't exist in GitLab yet, he will be created during the migration process. However, creating a new GitLab account is a fairly complex affair: you can specify social accounts, biography, links and a lot of other stuff. If you don't say anything about how an user should be created, Tracboat uses some defaults. However you can throw a proper section in the configuration file to tweak those user creation attributes:

$ cat config.toml
[tracboat.users.default]
    admin = false
    external = true
    website_url = "http://www.foo.gov"

Those values will be applied to all new accounts created during the migration process. However, you can specify additional user subsections to precisely control which values would be used for a particular account:

$ cat config.toml
[tracboat.users.default]
    admin = false
    external = true
    website_url = "http://www.foo.gov"

[tracboat.users."[email protected]"]
    username = "theboss"
    bio = "Hi. I am the boss here."
    admin = true
    twitter = "@theboss"
    external = false

In this case, all users are going to be created with the attributes contained in the [tracboat.users.default] section except for the boss that asked explicitly for some extra goodies.

Example

This is a fairly complete configuration example with a usermap and custom user attributes. You can find additional examples in the examples/ directory.

# Tracboat will look for values in the [tracboat] section only, so
# you can merge in a single file values for other applications.

[tracboat]

# The Trac instance to be crawled.
# If you have any secrets in the URL (just like in this case,
# our password is in plain text), consider using the corresponding
# environment variable TRACBOAT_TRAC_URI to avoid having secrets in
# the configuration file.
trac_uri = "https://myuser:MYPASSWORD@localhost/login/xmlrpc"

# Disable ssl certificate verification (e.g.: needed with self signed certs).
ssl_verify = false

# The GitLab project name.
# Can be specified as a path, subdirectories will be treated as GitLab
# namespaces.
gitlab_project_name = "migrated/myproject"

# The fallback user, used when a Trac username has no entry in the
# [tracboat.usermap] section.
fallback_user = "[email protected]"

# Users configuration.
# Every section beyond this point can be passed in separate TOML files
# with repeated --umap-file command line options or directly here:
#
# umap_file = ['users1.toml', 'users2.toml']

# The Trac -> GitLab user conversion mapping.
# It is *highly* recommended to use a valid email address for the GitLab part
# since by default each account will be created with a random password
# (you need a valid address for the password reset procedure to work properly).
[tracboat.usermap]
    tracuser1 = "[email protected]"
    tracuser2 = "[email protected]"
    tracuser3 = "[email protected]"
    tracuser4 = "[email protected]"

[tracboat.users]
# GitLab users attributes.
# This section allows to specify custom attributes
# to be used during GitLab user creation. Accepted values are
# listed here:
# https://docs.gitlab.com/ce/api/users.html#user-creation

[tracboat.users.default]
    # This 'default' section specifies attributes applied
    # to all new GitLab users.
    external = true

[tracboat.users."[email protected]"]
    # This section affects a specific user (in this case "[email protected]").
    # These key-value entries will be merged with those in the
    # [tracboat.users.default] section. For repeated values, those specified
    # here will prevail.
    #
    # There are some mandatory values that must be specified
    # for each user, otherwise the following default values
    # will be used:
    #
    # username = ...
    #     Defaults to the user part of the GitLab email address
    #     (e.g. "gitlabuser4" for "[email protected]").
    #
    # encrypted_password = ...
    #     Defaults to a random password (at the first login the user must carry
    #     out a password reset procedure). Anyway, you are *highly* discouraged
    #     to specify secrets here, please stick to the default behaviour.
    username = "theboss"
    bio = "Hi. I am the boss here."
    admin = true
    twitter = "@theboss"
    external = false  # this value overrides tracboat.users.default.external

[tracboat.users."[email protected]"]
    # This section affects the fallback user, used when a Trac
    # username has no entry in the [tracboat.usermap] section.
    username = "migration-bot"
    bio = "Hi. I am the robot that migrated all your stuff."
    admin = true
    external = false

Credits

Tracboat was initially created by Federico Ficarelli and is now maintained by a pack of great contributors (refer to AUTHORS file for details). Initial inspiration and core migration logic comes from the trac-to-gitlab project by Maël Lavault: this project was born from heavy cleanup and refactoring of that original code, so this is why this spinoff inherited its GPLv3 license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].