Skip to main content

CLI tool to support migration from DSW 2.X to DSW 3.0

Project description

dsw2to3

CLI tool to support data migration from DSW 2.14 to DSW 3.0

Usage

Prerequisites

  • DSW 3.0
  • MongoDB (with DSW 2.14 data)
  • PostgreSQL (with initial DSW 3.0 structure)
  • S3 storage (e.g. Minio)
  • Python 3.6+ (recommended to use virtual environment)

The machine where you are going to execute the migration tool must have access to MongoDB, PostgreSQL, and S3 storage. See examples/docker-compose.yml for reference.

You need to run DSW 3.0 at least once before the data migration, so it initializes your PostgreSQL database (it will create tables and initial data). You can try to log-in with the default user to check if it is initialized correctly.

Don't hesitate to consult with us if unclear.

Installation

You can install the tool using PyPI:

$ python -m venv env
$ . env/bin/activate
(env) $ pip install dsw2to3
...
(env) $ dsw2to3 --help

Or using this repository:

$ git clone https://github.com/ds-wizard/dsw2to3.git
$ python -m venv env
$ . env/bin/activate
(env) $ pip install .
...
(env) $ dsw2to3 --help

Important notes

  • Migration tool must have access to MongoDB database (data source), PostgreSQL database and S3 storage (target). It needs to be configured in config.yml. During the migration (e.g. from DSW or other tool), the data must not change to avoid inconsistency.
  • Migration tool does not make any changes in MongoDB, it only reads data from there.
  • Migration tool checks if target PostgreSQL database is in expected state (after fresh installation of DSW 3.0).
  • Migration tool initially deletes all data from PostgreSQL database before migrating to avoid duplication and inconsistency (for regular use it just removes the default data, e.g., default users).
  • Migration tool initially deletes all objects in configured S3 bucket. If the bucket does not exist, it tries to create a new one.
  • Migration tool migrates data from MongoDB to PostgreSQL in expected way for DSW as well as from MongoDB (GridFS) to S3 storage.
  • You can run the tool with --dry-run to check what it will do. During dry run, nothing is deleted, changed, or added (no SQL transactions are committed).

Steps

  1. Prepare config.yml for the migration based on your setup (see config.example.yml)
  2. Stop DSW in order to prevent changes in data during the migration
  3. Run dsw2to3 -c path/to/config.yml --dry-run to see how it will work with your configuration
  4. Run dsw2to3 -c path/to/config.yml (see dsw2to3 --help for more options)
  5. After migration, run DSW 3.0 and check the migrated data
  6. Archive data from MongoDB (e.g. using mongodump)
  7. Clean up your deployment (get rid of unused services and configuration files)

In case of error during the migration, follow the details from logs. You can run it with --best-effort flag that will skip errors (just log them out).

Questions and Discussion

If anything is unclear, or you need help, let us know via issue in this repository.

License

This project is licensed under the Apache License v2.0 - see the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dsw2to3-0.1.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

dsw2to3-0.1.0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file dsw2to3-0.1.0.tar.gz.

File metadata

  • Download URL: dsw2to3-0.1.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for dsw2to3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d50eb687fdb06c51f99eb552202addcc16d3fbfe6daf6f21cf13fd7ec56f8d91
MD5 0cd7c038b996d3fae11a4c9c969b4593
BLAKE2b-256 e0f1c0480e269b66cfacf5da3390e8425b0d2da609f545c073fe0ec79030aca3

See more details on using hashes here.

File details

Details for the file dsw2to3-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dsw2to3-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for dsw2to3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3beb108cc9a99bf9a89c4028e010d1ffaedaf1bbd94bfee685fc769acaa7603a
MD5 2a76f530db1d50820d6d1980939872c6
BLAKE2b-256 5e80f22739f17f0cac87eae95a300b44b4560d8ff3f09537327fe50712a47772

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page