Skip to content

Instantly share code, notes, and snippets.

@katiakweb
Forked from cole007/digitalocean.md
Created September 14, 2021 03:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katiakweb/d34534fdc75398601b15647db8453d20 to your computer and use it in GitHub Desktop.
Save katiakweb/d34534fdc75398601b15647db8453d20 to your computer and use it in GitHub Desktop.
Digital Ocean internal migration - moving files between droplets over SSH/SCP

If you need to move a lot of files between DO server you can move these through SCP over the internal private Digital Ocean network.

NB both droplets need to be within the same region

To do this you need:

  1. enable private network for each droplet (if not done at creation, note the droplet needs to be off for this to be enabled once live)

  2. ensure that eth1 is enabled for both droplets if not already - see https://www.digitalocean.com/community/tutorials/how-to-enable-digitalocean-private-networking-on-existing-droplets

  3. scp files from the source server to the destination server are sent like:

    scp -r /srv/users/serverpilot/apps/XXX/public/resources root@11.22.33.44:/srv/users/serverpilot/apps/XXX/public

Note that you need to specify the source directory you want to move and the parent directory you want to move it to. If you moved ~/resources to ~/resources you would create a folder called ~/resources/resources in the destination location.

In above example 11.22.33.44 is the internal (private) IP address for the destination server. You can discover this through the DO admin area under settings or by SSH-ing into the destination server and typing ifconfig (the IP address will be the inet addr under eth1).

You will be prompted for the root password on the destination server, or the password for whatever user account you are using to access the destination server, e.g. root@, serverpilot@. etc. To avoid having to enter the password you can set up SSH keys by following the guide at https://www.digitalocean.com/community/tutorials/how-to-set-up-and-use-digitalocean-private-networking

Refs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment