Skip to content

Instantly share code, notes, and snippets.

@cap10morgan
cap10morgan / gist:8855187
Created February 7, 2014 00:15
inside a container, SSH'd in via sshd running under supervisord
ubuntu@5bb534e62eb4:~$ ls -la
total 32
drwxr-xr-x 9 ubuntu ubuntu 4096 Feb 6 08:44 .
drwxr-xr-x 9 root root 4096 Feb 6 08:41 ..
-rw------- 1 root root 94 Feb 6 08:44 .bash_history
-rw-r--r-- 1 ubuntu ubuntu 220 Mar 30 2013 .bash_logout
-rw-r--r-- 1 ubuntu ubuntu 3637 Mar 30 2013 .bashrc
drwx------ 2 ubuntu ubuntu 4096 Feb 6 08:41 .cache
-rw-r--r-- 1 ubuntu ubuntu 675 Feb 6 08:43 .profile
drwx------ 2 ubuntu ubuntu 4096 Feb 6 08:44 .ssh
@cap10morgan
cap10morgan / service.clj
Created February 20, 2014 22:44
Graceful Jetty shutdown in pedestal-service 0.2.x
(ns myapp.service
(:require [io.pedestal.service.http :as bootstrap]))
(defn jetty-configurator [server]
(let [one-minute 60000]
(.setGracefulShutdown server one-minute)
(.setStopAtShutdown server true))
server)
(defn service []
lxc-start: No such file or directory - failed to mount '/dev/pts/5' on '/usr/lib/x86_64-linux-gnu/lxc//dev/console'
lxc-start: failed to setup the mount entries for '2518e54f87522b7c5df43ce0a178a56851a2678b1a00ab155077fffe0dd9d44a'
lxc-start: failed to setup the container
lxc-start: invalid sequence number 1. expected 2
lxc-start: failed to spawn '2518e54f87522b7c5df43ce0a178a56851a2678b1a00ab155077fffe0dd9d44a'
lxc-start: Device or resource busy - failed to remove cgroup '/sys/fs/cgroup/cpuset//lxc/2518e54f87522b7c5df43ce0a178a56851a2678b1a00ab155077fffe0dd9d44a'
[error] client.go:2296 Error resize: Error: resize: bad file descriptor
FROM democracyworks/clojure-api:latest
MAINTAINER Democracy Works, Inc. <dev@turbovote.org>
# This will be clobbered by a config volume on the servers,
# but allows a dev deployment to spin up with in-memory Datomic.
ADD ./docker-dev-resources/ /nixon/resources/
ADD ./target/nixon.jar /nixon/
# install serf (TODO: move this into a parent container)
knife[:ssh_attribute] = 'cloud.local_ipv4'
knife ec2 server create --region us-west-2 --availability-zone us-west-2a --subnet subnet-41be5024 --node-name docker1 --flavor c3.2xlarge --environment production --run-list 'role[docker]' --image ami-b6cca686 --ssh-key thill --identity-file ~/.ssh/thill-us-west-2.pem --security-group-ids sg-aaf70bcf --ssh-user ubuntu
Instance ID: i-9835d493
Flavor: c3.2xlarge
Image: ami-b6cca686
Region: us-west-2
Availability Zone: us-west-2a
Security Group Ids: sg-aaf70bcf
Tags: Name: docker1
SSH Key: thill
@cap10morgan
cap10morgan / gist:582a412cd35eca8f2ccf
Created May 2, 2014 17:47
/var/chef/cache/chef-stacktrace.out
Generated at 2014-05-02 17:28:15 +0000
Net::HTTPFatalError: 500 "Internal Server Error"
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2633:in `error!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/http.rb:143:in `request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/http.rb:124:in `post'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/api_client/registration.rb:92:in `create'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/api_client/registration.rb:83:in `create_or_update'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/api_client/registration.rb:56:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/client.rb:323:in `register'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.2/lib/chef/client.rb:416:in `do_run'
@cap10morgan
cap10morgan / gist:4f04a21680f0f8eefd49
Created July 8, 2014 20:32
confd config and template
# template resource - /confd/conf.d/haproxy.toml
[template]
src = "haproxy.cfg.tmpl"
dest = "/etc/haproxy/haproxy.cfg"
owner = "root"
group = "root"
mode = "0644"
keys = [ "/ftp-reverse-proxy" ]
check_cmd = "/usr/sbin/haproxy -c -q -f {{ .src }}"
reload_cmd = "/usr/sbin/haproxy -f {{ .src }} -p /var/run/haproxy.pid -sf $(</var/run/haproxy.pid)"
@cap10morgan
cap10morgan / gist:49b8e5b2a268b25275d1
Created July 8, 2014 20:33
confd command & output
# confd -verbose -onetime -debug -node 172.17.0.2:4001 -confdir /confd
2014-07-08T20:33:35Z 76837d23da9b confd[104]: WARNING Skipping confd config file.
2014-07-08T20:33:35Z 76837d23da9b confd[104]: NOTICE Starting confd
2014-07-08T20:33:35Z 76837d23da9b confd[104]: NOTICE Backend set to
2014-07-08T20:33:35Z 76837d23da9b confd[104]: NOTICE etcd nodes set to http://172.17.0.2:4001
2014-07-08T20:33:35Z 76837d23da9b confd[104]: DEBUG Loading template resources from confdir /confd
2014-07-08T20:33:35Z 76837d23da9b confd[104]: DEBUG Processing template resource /confd/conf.d/haproxy.toml
2014-07-08T20:33:35Z 76837d23da9b confd[104]: DEBUG Loading template resource from /confd/conf.d/haproxy.toml
2014-07-08T20:33:35Z 76837d23da9b confd[104]: DEBUG Retrieving keys from store
2014-07-08T20:33:35Z 76837d23da9b confd[104]: DEBUG Key prefix set to /
@cap10morgan
cap10morgan / run.sh
Created July 8, 2014 22:27
new coreos/etcd wrapper script
#!/bin/sh
IP_ADDR=$(ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
exec /opt/etcd/bin/etcd -addr $IP_ADDR:4001 -peer-addr $IP_ADDR:7001 "$@"