From be8f31f0fd4a2871945d77301532f62431e629df Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Sat, 8 Aug 2015 20:51:12 -0700 Subject: [PATCH] updated docs --- doc/setup/README.md | 2 -- doc/setup/github.md | 43 ++++++++++++++++-------- doc/setup/gitlab.md | 52 ++++++++++++++++++----------- doc/setup/mysql.md | 8 ++--- doc/setup/postgres.md | 4 +-- doc/setup/server.md | 8 ++--- doc/setup/sqlite.md | 10 +++--- pkg/remote/builtin/github/github.go | 4 +-- pkg/remote/builtin/gitlab/gitlab.go | 4 +-- 9 files changed, 80 insertions(+), 55 deletions(-) diff --git a/doc/setup/README.md b/doc/setup/README.md index 1bcdf5168..7680d6e85 100644 --- a/doc/setup/README.md +++ b/doc/setup/README.md @@ -5,8 +5,6 @@ * [Docker](docker.md) * [GitHub](github.md) * [GitLab](gitlab.md) - * [Bitbucket](bitbucket.md) * [Database](#) * [SQLite](sqlite.md) - * [Postgres](postgres.md) * [MySQL](mysql.md) diff --git a/doc/setup/github.md b/doc/setup/github.md index d2c5943f9..9ca56d439 100644 --- a/doc/setup/github.md +++ b/doc/setup/github.md @@ -1,25 +1,40 @@ # GitHub -Drone comes with built-in support for GitHub and GitHub Enterprise. To enable and configure GitHub, you should set the following environment variables: +Drone comes with built-in support for GitHub and GitHub Enterprise. To enable GitHub you should configure the GitHub driver using the following environment variables: ```bash REMOTE_DRIVER="github" - -GITHUB_CLIENT="c0aaff74c060ff4a950d" -GITHUB_SECRET="1ac1eae5ff1b490892f5" +REMOTE_CONFIG="https://github.com?client_id=${client_id}&client_secret=${client_secret}" ``` -## GitHub settings +## GitHub configuration -This section lists all environment variables used to configure GitHub. +The following is the standard URI connection scheme: -* `GITHUB_HOST` server address to connect to. The default value is `https://github.com` if not specified. -* `GITHUB_CLIENT` oauth client id for registered application -* `GITHUB_SECRET` oauth client secret for registered application -* `GITHUB_OPEN=false` allows users to self-register. Defaults to false for security reasons. -* `GITHUB_ORGS=drone,docker` restricts access to these GitHub organizations. **Optional** -* `GITHUB_PRIVATE_MODE=false` indicates GitHub Enterprise is running in private mode +``` +scheme://host[:port][?options] +``` -## GitHub Enterprise +The components of this string are: -If you are configuring Drone with GitHub Enterprise edition, you must specify the `GITHUB_HOST` in the configuration string. Note that you may also need to set `GITHUB_PRIVATE_MODE=true` when running GitHub Entperirse in private mode. +* `scheme` server protocol `http` or `https`. +* `host` server address to connect to. The default value is github.com if not specified. +* `:port` optional. The default value is :80 if not specified. +* `?options` connection specific options. + +## GitHub options + +This section lists all connection options used in the connection string format. Connection options are pairs in the following form: `name=value`. The value is always case sensitive. Separate options with the ampersand (i.e. &) character: + +* `client_id` oauth client id for registered application +* `client_secret` oauth client secret for registered application +* `open=false` allows users to self-register. Defaults to false for security reasons. +* `orgs=drone,docker` restricts access to these GitHub organizations. **Optional** +* `private_mode=false` indicates GitHub Enterprise is running in private mode +* `skip_verify=false` skip ca verification if self-signed certificate. Defaults to false. + +## GitHub registration + +You must register your application with GitHub in order to generate a Client and Secret. Navigate to your account settings and choose Applications from the menu, and click Register new application. + +Please use `/authorize` as the Authorization callback URL path. diff --git a/doc/setup/gitlab.md b/doc/setup/gitlab.md index 741dc5706..cc3dbff47 100644 --- a/doc/setup/gitlab.md +++ b/doc/setup/gitlab.md @@ -1,27 +1,39 @@ -> **NOTE** GitLab integration has not yet been merged into 0.4, but is planned in the near future +# Gitlab -# GitLab +Drone comes with built-in support for GitLab version 7.7 and higher. To enable Gitlab you should configure the Gitlab driver using the following environment variables: -Drone comes with built-in support for GitLab 7.7 and higher. To enable and configure GitLab, you should set the following environment variables: - -``` +```bash REMOTE_DRIVER="gitlab" - -GITLAB_HOST="https://gitlab.hooli.com" -GITLAB_CLIENT="c0aaff74c060ff4a950d" -GITLAB_SECRET="1ac1eae5ff1b490892f5" -GITLAB_OPEN="true" -GITLAB_ORGS="drone,drone-plugins" -GITLAB_SKIP_VERIFY="false" +REMOTE_CONFIG="https://gitlab.hooli.com?client_id=${client_id}&client_secret=${client_secret}" ``` -## GitLab settings +## Gitlab configuration -This section lists all environment variables used to configure GitLab. +The following is the standard URI connection scheme: -* `GITLAB_HOST` server address to connect to. -* `GITLAB_CLIENT` oauth client id for registered application -* `GITLAB_SECRET` oauth client secret for registered application -* `GITLAB_OPEN=false` allows users to self-register. Defaults to false for security reasons. -* `GITLAB_ORGS=drone,docker` restricts access to these GitLab organizations. **Optional** -* `GITLAB_SKIP_VERIFY=false` skip certificate chain and host name. Defaults to false for security reasons. +``` +scheme://host[:port][?options] +``` + +The components of this string are: + +* `scheme` server protocol `http` or `https`. +* `host` server address to connect to. The default value is github.com if not specified. +* `:port` optional. The default value is :80 if not specified. +* `?options` connection specific options. + +## GitLab options + +This section lists all connection options used in the connection string format. Connection options are pairs in the following form: `name=value`. The value is always case sensitive. Separate options with the ampersand (i.e. &) character: + +* `client_id` oauth client id for registered application +* `client_secret` oauth client secret for registered application +* `open=false` allows users to self-register. Defaults to false for security reasons. +* `orgs=drone,docker` restricts access to these GitLab organizations. **Optional** +* `skip_verify=false` skip ca verification if self-signed certificate. Defaults to false for security reasons. + +## Gitlab registration + +You must register your application with GitLab in order to generate a Client and Secret. Navigate to your account settings and choose Applications from the menu, and click New Application. + +Please use `/authorize` as the Authorization callback URL path. diff --git a/doc/setup/mysql.md b/doc/setup/mysql.md index 380cf76f7..73428f120 100644 --- a/doc/setup/mysql.md +++ b/doc/setup/mysql.md @@ -4,12 +4,12 @@ Drone comes with support for MySQL as an alternate database engine. To enable Postgres, you should specify the following environment variables: -``` +```bash DATABASE_DRIVER="mysql" -DATABASE_DATASOURCE="root:pa55word@tcp(localhost:3306)/drone" +DATABASE_CONFIG="root:pa55word@tcp(localhost:3306)/drone" ``` -## MySQL connection +## MySQL configuration The following is the standard URI connection scheme: @@ -29,7 +29,7 @@ The components of this string are: This is an example connection string: ``` -root:pa55word@tcp(localhost:3306)/drone?autocommit=false +root:pa55word@tcp(localhost:3306)/drone ``` ## MySQL options diff --git a/doc/setup/postgres.md b/doc/setup/postgres.md index fb4ddcaf6..864cec0b2 100644 --- a/doc/setup/postgres.md +++ b/doc/setup/postgres.md @@ -5,10 +5,10 @@ Drone comes with support for Postgres as an alternate database engine. To enable ``` DATABASE_DRIVER="postgres" -DATABASE_DATASOURCE="postgres://root:pa55word@127.0.0.1:5432/postgres" +DATABASE_CONFIG="postgres://root:pa55word@127.0.0.1:5432/postgres" ``` -## Postgres connection +## Postgres configuration The following is the standard URI connection scheme: diff --git a/doc/setup/server.md b/doc/setup/server.md index 2104001e7..ddb5b0466 100644 --- a/doc/setup/server.md +++ b/doc/setup/server.md @@ -12,7 +12,7 @@ This section lists all environment variables used to configure the server. This example changes the default port to `:80`: -``` +```bash SERVER_ADDR=":80" ``` @@ -22,7 +22,7 @@ Drone uses the `ListAndServerTLS` function in the Go standard library to accept This example accepts `HTTPS` connections: -``` +```bash SERVER_ADDR=":443" SERVER_KEY="/path/to/key.pem" SERVER_CERT="/path/to/cert.pem" @@ -30,9 +30,9 @@ SERVER_CERT="/path/to/cert.pem" > **NOTE** if the certificate is signed by a certificate authority, the cert should be the concatenation of the server's certificate followed by the CA's certificate. -When running Drone inside Docker, you'll need to mount the volume containing the certificate: +When running Drone inside Docker, you'll need to mount a volume containing the certificate: -``` +```bash docker run --volume /path/to/cert.pem:/path/to/cert.pem \ --volume /path/to/key.pem:/path/to/key.pem \ diff --git a/doc/setup/sqlite.md b/doc/setup/sqlite.md index 473541c3f..5b0f6b47d 100644 --- a/doc/setup/sqlite.md +++ b/doc/setup/sqlite.md @@ -2,12 +2,12 @@ Drone uses SQLite as the default database with zero configuration required. In order to customize the SQLite database configuration you should specify the following environment variables: -``` +```bash DATABASE_DRIVER="sqlite3" -DATABASE_DATASOURCE="/var/lib/drone/drone.sqlite" +DATABASE_CONFIG="/var/lib/drone/drone.sqlite" ``` -## Sqlite3 connection +## Sqlite3 configuration The components of the datasource connection string are: @@ -15,6 +15,6 @@ The components of the datasource connection string are: This is an example connection string: -``` -/var/lib/drone/drone.sqlite +```bash +DATABASE_CONFIG="/var/lib/drone/drone.sqlite" ``` diff --git a/pkg/remote/builtin/github/github.go b/pkg/remote/builtin/github/github.go index 1f8bb7e05..31507d385 100644 --- a/pkg/remote/builtin/github/github.go +++ b/pkg/remote/builtin/github/github.go @@ -53,8 +53,8 @@ func NewDriver(config string) (remote.Remote, error) { github := GitHub{} github.URL = url_.String() - github.Client = params.Get("client") - github.Secret = params.Get("secret") + github.Client = params.Get("client_id") + github.Secret = params.Get("client_secret") github.AllowedOrgs = params["orgs"] github.PrivateMode, _ = strconv.ParseBool(params.Get("private_mode")) github.SkipVerify, _ = strconv.ParseBool(params.Get("skip_verify")) diff --git a/pkg/remote/builtin/gitlab/gitlab.go b/pkg/remote/builtin/gitlab/gitlab.go index 308860cf9..b2ac633f1 100644 --- a/pkg/remote/builtin/gitlab/gitlab.go +++ b/pkg/remote/builtin/gitlab/gitlab.go @@ -49,8 +49,8 @@ func NewDriver(config string) (remote.Remote, error) { gitlab := Gitlab{} gitlab.URL = url_.String() - gitlab.Client = params.Get("client") - gitlab.Secret = params.Get("secret") + gitlab.Client = params.Get("client_id") + gitlab.Secret = params.Get("client_secret") gitlab.AllowedOrgs = params["orgs"] gitlab.SkipVerify, _ = strconv.ParseBool(params.Get("skip_verify")) gitlab.Open, _ = strconv.ParseBool(params.Get("open"))