From 80f7523e9bd80463224458786f273bc24fa700c5 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 30 Sep 2014 21:35:30 -0700 Subject: [PATCH] hooked up custom docker instances from config file --- .dockerignore | 1 + README.md | 15 +++++++++++++++ debian/drone/etc/default/drone | 4 ++-- debian/drone/etc/init/drone.conf | 2 +- server/app/views/account.html | 2 +- server/main.go | 31 +++++++++---------------------- server/worker/docker/docker.go | 10 +++++++++- 7 files changed, 38 insertions(+), 27 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..191381ee7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git \ No newline at end of file diff --git a/README.md b/README.md index 661548f7a..45d7b64da 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,21 @@ Or a combination of the two: DRONE_GITLAB_URL="https://gitlab.com" ./drone --config=/path/to/drone.conf ``` +## GitHub + +In order to setup with GitHub you'll need to register your local Drone installation +with GitHub (or GitHub Enterprise). You can read more about registering an application here: +https://github.com/settings/applications/new + +Below are example values when running Drone locally. If you are running Drone on a server +you should replace `localhost` with your server hostname or address. + +Homepage URL: +http://localhost:8000/ + +Authorization callback URL: +http://localhost:8000/api/auth/github.com + ## Compatibility Issues **WARNING** diff --git a/debian/drone/etc/default/drone b/debian/drone/etc/default/drone index 6109e5caa..b0ce4b7d5 100644 --- a/debian/drone/etc/default/drone +++ b/debian/drone/etc/default/drone @@ -4,10 +4,10 @@ # # -datasource="drone.sqlite": # -driver="sqlite3": -# -port=":8080": +# -bind=":8080": # -workers="4": # -#DRONED_OPTS="--port=:80" +#DRONED_OPTS="--bind=:80" # Email configuration #DRONE_SMTP_HOST= diff --git a/debian/drone/etc/init/drone.conf b/debian/drone/etc/init/drone.conf index 1e332ad83..b38b0cf48 100644 --- a/debian/drone/etc/init/drone.conf +++ b/debian/drone/etc/init/drone.conf @@ -5,7 +5,7 @@ console log script set -a - DRONED_OPTS="--port=:80" + DRONED_OPTS="--bind=:80" if [ -f /etc/default/$UPSTART_JOB ]; then . /etc/default/$UPSTART_JOB fi diff --git a/server/app/views/account.html b/server/app/views/account.html index 24f808db8..53172297c 100644 --- a/server/app/views/account.html +++ b/server/app/views/account.html @@ -8,7 +8,7 @@
- +
diff --git a/server/main.go b/server/main.go index e3a9257ed..f1126c4cb 100644 --- a/server/main.go +++ b/server/main.go @@ -97,24 +97,18 @@ func main() { // Create the worker, director and builders workers = pool.New() - workers.Allocate(docker.New()) - workers.Allocate(docker.New()) - workers.Allocate(docker.New()) - workers.Allocate(docker.New()) worker = director.New() - pub = pubsub.NewPubSub() - /* - if nodes == nil || len(nodes) == 0 { - worker.NewWorker(workerc, users, repos, commits, pubsub, &model.Server{}).Start() - worker.NewWorker(workerc, users, repos, commits, pubsub, &model.Server{}).Start() - } else { - for _, node := range nodes { - println(node) - worker.NewWorker(workerc, users, repos, commits, pubsub, &model.Server{Host: node}).Start() - } + if nodes == nil || len(nodes) == 0 { + workers.Allocate(docker.New()) + workers.Allocate(docker.New()) + } else { + for _, node := range nodes { + workers.Allocate(docker.NewHost(node)) } - */ + } + + pub = pubsub.NewPubSub() goji.Get("/api/logins", handler.GetLoginList) goji.Get("/api/stream/stdout/:id", handler.WsConsole) @@ -177,13 +171,6 @@ func main() { goji.Use(middleware.SetHeaders) goji.Use(middleware.SetUser) goji.Serve() - - // start webserver using HTTPS or HTTP - //if len(sslcert) != 0 { - // panic(http.ListenAndServeTLS(port, sslcert, sslkey, nil)) - //} else { - //panic(http.ListenAndServe(port, nil)) - //} } // ContextMiddleware creates a new go.net/context and diff --git a/server/worker/docker/docker.go b/server/worker/docker/docker.go index b37f7323a..352e5ab06 100644 --- a/server/worker/docker/docker.go +++ b/server/worker/docker/docker.go @@ -37,7 +37,15 @@ func New() *Docker { Kind: dockerKind, Created: time.Now().UTC().Unix(), docker: docker.New(), - //docker.NewHost(w.server.Host) + } +} + +func NewHost(host string) *Docker { + return &Docker{ + UUID: uuid.New(), + Kind: dockerKind, + Created: time.Now().UTC().Unix(), + docker: docker.NewHost(host), } }