The code, templates and content for my Hakyll powered blog at blog.rekahsoft.ca
Go to file
Collin J. Doering 913c2f0e67
.drone/ci.libsonnet: Add and renamed methods relocated from .drone.jsonnet: guix.pipeline, guix.step, awsDeployStep
* .drone.yml: Update file after updates to .drone.jsonnet

* .drone.jsonnet: Relocate guix_pipeline, guix_step, and deployStep to .drone/ci.libsonnet
library. Adjust existing function names to match new names in library.

Explicitly pass PLAN environment variable to ci.awsDeployStep for plan and apply stages
2021-12-11 13:19:55 -05:00
.drone .drone/ci.libsonnet: Add and renamed methods relocated from .drone.jsonnet: guix.pipeline, guix.step, awsDeployStep 2021-12-11 13:19:55 -05:00
clay Update business card photo 2019-12-15 21:21:26 -05:00
drafts Worked on draft church-encoding-in-javascript 2015-08-10 16:55:28 -04:00
files Update gpg public key uids 2018-12-15 21:58:23 -05:00
fonts Remove unused fonts 2015-01-14 04:50:28 -05:00
images Update business card photo 2019-12-15 21:21:26 -05:00
images-src image-src: Add inkscape svg's that were used to build site graphics 2021-11-25 14:46:18 -05:00
infra infra/Makefile: Remove CI env var check for terraform workspace switching 2021-12-09 12:50:08 -05:00
js Remove application cache functionality now that its deprecated 2021-11-27 23:43:22 -05:00
lib Update jquery from v1.11.2 -> v1.12.3 2021-11-25 21:16:18 -05:00
pages Update copyright year/s 2021-11-26 08:08:34 -05:00
posts posts/mikrotik-hap-ac-openwrt-installation.md: New post 2019-12-15 20:42:43 -05:00
src src/site.hs: Fix compiler warnings about unused modules/redundant imports 2021-11-29 09:48:12 -05:00
templates templates/default.js: Update MathJax cdn url 2021-11-27 23:41:12 -05:00
.drone.jsonnet .drone/ci.libsonnet: Add and renamed methods relocated from .drone.jsonnet: guix.pipeline, guix.step, awsDeployStep 2021-12-11 13:19:55 -05:00
.drone.yml .drone/ci.libsonnet: Add and renamed methods relocated from .drone.jsonnet: guix.pipeline, guix.step, awsDeployStep 2021-12-11 13:19:55 -05:00
.gitignore .gitignore: Do not ignore hidden files 2021-12-11 12:53:30 -05:00
LICENSE Update copyright year/s 2021-11-26 08:08:34 -05:00
README.org README.org: Set drone ci badge to use the master branch 2021-12-09 23:18:41 -05:00
Setup.hs Initial cabalization of site 2015-01-14 04:50:28 -05:00
TODO.org TODO.org: (Invalid page urls load as the home page): Add new TODO 2021-12-06 23:31:09 -05:00
blog-rekahsoft-ca.cabal WIP: guix development workflow 2021-11-23 22:58:24 -05:00
channels.scm Use guix for managing the required deployment environment 2021-12-06 22:25:05 -05:00
guix.scm Remove top-level manifest.scm as package in guix.scm is sufficient 2021-12-07 21:17:29 -05:00
robots.txt Add robots.txt for web robots 2015-08-05 02:42:12 -04:00
site site: Remove test command from site as the test suite was removed in 84735e9a 2021-11-27 23:52:32 -05:00

README.org

Source Code for #! Lambda Slang

Build Status

#! Lambda Slang is the personal technical blog of Collin Doering, built using software that respects our freedoms.

Features

Tools

The creation of this website was made possible by the following open source tools and libraries:

  • Hakyll is used to generate site from static files
  • Clay is used for CSS pre-processing
  • Skeleton is used for CSS boilerplate
  • MathJax is used for rendering mathematics
  • JQuery and JQuery-address are used for various DOM manipulations
  • Gnu Guix is used to manage development environments and packaging
  • Inkscape and the Gimp were used to create various images/artwork
  • Gnu Free Fonts, specifically FreeMono is used as main font
  • Gnu Emacs because there is no place like home; and no greater editor!

License

Simply put, you're welcome to use the code used to generate this site though there are a few restrictions:

  • Any images and artwork that embody the likeness of "#! Lambda Slang" are not to be distributed or used and are strictly copyright
  • The content of pages and posts can be used with attribution, providing you aren't making money off of it

Various licenses (GPLv3, Creative Commons BY-NC-SA License, and Creative Commons BY-NC-ND License) are deployed dependent on which part of the site is in question. Please see the LICENSE file for full details.

TODO Guix Development Environment

Gnu Guix is used to package this project and manage its dependencies, as well as to provide reproducible development environments.

A simple wrapper script site is provided that wraps the hakyll powered site builder to offer some additional functionality.

Start Development Environment

The development environment is defined by the following files:

channels.scm
Specifically defines a set of available software, their versions and their build recipe.
guix.scm
Defines the package for this site, blog-rekahsoft-ca.

To start a development environment, run the following:

  guix time-machine -C channels.scm -- shell -CN -E '^LANG$' -E '^TERM$' -E '^PS1$' -f guix.scm -Df guix.scm

This uses the guix time-machine feature to ensure the development environment is reproducible by supplying a set of guix channels, effectively pinning all software versions used. The guix shell command is used within the time-machine to start a development environment in a container (-C), which shares the hosts network namespace (-N). The environment variable LANG is passed into the container to ensure locales work as expected; without this, site building will fail! Additionally, the environment variable TERM is passed into the container to ensure the development shell behaves correctly. Finally, -f guix.scm loads the blog-rekahsoft-ca package, and -Df guix.scm indicates that development dependencies of the blog-rekahsoft-ca package should be included in the environment.

Deployment Development Environment

Gnu Guix is used, similar to in the previous section, to create environments with all tools necessary for deployments, with a notable difference being a guix.scm file is not provided or needed, as the deployment environment is used solely for its side effects.

infra/channels.scm
Symlink to ../channels.scm to make the guix cli workflow nicer when in the infra directory. Technically this doesn't need to be a symlink, and could be a different set of channels or version of channels compared to the channels file at the top-level of the repository, however this would complicate Composing Site Development and Deployment Environments, so its preferred that all guix environments for the project, including the development and deployment environment use the same set of Guix channels.
infra/manifest.scm
Defines packages required for deployment of this site

To start a deployment development environment, run the following:

  cd infra
  guix time-machine -C channels.scm -- shell -CN -E '^LANG$' -E '^TERM$' -E '^PS1$' -E '^AWS.*$'

Composing Site Development and Deployment Environments

  guix time-machine -C channels.scm -- shell -CN -E '^LANG$' -E '^TERM$' -E '^PS1$' -E '^AWS.*$' -f guix.scm -Df guix.scm -m infra/manifest.scm

Build Site

This website is built from a collection of markdown files and templates that are processed by pandoc and are stitched together using Hakyll. To build the html/css/jss and all other assets required to deploy and distribute the site, the hakyll derived site-builder, blog-rekahsoft-ca must be invoked. Under usual conditions it is not invoked directly, but instead via the site wrapper script. For example, this is how within a development environment the site can be built.

  site build

Clean Site

Building the site has the side effect of writing a couple files/directories to disk as a result of the build process. In some cases, its useful to start of with a clean slate and remove any files that were generated for the site. To so so, the clean sub-command can be used:

  site clean

Watch

  site watch

Deploy Site

Terraform is used to deploy this site. Its configuration files are located in ./infra.

Under normal conditions, all deployments occur from my internal ci/cd system. This ensures that the deployment process is reliable, repeatable and quick. However, in the case of both development and emergency deployments, clear documentation surrounding the deployment process is necessary.

TODO site deploy command

  site deploy

Setup a Particular Environment

Three environments (terraform workspaces) are currently available, including:

default
unused default terraform workspace
staging
https://www.blog.staging.rekahsoft.ca
production
https://www.blog.rekahsoft.ca
  make setup ENV=<env>

From this point onward, any make target run will operate on the selected environment, unless its switched with the workspace or setup targets, or manually with terraform.

See What Infrastructure Will Change

Run a terraform plan to see how the selected environments infrastructure will change.

  make plan

Deploy the Site

Run a terraform apply to deploy to the selected environment.

  make deploy

Working with Terraform Directly

Within a development environment, terraform, its providers and all other dependencies are available. As such, its possible to directly leverage terraform and its various operations. This is particularly useful when debugging or adding make targets.

Clean up Guix Store

  guix gc --list-dead | grep -e '^/gnu/store/.*-blog-rekahsoft-ca-.*' | xargs guix gc -D

Building a Release

The software built that itself builds this blog is released as a Guix package. It is currently not, and is not ever expected to be distributed via a channel, as it provides little benefit to anyone except myself, and is meant to operate along with stateful data, including the site templates, content, pages, posts, etc..

To build a release, run the following command:

  guix time-machine -C channels.scm -- build -f guix.scm

This will produce a guix package with the following three outputs:

out
The blog-rekahsoft-ca site builder and gencss css generator binaries, as well as site user script
site
A build of the website made with the site builder, etc.. in the out output of this package, using the content at the same version
static
License file and any other file that should be distributed (eg manual)

TODO What is done with the release?

Writing a Blog Post

  guix time-machine -C channels.scm -- shell -CN -E LANG -E TERM -E PS1 -f guix.scm -- site watch

Known Issues

If you have an issue while browsing my blog please file a issue in the blog-rekahsoft-ca issue tracker.

To see a list of already known issues, see TODO.org.