Software in context

Tags


How to set up Drone-wall

13th August 2014

Drone-wall screenshot

As a follow-up to How to set up a Private Continuous Deployment Server with Drone, here's a quick tutorial on installing Drone-wall.

Drone-wall is a wall display component for the Drone CI server. At the time of writing, Drone is a very young project, so drone-wall is even younger and has few features and sparse documentation. But if you've got Drone running, drone-wall is a nice little complement. I've found that its an easy way keep tabs on a handful of repositories; it's also fun to have a wall display somewhere.

1. Setup

Because drone-wall relies on Drone's SQLite database to know which repositories to watch, it'll have to be installed on the same server as Drone. The drone-wall docs claim that this will change after the Drone API is completed.

$ ssh [email protected]

For reference, my Drone server is a 2G DigitalOcean droplet running ubuntu 14.04.

2. Install Go

Drone-wall currently has to be built from source. Since it's written in Go, that means Go has to be installed. I've been wanting to play around with Go, as there are more and more cool projects its being used for (Drone, Docker!). So this was a great excuse for me to install it and get familiar with the development environment. The following instructions were pieced together from the golang.org install docs.

First grab a Go archive from golang.org. The download appropriate for your host can be found by browsing here:

$ wget http://golang.org/dl/go1.3.linux-amd64.tar.gz

By default, Go expects to be installed in /usr/local/go/, so extract the archive there:

$ tar -C /usr/local -xzf go1.3.linux-amd64.tar.gz

Next add Go to your PATH:

$ export PATH=$PATH:/usr/local/go/bin

That's it! Go should be installed. Verify with:

$ go version
go version go1.3 linux/amd64

3. Install Mercurial

Mercurial is a version control system that will be used later by the go get command.

$ sudo apt-get install mercurial

Then see if you have the hg command:

$ hg
Mercurial Distributed SCM
...

Git also ended up being necessary, but was already installed on my system.

4. Download drone-wall

Because drone-wall will be built from source as a Go project, we can't just drop it in any old directory; it has to live in a correctly structured Go development workspace. This fact is absent from the drone-wall README, and hiding in the Go docs discussion about code organization. But now we know. A good workspace will look like:

/my_workspace
|
|----/bin
|    |
|    |----executables
|
|----/pkg
|    |
|    |----packages
|
|----/src
     |
     |----source

I put my workspace in /source/GO, and then created a src directory there. The bin and pkg dirs will be created automatically in a second:

$ cd source
$ mkdir -p GO/src

Next, download drone into the GO/src/ dir:

$ cd GO/src
$ git clone https://github.com/drone/drone-wall

5. Install drone-wall

Now the instructions from the drone-wall README should actually work! From the drone-wall source directory:

$ go get

This will use git and mercurial to download all the dependencies required to build drone-wall. You'll notice a bunch of stuff is created in the pkg/ and src/ dirs of your Go workspace. Then:

$ go build

This builds drone-wall and drops an executable in your Go bin/.

6. Start drone-wall

Since we've done all the footwork, this is the easy part:

$ drone-wall --datasource=/var/lib/drone/drone.sqllite --team="{team}" --port=:8500

Instead of specifying individual comma-delimited repos with the --repos flag, --team watches all the repos owned by the Drone team I'm interested in.

We start drone-wall on port 8500 because we'll send it through an nginx reverse proxy in the next step. To verify,

$ curl localhost:8500

to see a web page.

7. Make drone-wall an upstart script

Drone-wall is running, but its hijacked a terminal. So we'll add an upstart script to daemonize it. These days upstart comes with Ubuntu. First stop the running drone-wall.

Add a drone-wall.conf file like the following to /etc/init/:

pre-start script
    mkdir -p /var/log/drone-wall/
end script
script
    exec /root/source/GO/bin/drone-wall --datasource=/var/lib/drone/drone.sqlite --port=:8500 --team={team_name} >> /var/log/drone-wall/drone-wall.log 2>&1
end script

Create the directory where the log file will go:

$ mkdir /var/log/drone-wall/

Then start drone-wall:

$ start drone-wall

Nice, right? Among other things, upstart also supports:

$ stop drone-wall
$ restart drone-wall

8. Wire drone-wall through nginx

Finally, let's add an nginx config file for drone-wall so that we can see it from the outside world on a nice URL like drone.status.myserver.com. More details on configuring a site with nginx can be found in the Drone tutorial.

Here's a /etc/nginx/sites-available/status.drone.myserver.com file, informed by this issue thread:

upstream drone-wall {
    server localhost:8500;
}

server {
    listen 80;
    server_name drone.status.myserver.com;
    location / {
        proxy_pass http://drone-wall;
        proxy_redirect      off;
        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Don't forget to add a soft link from `/etc/nginx/sites-enabled/'. Then restart nginx:

$ service nginx restart

If your DNS changes are configured and propagated, you should see an image like the one above at http://drone.status.myserver.com. Done!

Related posts:

Caleb Sotelo
AUTHOR

Caleb Sotelo

I'm a Software Engineer and Director of OpenX Labs. I try to write about software in a way that helps people truly understand it. Follow me @calebds.

View Comments