Skip to content

Instantly share code, notes, and snippets.

@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: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'
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
knife[:ssh_attribute] = 'cloud.local_ipv4'
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)
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
@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 []
@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 / gist:7811378
Created December 5, 2013 19:10
7maples Floobits Emacs log
Now listening on 53541
('got user_input', {u'id': 0, u'initial': u'~/floobits/share/democracyworks/payments-api', u'prompt': u'Give me a directory to sync data to: ', u'name': u'user_input', u'response': u'~/turbovote/payments-api'})
[Thu Dec  5 11:35:23 2013] Connecting to floobits.com:3448
Connecting to floobits.com:3448
SSL handshake completed to floobits.com:3448
Overwrite the following local files?
test/payments_api/service_test.clj
.gitignore
@cap10morgan
cap10morgan / async_geolocation.cljs
Created November 15, 2013 23:10
core.async HTML5 geolocation in ClojureScript
(ns cljs-minimal.core
(:require [cljs.core.async :as async :refer [put! <! >! <!! >!! chan]])
(:require-macros [cljs.core.async.macros :as m :refer [go]]))
(defn get-position []
(let [out (chan)
geo (.-geolocation js/navigator)]
(.getCurrentPosition geo (fn [pos] (put! out pos)))
out))