Skip to content

Instantly share code, notes, and snippets.

View ncdc's full-sized avatar

Andy Goldstein ncdc

View GitHub Profile
[p-agoldste.dev.rhcloud.com 52449abf5e329bc27c00002d]\> gear deployments
Activation time - Deployment ID - Git Ref - Git SHA1
2013-09-26 16:37:49 -0400 - b4e2c356 - master - c64f374 - ACTIVE
2013-09-26 16:37:42 -0400 - aeb82c45 - master - 1543b2f
@ncdc
ncdc / gist:6733946
Last active December 24, 2015 02:59
def with_gear_rotation(options={})
local_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]
gears = gear_registry.entries[:web]
else
gears = gear_registry.entries[:web][uuid]
end
@ncdc
ncdc / gist:6734300
Last active December 24, 2015 02:59
require 'parallel'
def with_gear_rotation(options={}, &block)
gears = [1,2,3]
parallel_output = Parallel.map(gears, :in_threads => 3) do |target|
rotate_and_yield(target, options, &block)
end
end
def rotate_and_yield(target, options, &block)
@ncdc
ncdc / gist:6734669
Last active December 24, 2015 02:59
$ curl -H "Authorization: Bearer $token" -H "Accept: application/json; version=1.2" https://openshift.redhat.com/broker/rest/appli
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1900 100 1900 0 0 3686 0 --:--:-- --:--:-- --:--:-- 4175
{
"api_version": 1.2,
"data": [
{
"links": {
@ncdc
ncdc / gist:6765613
Last active December 24, 2015 07:40
require 'json'
require 'active_support/hash_with_indifferent_access'
require 'active_support/core_ext/hash'
restart_output = {from_json: true, status: :success}
restart_output_json = JSON.dump(restart_output)
puts restart_output_json
# prints {"from_json":true,"status":"success"}
[root@ip-10-34-6-100 ~]# rhc cartridge scale -a p php-5.3 --min 2
This operation will run until the application is at the minimum scale and may take several minutes.
Setting scale range for php-5.3 ... done
php-5.3 (PHP 5.3)
-----------------
Scaling: x2 (minimum: 1, maximum: available) on small gears
{
"gear_results": {
"06fcc9462b7d11e3bb7e12313d2b1996": {
"errors": [],
"messages": [
"Rotating out gear in proxies",
"Restarting PHP cartridge\n",
"Rotating in gear in proxies"
],
"rotate_in_results": {
def with_gear_rotation(options={}, &block)
local_gear_env = ::OpenShift::Runtime::Utils::Environ.for_gear(@container_dir)
proxy_cart = options[:proxy_cart] = @cartridge_model.web_proxy
gears = []
if proxy_cart
if options[:all]
gears = gear_registry.entries[:web].values
elsif options[:gears]
gears = gear_registry.entries[:web].select { |k,v| options[:gears].include?(k) }.values
{:status=>"success",
:gear_results=>
{"524dd49262694a8dff000030"=>
{"status"=>"success",
"messages"=>
["Rotating out gear in proxies",
"Starting application p\n",
"Starting PHP cartridge\n",
"Rotating in gear in proxies"],
"errors"=>[],
@ncdc
ncdc / gist:6825789
Created October 4, 2013 13:20
Problem running rake ext_func_test
[root@ip-10-202-150-116 node]# rake ext_func_test
/opt/rh/ruby193/root/usr/bin/ruby -I"lib:/root/openshift-test/common/lib" -I"/opt/rh/ruby193/root/usr/share/ruby" "/opt/rh/ruby193/root/usr/share/ruby/rake/rake_test_loader.rb" "test/unit/*_test.rb" "["test/functional/scaling_func_test.rb"]"
Coverage report generated for node tests to /root/openshift-test/node/test/coverage/. 1091 / 4922 LOC (22.17%) covered.
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': cannot load such file -- /root/openshift-test/node/[test/functional/scaling_func_test.rb] (LoadError)
from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
from /opt/rh/ruby193/root/usr/share/ruby/rake/rake_test_loader.rb:15:in `block in <main>'
from /opt/rh/ruby193/root/usr/share/ruby/rake/rake_test_loader.rb:4:in `select'
from /opt/rh/ruby193/root/usr/share/ruby/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [/opt/rh/ruby193/root/usr/bin/ruby -I