LoginSignup
14
14

More than 5 years have passed since last update.

EC2上にdrone.ioのオープンソース版を載せて「Rebuild」ボタンを追加するパッチを当てる

Last updated at Posted at 2014-04-10

概要

↓このエントリに触発され、試してみたのですが、
上手く動いたのでこちらに記録します。
http://qiita.com/chiastolite/items/0b82950177b3241a185bhttp://blog.takus.me/2014/02/25/drone-on-centos/

EC2上にdrone.ioのオープンソース版を載せて
「Rebuild」ができるようになるまだmasterにマージされていない pullreq#158 をbuildインストールまでの手順をまとめました。

これこれ

基本部分は上記エントリーや、公式ドキュメントと同じです。

EC2インスタンスの作成

ubuntuのLTS(12.04)のAMIを使いました。

dockerのインストール

上記インスタンスが起動したら、docker周りのインストールを行います。
http://docs.docker.io/en/latest/installation/ubuntulinux/
にあるように、
まずDockerに最適なバックポートカーネルに差し替えます。

sudo aptitude update
sudo aptidude install -y linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo shutdown -r now

dockerの待ち受けポートとソケットファイルを開くように設定を追加する

/etc/default/docker
ubuntu@drone:~$ cat /etc/default/docker
# Docker Upstart and SysVinit configuration file

# Customize location of Docker binary (especially for development testing).
#DOCKER="/usr/local/bin/docker"

# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="-dns 8.8.8.8 -dns 8.8.4.4"
DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock"

# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"

# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"

drone.io の build & install

golangのインストール

https://code.google.com/p/go/downloads/list
から「Linux (x86 64-bit) tarball」 を wget

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

cat >>~/.bash_profile <<EOS
export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
EOS

source ~/.bash_profile

Rebuildパッチ(pullreq#158)をcheckout

まだmasterにマージされていない pullreq#158 をcheckoutするをチェックアウト

mkdir -p ~/go/src/github.com/drone/
cd ~/go/src/github.com/drone/

git clone git@github.com:drone/drone.git && cd drone
git fetch origin +refs/pull/158/head:refs/remotes/origin/pr/158
git checkout -qf -b pr/158 origin/pr/158

Github Enterpriseのprivateモード対応のパッチ

Github Enterpriseでprivateモードを利用している場合は以下のパッチが必要です。
(Github Enterpriseを利用していない場合は飛ばしてください)

--- a/pkg/model/repo.go
+++ b/pkg/model/repo.go
@@ -24,7 +24,7 @@ const (
 )

 const (
-       githubRepoPattern           = "git://%s/%s/%s.git"
+       githubRepoPattern           = "git@%s:%s/%s.git"
        githubRepoPatternPrivate    = "git@%s:%s/%s.git"
        bitbucketRepoPattern        = "https://bitbucket.org/%s/%s.git"
        bitbucketRepoPatternPrivate = "git@bitbucket.org:%s/%s.git"

build

sudo aptitude install -y git mercurial bzr build-essential

make deps
make && make test 

install

sudo make install

設定

最初はよくわからないかもしれないので、debugログを有効にするのをオススメ

/etc/default/drone
# Upstart configuration file for droned.

# Command line options:
#
#   -datasource="drone.sqlite":
#   -driver="sqlite3":
#   -path="":
#   -port=":8080":
#
#DRONED_OPTS="--port=:80"
DRONED_OPTS="-port=:80 -log.debug=true"
  • ログは、「 /var/log/upstart/drone.log 」に出力されます。

起動

sudo start drone

上記で起動後 http://(hostname)/install から初期設定を行います。
WebUIでの初期設定等は基本的に設定箇所が少ないので迷うことは少ないと思いますが、GithubのoAuth認証登録周りは若干忘れそうな気がするので後で書きます。

14
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14