Module 1 - Explore the source server

Before you migrate anything, look at what is on the server. In this module you connect to wsNN-source, record its state and leave a marker file. Later you will look for that file on the migrated server.

~10 minutesECS Workbench
Finish this module before you start the job

SMC copies the source once, at the moment the job starts copying data. A file you create after that is not on the destination. Complete Steps 1-5 before Module 3, otherwise the proof checks in Module 4 have nothing to find.

Step 1 - Connect with Workbench

  1. In the ECS console (Manila), open Instances and find wsNN-source.
  2. In the Actions column, click Connect (on some console versions this is Remote connection).
  3. In the dialog, under Workbench, click Sign in now.
  4. In the New Connection window:
    • Instance: wsNN-source
    • Connection Method: Password-Free, if it is offered. Otherwise choose Terminal and enter the instance root password from your credential sheet.
    • Port: 22
    • Username: root
    Click Log In. A terminal opens in a new browser tab. If you are asked to pick an IP address, choose the private IP: the workshop network does not allow SSH from the internet.
Pasting into Workbench

Use the copy button on each code block, then paste into the Workbench terminal with Ctrl+V or Cmd+V, or by right-clicking. Your browser may ask for clipboard permission the first time.

Step 2 - Confirm the server was built

A setup script installed the application when the instance first started. Check that it finished:

cat /opt/workshop/README.txt
tail -n 3 /var/log/workshop-setup.log

The last log line should read === Workshop setup finished at ... ===. If it does not, wait two minutes and run the command again. If it still does not appear, tell your facilitator.

Step 3 - Inspect the operating system and disks

hostnamectl
cat /etc/os-release | head -n 3
lsblk
df -h /

Note the hostname, the OS version and how much of the system disk is used. The hostname looks like iZ5ts...Z: ECS builds it from the instance ID. SMC copies only the used data, so the amount used here roughly predicts how long the copy takes.

Step 4 - Check the application and database

systemctl is-active nginx mysqld
curl -s http://localhost | grep -E "Legacy Shop|Original"
mysql shopdb -e "SELECT COUNT(*) AS customers FROM customers; SELECT COUNT(*) AS orders FROM orders;"

Expected: both services are active, the web page title is Legacy Shop - wsNN, and the database holds 1000 customers and 10000 orders.

This is the page you will look for on the migrated server. The workshop network does not expose port 80 to the internet, so you check the page with curl from inside the network rather than in your browser.

Step 5 - Leave a proof file

Create a file and a database row that exist only on this server. They record the current time, the hostname and the IP address, so in Module 4 you can prove that the destination is a copy of this server and not a fresh build.

echo "Migrated by wsNN at $(date -Is) from $(hostname) ($(hostname -I | awk '{print $1}'))" > /root/smc-proof.txt
mysql shopdb -e "CREATE TABLE IF NOT EXISTS migration_marker (id INT PRIMARY KEY, note VARCHAR(200)); REPLACE INTO migration_marker VALUES (1, CONCAT('written on source at ', NOW()));"
cat /root/smc-proof.txt
mysql shopdb -e "SELECT * FROM migration_marker;"

Both commands at the end print the line you just wrote.

Checkpoint
  • nginx and MySQL are active, and curl returns the Legacy Shop - wsNN page.
  • /root/smc-proof.txt and the shopdb.migration_marker table exist.

Keep this Workbench tab open. You use it again in Modules 2 and 4.