Skip to content

Instantly share code, notes, and snippets.

View gordonbisnor's full-sized avatar

Gordon B. Isnor gordonbisnor

View GitHub Profile
@gordonbisnor
gordonbisnor / config.yml
Created June 3, 2009 04:18
config.yml for Thin, Sinatra, Webfaction
---
environment: production
chdir: /home/me/webapps/myapp
address: 127.0.0.1
user: root
group: root
port: myport
rackup: /home/me/webapps/myapp/config/config.ru
log: /home/me/webapps/myapp/thin.log
max_conns: 1024
@gordonbisnor
gordonbisnor / config.ru
Created June 3, 2009 04:23
Rackup config.ru For Sinatra,Thin,Webfaction
require 'mypp'
run Sinatra::Application
@gordonbisnor
gordonbisnor / rakefile.rb
Created June 3, 2009 04:25
Rakefile for Sinatra, Thin, Webfaction
require 'rake'
namespace :thin do
desc "Start The Application"
task :start do
puts "Restarting The Application..."
system("thin -s 1 -C config/config.yml -R config/config.ru start")
end
@gordonbisnor
gordonbisnor / whenever-with-ec2onrails.rb
Created June 18, 2009 00:24
Getting javan-whenever running with Ec2onRails
namespace :deploy do
desc "write the crontab file"
task :write_crontab, :roles => [:db_admin] do
run "cd #{release_path} && sudo -u root whenever --write-crontab #{application}"
end
end
@gordonbisnor
gordonbisnor / Adding A Passenger Site To Localhost
Created June 20, 2009 18:30
Add A Passenger Site To Localhost
Add host entry:
etc/hosts
Add Virtual Host Configuration File:
usr/local/apache2/conf/vhosts
@gordonbisnor
gordonbisnor / deploy.rb
Created August 20, 2009 19:56
Rails Cap Deploy For WebFaction
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
user = 'me'
password = "my_password"
application = 'me'
domain = 'me.com'
set :webfaction_port, "my port number goes here"
set :webfaction_username, "#{user}"
@gordonbisnor
gordonbisnor / deploy.rb
Created September 2, 2009 19:11
Getting Javan Whenever working with Capistrano on WebFaction
after "deploy:symlink", "deploy:update_crontab"
namespace :deploy do
desc "Write Crontab"
task :update_crontab, :roles => :app do
run "cd #{release_path} && /home/#{user}/ruby1.8/lib/ruby/gems/1.8/bin/whenever --write-crontab"
end
end
@gordonbisnor
gordonbisnor / deploy.rb
Created September 2, 2009 19:16
Getting cap deploy:migrate woring on Webfaction
# I ADD THIS TO CAP DEPLOY
set :rake, "/home/#{user}/ruby1.8/lib/ruby/gems/1.8/bin/rake"
# AND I ADD THIS TO .bash_profile and .bashrc
export GEM_PATH=/home/YOUR USERNAME/ruby1.8//lib/ruby/gems/1.8
@gordonbisnor
gordonbisnor / deploy.rb
Created September 2, 2009 19:22
Getting cap deploy restart working on Webfaction
desc "Redefine deploy:restart"
task :restart, :roles => :app do
invoke_command "/home/#{user}/ruby1.8/lib/ruby/gems/1.8/bin/mongrel_rails stop -c #{deploy_to}/current -P /home/#{webfaction_username}/webapps/#{application}/log/mongrel.pid", :via => run_method
invoke_command "/home/#{user}/ruby1.8/lib/ruby/gems/1.8/bin/mongrel_rails start -c #{deploy_to}/current -d -e production -P /home/#{webfaction_username}/webapps/#{application}/log/mongrel.pid -p #{webfaction_port}", :via => run_method
end
CANADIAN_PROVINCES = [["Alberta","AB"],["British Columbia","BC"],["Manitoba","MB"],["New Brunswick","NB"],["Newfoundland and Labrador","NL"],["Nova Scotia","NS"],["Northwest Territories","NT"],["Nunavut","NU"],["Ontario","ON"],["Prince Edward Island","PE"],["Quebec","QC"],["Saskatchewan","SK"],["Yukon","YT"]]