This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"orders": { | |
"count": 1, | |
"current_page": 1, | |
"page": [ | |
{ | |
"adjustment_total": "-5.95", | |
"adjustments": [ | |
{ | |
"adjustable_type": "Spree::Order", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app_dir = "/app" | |
worker_processes 30 | |
working_directory app_dir | |
timeout 180 | |
listen "/tmp/unicorn.sock", :backlog => 1024 | |
pid app_dir + "/tmp:/unicorn.pid" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream unicorn_spree { | |
server unix:/tmp/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
client_max_body_size 4G; | |
server_name _; | |
keepalive_timeout 75; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
module Spree | |
class SalesTotalQuickBooksCSV | |
def initialize | |
end | |
def to_csv | |
@processed_orders = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream rails-app { | |
server unix:/tmp/railsapp_app.sock fail_timeout=0; | |
} | |
server { | |
listen 80 default deferred; | |
# server_name example.com; | |
root /home/user/tuapp/public; | |
access_log /var/log/rails/tuapp-access.log; | |
error_log /var/log/rails/tuapp-error.log; |