Many of us are migrating away from Webfaction. In earlier post, I wrote about my new favorite alternative hosting service Opalstack. In this post I’ll give you an overview how to migrate WordPress from Webfaction to Opalstack.
Opalstack is Webfaction -like shared hosting provider (also VPS provider). If you’re familiar with Webfaction you will feel at home in the first second at Opalstack. It’s actually run by people who have left Webfaction.
Migrate WordPress from Webfaction
Basically all WordPress installations that do not contain any magic or crazy stuff will go with the same flow. If you’re moving your own site, this is basically what you need to do. If you’ve bigger site that is probably developed by some software vendor, let them do the work.
First: Create tarballs and dump the database.
It’s time to ssh to webfaction. First, dump your relevant database.
mysqldump -u [db_user] -p [databasename] > ~/db.sql
It will ask your password after that. In case you need fancier dump, you can always look for more sophisticated options. After running that command you’ll find db.sql containing dump of the whole database in your home directory.
Then, let’s create tarball of the wordpress site’s files. It will contain all code and all media files. Note that if you have such directory setup that is not following the default approach you may need to alter this phase a bit.
tar cvf ~/site.tar ~/webapps/[your-wordpress-site]
It will create a file to your home directory (called site.tar). It shouldn’t take too long.
Second: Create Apps and Databases at Opalstack
Login to Opalstack control panel at my.opalstack.com. Create a new app. Don’t create a WordPress app but just PHP-FPM Apache app. That’s important as we don’t want to get new wordpress site up but move your old one to Opalstack.
As always, I recommend creating a new user for each WordPress related app in Opalstack. It’s easy and it will limit damages if your WordPress gets hacked.
Next step: Create a MariaDB database and database user (user is created automagically if you want to). Note that all the default passwords etc. can be found from Notices at the left sidebar.
Add domains (probably a test one? Or if you’re feeling lucky, just your production ones). Add routes. I’m not explaining this more deeply as you’re from Webfaction and the concept is exactly the same (except naming).
Either change existing DNS entries to point to Opalstack or add a new A record for a subdomain (like test.yourdomain.com) which points to Opalstack.
At this point we should be able to go to your new application sitting in the domain you already set up. There should be only white screen or error page. But it should resolve alright!
Third: Install WordPress from Webfaction to Opalstack
Then it’s time to load data from Webfaction to Opalstack. Open ssh terminal to Opalstack, go to your home directory and fetch data.
> scp [email protected]:db.sql . > scp [email protected]:site.tar .
Now you got your data from Webfaction to Opalstack. Then let’s load it up. First database:
mysql -u [db_username] -p [databasename] < db.sql
Don’t worry it saying mysql even though its MariaDB that Opalstack is using. They’re 100% compatible in our case.
Then, lets go with the tarball. Extracting it:
cd ~/apps/yournewapp tar xvf ~/site.tar
If you happen to have too much directory structure after that (so that your site files are found in ~/apps/yournewapp/oldapp/), just go to oldapp directory and say
mv * ..
You probably need to check that it also moves all dot-files, so after that check
And if any dotfiles are there (usually .htaccess), move it also
mv .htaccess ..
Now we have data in place. Go back to your apps root folder. Edit wp-config with your favorite editor (I prefer vim) to update database connection credentials.
Also, if you’re testing your site with a new domain, check your options from wordpress documentation.
That’s pretty much it! Try to login, test that everything works.
Oh noes, my site behaves weirdly or just shows source code
Fear not. They’ve used a bit different methodology in Webfaction than they use in Opalstack and if you’re running old site you’ve probably added SetHandler directives into your .htaccess to choose right php version to use.
In Opalstack you choose php version from the control panel. Just delete segments regarding that SetHandler and it should fix the problem.
If not, you can always post question to community forum which is very helpful or send directly email to support. They answer very.. very fast!
It was quite much of text but action itself is quite straight forward. Try this methodology over those wanky migration plugins that will cause you more headache than give you benefits.