28 Nov 2015

Trending on Cloud!

Recently, I got to deploy a homepage for our company after such a long time being under the hood.  In the past, I used to be working under some sort of heavyweight server-side environment (Java, Oracle, IBM AIX/HP and the likes) and did not really fall in love with so-called lightweight trend like LAMP stack.

However, emerging trend towards cloud has changed my mind completely with my recent review & deployment.  To be honest, I occasionally maintained my older blog over the last 10 years in a classic shared web hosting service and found that was not fun with the limited services they offered (PHP/.NET code transferred via FTP along with a simple PhpMyAdmin console to talk to your database, for example), and felt like not worth of maintaining a shared hosting service in the long-run — therefore, I stopped doing that for a while.

Recent cloud services like Amazon AWS, Google and Digital Ocean have caught my attention back — given not only its affordable cost but also giving you fully control your stuff, furthermore, they also open for you the capability to scale up when needed be.  So I quickly took a Digital Ocean VPS (smallest one) and quite surprisingly my site performance went up like 10x faster (disclaimer: with some trivial tricks applied in tuning DB, PHP Fast-CGI and Redis caching) — especially the cost of my VPS now is just 1/10 if compared to our current shared hosting plan.  Any reason why should I continue with that?

All right, too much texts already, now we just need to look for the current LEMP stack deployment using EasyEngine — which I found by far the fastest, clean and very easy to do if you are not going to deploy in multiple machines (there you could consider Vagrant with Ansible/Puppet/Chef).  If you only need to deal with WordPress, most probably EasyEngine is a very good choice.  I decided to skip Apache for Nginx given it could handle better high load — yet consuming low memory footprint.

  1. Let Digital Ocean create for us a VPS box having Ubuntu 14.04.x LTS (command line only — no GUI pls to save resource — we paid for it anyway) up in just less than a minute, assign for your box a Floating IP as well.
  2. Then, SSH into that instance and let EasyEngine do the deployment works — while I could just enjoy my coffee in few command lines:

    • Install the engine:
    • Create the website:
  3. I am going to have multi-site WordPress and having Redis as the cache.  EasyEngine will ask you to supply some further info as DB name, DB password, etc.  But it will automatically download, deploy Nginx, Php5-fpm, MariaDB (replacement but considered as better yet fully compatible to MySQL), Redis cache, especially it would configure in a well-organized manner with performance tuning ready.  And that’s it! If you have already had your favorite theme to apply and upload, you are going to have your homepage up and running with an optimized configuration for performance and caching already, in less than 10 minutes.

Still finding your site slow?  You could even ask EasyEngine to turn on HHVM and PageSpeed — However, I do not turn them on for the time being as they are still in experimental development mode and being unstable with my testing.  HHVM seemed to amazingly boost the performance roughly 2.x times even if compared to Php5-fpm — but it comes with the cost of very high CPU usage and more memory consuming, it does crash or running 100% CPU sometimes probably due to some of its mysterious memory leak.  I definitely will come back with HHVM when it has become more stable.

Next, we will wrap our little box with Open VPN and optionally configuring Squid3 to boost frequent visit websites.  My purpose is to have my mobile always tunnel thru that box whenever I am hanging outside at any coffee shops or restaurants.  I just do not feel comfortable if someone curiously keep looking at my internet surfing habit.  However, it is time for lunch now and will be back in the next post.