Skip to content

Instantly share code, notes, and snippets.

View afloesch's full-sized avatar

Andrew Loesch afloesch

  • Bowers & Wilkins
  • Menlo Park, CA
View GitHub Profile
@afloesch
afloesch / README.md
Created January 29, 2020 02:41
Nginx Environment Variables

Nginx Environment Variables

I had a hard time finding a decent example on how to use the lua nginx module to get environment variables and pass them to the location block for the proxy settings, so wanted to share the solution that worked for me.

Example nginx conf:

env NGROK_URL;
@afloesch
afloesch / README.md
Last active August 9, 2019 22:40
Python signed requests to AWS Elasticsearch

Python Signed Requests to AWS Elasticsearch

AWS provides a basic example for making signed requests to managed Elasticsearch clusters, but the example doesn't cover how to deal with EC2 instance profiles, which will require passing the session token.

Here's a simple example, which also handles authenticating when using an instance profile instead of a generated user level access key and secret, leverages the elastic bulk upload API to add multiple records at the same time, and threads the request so it can be made in a non-blocking fashion.

Terraforming API Gateway to SQS queue

Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.

SQS

Start by creating the SQS queue.

resource "aws_sqs_queue" "queue" {
@afloesch
afloesch / jenkins-in-docker.md
Last active October 8, 2024 03:36
Jenkins in Docker (docker-in-docker)

Jenkins in Docker (docker-in-docker)

Testing Jenkins flows on your local machine, or running Jenkins in production in a docker container can be a little tricky with a docker-in-docker scenario. You could install Jenkins to avoid any docker-in-docker issues, but then you have Jenkins on your machine, and the local environment is likely going to be a fairly different from the actual production build servers, which can lead to annoying and time-consuming issues to debug.

Build environment differences are precisely why there is a strong argument to be made to run build processes strictly in docker containers. If we follow the philosophy that every build step or action should run in a docker container, even the Jenkins server itself, then we get massive benefits from things like, total control over the build environment, easily modify the build environment without the possibility of adversely effecting other jobs, explicit and strongly controlled tool versions,