title: setup drone continuous integration with github
body: <p>I'm trying to setup a CI server inside a corporate network with drone (open source edition). Its author describes drone as very simple solution even for programmer (as I am), though some moments are not clear for me (may be official documentation misses them).</p>
  
  <p>First, I've made up an docker image for my rails application: rails-qna.
  Next, composing drone images:</p>
  
  <p><strong>docker-compose.yml:</strong></p>
  
  <pre><code>version: '2'
  
  services:
    drone-server:
      image: drone/drone:0.5
      ports:
       - 80:8000
      volumes:
       - ./drone:/var/lib/drone/
      restart: always
      environment:
       - DRONE_OPEN=true
       - DRONE_ADMIN=khataev
       - DRONE_GITHUB_CLIENT=github-client-string
       - DRONE_GITHUB_SECRET=github-secret-string
       - DRONE_SECRET=drone-secret-string
  
    drone-agent:
      image: drone/drone:0.5
      command: agent
      restart: always
      depends_on: [ drone-server ]
      volumes:
       - /var/run/docker.sock:/var/run/docker.sock
      environment:
       - DRONE_SERVER=ws://drone-server:8000/ws/broker
       - DRONE_SECRET=drone-secret-string
  </code></pre>
  
  <p>Application is registered on Github and secret/client strings are provided.</p>
  
  <p>I placed .drone.yml file into my project repository:</p>
  
  <pre><code>pipeline:
    build:
      image: rails-qna
      commands: 
        - bundle exec rake db:drop
        - bundle exec rake db:create
        - bundle exec rake db:migrate
        - bundle exec rspec
  </code></pre>
  
  <p>Unclear moments:
  1) While registering OAuth application on github, we should specify Homepage URL and authorization callback URL. Where should they point to? Drone server container? Guessing that so, I specified 
  mycorporatedomain.com:3005 
  and
  mycorporatedomain.com:3005/authorize
  and setup port forwarding from 3005 port to 80 port of host, where drone docker is running. May be I'm wrong?</p>
  
  <p>2) What should I specify in key DRONE_GITHUB_URL? 
  <a href="https://github.com" rel="nofollow noreferrer">https://github.com</a> or full path to my project repository, i.e.
  <a href="https://github.com/khataev/qna" rel="nofollow noreferrer">https://github.com/khataev/qna</a>? </p>
  
  <p>3) What if I want to build some branch other than master? Were should I specify it? For now drone ready branch (with .drone.yml) is not a master branch - would it work?</p>
  
  <p>4) Why DRONE_GITHUB_GIT_USERNAME and DRONE_GITHUB_GIT_PASSWORD are <a href="http://readme.drone.io/admin/setup-github/" rel="nofollow noreferrer">optional</a>? How it is supposed to work if, I don't specify username and password for my github account?</p>
  
  <p>5) When I start drone images with docker up, I get this errors:</p>
  
  <pre><code>→ docker-compose up
  Starting drone_drone-server_1
  Starting drone_drone-agent_1
  Attaching to drone_drone-server_1, drone_drone-agent_1
  drone-server_1  | time="2017-03-04T17:00:33Z" level=fatal msg="version control system not configured" 
  drone-agent_1   | 1:M 04 Mar 17:00:35.208 * connecting to server ws://drone-server:8000/ws/broker
  drone-agent_1   | 1:M 04 Mar 17:00:35.229 # connection failed, retry in 15s. websocket.Dial ws://drone-server:8000/ws/broker: dial tcp: lookup drone-server on 127.0.0.11:53: no such host
  drone_drone-server_1 exited with code 1
  drone-server_1  | time="2017-03-04T16:53:38Z" level=fatal msg="version control system not configured" 
  </code></pre>
  
  <p><strong>UPD</strong>
  5) this was solved - forgot to specify</p>
  
  <pre><code>DRONE_GITHUB=true
  </code></pre>