Blogging

Blaugust 2023 Wrap-Up – What I Learned

The last theme week for Blaugust is “Lessons Learned”. I can’t say I learned anything new, I’ve been blogging for a while, literally decades, and I’m already aware of well, all of that which comes along with it. As, kind of depressing as they are. But let’s pretend it’s all fresh and new.

Daily Updates

As much as I like the idea of updating daily, I am not cut out for it, not anymore. Maybe never, though this isn’t the first time I put effort into daily blogging. I like to think I have plenty of idea of things to write about, but I also don’t really have the time to write about all of them, and over time, I start to feel repetitive. Maybe a little repetition isn’t a bad thing. In theory, new people come to read the blog and most aren’t going to be reading through the archive.

I just kind of hate feeling repetitive. It doesn’t really matter though, with “lesson 2”.

No One Cares

They really don’t. I don’t really care that they don’t, really. I accepted years ago that I do this, write these dumb pointless posts, for my own outlet. I kind of hopped things would at least bump a little when I started posting daily, but it didn’t. That or WordPress stats are busted as fuck. The total views and visits for this month, are pretty much, to slightly lower, than the views and visits last month. Maybe a bit lower.

Last month, when I wasn’t posting daily and actively sharing some posts out into the world.

I really don’t care about how many people read this blog, but it’s kind of really disheartening. For the month, it’s around 100, people. Total. For the year it’s around 1500 so far. Let’s contrast this a bit, with something that’s not really a 1:1 comparison, but kind of in the same vein. I posted a short video from the Alanis Morissette show on TikTok a few days ago. Within 24 hours, it had essentially more views than my blog has gotten, all year.

¯\_(ツ)_/¯

It’s really really just like, you know, why bother?

Wrap-Up

Anyway, on that downer note, here are my posts from the month:

Honorable Mention to 10 syndicated movie posts from Letterboxd and 18 automated link digest posts.

I also did all of the little made-up achievements so that means “Going Platnum”.

100 Days of Python, Project 082 – Personal Portfolio Website #100DaysofCode

This felt like an odd one, but probably still a good one to be included.  I also was kind of torn on if I even needed/wanted to actually “do” it.  This part is effectively already “Done”.  We created a GitHub.io site.  We created a Heroku based Blog (which I skipped in favor of doing it on my own server/host).  I also basically already have a portfolio website.  Right here, on this blog.  I post my projects, I write about them, etc etc.  I also have a pretty nice GitHub page, which is the best “programming portfolio” one can have.

So I was going to skip it initially, but instead, I opted to go with getting Flask to work on my web server, which was more of a hassle than I expected, but now, over time, I can start modifying that site to show case some of the things I’ve built.  Currently, it resides at https://joshmiller.net .  It’s nothing fancy as of this writing, just the bare bones of the Flask Blog built previously.  I did strip out the registration portion.  I really don’t need or want to deal with comments.  Sorry, @me on Mastodon instead.  I don’t really need a blog either, so don’t expect much going on there, but I want to keep it for now because I may use it to basically, blog about the blog.  I also want to build some new features over time to make it more full featured.  For starters, it needs a settings/admin page, to set things like the title and toggle comments on/off.  It also desperately needs an upload portal for images for use in blogs.

So what’s the point.  Well, for one, it has built in Authentication.  Which means I can build pages and tools that only I will ever have access to.  One I have been thinking of building would basically be a blog post form, that simultaneously posts to several social networks, using APIs.  Also, related to authenticating, the functional nature of these Flask Apps, means I can easily drop in say, the Top Ten Movies website, and have it show up at joshmiller.net/movies or something, just by adjusting some of the code.  And with the built in authentication, I can lock the world out from being able to edit my movies list.

I also, have been really looking for SOME use for that domain.  Though, I still may reconsider and move it all to a sub domain on this site.  I have not decided.  I already stopped using that domain for email and it essentially just… exists… now.

Anyway, I think it’s worth talking about how I got things going, because I had a hell of a time getting Apache to work nicely with Flask and WSGI.  And I looked into a lot of guides…. a LOT.

Honestly it’s been so many I will probably miss something here.  This is going to be a bit general and not nearly as hand holdey as it could be.  Chances are, if you can’t figure this out, you probably shouldn’t be doing it.  And chances are, you already have a web server with Apache going, so you kind of know what you’re doing.  The first step is to make sure Python is installed, and Python3, and the various needed imports, using pip3, not pip.

sudo apt-get install python3

sudo apt-get install python3-pip

If you need them.

Download your flask app to a folder /var/www/FlaskApp .  It should just be in the base here, but it can be elsewhere if you know what you’re doing.  Then run the main.py file.

python3 main.py

Fix any permissions issues, or, for now try sudo python3 main.py.  For everything it can’t find each run, do

sudp pip3 install <Package>

Eventually the main.py should run, and you can access your site at <ServerIP:5000>.  The truck now is getting Apache to work with it.  First you’ll want to install mod-wsgi then enable it.

sudo apt-get install libapache2-mod-wsgi python-dev

sudo a2enmod wsgi

Now, in the folder with main.py, the /var/www/FlaskApp folder, create a file called flaskapp.wsgi.

sudo nano flaskapp.wsgi

Inside this file, add the following.

#!/usr/bin/python

import sys

import logging

logging.basicConfig(stream=sys.stderr)

sys.path.insert(0,"/var/www/FlaskApp/")

from main import app as application

application.secret_key = 'Your Secret Key, it may Need to be the same as the one in main.py I am not sure'

application.root_path = '/var/www/FlaskApp'

Save that file.

Next create the site file for Apache to use.

sudo pico /etc/apache2/sites-available/YOUR_SiTE_FILE_NAME_CAN_BE_WHATEVER_MAKE_IT_MEANINGFUL.conf

Inside that file, add the following.  Please note, this file also contains settings that allow for SSL via Let’s Encrypt, which you should be running on your web server anyway.

<IfModule mod_ssl.c>

SSLStaplingCache shmcb:/var/run/apache2/stapling_cache(128000)

<VirtualHost *:443>

        ServerAdmin YOUR EMAIL HERE

        ServerName YOUR SITE DOMAIN OR SUBDOMAIN.DOMAIN HERE

        ServerAlias www.YOUR SITE DOMAIN HERE SO WWW REDIRECTS REMOVE FOR SUB DOMAINS

        WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi

        <Directory /var/www/FlaskApp/FlaskApp/>

          Order allow,deny

          Allow from all

        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined

# If you don't have Lets Encrypt you can probably dump this next section through <VirtualHost> Keep that

        Include /etc/letsencrypt/options-ssl-apache.conf

        Header always set Strict-Transport-Security "max-age=31536000"

        SSLUseStapling on

        Header always set Content-Security-Policy upgrade-insecure-requests

        # Lets Encrypt Folders below

        SSLCertificateFile /etc/letsencrypt/live/YOURSITEDOMAIN.com/fullchain.pem

        SSLCertificateKeyFile /etc/letsencrypt/live/YOURSITEDOMAIN.com/privkey.pem

</VirtualHost>

</IfModule>

Now, the most important thing to note here.  In every single guide I found, it included a section to alias the “Static” directory.  I got to a point where my site was working, but it was not loading CSS.  I fixed this by REMOVING this alias.  

I beleive that having “application.root_path = ‘/var/www/FlaskApp'” inside the wsgi file, confliced with the Alias.  But the application wasn’t running at all without “application.root_path = ‘/var/www/FlaskApp'”.  The end result, was a working blog site.  I could create a user, create new posts, leave comments, and everything looked as it should.  It’s working now though, at least, which was the goal.  I can polish it up over time.  

Like I mentioned previously, I am not sure what or how much I will post there.  I may actually completely remove the blog part of it.  I’m more interested in the admin/login functionality really.  I already have plenty of blogging outlets between this site and Mastodon, and using Tumblr more and probably a fresh new push at Lameazoid.com as well.  I don’t need this additional random blog at all.

Blog Consolidation and Feeds

Switching to Mastodon from Twitter has slightly renewed my interest in my blog, and more specifically my blog as a place for all of my stuff, not necessarily a place for “others”. Not that others can’t enjoy it. Maybe that isn’t quite the right way to say what I mean.

Basically, I want this blog to be a bit more of an archive for things I do online. Part of this however, also means making some of it less visible, so things don’t feel cluttered, but the data is still there. It’s probably easier to just give some examples of what I have done recently. Some of which is inspired a bit by things I have seen others do.

Letterboxed Syndication

I have a new category on the side, Feeds, which currently only has one sub category, for Letterboxed. What this does is it creates posts from reviews and ratings and movies I’ve watched, based on my Letterboxed account.

It’s a simple plugin for “RSS to Post”. The trickier part was, the initial import, only pulled the last 51 items. So I had to find a separate plug in that would import an XML export as a WordPress post. This still needs some massaging though, as I don’t think it imported everything. Plus, it did not create the cool Poster images. I may have to manually fix those, if I bother.

Photo Galleries

I’ve also started creating Photo Gallery posts. I had some Photo Gallery software set up but I opted to purge it when I cleaned up the malware on the server, because it was a potential attack vector. The less I have to keep clean the better. Plus for what I’m doing WordPress functions just fine.

I’ll add more older photos over time, but this gives a nice place to just post some of the various photos from over the years.

Micro Blog

There’s something screwy going on with this category, I’m not sure what, but basically, it’s a category, Micro Blog, which is intended to be excluded from the main feed, and often posting more “Twittery” posts.

Currently it’s just a collection of scores from various Wordle style daily games. I hope to use it for a bvit more though in the future. I wouldn’t mind finding a way to syndicate my Duolingo progress or Fitbit stats to the Microblog of Feeds section, for example.