Last active
June 16, 2016 16:59
-
-
Save kacole2/5d79a0519b5f2d0c6155 to your computer and use it in GitHub Desktop.
Creating a worker with clockwork on cloudfoundry
This file contains 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
#Read the how-to at http://www.kendrickcoleman.com/ | |
#this is the clockwork configuration file | |
require File.expand_path('../../config/boot', __FILE__) | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'clockwork' | |
include Clockwork | |
every(30.seconds, 'Running my reoccurring process...') { SiteDatum.myreoccurringprocess } |
This file contains 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
--- | |
applications: | |
- name: webfrontend | |
memory: 1024M | |
instances: 1 | |
path: . | |
domain: cfapps.io | |
command: bundle exec rails s -p $PORT | |
services: | |
- my-elephant-db | |
- name: clockwork | |
memory: 512MB | |
instances: 1 | |
path: . | |
buildpack: https://github.com/ddollar/heroku-buildpack-multi.git | |
no-route: true | |
command: bundle exec clockwork lib/clock.rb | |
services: | |
- my-elephant-db |
This file contains 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
#Read the how-to at http://www.kendrickcoleman.com/ | |
#this is the Modal file. | |
class SiteDatum < ActiveRecord::Base | |
def self.myreoccurringprocess | |
#DO SOME STUFF HERE | |
mechanize = Mechanize.new | |
page = mechanize.get('http://www.google.com') | |
puts page.title | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment