Skip to content

Instantly share code, notes, and snippets.

@Software-Noob
Last active March 26, 2024 19:00
Show Gist options
  • Save Software-Noob/c18258658bef28e73b24d11d02d24915 to your computer and use it in GitHub Desktop.
Save Software-Noob/c18258658bef28e73b24d11d02d24915 to your computer and use it in GitHub Desktop.
Pterodactyl panel and wings migration

Pterodactyl Migration

Migrating panel

  1. Backup your hidden .env file containing the decryption APP_KEY from /var/www/pterodactyl

  1. Export the database, in this case ours is named panel

    mysqldump -u root -p --opt panel > /var/www/pterodactyl/panel.sql

    The .sql file would be saved in the /var/www/pterodactyl/ folder.


  1. Follow the panel installation documentation to install the panel on your new server.

  1. Transfer the panel.sql file to your new server and import the database. Make sure you're in the folder containing your .sql dump when performing the commands.

    mysql -u root -p panel < panel.sql

  2. After this, transfer your old .env file to the /var/www/pterodactyl location to complete the panel migration.

Migrating Wings

  1. Follow the Wings installation documentation to install Wings on your new machine.

  1. Once new Wings are configured, migrate all your volumes from your old machine to the new one. By default, the path would be /var/lib/pterodactyl/volumes/. Check your Wings config.yml for your configured data path.

Updating allocations

After the migration of volumes is done, you must update all the allocations since your IP most likely has changed.

Type hostname -I | awk '{print $1}' on your Wings machine to retrieve the IP. After that, login to your Panel machine to modify the database.

In the example below, we assume that the database name is panel. Replace newipherewith the IP returned from the hostname command above while oldiphere with the IP of your old allocation.

mysql -u root -p
UPDATE panel.allocations SET ip = 'newiphere' WHERE ip = 'oldiphere';
exit
@oq-x
Copy link

oq-x commented Aug 31, 2022

gr8

@erxson
Copy link

erxson commented Sep 3, 2022

thanks!

@KingTino104
Copy link

ok if this is how im supposed to backup stuff

  • for context i asked in ptero server how to backup everything and they sent this

@AndyIsHereBoi
Copy link

ok if this is how im supposed to backup stuff

  • for context i asked in ptero server how to backup everything and they sent this

well it shows everything you need to have backed up

@rathmerdominik
Copy link

rathmerdominik commented Oct 4, 2023

How would you do that with the docker image?
From locally installed to docker that is

@Pomdre
Copy link

Pomdre commented Nov 3, 2023

How would you do that with the docker image? From locally installed to docker that is

Get the image id by doing:
docker images

Say you have an image with id "imageid".
Save the image with id:
docker save -o /home/root/imagebackup.tar imageid

Copy the image from the path to any host. Now import to your local Docker installation using:
docker load -i <path to copied image file>

or if you dont want to do it manually you can loop over the images:

# List Docker images and extract image IDs
image_ids=$(docker images --format "{{.ID}}")

# Directory to store the image tarballs
backup_dir="/home/root/imagebackups"

# Ensure the backup directory exists
mkdir -p "$backup_dir"

# Loop over each image ID
for image_id in $image_ids
do
    # Save the image to a tarball
    docker save -o "$backup_dir/${image_id}.tar" "$image_id"
    
    # Copy the tarball to another host (replace <destination_host> with the actual hostname or IP address)
    scp "$backup_dir/${image_id}.tar" user@<destination_host>:/path/to/destination/directory/
    
    # Import the image on the destination host
    ssh user@<destination_host> "docker load -i /path/to/destination/directory/${image_id}.tar"
    
    # Remove the tarball on the source host (optional)
    rm "$backup_dir/${image_id}.tar"
done

@LuckyLoo1730
Copy link

Thanks, you helped me a lot!

@GreenArrowlol
Copy link

migrate all your volumes from your old machine to the new one.

How would I do this? Do I need to download them onto my laptop and upload them from there?

@Pomdre
Copy link

Pomdre commented Feb 25, 2024

migrate all your volumes from your old machine to the new one.

How would I do this? Do I need to download them onto my laptop and upload them from there?

@GreenArrowlol Yes, or you can transfer the using sftp without downloading them to your local machine.

@GreenArrowlol
Copy link

migrate all your volumes from your old machine to the new one.

How would I do this? Do I need to download them onto my laptop and upload them from there?

@GreenArrowlol Yes, or you can transfer the using sftp without downloading them to your local machine.

hey I've never done that before, could you tell me more about the process

@Pomdre
Copy link

Pomdre commented Feb 26, 2024

migrate all your volumes from your old machine to the new one.

How would I do this? Do I need to download them onto my laptop and upload them from there?

@GreenArrowlol Yes, or you can transfer the using sftp without downloading them to your local machine.

hey I've never done that before, could you tell me more about the process

For help on that the best place will be to join the pterodactyl discord server or ask chatgpt about how to copy folders frome one server to another using sftp.

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