docker

Dockerize a SvelteKit App Using PNPM

7 minute read Published

Optimized development workflow using SvelteKit, PNPM and Docker.

Developers don’t just use pNPM because they hate NPM (that’s what Yarn is for). They use it because node_modules are the heaviest objects in the universe. But there are other things to love about PNpm besides its ability to shave gigabytes off your hard disk and saving you a considerable amount of time wasted mucking around with node_modules. Here I’ll show you how to use pnpm fetch to increase the speed of your Docker builds using an --offline install.

WordPress K3s — Init Containers and Helm

11 minute read Updated

How to create a hardened WordPress installation in Kubernetes using Init Containers and Helm on MacOS.

Last week Pantheon dealt the final blow to the website I drove from 100 visitors up to 80,000 per month. By the time I heard the death knell we had a 10-day advance notice the price of hosting was increasing 1025% to $450/month.

I quickly spun up a Plesk instance on Digital Ocean and installed WordPress on a $10/month VPS but realized Plesk was too bloated for our needs and probably not going to cut the mustard in the scale department should traffic decide to climb.

After initially attempting to deploy Wordpress using the Helm chart by Bitnami via the App Marketplace in Rancher 2.5 I found the chart difficult to use, kept looking and eventually found a an alternative chart on a self-hosted VCS.

Like the Bitnami chart the independent chart includes optional database set-up. Unlike the Bitnami chart, however, the self-hosted chart also includes a Redis object cache, OpenID Connect authentication. It also builds a hardened WordPress Pod using WP CLI from scratch with Ansible inside an Init Container. And in this tutorial I’m going to show you how you install it on macOS with K3D.

K3D Load Balancing — MetalLB on Mac

8 minute read Published

How to workaround the Docker host network limitation on macOS using Kubernetes in Docker with K3s and MetalLB.

In this post I’m going to show you a neat little hack to get a bare metal load balancer called MetalLB working in K3s under Docker Desktop for Mac. Before you get started please follow the steps to set-up K3s using k3d with Rancher if this is your first time using Kubernetes. If you already have a K3D cluster running, we’ll be creating a new one for experimentation.

This hack allows Mac users running Kubernetes locally via Docker have it provide EXTERNAL-IP addresses from a pool of addresses so multiple K8s services can be run on the same port, namely 80 (http) and 443 (https), at the same time. Effectively this is a workaround for docker/for-mac/issues/155. Without this hack LoadBalancer IP addresses will show as <pending> or <none> in kubectl.

Let’s see how it works.

K8s on macOS with K3s, K3d and Rancher

12 minute read Published

How to install and run Rancher for Kubernetes on macOS using K3s and K3d.

In this post we’re going to take a quick look at how to run Rancher in a Kubernetes cluster locally on macOS for development and testing purposes. There are several different ways to run Kubernetes for local development. In this guide I’m going to focus on just one way: K3D.

K3D is a lightweight wrapper to run Rancher Labs’ K3s in Docker. K3s is a certified Kubernetes distribution for edge and IoT applications with a small resource footprint and ARMv7 support. Like KiND, K3D uses a container runtime as opposed to a virtual machine — saving precious resources. Unlike KiND, K3D supports the ARM architecture and requires about 16x less RAM.

When you’re finished you’ll have a functional K3s Kubernetes cluster running on your Mac with Rancher UI for cluster management. This guide assumes you’ve never run Kubernetes before and, therefore, also serves as a practical starting point, though I won’t be going into detail about the nuts and bolts of Kubernetes.

Jamupuri Kratom

Headless e-commerce platform co-op for organic kratom suppliers from Indonesia. Built and maintained because Kratom saved my life.

:: Reaction Commerce / GraphQL / MongoDB / Next.js / Docker / Traefik

After finding the cure for my chronic bronchitis I set out to create an e-commerce website helping sell botanicals from Indonesia to the United States. My initial site design was using a headless e-commerce starter I created with a Shopify back-end but I wasn’t satisfied with the speed nor speed.

The Reaction system I use now provides a microservice architecture based around a GraphQL API using MongoDB for persistance.

The storefront, shown below, uses a customized version of the latest Example Storefront stable release and the entire system runs on less than 2GB of RAM.

Archuro

Build minimal, portable application development environments on macOS.

:: Docker / Bash5 / Stow / Homebrew / p10k / VS Code

Archuro

Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better.

Edsger Wybe Dijkstra

Redirect non-www to www Traefik v2

4 minute read Published

How to create more timeless URLs using Traefik 2 with Docker labels.

I like cool URIs that don't change so whenever I’m making a new website I make sure I put my web content on the www subdomain where it belongs. This of course leaves the domain apex, or root of the domain, empty and user agents don’t always do what comes so natural to us humans — adding a www in front of a domain name.

Computers get even more clumsy when you add HTTPS into the equation and are working with new technologies. So if you’re looking for cool URIs too here’s how to redirect domain.example to www.domain.example with Traefik v2 over both HTTP and HTTPS using Docker labels in a docker-compose.override.yml YAML file:

Git-based Continuous Delivery with Rio

16 minute read Published

Using Rio in a compact Kubernetes cluster for Git-based continuous delivery.

Rio is a MicroPaaS for Kubernetes designed to run using minimal resources. Rio provides automatic DNS and HTTPS, load balancing, routing, metrics and more. Use it to remove the chore of creating and managing a secure IT infrastructure.

k3s is a lightweight, certified Kubernetes distribution capable of running on constrained hardware and therefore ideal for local, edge and IoT substrates. K3s was originally developed for Rio but useful enough to stand on its own.

Today I’m going to show you how to easily set-up k3s and Rio on Manjaro Linux MacBook and use them to create a self-hosted, git-based continuous delivery pipeline to serve your own website.

If you’re not yet familiar with Kubernetes, no problem. Please let this gentle introduction serve as your practical guide. When you’re finished you’ll have a better understanding of the concepts and tools used in container orchestration and a shiny new website you can use to demonstrate your skills.

Hugo Deploy: Migrating from S3 Website

10 minute read Published

How to install and configure Hugo for Amazon S3 deployments using Docker.
Scala is great and all though I’m not familiar with it and the maintainer of the deployment tool I’ve been using since 2016 ended active support for s3_website earlier this year. That’s too bad because s3_website was a huge breath of fresh air for me given its support for deploying both Jekyll and Hugo, among others. In addition to its support for various generators s3_website also has some novel features for deployments to AWS not trivial otherwise including:

Swarm Clusters on Digital Ocean

9 minute read Updated

How to set-up a two-node Swarm cluster on Digital Ocean using Docker Machine.

Lately I’ve been learning more about cloud architecture and related tooling. Stuff like Lambda, Serverless, AWS CLI and – now that it’s a part of Docker Machine – container orchestration with Docker Swarm clusters.

As an AWS user I’m particularly geeked about the Docker Private Beta, which makes it possible to experiment with Swarm using Amazon Web Services. But rather than waiting for a private beta we’re going to experiment with Docker Swarm using one of my favorite prototyping tools apart from the RPi: Digital Ocean.

Chat Applications With Redis, Docker and Go

4 minute read Published

Create your own web-based chat app using Redis, Docker and Go.

For several weeks I’ve been thinking about how to go about creating a chat application. After a knowledge drop from Kent Safranski I was inspired to stand-up the chat app using Redis. For the experiment I decided to use Go given the concurrency affordances baked into the language. So I took A Tour of Go and hit the blogs to see what I could find in the open source community.

Reading Redis, Go, & How to Build a Chat Application made me aware of Redigo, a Go client for Redis, and helped demystify use of Redis’ PubSub with Go. The article was a solid introduction and did a great job breaking things down, but ultimately left me wanting a prototype to try things out on the Web. After some more sleuthing on DuckDuckGo I discovered an open source demo app meeting my requirements and providing a great sandbox for experimentation.

In this article I’ll cover how to create a chat application which uses Redis and Go by leveraging open source software and Docker, and use Ngrok to expose the app to the Web over HTTPS.