Moving WordPress to Digital Ocean

digitalocean[1]

 

 

 

I originally wrote this article in a positive light but after a year plus  I have an update..

Avoid Digital Ocean at all costs, they are shit.

Digital Ocean Problems:

  1. Horrible, horrible customer service. Look elsewhere if you want rock solid support. DO just copy pastes boilerplate responses and are generally incapable of doing anything.
  2. Get ready for lots of downtime. Unless you can fine tune a DB get ready for constant downtime and reboots with little to no reason.
  3. Late payment on your account? They email you and after 3 weeks delete everything including your backups and images.

Digital ocean is a garbage service, you know what they say you get what you pay for. Aviod them at all costs you will thank me later.

 

********** Original article below **********

 

So I recently went through shared hosting hell with a host that start with a color and ends in “host”, it’s not redhost or yellowhost, can you guess which crappy host it is?

I’m big fan of Linode but did I really need an unmanaged VPS for a few small scale sites at that price? These sites are tiny, netting under 5k a month (traffic) and not doing much under the hood.

Enter Digital Ocean , yes that is a referral link that nets me a whopping 10 bucks, anyhow this is why I choose them.

  • 5$ for 512MB ram
  • 20GB SSD !
  • 1 TB transfer
  • LAMP stack installed

You can’t beat full server access for 5 beans on a solid state drive that is also scalable and includes “snapshots” and backups. Is it to good to be true, well I guess I will find out, but so far so good:) The problem of course is that it’s unmanaged, setting up a plain jane WordPress is easy enough, just click the WordPress button when you log in and it will automatically create everything for you.

But I didn’t want Digital Ocean to install WP for me since I was moving existing sites, and since I had to do this multiple times (yes you can “clone” a droplet I know), here is my TODO rundown. It’s not an in depth guide, it’s just a reminder so I don’t spend all day configuring a damn server.

things-to-do[1]

1. Sign in and create a droplet , make sure the droplet name doesn’t match your FQDN.

2. Create a LAMP image in the application menu, that way you don’t have to built PHP/MySQL and Apache, yay?

The downside: the LAMP image is only available on Ubuntu bleh,  it will have to do. This should take about 45 seconds. Also it’s an Ubuntu LAMP without PECL,  so nothing cutting edge ..or let’s be honest released within the last 4 years…

3. SSH into your server , change the root password that was send via email.

4. Create a new user with root privileges like this guide.

5. Remove the root login and change the port #.

6. Configure Apache logs, I don’t know where they are by default. Open apache config and set the logs some place nice. The server has logrotate, configure it.

7. Install APC to cache the PHP. This is a pain since Ubuntu’s APC package is old and has a shit bug in it. So if you apt-get php-apc make sure to set the APC config file, specifically setting apc.slam_defense = 0. By the way the default install does not load module settings via `php.ini`,  look in `conf.d`.

Remember server will blowup if U not add some basic APC settings.

8. Enable some apache modules, use a2enmod for headers, rewrite and expires, they are somewhere in the apache2 directory, I think under `mods-available`.

9. Download (wget) WordPress.

10. Create a database user and import the .sql files, a guide.

11. Grab all the files, actually just grab /wp-content and SSH them onto the server, since WordPress is already there.

12. Configure the apache vhost, which is in apache2/sites-available. For WordPress make sure AllowOveride All..bunch of other stuff .allow from all is set for permalinks!

13.  Edit the wp-config.php file with new database stuff

14. Restart Apache

15. Go into the Digital Ocean admin and create a snapshot of your droplet so you don’t have to do that ever again.

Additional things

1. Rename the default SQL password, since it is set to  ‘password’ , nice.

2. Need email? Configure exim4, don’t forget to change the php.ini setting for sendmail so your email doesn’t look like spam.

3. apt-get update

4. Install/configure a firewall (iptables, fail2ban).

5. Grab a beer.

who-gives-a-ssh_design[1]

Oh ya someone made a Vagrant manager for Digital Ocean that looks like it would be the way to go –> https://github.com/smdahlen/vagrant-digitalocean

Advertisements

10 thoughts on “Moving WordPress to Digital Ocean

  1. I’ll be interested to see how Digital Ocean fares, and the opinions of their service. Their growth has been straight through the roof and, all considered, is definitely worth taking a close look at. I’m waiting for some more info before making any moves. And your To-Do list looks like a nightmare.

    • My to-do is pretty much the same for any VPS, Linode actually has more pre=build stacks ( user contributed), I’m pretty sure Digital Ocean will be adding more. There is a 1 click install for WordPress but you would still need to clean up afterwards especially for security.

      I can say that my sites have been really impressively fast, I see an increase of 15-20x, which is massive , though to be fair they were on a really crappy shared host before. The site load went from 6-9 seconds to 0.2 – 0.6 seconds, and the uptime has also been much better.

      Backups and snapshots are stored on a separate HD as well so it’s seems safe, and setting up rsync to amazon is somewhat simple if you need another safety net.

      • That’s a really impressive speed increase, which makes the switch from shared hosting that much more compelling. I was just scowling at the throttle logs for my sites at hostgator. Their service has been fine (except providing no way to log into your cPanel from their home page=petty but annoying) but I’m catching heat for all my files and will need to upgrade soon. I’m going to keep my eyes on D.O.

      • I just wanted to follow up on this. I indeed did place several sites on Digital Ocean a while back and haven’t regretted it one bit. I’ll probably move more sites there when the times comes, in fact.

  2. This is a great post. I just discovered digital ocean and I’ve been wanting to move some of my sites to it. I’ve been following along and I know it’s not in depth. I am a total novice to Ubuntu or any kind did programs. Can you explain what step 6 is in more detail or link me to someplace that will show me what to do? I don’t know what it means to configure apache logs or to configure logrotate and put apache logs some place nice.

    Thanks for your help

    • Step 6 is to configure error logging for apache and PHP. It’s important since with a VPS you are on your own, if something goes wrong your error logs will help troubleshoot the issue. They also give insight into how the web server is running.

      You can check the apache config file to see where it is placing the log files by default, I tend to change the location to something easy like `/apache2/logs` .Logrotate will compress and rotate your log files so that they are easier to manage and don’t eat up your hard drive. For example if you have an error firing every few minutes (pretty common with WordPress plugins) you don’t end up with massive amounts of data after x months/years. I usually keep error logs for 30 days and limit each log file to 1MB so they are easier to read. Here are some examples: http://www.thegeekstuff.com/2010/07/logrotate-examples/

  3. It’s very encouraging to hear that WordPress is performing so nicely for you on Digital Ocean’s smallest-size droplet. With only 512 MB of RAM, this droplet has even less memory than an AWS Micro instance (having 613 MB), and I know that most people have been complaining about very lousy WordPress performance on the latter — but maybe that is only because of Amazon’s aggressive throttling of these Micro instances.

    Have you tried installing multiple (low-traffic) WordPress sites on a single such droplet? I’d be interested to hear your experiences with that.

    Thanks for the great post! 🙂

  4. I have not yet set up multiple sites per instance since 5$ is not worth the risk of eating up tons of ram. Though I can see how the price adds up quickly I would probably just install WordPress once and use it as a network (http://codex.wordpress.org/Create_A_Network) and limit the plugin use to ones that are not hogs. I don’t see any issues with having many sites on the same droplet , and of course you can always ramp up the ram by paying a bit more.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s