Skip to content

Instantly share code, notes, and snippets.

@aaronfeng
aaronfeng / cloud-init
Created October 7, 2014 18:15
cloud-init for Digital Ocean
#cloud-config
coreos:
etcd:
discovery: https://discovery.etcd.io/<token>
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $private_ipv4 # used for fleetctl ssh command
units:
@aaronfeng
aaronfeng / ec2-libswarm-readme.md
Last active December 6, 2015 10:00
README for libswarm EC2 Service

https://github.com/docker/libswarm

EC2 Libswarm Service

This service will deploy Docker container onto EC2 instance. It will do all of the work spinning up the instance if it doesn't exist already.

Usage:

export AWS_ACCESS_KEY_ID=XXXX

@aaronfeng
aaronfeng / gist:9cfae309fd73f2e45942
Created June 18, 2014 14:04
libswarm aggregate
./swarmd "dockerserver tcp://localhost:4243" "aggregate 'ec2 --ami=xxxx --keypair=xxxx --tag=xxxx' 'dockerclient tcp://x.x.x.x:4243'"
package main
import (
"fmt"
"net"
"bufio"
"io"
"os"
"time"
)
@aaronfeng
aaronfeng / gist:8698709
Created January 29, 2014 22:40
docker registry
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/docker-registry/lib/storage/boto_base.py", line 48, in _fetch_part
boto_key.get_contents_to_file(f, headers={'Range': brange})
File "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 1578, in get_contents_to_file
response_headers=response_headers)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 1418, in get_file
query_args=None)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 1471, in _get_file_internal
@aaronfeng
aaronfeng / gist:8478425
Last active January 3, 2016 14:49
latest chef with omnibus
Bundler could not find compatible versions for gem "json":
In Gemfile:
chef (~> 11.8.2) ruby depends on
json (<= 1.7.7, >= 1.4.4) ruby
omnibus (~> 1.3.0) ruby depends on
json (1.8.1)
@aaronfeng
aaronfeng / bundle_ruby
Last active December 31, 2015 19:09
Intercepts `ruby` in order to prepend `bundle exec` if Gemfile.lock is present
#!/bin/bash
# remember original ruby location
export CURRENT_RUBY=$(which ruby)
alias ruby="ruby_wrapper"
# call bundle exec if there's a Gemfile.lock
function ruby_wrapper() {
# unalias it to get the real ruby version
─➤ vagrant provision 1 ↵
[default] The cookbook path '/Users/aaron.feng/code/artifact-cookbook-good/fixtures/databags' doesn't exist. Ignoring...
[Berkshelf] This version of the Berkshelf plugin has not been fully tested on this version of Vagrant.
[Berkshelf] You should check for a newer version of vagrant-berkshelf.
[Berkshelf] If you encounter any errors with this version, please report them at https://github.com/RiotGames/vagrant-berkshelf/issues
[Berkshelf] You can also join the discussion in #berkshelf on Freenode.
[Berkshelf] Updating Vagrant's berkshelf: '/Users/aaron.feng/.berkshelf/default/vagrant/berkshelf-20131029-50324-z5k7zn-default'
[Berkshelf] Using artifact (1.10.3)
[Berkshelf] Using artifact_test (0.1.0) at './fixtures/artifact_test'
[Berkshelf] Using windows (1.8.10)
@aaronfeng
aaronfeng / gist:6907828
Created October 9, 2013 20:31
by default /mnt can't be mounted. pass -lxc-conf to allow mounting of /mnt from host to the container
docker run -lxc-conf="lxc.pivotdir = lxc_putold" -v /mnt/data:/mnt/data ubuntu touch /mnt/data/hello
@aaronfeng
aaronfeng / nginx_open_sockets
Created September 27, 2013 16:59
number of sock opened by nginx
ps aux | grep ngin[x] | tr -s ' ' | echo -n `cut -d' ' -f2` | tr ' ' ',' | xargs -I pid sh -c "ls -alh /proc/{pid}/fd" | grep socket | wc -l