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
| class LongRunningTasks | |
| include Queueable | |
| queue 'myqueue' | |
| def download(url) | |
| require 'open-uri' | |
| open("#{RAILS_ROOT}/tmp/#{Time.now.to_i}", 'w+') { |f| f.write(open(url).read) } | |
| 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 'queueable' | |
| class ApplicationTasks | |
| include Queueable | |
| 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
| puts "Hello World" |
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
| class Greeter | |
| attr_accessor :greeting | |
| def initialize(greeting) | |
| self.greeting = greeting | |
| end | |
| def greet | |
| puts self | |
| 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
| pool :sandbox do | |
| instances 1..1 | |
| cloud :hello_world do | |
| # Update with the path to your EC2 keypair | |
| # If you don't have one, create with: | |
| # $ ec2-create-keypair NAME > /path/to/your/keypairs/<NAME> | |
| keypair "/path/to/your/keypairs/<NAME>" | |
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
| # Following adds a svn co of my_app to /mnt/svn-repos/my_app on cloud-start | |
| # svn up is run on the working copy every cloud-configure | |
| has_svn_repos :name => "my_app", | |
| :at => "/mnt/svn-repos", | |
| :source => "http://svn.myhost.com/my_app", | |
| :user => "<optional>", | |
| :password => "<optional>" |
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
| pool :involver_rails do | |
| cloud :nginx do | |
| instances 2..2 # binds against 2 elastic IPs | |
| has_package "nginx" | |
| end | |
| cloud :app do | |
| instances 2..12 | |
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 "jruby" | |
| module JettyRails | |
| class Runner | |
| attr_reader :servers | |
| def initialize(config = {}) | |
| @servers = {} | |
| config.symbolize_keys! |
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
| #!/bin/sh | |
| echo "Starting memcached in background..." | |
| memcached & | |
| echo "Starting OpenMQ broker in background..." | |
| imqbrokerd -silent & | |
| echo "Starting background_tasks queue processor in background..." | |
| jruby script/queue_processor >/dev/null 2>&1 & | |
| echo "Starting Jetty Rails..." | |
| jruby --headless -S jetty_rails |
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
| namespace :deploy do | |
| desc "Restarts each app role one at a time, removing from load balancing during restart" | |
| serial_task self, :rolling_restart, :roles => :app do | |
| lb = fetch(:load_balancer) | |
| lb_removal = lambda { `elb-deregister-instances-from-lb #{lb} --instances #{@instance_id}` } | |
| lb_addition = lambda { `elb-register-instances-with-lb #{lb} --instances #{@instance_id}` } | |
| watch = "rails" | |
| port = 8080 |
OlderNewer