Skip to content

Instantly share code, notes, and snippets.

View hecbuma's full-sized avatar

Hector Bustillos hecbuma

View GitHub Profile
# Executes a request simulating GET HTTP method and set/volley the response
def get(action, parameters = nil, session = nil, flash = nil)
process(action, parameters, session, flash, "GET")
end
# Executes a request simulating POST HTTP method and set/volley the response
def post(action, parameters = nil, session = nil, flash = nil)
process(action, parameters, session, flash, "POST")
end
require 'faraday'
require 'json'
conn = Faraday.new
response = conn.get 'https://identity.api.rackspacecloud.com/v2.0/tokens' do |request|
request.headers['Content-Type'] = 'application/json'
request.body = "{\"auth\": {\"RAX-KSKEY:apiKeyCredentials\": { \"username\": \"littlebits\",\"apiKey\": \"96c884d7223f4b85bd3d12c72e7523af\"}}}"
end
res_json = JSON.parse response.body
# Dockerfile for installing and running Nginx
# Select ubuntu as the base image
FROM ruby:2.1.3
# Install nginx
RUN apt-get update -q
RUN apt-get install -qy nginx
RUN apt-get install -qy build-essential
$ sudo docker run -it -p 80:80 --rm myapp/v1 /bin/bash
root@b27df3ca0fb2:/app# ls
Capfile Gemfile.lock README.md config doc lib script vendor
Dockerfile Guardfile Rakefile config.ru engines log spec
Gemfile Procfile app db features public tmp
root@b27df3ca0fb2:/app# bundle exec unicorn_rails -c config/unicorn.rb -E production
root@2e9b21c76dde:/app# bundle exec unicorn_rails -c config/unicorn.rb -E production -D
root@2e9b21c76dde:/app# ps -uax | grep unicorn
root 30 13.4 21.9 438620 223760 ? Sl 03:36 0:11 unicorn_rails master -c config/unicorn.rb -E production -D
root 36 0.0 21.3 438620 217232 ? Sl 03:36 0:00 unicorn_rails worker[0] -c config/unicorn.rb -E production -D
root 39 0.0 21.3 438620 217240 ? Sl 03:36 0:00 unicorn_rails worker[1] -c config/unicorn.rb -E production -D
root 42 0.0 21.3 438620 217252 ? Sl 03:36 0:00 unicorn_rails worker[2] -c config/unicorn.rb -E production -D
root 45 0.0 21.3 438620 217252 ? Sl 03:36 0:00 unicorn_rails worker[3] -c config/unicorn.rb -E production -D
root 48 0.0 21.3 438620 217260 ? Sl 03:36 0:00 unicorn_rails worker[4] -c config/unicorn.rb -E production -D
root 52 0.0 0.0 11084 696 ? S+ 03:37 0:00 grep unicorn
upstream unicorn_spree {
server unix:/tmp/unicorn.sock fail_timeout=0;
}
server {
listen 80;
client_max_body_size 4G;
server_name _;
keepalive_timeout 75;
app_dir = "/app"
worker_processes 30
working_directory app_dir
timeout 180
listen "/tmp/unicorn.sock", :backlog => 1024
pid app_dir + "/tmp:/unicorn.pid"
{
"orders": {
"count": 1,
"current_page": 1,
"page": [
{
"adjustment_total": "-5.95",
"adjustments": [
{
"adjustable_type": "Spree::Order",
Started GET "/projects/secret-code-outlet" for 127.0.0.1 at 2015-01-13 13:07:09 -0600
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"secret-code-outlet"}
Project Load (16.8ms) SELECT `projects`.* FROM `projects` WHERE `projects`.`slug` = 'secret-code-outlet' ORDER BY `projects`.`id` ASC LIMIT 1
Spree::Product Load (2.9ms) SELECT `spree_products`.* FROM `spree_products` WHERE `spree_products`.`slug` = 'battery-plus-cable' AND (`spree_products`.deleted_at IS NULL) ORDER BY `spree_products`.`id` ASC LIMIT 1
ProjectProduct Load (16.9ms) SELECT `project_bits`.* FROM `project_bits` INNER JOIN `spree_products` ON `spree_products`.`id` = `project_bits`.`product_id` AND (`spree_products`.deleted_at IS NULL) INNER JOIN `spree_products_taxons` ON `spree_products_taxons`.`product_id` = `spree_products`.`id` INNER JOIN `spree_taxons` ON `spree_taxons`.`id` = `spree_products_taxons`.`taxon_id` WHERE `project_bits`.`project_id` = 2041 AND `spree_taxons`.`name` = 'Bits' ORDER BY spree_products.
This file has been truncated, but you can view the full file.
[03/12/15 21:51:24 +0000 ip-10-13-165-214 (19075)] DEBUG : Starting the worker thread in 19075 (parent 6201) after forking.
[03/12/15 21:51:24 +0000 ip-10-13-165-214 (19065)] DEBUG : Starting the worker thread in 19065 (parent 6201) after forking.
[03/12/15 21:51:25 +0000 ip-10-13-165-214 (19075)] DEBUG : EnvironmentReport failed to retrieve value for "Plugin List": undefined method `plugins' for #<Rails::Application::Configuration:0x007f3ace8832f8>
[03/12/15 21:51:25 +0000 ip-10-13-165-214 (19075)] DEBUG : EnvironmentReport failed to retrieve value for "JRuby version": uninitialized constant NewRelic::EnvironmentReport::JRUBY_VERSION
[03/12/15 21:51:25 +0000 ip-10-13-165-214 (19075)] DEBUG : EnvironmentReport failed to retrieve value for "Java VM version": uninitialized constant NewRelic::EnvironmentReport::ENV_JAVA
[03/12/15 21:51:25 +0000 ip-10-13-165-214 (19075)] DEBUG : EnvironmentReport ignoring value for "Rails threadsafe" which came back falsey: nil
[03/12/15 21:51:25 +0000 ip-10-13-165-214 (19075)] D