Skip to content

Instantly share code, notes, and snippets.

View clcollins's full-sized avatar

Christopher Collins clcollins

View GitHub Profile

Example Ruby On Rails development workflow with containers

This is an example of a workflow we've developed to develop Ruby on Rails applications in Docker containers, to assure the local development occurs in the same environment as the production workload. It also has the side benefit of making local development easier: every project can be built with whatever dependencies or libraries are desired, without having to try to install them on the developers' local machines. In addition, local tools and direct code manipulation are still possible, making development feel entirely native to the local machine.

This general workflow works for other languages just as easily. See the "What about other languages?" section, below.

Assumptions:

  1. You have a database container that will initialize itself on startup, setup DB & user/password
@clcollins
clcollins / cleanup_docker.sh
Created June 7, 2018 18:31 — forked from ralphtheninja/cleanup_docker.sh
Cleanup and reset docker on Jenkins workers / slaves
#!/bin/bash
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo
# Attempts to cleanly stop and remove all containers, volumes and images.
docker ps -q | xargs --no-run-if-empty docker stop
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes
docker volume ls -q | xargs --no-run-if-empty docker volume rm
docker images -a -q | xargs --no-run-if-empty docker rmi -f
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again.
@clcollins
clcollins / WorkingWithForks.md
Created July 30, 2018 16:47
Git Cheet Sheet

Working With Forks/Upstream

Get Upstream Tags

Update Git config

Add this to the [upstream] section in .git/config

fetch = +refs/tags/*:refs/tags/*

@clcollins
clcollins / WorkingWithDockerHub.md
Last active May 15, 2019 15:16
Working WIth Docker Hub

Working With Docker Hub

Documentation for creating/managing repositories and images for the STINGAR organization on Docker Hub.

NOTE: This should ONLY be done this way until we get some automation.

Before you start

@clcollins
clcollins / python_openshift_api_snippet.cson
Last active December 3, 2018 14:50
Atom Snippet: Python OpenShift Dynamic Client init function
# A snippet for instantiating an OpenShift dynamic client
# for working with the OpenShist Rest API
#
# Requires:
# OpenShift-RestClient-Python - https://github.com/openshift/openshift-restclient-python
# Kubernetes Python Client - https://github.com/kubernetes-client/python
#
# `pip3 install --user kubernetes && pip3 install --user openshift`
#
# import kubernetes
@clcollins
clcollins / language_DWARF.txt
Created May 9, 2019 19:40
DwarfFortress Dwarf Language File
language_DWARF
[OBJECT:LANGUAGE]
[TRANSLATION:DWARF]
[T_WORD:ABBEY:kulet]
[T_WORD:ACE:alak]
[T_WORD:ACT:bidok]
[T_WORD:AFTER:nicol]
[T_WORD:AGE:anam]
@clcollins
clcollins / main.go
Last active June 19, 2019 14:36
Help a Go Newbie
package main
import (
"fmt"
"os"
"path/filepath"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
@clcollins
clcollins / oc-dummy-go.go
Last active August 12, 2019 18:21
Trying to figure out how to use client-go for oc and kubectl...
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
// "time"
// "k8s.io/client-go/rest"
@clcollins
clcollins / id_ed25518.pub
Created September 6, 2019 14:43
Throwaway Public Key
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMOHCYwjPmYsW9EKpuEQkMxolLijxMfqbXAT//34sGox
@clcollins
clcollins / sum-es-indices.py
Created November 12, 2019 17:35 — forked from portante/sum-es-indices.py
A script to generate a report of Elasticsearch index usage (from _cat/indices?v&bytes=b) by prefix for a set of known date suffixes.
#!/usr/bin/env python2
# A script to generate a report of Elasticsearch index usage
# (from _cat/indices?v&bytes=b) by prefix for a set of known
# date suffixes.
#
# E.g.
# $ curl -X GET http://localhost:9200/_cat/indices?v\&bytes=b -o indices.lis
# $ ./sum-es-indices.py indices.lis
#