This is the source that powers https://www.codependentcodr.com
Site is generated using Pelican, and hosted in AWS.
By in large I just ran the pelican-quickstart
and have tweaked a few things here and there as I work on the site.
Some of the things I've changed that might be novel:
Being a VS Code user, I created a tasks.json
file which has a handful of tasks for things like starting
the dev server, uploading to S3, etc.
Because of the way the project is set up you need the path to the virtual environment where pelican is installed (you
need to be able to call the activate
script in the virtual environment before the actual command).
I created a config value in my workspace config for this called pelican.activatePath
. This however, does give a
warning in VS Code (since it's an "Unknown configuration setting"), but I can't think of a better way to have the
tasks point at the virtual environment where Pelican is installed.
In the Makefile I added targets for running markdownlint
and
pylint
. A push to S3 first runs these linters over the stuff in the repo and a non-zero
result stops the deployment. While not as robust as a proper CI/CD pipeline with Jenkins or such, this is good
enough for my needs and was super quick to set up.
Config for the markdown linter is in .markdownlint.json
. For the most part I just added exceptions that were
needed so that Pelican's metadata didn't trigger markdownlint warnings.
For Pylint I don't use any special config (just default out of the box config).
To support the linting stuff, rather than enforcing I have the tools installed, I create a Docker image & install
the tools to it. This means if you want to do the same all you need is Docker, no need for npm
, etc.
The clean
target of the Makefile
also removes any previously built codependentcodr
images.
Instead of s3cmd
(which is what the generated Makefile
uses), I changed to use the
AWS CLI because A) it's better, and B) I already had it installed.
I hacked together some stuff in pelicanconf.py
to get the git SHA & throw it into a variable. This
is then displayed in the page footer, which I find useful for sanity checking what revision is running.
Flex (the theme I use) has support for Github Corners,
but the colour isn't configurable. I modified the theme to use a config value GITHUB_CORNER_BG_COLOR
which sets the background colour of the github corners icon (in my config I set it to the same value
as the BG colour of buttons from the theme).
As mentioned, I have the site set up in AWS. All the generated content goes into a S3 bucket, and then I have a Cloudfront distribution in front of that. I pretty much only have CF for the purposes of getting an SSL cert in place (I doubt I have many readers around the world, so not like I need a CDN). The cert is from AWS Certificate Manager. Unlike most tutorials (and probably to my detriment), I don't manage DNS with Route 53, but instead through the registrar I purchased the domain from (https://namecheap.com).