Self-Hosted: Migrating Hudu Installation to a New Server

Below is a step-by-step guide for moving Hudu from one server to another.

Required Files & Directories from the Old Server

  • .env file
  • SQL dump
  • Object Storage

Step 1: Retrieve the ENV File

  1. SSH into the server you want to back up.
  2. Navigate to the Hudu directory: cd ~/hudu2
  3. Run: ls -a (this will show the .env file)
  4. Open it with vim or nano: nano .env
  5. Copy the contents and save them in a text file for safekeeping.

Step 2: Create a SQL Dump

  1. SSH into the server.
  2. Navigate to the directory: cd ~/hudu2
  3. Make sure the server is up and running.
  4. Run: sudo docker compose exec -T db pg_dump -U postgres hudu_production > NAME-OF-DUMP.sql
  5. This file can now be moved onto a new server to be used. Make sure to keep the same .env variables.

Step 3: Retrieve Local Storage

(Unless you are using S3 Storage)

  1. SSH into the server.
  2. Navigate to: /var/lib/docker/volumes/hudu2_app_data/_data
  3. Download the entire _data folder and store it securely.

Step 4: Migrating to a New Server

  1. Follow the Hudu setup guide of your choice.
  2. Get Hudu fully running on the new server.
  3. Take Docker down: sudo docker compose down
  4. Move the SQL dump to the new server.
  5. Open the new .env file, remove all contents, and paste in the old .env contents.
  6. Navigate to the object storage directory: /var/lib/docker/volumes/hudu2_app_data/_data
  7. Delete the new _data directory: rm -rf _data
  8. Replace it with the old _data directory.
  9. Ensure your A Record is pointed at the new IP (if using a custom SSL or Let's Encrypt).

Step 5: Restoring the Database

  1. Make sure you have an up-to-date backup of your documentation before you begin.
  2. Move the .sql database dump file into the 

    ~/hudu2

     directory. Typically, the easiest way to move files is via SCP or SFTP.

  3. Run: 

    sudo docker compose down

     to bring your instance down.

  4. Run: 

    sudo docker compose up -d db
  5. Run the command: 

    sudo docker compose exec db dropdb hudu_production -U postgres
  6. Run the command: 

    sudo docker compose exec db createdb hudu_production -U postgres
  7. Run the command: 

    cat NAME-OF-DUMP.sql | sudo docker compose exec -T db psql -d hudu_production -U postgres
  8. Run: 

    sudo docker compose down
  9. Run: 

    sudo docker compose up -d

     to get your instance back up and running!

   If you are on v1 of Docker Compose, you may need to add a dash between Docker-Compose to run the commands.

You should now have a fully migrated Hudu instance on the new machine.

Troubleshooting Missing Files

If you experience missing photos or fields, repeat these steps:

  • Delete the _data directory.
  • Replace it with your old _data directory.
  • Restart Docker.

Migrate to Cloud-Hosted

If you are looking to migrate from your self-hosted installation to our cloud-hosted solution, please follow steps 1–3 above, and reach out to support to get a secure link to upload your files. Please note, there is a one-time fee of $199.

  • An engineer will provision your cloud-hosted machine.

  • An engineer will perform the migration once your files have been received.

  • Depending on the amount of data, migrations may take 1–3 days to complete.

  • After the SQL dump has been performed, you should not enter any new data into your self-hosted instance, as changes made after this point will not be included in the migration.

Was this article helpful?
0 out of 0 found this helpful