Skip to content

Commit

Permalink
Working index route with foreman and unicorn. You may have to do a lo…
Browse files Browse the repository at this point in the history
…t of mkdirs to keep unicorn happy. Run it with 'foreman start' and point your browser to localhost:3000
  • Loading branch information
beechnut committed Aug 9, 2014
1 parent eb87808 commit 0382db7
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ruby-gemset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
textbus
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-2.1.1
12 changes: 12 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
source 'https://rubygems.org'

gem 'sinatra'

# Postgres database
gem 'activerecord'
gem 'sinatra-activerecord'
gem 'pg'

# server
gem 'unicorn'
gem 'foreman'
60 changes: 60 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (4.1.4)
activesupport (= 4.1.4)
builder (~> 3.1)
activerecord (4.1.4)
activemodel (= 4.1.4)
activesupport (= 4.1.4)
arel (~> 5.0.0)
activesupport (4.1.4)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
builder (3.2.2)
dotenv (0.11.1)
dotenv-deployment (~> 0.0.2)
dotenv-deployment (0.0.2)
foreman (0.74.0)
dotenv (~> 0.11.1)
thor (~> 0.19.1)
i18n (0.6.11)
json (1.8.1)
kgio (2.9.2)
minitest (5.4.0)
pg (0.17.1)
rack (1.5.2)
rack-protection (1.5.3)
rack
raindrops (0.13.0)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
sinatra-activerecord (2.0.2)
activerecord (>= 3.2)
sinatra (~> 1.0)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
unicorn (4.8.3)
kgio (~> 2.6)
rack
raindrops (~> 0.7)

PLATFORMS
ruby

DEPENDENCIES
activerecord
foreman
pg
sinatra
sinatra-activerecord
unicorn
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: unicorn -c config/unicorn.rb -E development
10 changes: 10 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require "rubygems"
require "sinatra/base"

class TextBus < Sinatra::Base

get '/' do
'This will be a text someday'
end

end
8 changes: 8 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$stdout.sync = true

require "rubygems"
require "sinatra"

require File.expand_path '../app.rb', __FILE__

run TextBus
19 changes: 19 additions & 0 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# set path to app that will be used to configure unicorn
@dir = "/Users/matt/Documents/repos/textbus" # current directory

worker_processes 2
working_directory @dir

timeout 30

# Specify path to socket unicorn listens to,
# we will use this in our nginx.conf later
listen "#{@dir}/tmp/sockets/unicorn.sock", :backlog => 64
listen 3000

# Set process id path
pid "#{@dir}/tmp/pids/unicorn.pid"

# Set log file paths
stderr_path "#{@dir}/log/unicorn.stderr.log"
stdout_path "#{@dir}/log/unicorn.stdout.log"
49 changes: 49 additions & 0 deletions log/unicorn.stderr.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
I, [2014-08-09T13:58:08.524897 #78215] INFO -- : unlinking existing socket=/Users/matt/Documents/repos/textbus/tmp/sockets/unicorn.sock
I, [2014-08-09T13:58:08.525155 #78215] INFO -- : listening on addr=/Users/matt/Documents/repos/textbus/tmp/sockets/unicorn.sock fd=9
I, [2014-08-09T13:58:08.525302 #78215] INFO -- : worker=0 spawning...
I, [2014-08-09T13:58:08.527248 #78215] INFO -- : worker=1 spawning...
I, [2014-08-09T13:58:08.529311 #78216] INFO -- : worker=0 spawned pid=78216
I, [2014-08-09T13:58:08.530062 #78216] INFO -- : Refreshing Gem list
I, [2014-08-09T13:58:08.533103 #78215] INFO -- : master process ready
I, [2014-08-09T13:58:08.536052 #78217] INFO -- : worker=1 spawned pid=78217
I, [2014-08-09T13:58:08.536856 #78217] INFO -- : Refreshing Gem list
I, [2014-08-09T13:58:08.660933 #78217] INFO -- : worker=1 ready
I, [2014-08-09T13:58:08.662991 #78216] INFO -- : worker=0 ready
I, [2014-08-09T13:59:48.325990 #78215] INFO -- : reaped #<Process::Status: pid 78217 exit 0> worker=1
I, [2014-08-09T13:59:48.326266 #78215] INFO -- : reaped #<Process::Status: pid 78216 exit 0> worker=0
I, [2014-08-09T13:59:48.327026 #78215] INFO -- : master complete
I, [2014-08-09T13:59:50.265989 #78238] INFO -- : unlinking existing socket=/Users/matt/Documents/repos/textbus/tmp/sockets/unicorn.sock
I, [2014-08-09T13:59:50.266258 #78238] INFO -- : listening on addr=/Users/matt/Documents/repos/textbus/tmp/sockets/unicorn.sock fd=9
I, [2014-08-09T13:59:50.267244 #78238] INFO -- : listening on addr=0.0.0.0:3000 fd=10
I, [2014-08-09T13:59:50.267396 #78238] INFO -- : worker=0 spawning...
I, [2014-08-09T13:59:50.271096 #78238] INFO -- : worker=1 spawning...
I, [2014-08-09T13:59:50.272872 #78239] INFO -- : worker=0 spawned pid=78239
I, [2014-08-09T13:59:50.273747 #78239] INFO -- : Refreshing Gem list
I, [2014-08-09T13:59:50.278706 #78240] INFO -- : worker=1 spawned pid=78240
I, [2014-08-09T13:59:50.279651 #78240] INFO -- : Refreshing Gem list
I, [2014-08-09T13:59:50.277894 #78238] INFO -- : master process ready
I, [2014-08-09T13:59:50.411119 #78239] INFO -- : worker=0 ready
I, [2014-08-09T13:59:50.431114 #78240] INFO -- : worker=1 ready
127.0.0.1 - - [09/Aug/2014 13:59:57] "GET / HTTP/1.1" 200 25 0.0347
127.0.0.1 - - [09/Aug/2014 13:59:57] "GET /favicon.ico HTTP/1.1" 404 482 0.0295
127.0.0.1 - - [09/Aug/2014 14:00:18] "GET / HTTP/1.1" 200 25 0.0018
127.0.0.1 - - [09/Aug/2014 14:00:20] "GET / HTTP/1.1" 200 25 0.0018
I, [2014-08-09T14:00:34.511189 #78238] INFO -- : reaped #<Process::Status: pid 78240 exit 0> worker=1
I, [2014-08-09T14:00:34.512080 #78238] INFO -- : reaped #<Process::Status: pid 78239 exit 0> worker=0
I, [2014-08-09T14:00:34.512760 #78238] INFO -- : master complete
I, [2014-08-09T14:00:36.115835 #78249] INFO -- : unlinking existing socket=/Users/matt/Documents/repos/textbus/tmp/sockets/unicorn.sock
I, [2014-08-09T14:00:36.116127 #78249] INFO -- : listening on addr=/Users/matt/Documents/repos/textbus/tmp/sockets/unicorn.sock fd=9
I, [2014-08-09T14:00:36.121241 #78249] INFO -- : listening on addr=0.0.0.0:3000 fd=10
I, [2014-08-09T14:00:36.121446 #78249] INFO -- : worker=0 spawning...
I, [2014-08-09T14:00:36.139605 #78250] INFO -- : worker=0 spawned pid=78250
I, [2014-08-09T14:00:36.140548 #78250] INFO -- : Refreshing Gem list
I, [2014-08-09T14:00:36.187632 #78249] INFO -- : worker=1 spawning...
I, [2014-08-09T14:00:36.190485 #78251] INFO -- : worker=1 spawned pid=78251
I, [2014-08-09T14:00:36.191381 #78251] INFO -- : Refreshing Gem list
I, [2014-08-09T14:00:36.249093 #78249] INFO -- : master process ready
I, [2014-08-09T14:00:36.456828 #78250] INFO -- : worker=0 ready
I, [2014-08-09T14:00:36.459422 #78251] INFO -- : worker=1 ready
127.0.0.1 - - [09/Aug/2014 14:00:38] "GET / HTTP/1.1" 200 27 0.0302
I, [2014-08-09T14:00:43.138133 #78249] INFO -- : reaped #<Process::Status: pid 78251 exit 0> worker=1
I, [2014-08-09T14:00:43.138386 #78249] INFO -- : reaped #<Process::Status: pid 78250 exit 0> worker=0
I, [2014-08-09T14:00:43.138533 #78249] INFO -- : master complete
Empty file added log/unicorn.stdout.log
Empty file.

0 comments on commit 0382db7

Please sign in to comment.