Deployment Guide

Deploying MigrationCoordinator to the production server at mc.shareddev.com

Server Details

Server136.144.128.65 (mc.shareddev.com)
SSH Usertmpwork
SSH KeyC:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key
Install Path/var/www/migrationcoordinator
Servicemigrationcoordinator (systemd)
Runs Asmigrationcoordinator user
Port5002 (behind Nginx with HTTPS)
Dashboardhttps://mc.shareddev.com
Production DBMigrationCoordinator_prod

Pre-Deployment: Apply Migrations

If new migration scripts were added (check database/migrations/), follow these steps before deploying the new code.

0aRefresh the baseline

This takes the current baseline .mdf, applies all pending migration scripts from database/migrations/, assigns a new version number, and generates a deployment script. The migration files are deleted from the server after being consolidated into the new baseline.

  1. Open the dashboard at https://mc.shareddev.com
  2. Go to the MigrationCoordinator project detail page
  3. Click Refresh Baseline
  4. Download the generated files to your local repo:
    • Updated baseline .mdfdatabase/baseline/MigrationCoordinator.mdf
    • Version deployment script .sqldatabase/versions/
  5. Commit and push both files to main

0bApply the version SQL to production

Use the newly generated version SQL to update the production database:

  1. Connect to 136.144.128.65 in SSMS as migcoord
  2. Select the MigrationCoordinator_prod database
  3. Run the new version SQL file (each migration is wrapped with skip-if-applied guards, so it is safe to re-run)
Always complete steps 0a and 0b before deploying new code. New code may depend on schema changes, and the baseline must match the production schema for dev databases to work correctly.

Deployment Steps

All commands are run from your local Windows machine in a terminal (PowerShell, Git Bash, or Claude Code).

1Build for Linux

Compile the project for Linux x64 without bundling the .NET runtime (already installed on the server).

cd C:\Repositories\MigrationSystem
dotnet publish src/MigrationCoordinator/MigrationCoordinator.csproj -c Release -r linux-x64 --self-contained false -o publish_temp

2Prepare server upload folder

Remove any old deploy folder and create a fresh one.

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo rm -rf /tmp/migcoord_deploy && mkdir -p /tmp/migcoord_deploy"

3Upload files to the server

Copy all built files including subdirectories (wwwroot, localization folders).

scp -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" -r C:/Repositories/MigrationSystem/publish_temp/* tmpwork@136.144.128.65:/tmp/migcoord_deploy/

4Stop the service

Stop the running MigrationCoordinator so files can be safely replaced.

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo systemctl stop migrationcoordinator"
The coordinator will be unavailable while stopped. All agent MCP calls will fail until the service is restarted. Keep the downtime short.

5Backup production appsettings.json

The build output includes a default appsettings.json that will overwrite the production config. Save it first.

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo cp /var/www/migrationcoordinator/appsettings.json /tmp/appsettings_backup.json"

6Copy new files to install directory

Replace the application files with the new build. Use -r for subdirectories.

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo cp -r /tmp/migcoord_deploy/* /var/www/migrationcoordinator/"

7Restore production appsettings.json

Put the production config back (connection string, API key, etc.).

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo cp /tmp/appsettings_backup.json /var/www/migrationcoordinator/appsettings.json"

8Fix file ownership

Files were copied as root (via sudo). The service runs as the migrationcoordinator user and needs to own its files.

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo chown -R migrationcoordinator:migrationcoordinator /var/www/migrationcoordinator"

9Start the service

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo systemctl start migrationcoordinator"

10Verify

Check the service is running:

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo systemctl status migrationcoordinator"

Should show active (running). Also check https://mc.shareddev.com in the browser.


Clean Up

11Remove temporary files

Local:

rm -rf C:\Repositories\MigrationSystem\publish_temp

Server:

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo rm -rf /tmp/migcoord_deploy /tmp/appsettings_backup.json"

Rollback

If something goes wrong after deployment:

# Stop the broken service
ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo systemctl stop migrationcoordinator"

# Restore from backup (if you made one before deploying)
ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo cp -r /var/www/migrationcoordinator_backup/* /var/www/migrationcoordinator/"
ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo chown -R migrationcoordinator:migrationcoordinator /var/www/migrationcoordinator"

# Start the old version
ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo systemctl start migrationcoordinator"
To make a full backup before deploying, add this before Step 4:
ssh ... "sudo cp -r /var/www/migrationcoordinator /var/www/migrationcoordinator_backup"

Quick Reference: One-Liner Deploy

For experienced users, steps 4–9 can be combined into a single SSH command:

ssh -i "C:\Repositories\SharedDev\ISO27001\Apps\tmp\tmpwork_key" tmpwork@136.144.128.65 "sudo systemctl stop migrationcoordinator && sudo cp /var/www/migrationcoordinator/appsettings.json /tmp/appsettings_backup.json && sudo cp -r /tmp/migcoord_deploy/* /var/www/migrationcoordinator/ && sudo cp /tmp/appsettings_backup.json /var/www/migrationcoordinator/appsettings.json && sudo chown -R migrationcoordinator:migrationcoordinator /var/www/migrationcoordinator && sudo systemctl start migrationcoordinator"

Useful Commands

ActionCommand
View logs ssh ... "sudo journalctl -u migrationcoordinator -f"
Check status ssh ... "sudo systemctl status migrationcoordinator"
Restart service ssh ... "sudo systemctl restart migrationcoordinator"
View service config ssh ... "sudo systemctl cat migrationcoordinator"
View production config ssh ... "sudo cat /var/www/migrationcoordinator/appsettings.json"

MigrationCoordinator — Deployment Guide — Last updated March 2026