Skip to content

Instantly share code, notes, and snippets.

View brianjbayer's full-sized avatar

Brian J. Bayer brianjbayer

View GitHub Profile
@brianjbayer
brianjbayer / gist-curlless-rack-based-healthchecks.md
Last active November 25, 2024 08:49
Add Rack-based liveness and readiness health checks and a Ruby program to check them to your (Rails) application

Adding Rack-Based Health Checks Without curl or wget

Lake View Cemetary, Cleveland OH - Wendy Bayer

Image: Lake View Cemetary, Cleveland OH by Wendy Bayer


You can not address a problem without first knowing that there is a problem. Having health checks in your application allows you to easily determine and monitor the status of your critical application

@brianjbayer
brianjbayer / gist-representing-email-addresses-in-rails.md
Last active March 10, 2023 20:21
Detailed overview of the official email standards and how to more correctly implement them in Ruby on Rails and PostgreSQL

Representing Email Addresses in Rails

Joshua Tree Saloon - Wendy Bayer

Image: Joshua Tree Saloon by Wendy Bayer


Dealing with and representing email addresses is very common in Ruby on Rails and other web applications. This is especially true when representing and implementing an

@brianjbayer
brianjbayer / gist-unlocking-the-secrets-of-rails-secrets-and-credentials.md
Last active April 8, 2025 10:05
A comprehensive examination of Rails Secrets, Credentials, and Secret Key Base

Unlocking the Secrets of Rails Secrets and Credentials

Interurban Tunnel at Blackhand Gorge- Brian J Bayer


If you are like many (most?) of us, you have encountered Rails Credentials/Secrets and secret_key_base and may have been left a bit (or more) confused.

This post is an attempt to remove some of that confusion by

@brianjbayer
brianjbayer / gist-rails-api-error-handling-and-tests.md
Last active January 29, 2023 16:43
Add a basic single schema, custom response Error Handler to your Rails API with tests

Adding Rails API Error Handling with Tests

Iron Gate - Wendy Bayer

Image: Iron Gate by Wendy Bayer


Development is a dangerous game. Things you don't expect, things you do. Systems fail, the cloud is not infallible.

@brianjbayer
brianjbayer / Dockerfile
Created November 7, 2022 22:47
WIP: Rails 7 App Dockerfile
# --- Base Image ---
FROM ruby:3.1.2-slim-bullseye AS ruby-base
# --- Base Builder Stage ---
FROM ruby-base AS base-builder
# Update to match version in app Gemfile.lock
ARG BUNDLER_VER=2.3.21
# Static config
@brianjbayer
brianjbayer / Dockerfile
Created October 19, 2022 14:24
Containerized Ruby on Rails 7 Bootstrap/Development Environment
# Dockerfile for a containerized development environment
# for the railstutorial.org Rails tutorial
# ASSUMPTION: source is volume mounted
# docker build --no-cache -t railsgen .
# docker run -it --rm -v $(pwd):/app -p 3000:3000 railsgen
# bundle exec bin/rails server -p 3000 -b 0.0.0.0
FROM ruby:3.1.2-slim-bullseye
ARG BUNDLER_VER=2.3.14
ARG RAILS_VER=7.0.4
@brianjbayer
brianjbayer / gist-create-dev-run-csharp-project-with-docker.md
Last active July 12, 2024 03:26
Create, Develop, and Run a New C# (.NET) Project Using Docker

Create, Develop, and Run Your C# (.NET) Projects All in Docker

Hand Rail at The Ohio State University - Wendy Bayer

Image Hand Rail at The Ohio State University by Wendy Bayer


You can create, develop, and run a new C# (.NET) project just using Docker without having to install dotnet on your machine.

@brianjbayer
brianjbayer / gist-image-based-cicd.md
Last active February 18, 2024 15:28
A "White Paper" on Using an Image-Based CI/CD Model

An Image-Based Continuous Integration / Continuous Deployment Model

Kit Kat Clock (TM) - Brian J. Bayer


This model and approach is based on the belief that the (Docker) image of the application (and not the source code) should be the "source of truth" and object of the Continuous Integration / Continuous Deployment (CI/CD).

Key Points Covered...

Example of Outputs in GitHub Actions

Called Job

  branch-and-last-commit:
    runs-on: ubuntu-latest
    outputs:
      branch-name: ${{ steps.getbranch.outputs.branchname }}

 steps:
@brianjbayer
brianjbayer / gist-add-ci-to-your-dockerbuild.md
Created March 21, 2022 14:56
Add Automated Continuous Integration (CI) To Your Dockerfile - Docker Multi-Stage Build Anti-Pattern

Simple, Cheap Continuous Integration (CI) in a Dockerfile

Garage Pool - Brian J. Bayer


This is absolutely no substitute for true automated Continuous Integration (CI), but it is better than nothing and it is fairly simple and cheap if you are already building images. It is also a great illustration of how to use multi-stage builds