github.com/marinho/drone@v0.2.1-0.20140504195434-d3ba962e89a7/README.md (about)

     1  Drone is a [Continuous Integration](http://en.wikipedia.org/wiki/Continuous_integration) platform built on [Docker](https://www.docker.io/)
     2  
     3  [![Build Status](http://beta.drone.io/github.com/drone/drone/status.svg?branch=master)](http://beta.drone.io/github.com/drone/drone)
     4  [![GoDoc](https://godoc.org/github.com/drone/drone?status.png)](https://godoc.org/github.com/drone/drone)
     5  
     6  ### Getting Started
     7  
     8  * [Installation](http://drone.readthedocs.org/en/latest/install.html)
     9  * [Configuration](http://drone.readthedocs.org/en/latest/setup.html)
    10  * [Getting Help](http://drone.readthedocs.org/en/latest/index.html#need-help)
    11  
    12  ### Contributing
    13  
    14  Interested in contributing? Great! Please read our [contributor guidelines](http://drone.readthedocs.org/en/latest/contribute.html#pull-requests).
    15  
    16  ---
    17  
    18  * [System Requirements](#system)
    19  * [Installation](#setup)
    20  * [Builds](#builds)
    21  * [Images](#images)
    22  * [Application Environment](#environment)
    23  * [Git Command Options](#git-command-options)
    24  * [Deployments](#deployments)
    25  * [Notifications](#notifications)
    26  * [Database Services](#databases)
    27  * [Caching](#caching)
    28  * [Params Injection](#params-injection)
    29  * [Wall display](#wall-display)
    30  * [Local development](#local-development)
    31  * [Documentation and References](#docs)
    32  
    33  ### System
    34  
    35  Drone is tested on the following versions of Ubuntu:
    36  
    37  * Ubuntu Precise 12.04 (LTS) (64-bit)
    38  * Ubuntu Raring 13.04 (64 bit)
    39  
    40  Drone's only external dependency is the latest version of Docker (0.8)
    41  
    42  ### Setup
    43  
    44  Drone is packaged and distributed as a debian file. You can download an install
    45  using the following commands:
    46  
    47  ```sh
    48  $ wget http://downloads.drone.io/latest/drone.deb
    49  $ sudo dpkg -i drone.deb
    50  $ sudo start drone
    51  ```
    52  
    53  Once Drone is running (by default on :80) navigate to **http://localhost:80/install**
    54  and follow the steps in the setup wizard.
    55  
    56  **IMPORTANT** You will also need a GitHub Client ID and Secret:
    57  
    58  * Register a new application https://github.com/settings/applications
    59  * Set the homepage URL to http://$YOUR_IP_ADDRESS/
    60  * Set the callback URL to http://$YOUR_IP_ADDRESS/auth/login/github
    61  * Copy the Client ID and Secret into the Drone admin console http://localhost:80/account/admin/settings
    62  
    63  I'm working on a getting started video. Having issues with volume, but hopefully
    64  you can still get a feel for the steps:
    65  
    66  https://docs.google.com/file/d/0By8deR1ROz8memUxV0lTSGZPQUk
    67  
    68  **Using MySQL**
    69  
    70  By default, Drone use sqlite as its database storage. To use MySQL/MariaDB instead, use `-driver` flag
    71  and set it to `mysql`. You will need to set your DSN (`-datasource`) in this form: 
    72  ```
    73      user:password@tcp(hostname:port)/dbname?parseTime=true
    74  ```
    75  Change it according to your database settings. The parseTime above is required since drone using
    76  `time.Time` to represents `TIMESTAMP` data. Please refer to [1] for more options on mysql driver.
    77  
    78  You may also need to tweak some innodb options, especially if you're using `utf8mb4` collation type.
    79  ```
    80      innodb_file_format = Barracuda
    81      innodb_file_per_table = On
    82      innodb_large_prefix = On
    83  ```
    84  Please consult to the MySQL/MariaDB documentation for further information
    85  regarding large prefix for index column and dynamic row format (which is used in Drone).
    86  
    87  [1] https://github.com/go-sql-driver/mysql
    88  
    89  ### Builds
    90  
    91  Drone use a **.drone.yml** configuration file in the root of your
    92  repository to run your build:
    93  
    94  ```
    95  image: mischief/docker-golang
    96  env:
    97    - GOPATH=/var/cache/drone
    98  script:
    99    - go build
   100    - go test -v
   101  services:
   102    - redis
   103  notify:
   104    email:
   105      recipients:
   106        - brad@drone.io
   107        - burke@drone.io
   108  ```
   109  
   110  ### Images
   111  
   112  In the above example we used a custom Docker image from index.docker.io **mischief/docker-golang**
   113  
   114  Drone also provides official build images. These images are configured specifically for CI and
   115  have many common software packages pre-installed (git, xvfb, firefox, libsqlite, etc).
   116  
   117  Official Drone images are referenced in the **.drone.yml** by an alias:
   118  
   119  ```sh
   120  image: go1.2   # same as bradrydzewski/go:1.2
   121  ```
   122  
   123  Here is a list of our official images:
   124  
   125  ```sh
   126  # these two are base images. all Drone images are built on top of these
   127  # these are BIG (~3GB) so make sure you have a FAST internet connection
   128  docker pull bradrydzewski/ubuntu
   129  docker pull bradrydzewski/base
   130  
   131  # clojure images
   132  docker pull bradrydzewski/lein             # image: lein
   133  
   134  # dart images
   135  docker pull bradrydzewski/dart:stable      # image: dart
   136  
   137  # erlang images
   138  docker pull bradrydzewski/erlang:R16B      # image: erlangR16B
   139  docker pull bradrydzewski/erlang:R16B02    # image: erlangR16B02
   140  docker pull bradrydzewski/erlang:R16B01    # image: erlangR16B01
   141  
   142  # gcc images (c/c++)
   143  docker pull bradrydzewski/gcc:4.6          # image: gcc4.6
   144  docker pull bradrydzewski/gcc:4.8          # image: gcc4.8
   145  
   146  # go images
   147  docker pull bradrydzewski/go:1.0           # image: go1
   148  docker pull bradrydzewski/go:1.1           # image: go1.1
   149  docker pull bradrydzewski/go:1.2           # image: go1.2
   150  
   151  # haskell images
   152  docker pull bradrydzewski/haskell:7.4      # image: haskell
   153  
   154  # java and jdk images
   155  docker pull bradrydzewski/java:openjdk6    # image: openjdk6
   156  docker pull bradrydzewski/java:openjdk7    # image: openjdk7
   157  docker pull bradrydzewski/java:oraclejdk7  # image: oraclejdk7
   158  docker pull bradrydzewski/java:oraclejdk8  # image: oraclejdk8
   159  
   160  # node images
   161  docker pull bradrydzewski/node:0.10        # image node0.10
   162  docker pull bradrydzewski/node:0.8         # image node0.8
   163  
   164  # php images
   165  docker pull bradrydzewski/php:5.5          # image: php5.5
   166  docker pull bradrydzewski/php:5.4          # image: php5.4
   167  
   168  # python images
   169  docker pull bradrydzewski/python:2.7       # image: python2.7
   170  docker pull bradrydzewski/python:3.2       # image: python3.2
   171  docker pull bradrydzewski/python:3.3       # image: python3.3
   172  docker pull bradrydzewski/python:pypy      # image: pypy
   173  
   174  # ruby images
   175  docker pull bradrydzewski/ruby:2.0.0       # image: ruby2.0.0
   176  docker pull bradrydzewski/ruby:1.9.3       # image: ruby1.9.3
   177  
   178  # scala images
   179  docker pull bradrydzewski/scala:2.10.3     # image: scala2.10.3
   180  docker pull bradrydzewski/scala:2.9.3      # image: scala2.9.3
   181  
   182  ```
   183  
   184  ### Environment
   185  
   186  Drone clones your repository into a Docker container
   187  at the following location:
   188  
   189  ```
   190  /var/cache/drone/src/github.com/$owner/$name
   191  ```
   192  
   193  Please take this into consideration when setting up your build commands, or
   194  if you are using a custom Docker image.
   195  
   196  ### Git Command Options
   197  
   198  You can specify the `--depth` option of the `git clone` command (default value is `50`):
   199  
   200  ```
   201  git:
   202    depth: 1
   203  ```
   204  
   205  ### Deployments
   206  
   207  Drone can trigger a deployment at the successful completion of your build:
   208  
   209  ```
   210  deploy:
   211    heroku:
   212      app: safe-island-6261
   213  
   214  publish:
   215    s3:
   216      acl: public-read
   217      region: us-east-1
   218      bucket: downloads.drone.io
   219      access_key: C24526974F365C3B
   220      secret_key: 2263c9751ed084a68df28fd2f658b127
   221      source: /tmp/drone.deb
   222      target: latest/
   223  
   224    swift:
   225      username: someuser
   226      password: 030e39a1278a18828389b194b93211aa
   227      auth_url: https://identity.api.rackspacecloud.com/v2.0
   228      region: DFW
   229      container: drone
   230      source: /tmp/drone.deb
   231      target: latest/drone.deb
   232      branch: master
   233  
   234  ```
   235  
   236  Drone currently has these `deploy` and `publish` plugins implemented (more to come!):
   237  
   238  **deploy**
   239  - [heroku](#docs)
   240  - [git](#docs)
   241  - [modulus](#docs)
   242  - [nodejitsu](#docs)
   243  - [ssh](#docs)
   244  - [tsuru](#docs)
   245  - [bash](#docs)
   246  
   247  **publish**
   248  - [Amazon s3](#docs)
   249  - [OpenStack Swift](#docs)
   250  - [PyPI](#docs)
   251  
   252  Publish plugins can be limited to a specific branch using the `branch` configuration
   253  as seen above in the `swift` example. If you do not specify a `branch` all branches
   254  will be published, with the exception of Pull Requests.
   255  
   256  ### Notifications
   257  
   258  Drone can trigger email, hipchat and web hook notification at the beginning and
   259  completion of your build:
   260  
   261  ```
   262  notify:
   263    email:
   264      recipients:
   265        - brad@drone.io
   266        - burke@drone.io
   267  
   268    webhook:
   269      on_success: true
   270      on_failure: true
   271      urls:
   272        - http://my-deploy-hook.com
   273  
   274    hipchat:
   275      room: support
   276      token: 3028700e5466d375
   277      on_started: true
   278      on_success: true
   279      on_failure: true
   280  ```
   281  
   282  ### Databases
   283  
   284  Drone can launch database containers for your build:
   285  
   286  ```
   287  services:
   288    - cassandra
   289    - couchdb
   290    - couchdb:1.0
   291    - couchdb:1.4
   292    - couchdb:1.5
   293    - elasticsearch
   294    - elasticsearch:0.20
   295    - elasticsearch:0.90
   296    - neo4j
   297    - neo4j:1.9
   298    - mongodb
   299    - mongodb:2.2
   300    - mongodb:2.4
   301    - mysql
   302    - mysql:5.5
   303    - postgres
   304    - postgres:9.1
   305    - rabbitmq
   306    - rabbitmq:3.2
   307    - redis
   308    - riak
   309    - zookeeper
   310  ```
   311  
   312  If you omit the version, Drone will launch the latest version of the database. (For example, if you set `mongodb`, Drone will launch MongoDB 2.4.)
   313  
   314  You can also launch custom Docker containers using standard docker notation:
   315  
   316  ```sh
   317  services:
   318    - dockerfile/rethinkdb # same as dockerfile/rethinkdb:latest
   319    - barnybug/elasticsearch:1.0.1
   320  ```
   321  
   322  **NOTE 1:** database and service containers are exposed over TCP connections and
   323  have their own local IP address. If the **socat** utility is installed inside your
   324  Docker image, Drone will automatically proxy localhost connections to the correct
   325  IP address.
   326  
   327  **NOTE 2:** avoid running services that use the same ports. For example, don't specify
   328  multiple versions of Elastic Search since the port will already be in use.
   329  
   330  ### Caching
   331  
   332  Drone can persist directories between builds. This should be used for caching dependencies to
   333  decrease overall build time. Examples include your `.npm`, `.m2`, `bundler`, etc.
   334  
   335  ```
   336  cache:
   337    - /usr/local/bin/go/pkg
   338  ```
   339  
   340  This will cache the directory relative to the root directory of your repository:
   341  
   342  ```
   343  cache:
   344    - .npm
   345  ```
   346  
   347  **NOTE:** this is an alpha quality feature and still has some quirks. See https://github.com/drone/drone/issues/147
   348  
   349  ### Params Injection
   350  
   351  You can inject params into .drone.yml.
   352  
   353  ```
   354  notify:
   355    hipchat:
   356      room: {{hipchatRoom}}
   357      token: {{hipchatToken}}
   358      on_started: true
   359      on_success: true
   360      on_failure: true
   361  ```
   362  
   363  ![params-injection](https://f.cloud.github.com/assets/1583973/2161187/2905077e-94c3-11e3-8499-a3844682c8af.png)
   364  
   365  ### Wall display
   366  
   367  A wall display for Drone is available as a separate service. See [Drone Wall](https://github.com/drone/drone-wall)
   368  for details.
   369  
   370  ### Local development
   371  
   372  Local Drone setup for development is pretty straightforward.
   373  
   374  You will need to clone the repo, install Vagrant and run `vagrant up`.
   375  This command will download base Ubuntu image, setup the virtual machine and build Drone.
   376  
   377  Afterwards, you may `vagrant ssh` into the vagrant instance, where docker is already installed and ready to go.
   378  
   379  Once in the vagrant instance, run `make run`, the visit http://localhost:8080/install in your browser.
   380  
   381  The Makefile has other targets so check that out for more build, test, run configurations.
   382  
   383  ### Docs
   384  
   385  * [drone.readthedocs.org](http://drone.readthedocs.org/) (Coming Soon)
   386  * [GoDoc](http://godoc.org/github.com/drone/drone)
   387