Migration of existing wordpress site to railway

tc-admin
PROOP

a month ago

I have a WordPress site hosted on EC2 that I’d like to migrate to Railway. I plan to add the code to GitHub and deploy from there. However, I’m not sure how to migrate the existing media (about 15 GB) in that setup. I previously did a similar migration for Strapi, and the only workaround was to upload content via Filebrowser. What solution would you recommend? I’m potentially migrating 10+ apps, so I’d really appreciate a more straightforward, repeatable approach.

Solved$20 Bounty

4 Replies

Railway
BOT

a month ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


Is the media stored on the EC2 instance’s attached volume and served directly under wp-content/uploads ?


crisog

Is the media stored on the EC2 instance’s attached volume and served directly under wp-content/uploads ?

tc-admin
PROOP

a month ago

Yes, that's correct


vedmaka
HOBBY

a month ago

The simplest and the most user friendly option is perhaps to deploy https://railway.com/deploy/Nan7Bs and temporarily detach the volume from your Wordpress service and attach it to the Filebrowser service, upload your data, and the attach the volume to the Wordpress service again. When deploying file browser make use to use USE_VOLUME_ROOT=1

It would be great if there would be an option in the railway CLI to do something like scp . For now since the ssh over WebSockets is the only way to get into the container you could still try the following trick (not too secure, but works):

  1. On your existing EC2 instance archive the upload directory cd wp-content && tar -zcvf ~/uploads.tar.gz uploads to create uploads.tar.gz archive

  2. Move the archive you have just created into the uploads directory to make it publicly accessible via HTTP mv uploads.tar.gz uploads/

  3. Test you can download it via browser https://you-wordpress-site.com/wp-content/uploads/uploads.tar.gz

  4. SSH into your Railway service (use "Copy SSH command" item from right click menu on the service on the Railway dashboard)

  5. Download your files using wget i.e. cd ~/ then wget https://you-wordpress-site.com/wp-content/uploads/uploads.tar.gz , this way you'll end up with the files archive in your homedir on the instance

  6. Move the archive into Wordpress directory mv ~/uploads.tar.gz /var/www/html/wp-content/ and extract it cd /var/www/html/wp-content && tar -xvzf uploads.tar.gz

do not forget to delete the archive from your original EC2 uploads directory and the Railway service directory otherwise the archive would be accessible by anyone


Status changed to Solved brody about 1 month ago


Loading...