<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marc Best on Medium]]></title>
        <description><![CDATA[Stories by Marc Best on Medium]]></description>
        <link>https://medium.com/@marc_best?source=rss-d5c606bd4076------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4uCCw9tVbhCtP6bS0m-LrA.jpeg</url>
            <title>Stories by Marc Best on Medium</title>
            <link>https://medium.com/@marc_best?source=rss-d5c606bd4076------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 10:30:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marc_best/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Adding resque-scheduler to a Rails projects]]></title>
            <link>https://medium.com/@marc_best/adding-resque-scheduler-to-a-rails-projects-baa3fb5fbbb1?source=rss-d5c606bd4076------2</link>
            <guid isPermaLink="false">https://medium.com/p/baa3fb5fbbb1</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[resque]]></category>
            <dc:creator><![CDATA[Marc Best]]></dc:creator>
            <pubDate>Thu, 09 May 2019 18:25:55 GMT</pubDate>
            <atom:updated>2019-05-09T21:38:44.881Z</atom:updated>
            <content:encoded><![CDATA[<p>This will cover adding Resque-scheduler which is an extension for Resque that adds support for queueing items in the future. This will expand on the tutorial on adding Resque to a Heroku Rails project (<a href="https://medium.com/@marc_best/deploying-rails-resque-to-heroku-with-redistogo-a3d17ba17e50">https://medium.com/@marc_best/deploying-rails-resque-to-heroku-with-redistogo-a3d17ba17e50</a>)</p><p>Heroku example: <a href="https://heroku-resque-redistogo.herokuapp.com/resque_web/scheduler/schedule">https://heroku-resque-redistogo.herokuapp.com/resque_web/scheduler/schedule</a></p><p>Example code: <a href="https://github.com/marcbest/heroku-resque-redistogo-example">https://github.com/marcbest/heroku-resque-redistogo-example</a></p><ol><li>Add the ‘Resque scheduler’ and ‘Resque scheduler web’ gem to your Gemfile and bundle</li></ol><p><a href="https://github.com/resque/resque-scheduler">resque/resque-scheduler</a></p><p><a href="https://github.com/mattgibson/resque-scheduler-web">https://github.com/mattgibson/resque-scheduler-web</a></p><pre># Gemfile</pre><pre>gem &#39;resque-scheduler&#39;<br>gem &#39;resque-scheduler-web&#39;</pre><p>2. Update the Resque rake task to include the setting up of the scheduler</p><pre># lib/tasks/resque.rake</pre><pre>require &#39;resque/tasks&#39;<br>require &#39;resque/scheduler/tasks&#39;</pre><pre>task &quot;resque:preload&quot; =&gt; :environment</pre><pre>namespace :resque do<br>  task :setup do<br>    require &#39;resque&#39;<br>  end</pre><pre>task :setup_schedule =&gt; :setup do<br>    require &#39;resque-scheduler&#39;<br>  end</pre><pre>task :scheduler =&gt; :setup_schedule<br>end</pre><p>3. Create a yaml file to contain your jobs that you would like to schedule e.g.</p><pre># config/schedule.yml</pre><pre>test_blog_job:  <br>  cron: &#39;0 12 * * *&#39;  <br>  rails_env: production  <br>  class: TestJob  <br>  description: A test job that runs once a day</pre><p>4. Create the jobs that is to be run in the job directory</p><pre># jobs/test_job.rb</pre><pre>class TestJob<br>  def self.queue<br>    :low_priority<br>  end</pre><pre>def self.perform<br>    sleep(rand(20))<br>  end<br>end</pre><p>5. Add the below line to the end of the Resque initializer to tell Resque to load your scheduled jobs from the file you created</p><pre># config/initializers/resque.rb</pre><pre>Resque.schedule = YAML.load_file Rails.root.join(&#39;config&#39;, &#39;schedule.yml&#39;)</pre><p>6. Update the Procfile to start also start scheduler</p><pre># Procfile</pre><pre>resque: QUEUE=* bundle exec rake resque:work<br>scheduler: bundle exec rake resque:scheduler</pre><p>Restart your server and ensure that you are running the rake tasks listed in the procfile. Scheduler should now be setup and working.</p><p>You can visit your Resque web interface to confirm this e.g locally (<a href="http://localhost:5000/resque_web/scheduler/schedule">http://localhost:3000/resque_web/scheduler/schedule</a>). You should see the job that was added to the schedule.yml listed in the schedule tab as seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7A_8e-mU1PLD93whpDF2Yw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baa3fb5fbbb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Resque to Heroku with RedisToGo and Rails 5]]></title>
            <link>https://medium.com/@marc_best/deploying-rails-resque-to-heroku-with-redistogo-a3d17ba17e50?source=rss-d5c606bd4076------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3d17ba17e50</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[rails-5]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[resque]]></category>
            <dc:creator><![CDATA[Marc Best]]></dc:creator>
            <pubDate>Wed, 20 Feb 2019 23:21:08 GMT</pubDate>
            <atom:updated>2019-05-09T21:41:53.460Z</atom:updated>
            <content:encoded><![CDATA[<p>This will assume that you have already created your Rails application and it is already up and running in Heroku, if not follow <a href="https://devcenter.heroku.com/articles/getting-started-with-rails5">https://devcenter.heroku.com/articles/getting-started-with-rails5</a></p><p><strong>Example code can be found</strong>: <a href="https://github.com/marcbest/heroku-resque-redistogo-example/tree/resque-redis-to-go">https://github.com/marcbest/heroku-resque-redistogo-example/tree/resque-redis-to-go</a></p><p><strong>Example Heroku App</strong>: <a href="https://heroku-resque-redistogo.herokuapp.com/">https://heroku-resque-redistogo.herokuapp.com/</a></p><ol><li>Add the Resque and Resque web gem to your Gemfile</li></ol><pre># Gemfile</pre><pre>gem &#39;resque&#39;</pre><pre>gem &#39;resque-web&#39;, require: &#39;resque_web&#39;</pre><p>2. Modify the routes.rb file for the Resque web gem. (for securing this page check <a href="https://github.com/resque/resque-web#security">https://github.com/resque/resque-web#security</a>)</p><pre># config/routes.rb</pre><pre>require &quot;resque_web&quot;</pre><pre>Rails.application.routes.draw do<br>  mount ResqueWeb::Engine =&gt; &quot;/resque_web&quot;</pre><pre>  root to: &#39;home#index&#39;<br>end</pre><p>3. Create a proc file to run your workers</p><pre># Procfile</pre><pre>resque: QUEUE=* bundle exec rake resque:work</pre><p>4. Add <strong>RedisToGo</strong> addon in Heroku</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tlz-_naIdoF89UCQa16Ggg.png" /></figure><p>5. By default Resque will attempt to connect to Redis on localhost:6379 create an initializer to use the REDISTOGO_URL set by Heroku</p><pre># config/initializers/resque.rb</pre><pre>require &#39;resque/server&#39;</pre><pre>if Rails.env.development?<br>  Resque.redis = Redis.new(:host =&gt; &#39;localhost&#39;, :port =&gt; &#39;6379&#39;)<br>else<br>  uri = URI.parse(ENV[&#39;REDISTOGO_URL&#39;])  <br>  REDIS = Redis.new(:host =&gt; uri.host, :port =&gt; uri.port, :password =&gt; uri.password)<br>  <br>  Resque.redis = REDIS<br>end</pre><p>6. Create a Resque rake task</p><pre># lib/tasks/resque.rake</pre><pre>require &#39;resque/tasks&#39;</pre><pre>task &quot;resque:preload&quot; =&gt; :environment</pre><p>7. Deploy you app to Heroku using git push heroku master</p><p>8. Enable the resque task to be run by Heroku from your dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAUrutmAyBI3lWZuT6OhNg.png" /></figure><p>9. Navigate to `<a href="https://heroku-resque-redistogo.herokuapp.com/resque_web/workers">https://{your-app-name}.herokuapp.com/resque_web/workers</a>` to confirm everything is working as expected!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oif2tPpbZAa1fNx2NePt3w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3d17ba17e50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Triggering a Jenkins build from a push to Github]]></title>
            <link>https://medium.com/@marc_best/trigger-a-jenkins-build-from-a-github-push-b922468ef1ae?source=rss-d5c606bd4076------2</link>
            <guid isPermaLink="false">https://medium.com/p/b922468ef1ae</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[ci]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <dc:creator><![CDATA[Marc Best]]></dc:creator>
            <pubDate>Fri, 14 Apr 2017 22:20:32 GMT</pubDate>
            <atom:updated>2017-04-24T09:47:38.172Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article we will look at setting up the basis for Continuous Integration using Jenkins for orchestration and Github for source control. We will be configuring a Jenkins build to be initiated on a push to a repository.</p><h4>1. Install Github Integration Plugin</h4><p>First we need to install the <a href="https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Integration+Plugin">GitHub Integration Plugin</a>, this will give us the ability to configure Jenkins to use our Github repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBrLOQcf79V7MU3mqzONjw.png" /><figcaption>Installing Github integration plugin</figcaption></figure><h4>2. Prepare Github repository</h4><p>We need to add a service to call the Jenkins Github webhook on a push, to do this go to settings -&gt; integrations &amp; Services and add a new service. The Jenkins Github plugin service should be in the list of available services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8XxmrgIi2NwpX_XOqYIrrg.png" /></figure><p>Enter the URL of your Jenkins instance followed by /github-webhook/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wc4mA2Fnxqf3AMPNbPJiTw.png" /></figure><h4>3. Giving the Jenkins user access to the Github repository</h4><p>We need to give the Jenkins user access to our repository by adding a deploy key in the Github settings.</p><p>The first step is generating SSH keys for the Jenkins user if they do not already exist.</p><pre>jenkins@ip:/home/ubuntu$ ssh-keygen</pre><p>Depending on where the key was created, you need to copy the public key so that it can be added to Github</p><pre>jenkins@ip:/home/ubuntu$ cat /var/lib/jenkins/.ssh/id_rsa.pub</pre><p>Add the key copied in the previous step to Github. To do this head to the repository settings -&gt; Deploy keys</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGZ23qCZ8G3egpqSk3v2XQ.png" /></figure><p>The last step is to check that everything is working as expected, as the Jenkins user in your console enter the below to check the connection to Github.</p><pre>jenkins@ip:~/.ssh$ ssh git@github.com</pre><p>If successful you should see the following message</p><pre>Warning: Permanently added the RSA host key for IP address &#39;{YOUR_SERVER_IP}&#39; to the list of known hosts.</pre><pre>PTY allocation request failed on channel 0</pre><pre>Hi marcbest/medium-jenkins-git-tut! You&#39;ve successfully authenticated, but GitHub does not provide shell access.</pre><pre>Connection to github.com closed.</pre><h4>4. Update Jenkins job with Github configuration</h4><p>In the ‘General’ section of the job configuration check the Github project tick box and enter the URL to the repository that you configured in step 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJ2b-sf0kIauZmIapza3vg.png" /></figure><p>Next update the Source Code Management section, first set the repository URL (note the format git@github.com:{YOUR_REPO}. You can also specify the branch you would like to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hvo9bsOnMaeIanE3LSjZPw.png" /></figure><p>The last step is to tell Jenkins to build when the Github hook is called, select the highlighted option below in the Build Triggers section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fh3zgPmLPoLRjcYaO0CdBw.png" /></figure><p>That’s it! Your Jenkins build should now be triggered whenever a push is made to your repository.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b922468ef1ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>