Migration of old cosmoSys instances (Redmine 4.2 with cosmosys_rm, cosmosys_req_rm, cosmosys_git_rm and, in some, cosmosys_req_poris_rm) to the current cosmoSys (Redmine 7, deployed with cosmoSys_deploy), through snapshots, with their history, their users and passwords, and their tags.
The migration procedure is written in Spanish: docs/procedimiento-migracion.md. It is meant to be followed end to end, without help, by an administrator who knows Docker and Linux but not cosmoSys internals. Start there, and follow it from a released version, not from the tip of main:
git clone --branch v0.1.0 https://github.com/cosmoBots/snapshots_gen.gitRead this before running anything against a real instance. Every file the migration produces is a copy of the old instance and must be handled like a database backup:
- the legacy snapshot (
.cslegacy) and the history package (.cshistory) carry every user's e-mail address and password hash (salted SHA-1, the scheme of Redmine 4.2 and 7, which a weak password does not survive); - the
.csyspackages carry the whole content of each project, the.cstagspackage the names of every tag, and the conversion report (report.md,report.json), the import reports and the comparison extracts carry logins, subjects, notes and values.
Keep them in a private working directory (umask 077, modes 700 and 600, outside any Git checkout or synchronized folder), move them only over SSH or on an encrypted disk, never by e-mail, chat, issue or public link, and delete them when the migration is over. The procedure has a section on this ("Material sensible") with what each file holds, how to check permissions, how to move and delete them, and what to do if one ends up in the wrong place.
To report a security problem, see SECURITY.md: only through GitHub's private vulnerability reporting, and never with data from a real instance.
The procedure was rehearsed from Redmine 4.2.10 on MySQL 5.7 (with additionals 3.0.5.2 and the cosmoBots fork of additional_tags 1.0.4) to cosmoSys 0.2.10 with cosmoSys Requirements, on Redmine 7.0.1 and PostgreSQL 16, with the tags plugin set of cosmoSys_deploy (additionals and additional_tags 4.6.0). It needs a cosmoSys_deploy that pins cosmoSys 0.2.10; the procedure says how to check it. Other versions have not been rehearsed: the importer relies on internal classes of cosmoSys, so another version means rehearsing on a copy first.
The tool has three pieces, each of which knows only one side:
exporter/: runs inside the old instance withrails runner(Ruby 2.7, Rails 5.2). It only reads, installs nothing and restarts nothing. It writes a lossless legacy snapshot: every table by name, the attachment files and a report of what it could not capture.converter/: runs with a current Ruby and Redcarpet 3.5.1 (the Markdown parser of Redmine 4.2), outside both instances. It turns a legacy snapshot into a.csyspackage per root project that the cosmoSys import accepts, a history package, a tags package (.cstags) and a conversion report.importer/: runs inside the new instance withrails runner. Before the.csysimport it creates users with their passwords, groups and custom fields; it runs the.csysimport with the cosmoSys preflight; after it, before anyone works there, it writes the history (notes, changes, wiki versions, time entries and watchers) and restores the original authors and dates; and last it writes the tags, exactly as they were, into the tag plugin of the new instance, and gives each role the tag permissions its old role had. No notification is queued or sent while it runs.
Links inside the texts (to items, users and attachments, and to the old instance itself) are written by the converter as placeholders that the importer resolves with the new ids in one pass (converter/lib/snapshots_gen/text_links.rb). What is a link is decided as the old instance decided it: the converter renders each text with Redmine 4.2's formatter (converter/lib/snapshots_gen/redmine42.rb) and leaves as it was, and reports, what it cannot decide that way. The conversion report lists, per text, what the new instance renders differently and someone has to review: Markdown that Redcarpet and CommonMark read differently, and formulas of a MathJax plugin.
test/history_text.rb with test/compare_history.rb, test/tags/, and test/render_text.rb with test/compare_render.rb compare the history, the tags and the rendering of every text (images, link targets and the SHA-256 of every attachment) of the new instance with those of the old one; the procedure runs them before the new instance is opened.
The legacy snapshot format is specified in docs/legacy-snapshot-format.md and the tags package in docs/cstags-format.md.
The three pieces work end to end on a synthetic old instance and on a copy of a real one: the history of every item reads as in the source, and every tag arrives with its exact name on the same items and pages. Known limitations:
- PORIS models cannot be migrated yet: the converter writes their "blocks" relations, which the current
cosmosys_porisplugin rejects, so the.csysimport of a package that has them fails. The procedure tells you to stop if the inventory shows PORIS trackers. - The order of the tags of an item is not kept: the new tag plugin always sorts them by name.
- The new tag plugin splits names with a comma, merges names that differ only in case and deletes unused tags when an item is edited after the migration. The import keeps them exact; the inventory and the conversion report count those cases so that they can be dealt with before migrating.
- Two-factor authentication is reset, and users of external authentication (LDAP) need a password from an administrator.
- Formulas of the old MathJax plugin are not translated, and some Markdown renders differently in CommonMark (underlines, single tildes, superscripts, some lists); the conversion report lists every case for review.
- Attachments that belong to nothing (uploads never attached) are not migrated; the report lists them.
These are for maintainers of the tool; the migration itself does not need them. The format code must run on Ruby 2.7 with rubyzip 2.3 (the old instances) and on a current Ruby with rubyzip 3 (the converter):
docker run --rm -v "$PWD":/w -w /w ruby:2.7 \
bash -c 'gem install rubyzip -v 2.3.2 && ruby test/legacy_snapshot_format_test.rb'
docker build -t snapshots_gen-converter converter/
docker run --rm -v "$PWD":/w -w /w snapshots_gen-converter \
bash -c 'for t in test/*_test.rb; do ruby "$t" || exit 1; done'To check a package:
bin/verify-legacy-snapshot PACKAGE.cslegacy
bin/verify-cstags PACKAGE.cstags history=PACKAGE.cshistory csys=ROOT.csys ...test/legacy_env/ runs disposable old instances (MySQL 5.7 and Redmine 4.2.10) on a copied or synthetic application tree, test/legacy_env/synthesize.rb fills one with invented history, test/e2e.sh runs the whole migration on a disposable new instance, and test/importer_files_rollback.rb checks on disk, in a disposable instance, that a dry run or a failed history import leaves none of the files it created, and test/importer_tags_e2e.sh imports the synthetic tags of test/importer_tags_fixture.rb (case variants, commas, composed and decomposed accents, emoji, 255 characters, an unused tag, tag changes in the history, roles with and without tag permissions) and compares what PostgreSQL holds byte by byte; it also checks the refusals, a second pass, the tag permissions given to the roles and that a history of another package is refused. test/exporter_inventory_test.rb checks the tag counts of the inventory. These end-to-end scripts expect a disposable working directory and deployment of their own (see the variables at the top of each script); never point them at an instance whose data matters.
Copyright (C) 2026 cosmoBots.eu. GPL-3.0-only, like cosmoSys, whose snapshot code this tool derives from. LICENSE holds the licence text and, at its end, the Redmine licensing note of snapshots_gen, as in the cosmoSys repositories. The canonical JSON writer in exporter/legacy_snapshot_format.rb is adapted from lib/cosmosys/canonical_json.rb of cosmoSys, with changes for date values; the importer calls the snapshot classes of the cosmoSys instance it runs in and copies none of them. converter/lib/snapshots_gen/redmine42.rb adapts parts of Redmine 4.2.10 (lib/redmine/wiki_formatting/markdown/formatter.rb, app/helpers/application_helper.rb and lib/redmine/wiki_formatting.rb, Copyright (C) 2006-2023 Jean-Philippe Lang, GPL-2.0-or-later), adapted by cosmoBots.eu on 2026-11-27 and distributed here under GPL-3.0-only; the file keeps Redmine's notice.