First post on new Blog!
So, I decided to start a new blog again. Most times whenever I started a blog, I would use something like Wordpress, Some Ruby alternative with Rails, or develop my own with Ruby/Sequel and web server engines like Sinatra, Ramaze, or any new flavor of a Ruby web engine framework to work with developing dynamic sites.
This time around, it's a bit different. I started learning Python about a month ago, and things seem to finally be clicking for me, so I figured I would look at frameworks for developing websites in Python. There are many out there, Flask being the most popular one. But I decided, that I didn't want to have to deal with developing a site where I would be looking at VPS alternatives, or Heroku instances, or various other options for developing a website.
Video Watching, and CDN ideals...
One of the regular YouTube and Lbry channels I watch videos on, is Chris Titus Tech. And he recently (As of 7/4/2020 over on Lbry) released a video called "Hosting Your Own Website for Free without a Server" Of course, me being the curious one, I figured I would check out the video and see what crazy shenanigans he was up to.
Turns out, he was talking about CDN hosting. CDN, or Content Delivery Network, is a form of hosting, that has been around since the days of Cloudflare, Google Cloud CDN, Level 3 Communications and Rackspace. There are many, many more out there now, but these were the ones that I knew of back in the day. It is a form of Cloud hosting, except for two major things. First, it's more for static hosting, not Dynamic hosting, and two, it's more geared towards delivering your website as fast as possible, taking a huge amount of connection requests at a time, without slowing down.
The way it does this, is simple to distribute your website to multiple Hosting Servers, that are synced together with your main copy of the site. And it isn't just a bunch of servers that get clones of your site, but more to the point, geographically cloned sites. Meaning, your primary server hosting your content can be located in California, and other servers can be located in Illinois, Canada, Taiwan, England, and so on and so on. There by reducing the number of hops it takes to get to your website, and reducing the load on a single server, no matter the distance a web browser has to go, to communicate with that server.
CDNs are quite popular now days, with Cloudflare and Google Cloud CDN being among the top two CDN hosting services out there, and as I said, they are more geared towards static content, not dynamic content. Where as with Amazon Web Services, Google Cloud Proper, and even services like Heroku, they are geared more towards hosting of dynamic content, with focus on popular Web Application Engines, such as Rails, Grails, ASP.net, Flask and so on. So we get to the point of, "Well, your doing a blog site, isn't that dynamic?" And your right, to a point.
Blogs have been made popular by apps out there like Wordpress, Drupal, and such, and even going as far as CMS designed blogs, such as Joomla and so on. Where all your blog entries are stored in the database, and dynamically generated whenever a user comes along and requests your website, or reads your article.
CMS gives you better control over the different modules and plugins you can have installed on your blog, so you can provide things such as Downloads, Image Gallery, Commerce Plugins, and such. Where as Blogs tend to stick with just presenting you with a place to record your inner most thoughts, without having to do a lot of the backend code work to make things work.
Ok, so what does all of this mean?
With all of this background about CDN's, and development of blogs and static sites history spelled out a bit, what does this mean? Well, as I mentioned above, I use to create my own software for my blogs, folloing the paradigm of, if I'm going to have a Blog, it's going to be dynamic. And to a certain point, this blog is a mixture of dynamic and static. The heck you say? Yep, this site as your viewing it now, is Static. There's no logins to login to, to make posts, edit posts, etc, etc. This site is all generated on my computer. Which is a Chris points out, there's no point of attack, no SQL Injection, or anything of that sort that would allow someone to hack my site.
Since it's all generated on my computer, there's less work that needs to be done to display the page, and makes it easier for the server to just display the HTML to the user. So, the dynamic part comes from my computer. Technically, the way websites are setup on Netlify, they are dynamically generated there as well. So we'll get to that in a moment. But, my decision to develop the blog in this method, comes down to simplicity, and ease of hosting the site, not having to worry about VPS (Virtual Private Servers), or using sites such as Host Gator, or any of the other options out there.
Technically, this site can even be hosted on Github if I wanted to, but I wanted to try out other things as well, and see how things are being done.
Therefore, enter Pelican, Netlify and GitHub....
So, now we get to the nitty gritty of everything. As I stated above at the begining of this blog post, I started learning Python about a month ago, working with GoDot, and Kivy for developing a Raspberry PI project (More on that in another blog post), I started to see what other things I could do with Python, and came across Chris' video for hosting, and learned of similar tools in Python for developing static websites. Chris uses Hugo, which is a Static site generator developed in Go, while I opted to do Pelican. Pelican allows you to do websites, plugins, and theming through Python, Jinja and actual pages / Blog entries through reStructuredText or Markdown. I opted for Markdown as it is just simpler.
With the setup that Chris guides you through in the video, you basically setup a Github repository to host the code for your site, this means the core files that will generate the static site. Setup an acount on Netlify, connecting it to your Github account (Netlify also supports Gitlab, and Bitbucket), select your repository that will hold your website, and tell it the command it needs to execute to generate your website, and lastely, where it's output goes. Once you do that, and hit deploy, within seconds, your site is up and running, and ready to go for visitors.
When you want to add a new entry, you just add a new Markdown file, and write your blog post, add it to the git repository, and commit it to the repo. Netlify automatically sees the change, and downloads the changes, updates your site, and it's all published. This saves you from having to setup SQL Servers with your hosting provider, download a version of Wordpress, Drupal, or Joomla, and setup the software on the site, install various plugins to get the right configuration for what you want, fix any conflicting plugins, and so on and so forth. It can become a big headache when your trying to setup any of these software packages, and getting them to work just right for you.
In the future, I think I will do a tutorial video and blog post about this, the setup of the code, and how to get everything to work just right for you. Of course, I'm saying this, even though I haven't fully deployed my website just yet, that'll be the next step.
So with this, I will start making posts about various things that I'm working on, or doing, via the categories I setup, and tagging of stuff. You'll have things dealing with C#, GoDot, Python, Ruby, Kivy, Personal stuff, and YouTube/Streaming stuff, such as OBS, Streamlabs, and so on. So hopefully, with all of this done, you'll maybe learn something, and come along for the ride as I try to pilot my own ship within the blog sphere, and developer / gamer world!