Skip to content

Instantly share code, notes, and snippets.

View ncdc's full-sized avatar

Andy Goldstein ncdc

View GitHub Profile
@ncdc
ncdc / .vimrc
Created April 30, 2013 15:29
My .vimrc
set nocompatible
syntax enable
color evening
set ai
set si
set is
set hls
set et
set sr
set ts=2
diff --git a/node/test/test_helper.rb b/node/test/test_helper.rb
index 7067eda..a7555c3 100644
--- a/node/test/test_helper.rb
+++ b/node/test/test_helper.rb
@@ -42,7 +42,15 @@ module OpenShift
class NodeTestCase < NodeBareTestCase
def before_setup
log_config = mock()
- log_config.stubs(:get).with("PLATFORM_LOG_CLASS").returns("StdoutLogger")
+ log_config.stubs(:get).with("PLATFORM_LOG_CLASS").returns("SplitTraceLogger")
@ncdc
ncdc / README.md
Last active April 11, 2016 19:08
Update OpenShift gear DNS and server_identity entries after a devenv gets a new IP address and DNS name (instance stop, instance start)

Save fixdns.rb to your devenv, e.g to ~. Run it like this:

/var/www/openshift/broker/script/rails r ~/fixdns.rb <login>

Also, run this to fix /etc/openshift/port-proxy.cfg:

ip=$(facter ipaddress)
sed -i "s,bind 10\.[0-9.]\+:,bind $ip:," /etc/openshift/port-proxy.cfg
begin
::OpenShift::Runtime::Utils::Cgroups.new(@uuid).boost do
logger.info "Executing initial gear prereceive for #{@uuid}"
Utils.oo_spawn("gear prereceive >> #{build_log} 2>&1",
env: env,
chdir: @container_dir,
uid: @uid,
timeout: @hourglass.remaining,
expected_exitstatus: 0)
[a1s-agoldste.dev.rhcloud.com 829533070332742162448384]\> gear prepare a.tar.gz
Prepared deployment artifacts in /var/lib/openshift/829533070332742162448384/app-deployments/2013-08-26_13-00-49.656
Deployment id is 3300ef3f
[a1s-agoldste.dev.rhcloud.com 829533070332742162448384]\> gear deployments
2013-08-26_13-00-49.656 - 3300ef3f - NOT DEPLOYED
2013-08-26_12-37-48.240 - 0bc8b5ef - DEPLOYED - ACTIVE
2013-08-26_10-33-16.770 - 6ea00bb7 - DEPLOYED
@ncdc
ncdc / gist:6355170
Created August 27, 2013 15:33
Patch to add update_ssh_config to build/devenv
+ desc "update_ssh_config TAG", "Updates the verifier entry in the ssh config file with the dns info from tag"
+ method_option :verbose, :type => :boolean, :desc => "Enable verbose logging"
+ method_option :region, :required => false, :desc => "Amazon region override (default us-east-1)"
+ def update_ssh_config(tag)
+ options.verbose? ? log.level = Logger::DEBUG : log.level = Logger::ERROR
+ conn = connect(options.region)
+ instance = find_instance(conn, tag, true, false)
+ update_ssh_config_verifier(instance)
+ end
I, [2013-09-11T14:56:00.862658 #21957] INFO -- : openshift.rb:80:in `cartridge_do_action' cartridge_do_action validation = openshift-origin-node update-cluster {"--with-app-uuid"=>"5230bad02a916a891c00008f", "--with-app-name"=>"p", "--with-container-uuid"=>"5230bad02a916a891c00008f", "--with-container-name"=>"p", "--with-namespace"=>"agoldste", "--with-request-id"=>"663b3ae4c31a56a11c1e1dbf5cf9f0bb", "--proxies"=>"5230bad02a916a891c00008f,p,agoldste,10.35.74.207 08df52121b1311e381b912313d2c5d21,08df52121b1311e381b912313d2c5d21,agoldste,10.35.74.207 094921741b1311e381b912313d2c5d21,094921741b1311e381b912313d2c5d21,agoldste,10.35.74.207 099e340c1b1311e381b912313d2c5d21,099e340c1b1311e381b912313d2c5d21,agoldste,10.35.74.207 664017228518077923065856,664017228518077923065856,agoldste,10.35.74.207 0a4595a81b1311e381b912313d2c5d21,0a4595a81b1311e381b912313d2c5d21,agoldste,10.35.74.207", "--cluster"=>"5230bad02a916a891c00008f,p,agoldste,10.35.74.207,38031 5230bb762a916a56b1000003,5230bb762a916a56b1000003,agoldste,10
# restart gear as supported by cartridges
def restart(cart_name, options={})
gear_env = ::OpenShift::Runtime::Utils::Environ.for_gear(@container_dir)
proxy_cart = options[:proxy_cart] = @cartridge_model.web_proxy
gears = []
if proxy_cart and options[:all]
entries = gear_registry.entries[:web]
gears = entries.map { |gear_uuid, entry| "#{gear_uuid}@#{entry.proxy_hostname}" }
else
@ncdc
ncdc / which to delete?
Last active December 23, 2015 22:19
OpenShift deployment dir structure
app-deployments
2013-09-25_12-19-31.426
repo
dependencies
build-dependencies
metadata
id (abcd1234, checksum of contents of this deployment dir (2013-09-25_12-19-31.426))
git_ref
git_sha1
state (DEPLOYED, currently isn't changed if something else is deployed later)
[root@ip-10-98-9-132 p]# find /var/lib/openshift/p-agoldste/ -name metadata.json -exec python -mjson.tool {} \;
{
"activations": [
1380227788.9234426,
1380227846.485841,
1380227862.8210766
],
"force_clean_build": null,
"git_ref": "master",
"git_sha1": "1543b2f",