<?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 Fabian Mettler on Medium]]></title>
        <description><![CDATA[Stories by Fabian Mettler on Medium]]></description>
        <link>https://medium.com/@mettler.fabian?source=rss-e32cf9470506------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eE1s9yVaf8B_LInmGxcd9A.png</url>
            <title>Stories by Fabian Mettler on Medium</title>
            <link>https://medium.com/@mettler.fabian?source=rss-e32cf9470506------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:26:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mettler.fabian/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[Ruby on Rails + Docker + VSTS + GitHub PRs = ❤]]></title>
            <link>https://medium.com/@mettler.fabian/ruby-on-rails-docker-vsts-github-prs-47bc6a4661a6?source=rss-e32cf9470506------2</link>
            <guid isPermaLink="false">https://medium.com/p/47bc6a4661a6</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[vsts]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Fabian Mettler]]></dc:creator>
            <pubDate>Wed, 04 Jan 2017 09:17:48 GMT</pubDate>
            <atom:updated>2017-01-04T09:27:08.061Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.visualstudio.com/team-services/">Visual Studio Team Services</a>’s Build &amp; Release Management is Microsoft’s view on how DevOps should be nowadays.</p><p>Inspired by this <a href="https://channel9.msdn.com/Events/microsoft-techncial-summit/Technical-Summit-2016/Keynote-with-Donovan-Brown-From-0-to-DevOps">Keynote</a> from <a href="https://twitter.com/donovanbrown">Donovan Brown</a> and frustrated by current used solutions / services, I gave Visual Studio Team Services a try.</p><p>In order to verify pull requests for a Ruby on Rails Application we need to set some triggers and to create a new build definition with three build steps:</p><ol><li>Run the required services with Docker Compose</li><li>Create the test db and run the migrations within the running application container</li><li>Run the tests within the running application container</li></ol><h3>Step 1 — Create a new build definition</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oQzflqKxaWWj4unEh2Sb-w.png" /><figcaption>1. Create a new build definition</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*51oPxvfwPI7zexVi1porAA.png" /><figcaption>2. Select the “Empty” template</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GmmwNJkk0IWGCm8b-w38Gw.png" /><figcaption>3. Select “GitHub” as repository source and “Hosted Linux Preview” as default agent queue</figcaption></figure><h3>Step 2 — Add a connection to the GitHub repository</h3><p>Please read the following <a href="https://www.visualstudio.com/en-us/docs/build/define/repository#connect-using-your-github-user-account">documentation</a> to connect to the GitHub repository with your account.</p><h3>Step 3 — Set the triggers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_sKTAFpezhZiS_AYtCTqg.png" /><figcaption>Exclude the master branch and add a new filter to listen to pull-requests changes.</figcaption></figure><p>Each time a pull-request is created or a commit is made to pull-request we want to trigger a build. This can be achieved by using refs/heads/* as a filter. Furthermore, we want to exclude the master branch because we only want to verify new or changes to existing pull requests.</p><h3>Step 4 — Install the Docker Integration</h3><p>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscs-rm.docker">Docker Integration Plugin</a> for Visual Studio Team Services.</p><h3>Step 5 — Add the first build step: Run the services</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QuPwgVhvsrM9AZ9_i5SALw.png" /><figcaption>1. Add a new build step</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jCAuvf2ga-AYCiw3KmiuGg.png" /><figcaption>2. Add a “Docker Compose” task from the catalog</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLxQQOIOvMwb4VLfxL3ztw.png" /><figcaption>3. Select the Docker Compose configuration file that should be used and set “Run service images” as action</figcaption></figure><p>We use the following configuration files for our Ruby On Rails Application:</p><p><em>docker-compose-CI.yml</em></p><pre>powpow-db:<br>  image: postgres:9.5.4<br>  ports:<br>    - 5432:5432/tcp</pre><pre>powpow-web:<br>  build: .<br>  dockerfile: Dockerfile-CI<br>  links:<br>    - powpow-db<br>  environment:<br>    RAILS_ENV: test</pre><p><em>Dockerfile-CI</em></p><pre>FROM ruby:2.3.3</pre><pre>RUN apt-get update -qq &amp;&amp; apt-get install -y build-essential libpq-dev nodejs</pre><pre>RUN mkdir /usr/src/app<br>WORKDIR /usr/src/app</pre><pre>ADD Gemfile /usr/src/app/Gemfile<br>ADD Gemfile.lock /usr/src/app/Gemfile.lock<br>RUN bundle install</pre><pre>ADD . /usr/src/app</pre><pre>COPY config/database-CI.yml /usr/src/app/config/database.yml</pre><p>config/database-CI.yml</p><pre>default: &amp;default<br>  adapter: postgresql<br>  encoding: utf8<br>  username: postgres<br>  host: powpow-db<br>  pool: 5</pre><pre>development:<br>  &lt;&lt;: *default<br>  database: powpow_dev</pre><pre># Warning: The database defined as &quot;test&quot; will be erased and<br># re-generated from your development database when you run &quot;rake&quot;.<br># Do not set this db to the same as development or production.<br>test:<br>  &lt;&lt;: *default<br>  database: powpow_test</pre><pre>production:<br>  &lt;&lt;: *default<br>  database: powpow_prod</pre><p>Note: As you might noticed, we use the “-CI” postfix for our configuration files to indicate that these are used for Continuous Integration purposes.</p><h3>Step 5 — Add the second build step: Create the DB and run the migrations</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oilkRL6VegSzNdMcDGjPFQ.png" /><figcaption>1. Add a “Docker Compose” task from the catalog</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X0u3nRJaGRh9Aqq0hdkkSg.png" /><figcaption>3. Select the Docker Compose configuration file, set the environment variable for RAILS_ENV and set the Rake command to create the DB and run the migrations.</figcaption></figure><h3>Step 6 — Add the last build step: Run the tests</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aW7fmELo8Bo48UBHoxOzRw.png" /><figcaption>1. Add a “Docker Compose” task from the catalog</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3WVZ83ZQHNCjB2gUxCkhw.png" /><figcaption>3. Select the Docker Compose configuration file, set the environment variable for RAILS_ENV and set the Rake command to run the tests</figcaption></figure><h3>Step 7 — Save the build definition</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2w-tfsdzmLD45fFnZRg-A.png" /><figcaption>Save the build definition</figcaption></figure><h3>Build it!</h3><p>From now on, Visual Studio Team services triggers a build each time a new pull request is created or a change is made to an existing pull request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*gP_lftou80pdNrwajbrW4A.png" /><figcaption>Service Integration for GitHub PRs checks ❤</figcaption></figure><p>P.S.: Visual Studio Team Services is awesome!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47bc6a4661a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>