Skip to content

Instantly share code, notes, and snippets.

jbayer-mbpro:helloflask jbayer$ cf push --buildpack git://github.com/heroku/heroku-buildpack-python.git
Using manifest file manifest.yml
Creating hello-flask... OK
1: a1-app.cf-app.com
2: none
Domain> a1-app.cf-app.com
Creating route hello-flask.a1-app.cf-app.com... OK
@jbayer
jbayer / gist:5696151
Created June 3, 2013 04:40
Help Alex!
jbayer-mbpro:ruby-build jbayer$ gem install tools-cf-plugin
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: tools-cf-plugin requires bosh_cli (< 1.6, >= 1.5.0.pre.3)
/var/folders/mt/0903tr2j54q4261kl9x_j5cr0000gp/T/ruby-build.20130621063708.41284 ~/workspace/vcap-test-assets/java_web/java_tiny_app/target
x ruby-2.0.0-p195/
x ruby-2.0.0-p195/eval_jump.c
x ruby-2.0.0-p195/transcode_data.h
x ruby-2.0.0-p195/complex.c
x ruby-2.0.0-p195/main.c
x ruby-2.0.0-p195/vm_insnhelper.h
x ruby-2.0.0-p195/goruby.c
x ruby-2.0.0-p195/enum.c
x ruby-2.0.0-p195/vm_trace.c
@jbayer
jbayer / gist:5915622
Created July 3, 2013 05:18
Example Cloud Foundry v2 ruby script for a short-lived process that should run every 10 min. This keeps the PID alive of this process so CF doesn't think the app instance is dead and try and restart it elsewhere.
#!/usr/bin/env ruby
while true
system "bundle exec rake cron"
sleep ARGV[0] || 600
end
This file has been truncated, but you can view the full file.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x571676]
goroutine 7 [running]:
github.com/cloudfoundry/yagnats.(*Client).Ping(0x0, 0x4bf7e8)
/var/vcap/packages/gorouter/src/github.com/cloudfoundry/yagnats/client.go:41 +0x36
github.com/cloudfoundry/go_cfmessagebus.(*NatsAdapter).Ping(0xc2000e1480, 0x5)
/var/vcap/packages/gorouter/src/github.com/cloudfoundry/go_cfmessagebus/nats.go:144 +0x28
github.com/cloudfoundry/gorouter.(*Registry).isStateStale(0xc2000e1500, 0x27)
/var/vcap/packages/gorouter/src/github.com/cloudfoundry/gorouter/registry.go:212 +0x2e
@jbayer
jbayer / gist:6433725
Created September 4, 2013 07:22
josh mckenty's python buildpack with flask test
jamesbayer:hello-flask jamesbayer$ cat hello.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
@jbayer
jbayer / gist:6519949
Created September 11, 2013 06:23
create user-provided service gist
$ cf -v
cf 5.3.0
$ cf create-service user-provided -t
>>> OMMITTED
Name?> somedb
What credential parameters should applications use to connect to this service instance?
(e.g. hostname, port, password)> uri
uri> mysql://dbuser:dbpasswd@mysql.vcap.me:3306/dbname
@jbayer
jbayer / gist:6568018
Created September 15, 2013 04:26
work-around for gcc strangeness building go, use the --cc option
$ brew install go --cross-compile-common
==> Downloading https://go.googlecode.com/files/go1.1.2.src.tar.gz
######################################################################## 100.0%
==> ./make.bash --no-clean
==> ./make.bash --no-clean
==> ./make.bash --no-clean
/private/tmp/go-BvwY/go/src/cmd/5l/../ld/lib.c:661:9: error: no case matching constant switch condition '53' [-Werror]
switch(thechar){
^~~~~~~
1 error generated.
@jbayer
jbayer / gist:6845024
Created October 5, 2013 19:18
Cloud Foundry Router - running 4 copies of the sticky-session app
$ cf app sticky-session
Showing health and status for app sticky-session...
OK
health: running
usage: 256M x 4 instances
urls: sticky-session-6115e.cfapps.io, sticky-session.cfapps.io
status since cpu memory disk
#0 running 2013-10-05 11:08:31 AM 0.0% 84.3M of 256M 93.6M of 1G
@jbayer
jbayer / gist:6850923
Created October 6, 2013 07:54
A simple multi-buildpack example of using the 1st buildpack to retrieve my app contents from a git repo, using another buildpack to stage my app.
$ ls
jamesbayer:foo jamesbayer$ vi .buildpacks
$ cat .buildpacks
https://github.com/jbayer/null-buildpack.git
https://github.com/cloudfoundry/heroku-buildpack-ruby.git
jamesbayer:foo jamesbayer$ cf push --buildpack https://github.com/ddollar/heroku-buildpack-multi.git
Name> git-test
Instances> 1