Now that most of my site is up to my standard. I just want to share to my potential viewers where and how this site is built up. While hosting a self-hosted WordPress site isn’t new. Every new instance brings in new iteration on my knowledge in making it efficient in the most cost-effective way possible. I first started hosting using a shared server, then move my stuff to a Virtual Private Server. Now I’m still hosting my site on the VPS, but added a few more things that makes my life hosting a WordPress site more easier. In this post, I’m going to give a brief overview on how this thing is all setup. I’ll probably give another post on how individual things are laid, so that people from the future may know or have an idea that will make them work in their setup.
Using Amazon Lightsail
I’ve been using VPS since 2011. Main reason being is that I can host more websites and have a finer control on what’s going on. Call it a control-freak but I prefer knowing what runs in my server and whether if done in my fault or not. This is my third VPS to date, all are low-cost. The first two are tmz (not the gossip blog) and aboveclouds. Both are good providers on their own, but on this iteration, I wanted to host a site which is near to my location. This leaves me with two choices, well, one actually and that’s Amazon Light sail.
Amazon won me on two things: one, I use their S3 to store my files and most archive my stuff; Two, they offer a slew of server farms where I can to put my little home in. In this case, I choose Singapore being my home. This gave me a better response time whenever I need to access my website. My SSH session are more smoother compared to my last two server. Mainly hosted on the U.S and U.K respectively. Speed isn’t an issue, since they’re Amazon and their bandwidth is no slouch. I wouldn’t also worry about downtime since Amazon pretty much run a large chunk of the web these days, and they know well what happens if somethings goes down.
Just a side note, I was also considering running the website on an ARM server (via Scaleway). Just think of a stack of Raspberry Pi on a server farm. These things called Microservers are becoming a new thing as well. Given that not everything needs to be placed on a x86 type of server. Low traffic, low performing site like this should fit just fine on an ARM server. Though, there are microservers that have specific functions that warrant their use. However, I could not get to one since my payment option is incompatible with theirs. Also, its cheaper compared to AWS. That only cost around 130 – 170 Philippine pesos and AWS cost around 250. Small difference, but hey, I’m curious.
Going back, the server I am on is their cheapest. It’s a 1 core unit on a 512MB Ram, a 20GB SSD and it will cost me 5$ a month. It enough probably to run 2-3 wp sites if needed be. I could also route my static files to S3 if 20GB is small. My old one, Deremoe racked 4GB of static assets but that was an optimized mess. That shouldn’t be a problem now but I am open on hosting my server files on S3 if needed be.
The Almighty Docker
Docker is relatively new to me. But I also changed how I do my developing by a HUGE margin. It basically isolates everything I need to write an app into these containers to which both my server and dev machine uses. This way, I don’t have to install sdks and databases on my machine making them cleaner. It also helps that I don’t have to hunt down the processes to turn off when I just want to game on my machine. On the server, I don’t have to “pollute” my server with configurations and packages that may or may not affect other projects resting on it. This way, I can have a MariaDB server and a Postgress server on my machine, or a ruby, php and node as my back-end without worrying making untoward behavior with everyone sharing the same pool. Docker to me, is a great tool to optimize and organize your tech stack and be able to recreate them without having to dig through tutorials to make them. There’s a script, declare the stuff you need and run them.
Another thing I want to add as a person who writes on a Windows machine, is that Docker gives me a Linux environment to work on. This remove the prejudice that writing code on windows that will be placed on a Linux system would show unexpected behavior. Well, even now there exist some, but it’s mostly file permissions that can be changed. You can also write a script that will copy your entire project file to a Docker instance to get that 100% compatibility test. That will surely check for any unwanted behaviors. I personally don’t do that in my case but that’s an option when needed be.
Now setting, Docker up is a broad topic to discuss here. I would get to it eventually in the future, but I just want to share my experience and how I vouch heavily on using docker for future project from now on. I would go as far as this should be taught in school besides learning how to use Git. But hey, I want to know your opinions still. Don’t hesitate to write one once I put the comment section up on the site.