Setting up this site
Hey fam! It’s 2020! I really needed to make some changes to my site (which I made from scratch using bootstrap tutorials) so this post is just a general overview about what went down.
I was quite dissatisfied with the look the old site had and I wanted to generate content by combining
python. Currently, the static material here is built using
blogdown which wraps around
hugo. I’ve chosen this route because the templates that are included in
hugo seemed quite stylish (compared to my poor attempt at a stylish webste T.T) and I didn’t want to dabble in html and css.
I had to deal with setting things up in digital coean, which involves paying $ 5 dollars per month for this website to be functional and also setting up networking logic so that people are able to view this site without typing up long lines of ip address numbers (instead they can just type www.pharmacoecon.me)
Signing up at digital ocean
Setting up a VPS (vritual private server) at digital ocean is super easy. When I was (only) a student, DO had a promotion where they gave 1 year trial period for students so I signed up back in 2017 (They might not have that deal anymore). If you’re interested, go to the site and make a user id and password then click on the create button on the upper right corner and click on droplet. The default operating system is ubuntu 18.04 with starter/standard plan that is $ 40 a month. If you’re like me, someone who’s only interested in small-scale server work, change that to the $ 5 per month plan and you’ll get the cheapest but hassle-free plan. If you’ve used
ssh before enter your public ssh key and you will be able to ssh into the droplet. Then click on “Create Droplet” and your server is made in less than 5 minutes!
Addendum: If you’re one of those cool kids that want to codify this process, try Terraform. DevOps using code makes sense and is something I do sometimes when I want to do complicated simulations that takes long hours and requires many CPU’s. I also have soem code for spinning up droplets and running simulations using
Setting up a Domain Name
Since I wanted people to be able to access this site using www.pharmacoecon.me, I bought the domain name at Name Cheap. It won’t be easy to find the name you want, but if you wanted to start a website (without using ip addresses) then you should sign up and search for the domain name you want. For me, it comes out to ~$ 12 a year. I don’t think I get that much traffic but it’s fun for me to maintain my own site and publish things I’ve learned (review and teach!) so its worth it for me. In order for your site domain name (e.g. www.pharmacoecon.me) to correctly point other users to the appropriate location on the web, you need to purchase a domain name from one of the many DNS providers.
If you’re interested, check this link out. The first time you setup a domain name and point it to digital ocean, you don’t need to go back to the DNS providers. Digital ocean makes it easy for content generators to setup their website easy through their control panel.
Nginx is essentially a program that directs traffic, balances the load on a server, and deals with website related issues (in layman’s term). For me, nginx makes it easy for me to create proxies and serve my website to the outside world. Most websites will have
apache installed as their webserver/proxy software. Check this link out to configure your server with
SSL (secure sockets layer). These technologies are used such that users are connecting to your site in a secure (encrypted connection) manner (in fact, once configured with nginx and ssl, the site only allows secure connection).
For me, I actually wasn’t able to access my site until I set up nginx with SSL. If you are running into access issues, it’s likely you need to properly set up your server with nginx + ssl (i.e. go through this link).
Setting up Blogdown/Hugo
There are a bunch of tutorials on setting up
blogdown. The one that’s easiest is this. Since
blogdown is a static site generator, you have to build it out each time you want to serve new content. One could set up
make to only generate new material on the site and I might make a new post about that later on but for now I’m going to focus on updating this site so people know what I’m up to.
Thanks for reading!