A Few New Things

A lot has changed since my last post. I switched from Lightsail to EC2. I finalized switching from Squarespace to AWS for sporterphoto.com. I got a new Mac mini. Oh yeah, and my son was born.

The switch from Lightsail to EC2 was because I wanted to use IAM. The pricing is comparable. There is a bit more complexity to EC2, but a lot more configurability. I was using an "Amazon Linux 2" VM on Lightsail specifically because I was similar to the "Amazon Linux 2 AMI" in EC2, which made the transition easy. I signed up for a Compute Savings Plan shortly after making the switch, saving a few bucks a month.

Switching sporterphoto.com over was simple. I had configured Apache when I brought my EC2 instance up so it was just a matter of DNS changes. I decided to migrate the domain name registration and DNS services to EasyDNS while I was at it, as that is where I register/DNS for all of my domains.

The new Mac mini is still a work in progress. I haven't set it up as a dev environment for my sites yet, as I had with my MacBook Pro. I think I can get Apache/PHP/DynamoDb all running locally, but it just hasn't been a priority. Aside from that, though, I love this new computer. Managing my photo library in Lightroom and Apple Photos is so fast. Web browsing is very smooth. Being able to run iOS apps is quite slick. And the couple games I've tried have run well. I have occasionally battled Bluetooth demons, as is a common issue with these, but it has been working for me recently.

About that other thing-- Conrad James Porter was born back in October. Wow. I can't really summarize the experience except to say wow. Maybe more on that some other time.

Apr 19th, 2020

More Web Development

As the CODVID-19 lockdown continues, I've continued doing more web development tinkering.

I've filled in some gaps in PDBlog's features. I can now login and add/edit/delete posts using via the web. No more posting via command line. I'm gonna work on image management and paging (or maybe infinite scrolling) next.

I'm still getting the hang of PHP. I'm finding a lot of similarities to ColdFusion, which was my jam for a decade starting around 1999. In fact, I haven't yet found anything "better" about PHP, compared to ColdFusion (from a decade ago), except that it is free and much more widely used. In many ways, ColdFusion then (much less now, which I haven't really looked into) was better than PHP is now. (To name a few ways: error handling, Application.cfm, shared variable scopes, CFCACHE.)

My next project is pulling my sporterphoto.com website off Squarespace and hosting it on my Lightsail box. I've been satisfied with Squarespace over the years-- it is just another fun project (plus it'll save me $80/year). I decided to do a slight redesign as part of that switchover. On this project I've learned more Bootstrap than PHP. I'm 90% done at this point-- I mostly just have to figure out when to switch everything over. My current setup is a bit convoluted: the domain is registered with Squarespace and my website is hosted there but I'm using Google for DNS resolution because I have Google Apps for that domain.. I'll figure something out.

Apr 14th, 2020

Introducing PDBlog

As I started resurrecting this site, I decided I wanted a blog. Sure, I could pick from among dozens of well-built blog apps, but I'd have to also run MySQL or something similar. However, I really want to treat the Lightsail instance that this site is hosted on as ephemeral/replaceable. I could opt to use RDS, but that is another cost that I don't need and not quite what I had in mind. I ended up deciding to build my own simple blog app using PHP and DynamoDB.

Building a full-featured blogging app is a daunting project. That wasn't my objective. I'm shooting for the minimum viable product. I need to be able to post and I need to show the posts. Simple stuff. I came up with the following milestones:

  • database initialization; post/edit via command-line; blog reading
  • UI improvements
  • RSS support
  • login and post/edit/preview via web
  • image upload/embedding

My first challenge was getting my dev environment running. I'm running Mac OS High Sierra, which includes Apache 2.4 and PHP 7.1. Amazon distributes DynamoDB Local, which is a dev version of their serverless NoSQL database and runs on my dev box. Surprisingly easy.

After a couple hours rereading and rewatching some tutorials on DynamoDB NoSQL data modeling, I had a solid plan for organizing my DynamoDB table. Now, to implement it...

Though I'm a novice with PHP and DynamoDB, they're fairly simple. For PHP there are a zillion resources online so any questions I had were easily answered. Helpfully, Amazon's documentation for the DynamoDB functions in the AWS SDK for PHP is pretty good.

After six or eight hours of work, I have accomplished first three milestones-- enough to go live. I've written:

  • PHP - script to initialize DynamoDB table and indexes
  • PHP - functions to add/edit/list/get blog posts
  • PHP - script to accept post info (command-line) and post to DynamoDB
  • HTML/PHP - index and permalink pages
  • XML/PHP - to generate RSS
  • CSS - a color scheme and style tweaks
  • one mod_rewrite rule in .htaccess

Under 500 lines of code and I have a minimally-functional solution in place. Not bad for a few evenings worth of tinkering.