Skip to content

Instantly share code, notes, and snippets.

Avatar

Benton Roberts benton

View GitHub Profile
@benton
benton / nginx.log
Created May 27, 2015
Nginx log from docker push
View nginx.log
10.10.25.251 - - [27/May/2015:19:23:04 +0000] "GET /v2/ HTTP/1.1" 401 194 "-" "docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/3.16.0-37-generic os/linux arch/amd64"
[27/May/2015:19:23:04 +0000] 10.10.25.251 - - - localhost to: -: GET /v2/ HTTP/1.1 upstream_response_time - msec 1432754584.880 request_time 0.000
2015/05/27 19:23:05 [info] 8#8: *54 client closed connection while waiting for request, client: 10.10.25.251, server: 0.0.0.0:80
10.10.16.231 - - [27/May/2015:19:23:05 +0000] "GET /v2/ HTTP/1.1" 401 194 "-" "docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/3.16.0-37-generic os/linux arch/amd64"
[27/May/2015:19:23:05 +0000] 10.10.16.231 - - - localhost to: -: GET /v2/ HTTP/1.1 upstream_response_time - msec 1432754585.267 request_time 0.000
2015/05/27 19:23:05 [info] 8#8: *57 client closed connection while waiting for request, client: 10.10.16.231, server: 0.0.0.0:80
10.10.25.251 - - [27/May/2015:19:23:05 +0000] "GET /v2/ HTTP/1.1" 401 194 "-" "docker/1.6.2 go/go1.4.2 git-commit/7c8fca2 kernel/3.16.0-
View registry.config.yaml
version: 0.1
log:
level: debug
fields:
service: registry
environment: production
storage:
cache:
layerinfo: redis
blobdescriptor: redis
View nginx.conf
user root;
daemon off;
worker_processes 1;
error_log /dev/fd/2 info;
events {
worker_connections 1024;
}
http {
@benton
benton / development.log
Last active Aug 29, 2015
localhost medistrano login error
View development.log
Filter redirecting to "/auth/google_oauth2"
==================================================
Redirected to http://localhost:3000/auth/google_oauth2
Filter chain halted as :google_filter rendered or redirected
Completed 302 Found in 15.1ms (ActiveRecord: 0.7ms)
Started GET "/auth/google_oauth2" for 127.0.0.1 at 2015-08-17 12:55:26 -0700
(google_oauth2) Request phase initiated.
/home/benton/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bundler/gems/mdsol-tools-a579688d034a/lib/mdsol_uri.rb:93:in `generate'
@benton
benton / Dockerfile
Created Feb 9, 2016
Docker-enabled Jenkins image
View Dockerfile
FROM jenkins:1.642.1
USER root
# install docker
RUN wget -qO- https://get.docker.com/gpg | apt-key add -
RUN wget -qO- https://get.docker.com/ | sh
RUN usermod -aG docker jenkins && usermod -aG users jenkins
USER jenkins
@benton
benton / get_image_data_from_ecr.rb
Created Feb 11, 2016
Get Docker image metadata from ECR - ruby version
View get_image_data_from_ecr.rb
require 'aws-sdk'
REPO_NAME = 'mdsol/mauth/distro'
REGION = 'us-east-1'
ecr = Aws::ECR::Client.new(region: REGION)
# get list of image tags in the repo
resp = ecr.list_images(repository_name: REPO_NAME)
tags = resp.image_ids.map{|id| id.image_tag}
# get manifests for all tags at once
@benton
benton / missing_instance.sh
Created Apr 6, 2016
EC2/Autoscaling API fail?
View missing_instance.sh
╭─benton@hume.local ~ ‹2.2.4›
╰─➤ aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names corral-archon-performance-VPC_app | grep -C 1 'i-'
"AvailabilityZone": "us-east-1e",
"InstanceId": "i-d39a8449",
"HealthStatus": "Healthy",
--
--
"AvailabilityZone": "us-east-1c",
"InstanceId": "i-3ac627bd",
"HealthStatus": "Healthy",
@benton
benton / ssh-docker-compose.md
Created Jun 25, 2016
Ephemeral/secure SSH key usage with docker-compose?
View ssh-docker-compose.md

Hello, Ben.

It was good to meet you in the Ask The Experts Booth at this year's DockerCon. Thank you for answering my questions about LDAP integration with the DataCenter's role-based access control, and for patiently attempting to explain to me how we at Medidata, the "docker-compose uninitiated", might overcome our need to bundle Ruby gems from non-public Git repositories, using only docker-compose. I'm still unclear on the specifics of the technique you laid out, so thanks even more for offering to provide an example!

Fortunately, our problem is very simply expressed as a single line added to the excellent [Rails example][1] that you guys already posted for Docker compose. Only the build phase is relevant here, so our problem can be quickly reproduced by following those instructions faithfully, until the part where it says to add the rubyracer gem to the Gemfile.

At that point, if we also add a gem whose source is a non-public git repo, of the form:

gem 'mygem', :git => 'git@github.com:user/myg
@benton
benton / print_ecr_image_labels.rb
Created Oct 26, 2016
prints the Docker Image Labels for ECR images matching a given tag expression
View print_ecr_image_labels.rb
#!/usr/bin/env ruby
# prints the Docker Image Labels for ECR images matching a given tag expression
require 'aws-sdk'
repo = 'mdsol/operationalanalytics/build'
tag_match = /feature-sprint3\.maps/
sort_field = 'com.mdsol.12f-buildDate'
reverse_sort = true # reverse is nicer when date sorting
label_filter = /\Acom\.mdsol\.12f-appDesc/ # values in these labels are ignored
date_fields = /\Acom\.mdsol\.12f-.*Date\Z/ # these values get DateTime parsed
@benton
benton / map-pairs.clj
Created Oct 27, 2016
Create map from alternating series of keys and values
View map-pairs.clj
(defn make-pairs
"Creates a vector of pairs from the incoming sequence. Ignores extra elements."
([] []) ; return an empty vector if supplied no arguments
([seq] (make-pairs seq [])); return a vector of pairs taken from seq
([seq pairs] ; return a vector of pairs, starting with some existing pairs
(if (< (count seq) 2) pairs
(make-pairs (rest (rest seq))
(conj (vec pairs) [(first seq) (second seq)])))))
(defn map-pairs