Skip to content

kalosyni/cygnus

Repository files navigation

Cygnus

GitLab Pipeline Status Quality Gate Status Coverage Nuget

Cygnus is a free open source data synchronization tool.

Use case

Given you have two data stores in your system that needs to be synchronized, Cygnus is the right tool to do it efficiently.

sequenceDiagram
  Cygnus->>Source (SQL Server): read
  Cygnus->>Destination (MongoDB): createOrUpdate

Quick start

Cygnus is a .NET global tool. It only requires to have .NET SDK installed to run.

# installs the tool on the system
dotnet tool install --global cygnus

# displays help
cygnus --help

# synchronizes data
cygnus -f <definition_yaml_file> -c <configuration_yaml_file>

Samples

Sample files: settings.json, sqlserver-to-mongodb-migration.yml

# runs the tool with verbose messages
run -v -f ./samples/sqlserver-to-mongodb-migration.yml -f ./samples/settings.json

Contribute

Tooling

Backing services

  • Local databases for tests and debug
# runs SQL Server in a container and create test data
MSSQL_HOST=mssql
MSSQL_PASSWORD='s0m3Str0ng!P@ssw0rd'
docker run --rm --name $MSSQL_HOST \
  -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=$MSSQL_PASSWORD" -p 1433:1433 \
  -d mcr.microsoft.com/mssql/server:2019-latest
docker cp $PWD/scripts/mssql/db-init.sql mssql:/home/db-init.sql
docker exec $MSSQL_HOST /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $MSSQL_PASSWORD -i /home/db-init.sql

# runs MongoDB in a container
MONGODB_HOST=mongodb
docker run --rm --name $MONGODB_HOST -d -p 27017:27017 mongo:5.0

Debugging

  • Create a file src/ConsoleApp/Properties/launchSettings.json
{
  "profiles": {
    "ConsoleApp": {
      "commandName": "Project",
      "commandLineArgs": "run -v -f ../../../../../samples/sqlserver-to-mongodb-migration.yml -f ../../../../../samples/settings.json"
    }
  }
}
  • Start debugging ConsoleApp project in Visual Studio

Validating the global tool

# packages the application
dotnet pack

# installs the tool from a local build
dotnet tool install --global --add-source ./nupkg cygnus --version 1.0.1-alpha-000000

# removes the tool
dotnet tool uninstall --global cygnus

Additional information