diff --git a/Makefile b/Makefile index fe207e9d..b7047b6e 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ build: go build -o bin/drone -ldflags "-X main.revision $(SHA) -X main.version $(VERSION).$(SHA)" github.com/drone/drone/cmd/drone-server go build -o bin/drone-agent -ldflags "-X main.revision $(SHA) -X main.version $(VERSION).$(SHA)" github.com/drone/drone/cmd/drone-agent +run: + bin/drone-server --debug clean: find . -name "*.out" -delete diff --git a/doc/install-docker.md b/doc/install-docker.md index edd7af67..0abe45d5 100644 --- a/doc/install-docker.md +++ b/doc/install-docker.md @@ -1 +1,36 @@ -install-docker.md \ No newline at end of file +An official Drone image is available in the [Docker registry](https://registry.hub.docker.com/u/drone/drone/). This is the recommended way to install and run Drone on non-Ubuntu environments. Pull the latest Drone image to get started: + +```bash +sudo docker pull drone/drone +``` + +An example command to run your Drone instance with GitHub enabled: + +```bash +sudo docker run -d \ + -v /var/lib/drone:/var/lib/drone \ + -e DRONE_GITHUB_CLIENT=c0aaff74c060ff4a950d \ + -e DRONE_GITHUB_SECRET=1ac1eae5ff1b490892f5546f837f306265032412 \ + -p 80:80 --name=drone drone/drone +``` + +### Persistence + +When running Drone inside Docker we recommend mounting a volume for your sqlite database. This ensures the database is not lost if the container is accidentally stopped and removed. Below is an example that mounts `/var/lib/drone` on your host machine: + +```bash +sudo docker run \ + -v /var/lib/drone:/var/lib/drone \ + --name=drone drone/drone +``` + +### Configuration + +When running Drone inside Docker we recommend using environment variables to configure the system. All configuration attributes in the `drone.toml` may also be provided as environment variables. Below demonstrates how to configure GitHub from environment variables: + +```bash +sudo docker run \ + -e DRONE_GITHUB_CLIENT=c0aaff74c060ff4a950d \ + -e DRONE_GITHUB_SECRET=1ac1eae5ff1b490892f5546f837f306265032412 \ + --name=drone drone/drone +``` diff --git a/doc/install-source.md b/doc/install-source.md index 39ba00b5..1b6a8517 100644 --- a/doc/install-source.md +++ b/doc/install-source.md @@ -1 +1,46 @@ -install-source.md \ No newline at end of file +This document provides a brief overview of Drone's build process, so that you can build and run Drone directly from source. For more detail, please see the `.drone.yml` and `Makefile`. + +### Requirements + +* Make +* Go 1.4+ +* Libsqlite3 + +### Build and Test + +We use `make` to build and package Drone. You can execute the following commands to build compile Drone locally: + +```bash +make deps +make +make test +``` + +The `all` directive compiles binary files to the `bin/` directory and embeds all static content (ie html, javascript, css files) directly into the binary for simplified distribution. + +The `test` directive runs the `go vet` tool for simple linting and executes the suite of unit tests. + +**NOTE** if you experience slow compile times you can `go install` the `go-sqlite3` library from the vendored dependencies. This will prevent Drone from re-compiling on every build: + +```bash +go install github.com/drone/drone/Godeps/_workspace/src/github.com/mattn/go-sqlite3 +``` + +### Run + +To run Drone you can invoke `make run`. This will start Drone with the `--debug` flag which instructs Drone to server static content from disk. This is helpful if you are doing local development and editing the static JavaScript or CSS files. + + +### Distribute + +To generate a debian package: + +```bash +make dist +``` + +To generate a Docker container: + +```bash +docker build --rm=true -t drone/drone . +``` \ No newline at end of file diff --git a/doc/install-ubuntu.md b/doc/install-ubuntu.md index a5a056f3..d3e89cd4 100644 --- a/doc/install-ubuntu.md +++ b/doc/install-ubuntu.md @@ -1 +1,39 @@ -install.md \ No newline at end of file +These are the instructions for running Drone on Ubuntu . We recommend using Ubuntu 14.04, the latest stable distribution. We also highly recommend using AUFS as the default file system driver for Docker. + +### System Requirements + +The default Drone installation uses a SQLite3 database for persistence. Please ensure you have `libsqlite3-dev` installed: + +```bash +sudo apt-get update +sudo apt-get install libsqlite3-dev +``` + +The default Drone installation also assumes Docker is installed locally on the host machine. To install Docker on Ubuntu: + +```bash +wget -qO- https://get.docker.com/ | sh +``` + +### Installation + +Once the environment is prepared you can install Drone from a debian file. Drone will automatically start on port 80. Edit /etc/drone/drone.toml to modify the port. + +```bash +wget downloads.drone.io/master/drone.deb +sudo dpkg --install drone.deb +``` + +### Start & Stop + +The Drone service is managed by upstart and can be started, stopped or restarted using the following commands: + +```bash +sudo start drone +sudo stop drone +sudo restart drone +``` + +### Logging + +The Drone service logs are written to `/var/log/upstart/drone.log`. \ No newline at end of file diff --git a/doc/setup-nginx.md b/doc/setup-nginx.md index bdb0c02b..7a98b394 100644 --- a/doc/setup-nginx.md +++ b/doc/setup-nginx.md @@ -1 +1,21 @@ -setup-nginx.md \ No newline at end of file +Using a proxy server is not really necessary. Drone serves most static content from a CDN and uses the Go standard library’s high-performance net/http package to serve dynamic content. If using Nginx to proxy traffic to Drone you may use the following configuration: + +```nginx +location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $http_host; + proxy_set_header Origin ""; + + proxy_pass http://127.0.0.1:8000; + proxy_redirect off; +} +``` + +You may also want to change Drone’s default port when proxying traffic. You can change the port in the `/etc/drone/drone.toml` configuration file: + +```toml +[server] +addr = ":8000" +```