QUICK AND DIRTY PYTHON LOGGING CONFIGURATION
This is my quick-and-dirty logging configuration that works for both scripts and containerized applications. from logging import StreamHandler, getLogger from os import getenv stderr_handler = StreamHandler() log = getLogger(__name__) log.setLevel(getenv('LOG_LEVEL', 'INFO')) log.addHandler(stderr_handler) This will provide console output when developing locally and will be picked up by the Docker/containerd logging driver when running in docker compose, Kubernetes, etc.
RUNNING EJBCA ON EKS
⚠️ Bitnami has taken most of their public images and Helm charts offline. Likely, this method no longer works. Bitnami provides a nice Helm chart for EJBCA, a FOSS public key infrastructure certificate authority application with a REST API. However, the Service and Ingress setup doesn’t work very well if you’re deploying to Amazon EKS. Our EKS clusters use the AWS Load Balancer Controller to automatically create ALBs from Kubernetes Ingresses which are properly annotated. This allows us to attach certificates stored in AWS Certificate Manager, set TLS policies, and establish health checks right in our manifests. Fantastic stuff.
GROGUE: A ROGUELIKE TUTORIAL IN GO (PART 4)
Happy New Year and welcome back to part 4 of my Rougelike tutorial in Go! (EDIT: It’s been 2024 for a while now, as I’ve been busy and wasn’t able to get this published when I initially intended.) We now have a dungeon that we can move around, but we’re not really exploring it if we can see it all from start. We should implement a “field of view” for the player to allow only a limited range around them to be seen.
GROGUE: A ROGUELIKE TUTORIAL IN GO (PART 3)
In Part 1, we created the dungeon as a large, empty room with walls around the edge. In this part, we’ll modify our dungeon generation code to start by filling the entire map with walls and then carving out rooms and connecting them with tunnels. Start by creating a structure we’ll use to create our rooms. Add the following code to level.go: type RectangularRoom struct { X1 int Y1 int X2 int Y2 int } // Create a new RectangularRoom structure. func NewRectangularRoom(x int, y int, width int, height int) RectangularRoom { return RectangularRoom{ X1: x, Y1: y, X2: x + width, Y2: y + height, } } The constructor takes the x and y coordinates of the top-level corner and computes the bottom right corner based on the width and height parameters.
GROGUE: A ROGUELIKE TUTORIAL IN GO (PART 2)
Now that we’re drawing the map on the screen, we need to add a player and have them move around on the map. Before diving in and creating a Player structure, we should probably consider how we want to handle all of the creatures or entities that will be moving around the map. Let’s create a structure that represents not just the player, but just about everything we may want to represent on the map: enemies, items, and whatever else we dream up.
GROGUE: A ROGUELIKE TUTORIAL IN GO (PART 1)
Welcome to part one of this series which will help you create your a roguelike game written in Go! This is based largely on the Roguebasin libtcod tutorial, which has proven very helpful in getting fledgling roguelike-devs off the ground. If you haven’t already completed the steps outlined in Part 0, please go back and do that now. With our dependencies installed and validated, let’s grab a few neat tiles created by by Jere Sikstus. Download wall.png and floor.png and place them in a folder called assets/ inside our project root.
GROGUE: A ROGUELIKE TUTORIAL IN GO (PART 0)
Are you interested in the [Go programming language])https://go.dev/) and creating a roguelike game? This tutorial will help you build the basics of a roguelike game in thirteen parts. Those parts will be: Drawing on the Screen Entities and the Map Generating a Dungeon Field of View Enemies Doing Damage (and Taking Some, Too) Adding an Interface Items and Inventory Ranged Attacks Saving and Loading Deeper into the Dungeon Increasing the Difficulty (of the Game) Gearing Up In this part 0, we’ll get the base of the project set up.
LEARNING GO
At work, we recently forked a project which includes a code written in Go and I needed to fix a bug in that code. I don’t know Go, but my colleagues were able to help me out and I was able to get the code working. I’ve decided, though, that it’s time for me to learn Go, as many Kubernetes utilities are written in it and I’m basically doing K8s day-in and day-out at this point. I’m taking a course on it to get the basics, but have a neat idea for deepening my knowledge. More on that later.
DEPLOY PYTHON LAMBDAS WITH TERRAFORM
Deploying lambdas to AWS has always been painful when those Lambdas need more than just boto3 and when sticking to Infrastructure-as-Code. You can bring in the Serverless Framework, but it is complicated to bring into your CICD pipelines and has some issues with repeatability of deployments. So, what if you want to deploy a single Lambda? In this post, I’ll discuss the method I use to deploy a Lambda, written in Python 3, to AWS using Terraform and GitLab CI.
MOVING OFF DOCKER HUB
Docker Hub was the place to get container images. To a degree, it still is, but support for other public registries has increased and if your software’s installation instructions include a Docker Compose file, then having that file pre-populated with images from a third-party registry is trivial. Docker announced last year that they’d be limiting the pull rate of container images on free accounts. Later, they announced that they would discontinue autobuilds for free accounts. For my FOSS projects, this was a problem. I used autobuilds to create Docker images when I made a release. Since my images can get marked as “unused” and I have to build them with a CI tool anyway, I decided to move to GitHub Container Registry and use GitHub Actions–which was already running my unit tests–to build and push the images.