diff options
Diffstat (limited to 'doc')
29 files changed, 611 insertions, 187 deletions
diff --git a/doc/api/README.md b/doc/api/README.md index b1740f35792..acd2f524beb 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -13,7 +13,7 @@ + [Merge Requests](merge_requests.md) + [Issues](issues.md) + [Milestones](milestones.md) -+ [Notes](notes.md) ++ [Notes](notes.md) (comments) + [Deploy Keys](deploy_keys.md) + [System Hooks](system_hooks.md) + [Groups](groups.md) @@ -21,9 +21,12 @@ ## Clients + [php-gitlab-api](https://github.com/m4tthumphrey/php-gitlab-api) - PHP ++ [Laravel API Wrapper for GitLab CE](https://github.com/adamgoose/gitlab) - PHP / [Laravel](http://laravel.com) + [Ruby Wrapper](https://github.com/NARKOZ/gitlab) - Ruby + [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python + [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java ++ [node-gitlab](https://github.com/moul/node-gitlab) - Node.js ++ [NGitLab](https://github.com/Scooletz/NGitLab) - .NET ## Introduction diff --git a/doc/api/issues.md b/doc/api/issues.md index 823b72f5b0c..d18506f9ce6 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -193,3 +193,7 @@ Parameters: + `id` (required) - The project ID + `issue_id` (required) - The ID of the issue + +## Comments on issues + +Comments are done via the notes resource. diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 4e864ae1078..d68f34971f1 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -105,10 +105,11 @@ POST /projects/:id/merge_requests Parameters: + `id` (required) - The ID of a project -+ `source_branch` (required) - The source branch -+ `target_branch` (required) - The target branch -+ `assignee_id` (optional) - Assignee user ID -+ `title` (required) - Title of MR ++ `source_branch` (required) - The source branch ++ `target_branch` (required) - The target branch ++ `assignee_id` (optional) - Assignee user ID ++ `title` (required) - Title of MR ++ `target_project_id` (optional) - The target project (numeric id) ```json { @@ -188,6 +189,54 @@ Parameters: ``` +## Accept MR + +Merge changes submitted with MR usign this API. +If merge success you get 200 OK. +If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged' +If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed' +If you dont have permissions to accept this merge request - you get 401 + +``` +PUT /projects/:id/merge_request/:merge_request_id/merge +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `merge_request_id` (required) - ID of MR ++ `merge_commit_message` (optional) - Custom merge commit message + +```json +{ + "id": 1, + "target_branch": "master", + "source_branch": "test1", + "project_id": 3, + "title": "test1", + "state": "merged", + "upvotes": 0, + "downvotes": 0, + "author": { + "id": 1, + "username": "admin", + "email": "admin@local.host", + "name": "Administrator", + "state": "active", + "created_at": "2012-04-29T08:46:00Z" + }, + "assignee": { + "id": 1, + "username": "admin", + "email": "admin@local.host", + "name": "Administrator", + "state": "active", + "created_at": "2012-04-29T08:46:00Z" + } +} +``` + + ## Post comment to MR Adds a comment to a merge request. @@ -257,3 +306,7 @@ Parameters: } ] ``` + +## Comments on issues + +Comments are done via the notes resource. diff --git a/doc/api/notes.md b/doc/api/notes.md index b15ebdd2bac..e9ad6e00c73 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -1,3 +1,5 @@ +Notes can be wall notes or comments on snippets, issues or merge requests. + ## Wall ### List project wall notes diff --git a/doc/api/projects.md b/doc/api/projects.md index 40bcc6e2cd4..ffaba0af7fe 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -43,7 +43,8 @@ GET /projects "owner_id": 1, "path": "diaspora", "updated_at": "2013-09-30T13: 46: 02Z" - } + }, + "archived": false }, { "id": 6, @@ -78,7 +79,8 @@ GET /projects "owner_id": 1, "path": "brightbox", "updated_at": "2013-09-30T13:46:02Z" - } + }, + "archived": false } ] ``` @@ -157,7 +159,8 @@ Parameters: "access_level": 50, "notification_level": 3 } - } + }, + "archived": false } ``` diff --git a/doc/api/users.md b/doc/api/users.md index 2d5dedb3a39..2b927c30777 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -220,6 +220,18 @@ Parameters: + **none** +## List SSH keys for user + +Get a list of a specified user's SSH keys. Available only for admin + +``` +GET /users/:uid/keys +``` + +Parameters: + ++ `uid` (required) - id of specified user + ## Single SSH key @@ -286,3 +298,18 @@ Parameters: + `id` (required) - SSH key ID +## Delete SSH key + +Deletes key owned by a specified user. Available only for admin. + +``` +DELETE /users/:uid/keys/:id +``` + +Parameters: + ++ `uid` (required) - id of specified user ++ `id` (required) - SSH key ID + +Will return `200 Ok` on success, or `404 Not found` if either user or key cannot be found. + diff --git a/doc/development/README.md b/doc/development/README.md index aa59eb2c3e1..eb88b6c860f 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -1,2 +1,5 @@ -+ [Architecture](architecture.md) -+ [Shell commands](shell_commands.md) +## Development + ++ [Architecture](architecture.md) of GitLab ++ [Shell commands](shell_commands.md) in the GitLab codebase ++ [Rake tasks](rake_tasks.md) for development diff --git a/doc/development/rake_tasks.md b/doc/development/rake_tasks.md new file mode 100644 index 00000000000..9e75b3a6275 --- /dev/null +++ b/doc/development/rake_tasks.md @@ -0,0 +1,25 @@ +# Rake tasks for developers + +## Setup db with developer seeds: + +Note that if your db user does not have advanced privilegies you must create db manually before run this command + +``` +bundle exec rake setup +``` + +## Run tests + +This runs all test suite present in GitLab + +``` +bundle exec rake test +``` + +## Generate searchable docs for source code + +You can find results under `doc/code` directory + +``` +bundle exec rake gitlab:generate_docs +``` diff --git a/doc/install/installation.md b/doc/install/installation.md index 2ccb2d2c706..44f5a28fde5 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -1,10 +1,10 @@ # Select Version to Install -Make sure you view this installation guide from the branch (version) of GitLab you would like to install. In most cases +Make sure you view [this installation guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) from the branch (version) of GitLab you would like to install. In most cases this should be the highest numbered stable branch (example shown below). ![capture](http://i.imgur.com/d2AlIVj.png) -If this is unclear check the [GitLab Blog](https://www.gitlab.com/blog/) for installation guide links by version. +If the highest number stable branch is unclear please check the [GitLab Blog](https://www.gitlab.com/blog/) for installation guide links by version. # Important notes @@ -27,10 +27,9 @@ The GitLab installation consists of setting up the following components: 1. Packages / Dependencies 2. Ruby 3. System Users -4. GitLab shell -5. Database -6. GitLab -7. Nginx +4. Database +5. GitLab +6. Nginx # 1. Packages / Dependencies @@ -87,7 +86,7 @@ Is the system packaged Git too old? Remove it and compile from source. mail server. By default, Debian is shipped with exim4 whereas Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with: - sudo apt-get install -y postfix + sudo apt-get install -y postfix Then select 'Internet Site' and press enter to confirm the hostname. @@ -102,8 +101,8 @@ Remove the old Ruby 1.8 if present Download Ruby and compile it: mkdir /tmp/ruby && cd /tmp/ruby - curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz - cd ruby-2.0.0-p353 + curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz | tar xz + cd ruby-2.0.0-p481 ./configure --disable-install-rdoc make sudo make install @@ -119,32 +118,10 @@ Create a `git` user for Gitlab: sudo adduser --disabled-login --gecos 'GitLab' git - -# 4. GitLab shell - -GitLab Shell is an ssh access and repository management software developed specially for GitLab. - - # Go to home directory - cd /home/git - - # Clone gitlab shell - sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.1 - - cd gitlab-shell - - sudo -u git -H cp config.yml.example config.yml - - # Edit config and replace gitlab_url - # with something like 'http://domain.com/' - sudo -u git -H editor config.yml - - # Do setup - sudo -u git -H ./bin/install - - -# 5. Database +# 4. Database We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). +NOTE: because we need to make use of extensions you need at least pgsql 9.1. # Install the database packages sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev @@ -153,7 +130,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da sudo -u postgres psql -d template1 # Create a user for GitLab. - template1=# CREATE USER git; + template1=# CREATE USER git CREATEDB; # Create the GitLab production database & grant all privileges on database template1=# CREATE DATABASE gitlabhq_production OWNER git; @@ -165,7 +142,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da sudo -u git -H psql -d gitlabhq_production -# 6. GitLab +# 5. GitLab # We'll install GitLab into home directory of the user "git" cd /home/git @@ -173,13 +150,13 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da ## Clone the Source # Clone GitLab repository - sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-8-stable gitlab + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-9-stable gitlab # Go to gitlab dir cd /home/git/gitlab **Note:** -You can change `6-8-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! +You can change `6-9-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! ## Configure it @@ -224,7 +201,7 @@ You can change `6-8-stable` to `master` if you want the *bleeding edge* version, # Configure Git global settings for git user, useful when editing via web # Edit user.email according to what is set in gitlab.yml sudo -u git -H git config --global user.name "GitLab" - sudo -u git -H git config --global user.email "gitlab@localhost" + sudo -u git -H git config --global user.email "example@example.com" sudo -u git -H git config --global core.autocrlf input **Important Note:** @@ -267,6 +244,19 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. # Or if you use MySQL (note, the option says "without ... postgres") sudo -u git -H bundle install --deployment --without development test postgres aws +## Install GitLab shell + +GitLab Shell is an ssh access and repository management software developed specially for GitLab. + + # Go to the Gitlab installation folder: + cd /home/git/gitlab + + # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): + sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.4] REDIS_URL=redis://localhost:6379 RAILS_ENV=production + + # By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows: + sudo -u git -H editor /home/git/gitlab-shell/config.yml + ## Initialize Database and Activate Advanced Features @@ -276,7 +266,6 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. # When done you see 'Administrator account created:' - ## Install Init Script Download the init script (will be /etc/init.d/gitlab): @@ -313,7 +302,8 @@ Check if GitLab and its environment are configured correctly: # or sudo /etc/init.d/gitlab restart -# 7. Nginx + +# 6. Nginx **Note:** Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the @@ -373,7 +363,7 @@ nobody can access your GitLab by using this login information later on. ## Additional markup styles Apart from the always supported markdown style there are other rich text files that GitLab can display. -But you might have to install a depency to do so. +But you might have to install a dependency to do so. Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#markups) for more information. For example, reStructuredText markup language support requires python-docutils: @@ -419,22 +409,22 @@ GitLab uses [Omniauth](http://www.omniauth.org/) for authentication and already These steps are fairly general and you will need to figure out the exact details from the Omniauth provider's documentation. * Stop GitLab - `sudo service gitlab stop` + `sudo service gitlab stop` * Add provider specific configuration options to your `config/gitlab.yml` (you can use the [auth providers section of the example config](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example) as a reference) * Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/Gemfile) `gem "omniauth-your-auth-provider"` * If you're using MySQL, install the new Omniauth provider gem by running the following command: - `sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment` + `sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment` * If you're using PostgreSQL, install the new Omniauth provider gem by running the following command: - `sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment` + `sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment` > These are the same commands you used in the [Install Gems section](#install-gems) with `--path vendor/bundle --no-deployment` instead of `--deployment`. * Start GitLab - `sudo service gitlab start` + `sudo service gitlab start` ### Examples diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 56a2a5efeb0..fd2dd16cd8e 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -43,18 +43,24 @@ We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab ## CPU -- 1 core works for under 100 users but the responsiveness might suffer -- **2 cores** is the **recommended** number of cores and supports up to 100 users -- 4 cores supports up to 1,000 users -- 8 cores supports up to 10,000 users +- 1 core works supports up to 100 users but the application will not be responsive +- **2 cores** is the **recommended** number of cores and supports up to 500 users +- 4 cores supports up to 2,000 users +- 8 cores supports up to 5,000 users +- 16 cores supports up to 10,0000 users +- 32 cores supports up to 20,0000 users +- 64 cores supports up to 40,0000 users ## Memory -- 512MB is too little memory, GitLab will be very slow and you will need 250MB of swap -- 768MB is the minimal memory size but we advise against this +- 512MB is the absolute minimum, you need 256MB of swap, you can configure only one slow unicorn worker, only ssh access will work, we do not recommend this - 1GB supports up to 100 users (with individual repositories under 250MB, otherwise git memory usage necessitates using swap space) -- **2GB** is the **recommended** memory size and supports up to 1,000 users -- 4GB supports up to 10,000 users +- **2GB** is the **recommended** memory size and supports up to 500 users +- 4GB supports up to 2,000 users +- 8GB supports up to 5,000 users +- 16GB supports up to 10,000 users +- 32GB supports up to 20,000 users +- 64GB supports up to 40,000 users ## Storage @@ -68,11 +74,14 @@ Apart from a local hard drive you can also mount a volume that supports the netw If you have enough RAM memory and a recent CPU the speed of GitLab is mainly limited by hard drive seek times. Having a fast drive (7200 RPM and up) or a solid state drive (SSD) will improve the responsiveness of GitLab. +## Database + +If you want to run the database separately, the **recommended** database size is **1 MB per user** # Supported webbrowsers - Chrome (Latest stable version) - Firefox (Latest released version) -- Safari 7+ (Know problem: required fields in html5 do not work) +- Safari 7+ (known problem: required fields in html5 do not work) - Opera (Latest released version) - IE 10+ diff --git a/doc/integration/README.md b/doc/integration/README.md index 3e8d329d558..4773dd8fffb 100644 --- a/doc/integration/README.md +++ b/doc/integration/README.md @@ -6,3 +6,6 @@ See the documentation below for details on how to configure these services. + [External issue tracker](external-issue-tracker.md) Redmine, JIRA, etc. + [LDAP](ldap.md) Set up sign in via LDAP + [OmniAuth](omniauth.md) Sign in via Twitter, GitHub, and Google via OAuth. ++ [Slack](slack.md) Integrate with the Slack chat service + +Jenkins support is [available in GitLab EE](http://doc.gitlab.com/ee/integration/jenkins.html). diff --git a/doc/integration/external-issue-tracker.md b/doc/integration/external-issue-tracker.md index 7d8312075ac..1b531aeeda7 100644 --- a/doc/integration/external-issue-tracker.md +++ b/doc/integration/external-issue-tracker.md @@ -2,8 +2,10 @@ GitLab has a great issue tracker but you can also use an external issue tracker - the 'Issues' link on the GitLab project pages takes you to the appropriate JIRA issue index; - clicking 'New issue' on the project dashboard creates a new JIRA issue; -- To reference JIRA issue PROJECT-1234 in comments, use syntax #PROJECT-1234. Commit messages get turned into HTML links to the corresponding JIRA issue. +- To reference JIRA issue PROJECT-1234 in comments, use syntax PROJECT-1234. Commit messages get turned into HTML links to the corresponding JIRA issue. ![jira screenshot](jira-integration-points.png) -You can configure the integration in the gitlab.yml configuration file.
\ No newline at end of file +You can configure the integration in the gitlab.yml configuration file. + +Support to add your commits to the Jira ticket automatically is [available in GitLab EE](http://doc.gitlab.com/ee/integration/jira.html). diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md index a4491432caf..84a5a8e8c28 100644 --- a/doc/integration/omniauth.md +++ b/doc/integration/omniauth.md @@ -21,6 +21,7 @@ Before configuring individual OmniAuth providers there are a few global settings ``` 2. Find the section dealing with OmniAuth. The section will look similar to the following.<br /> + ``` ## OmniAuth settings omniauth: @@ -50,6 +51,7 @@ Before configuring individual OmniAuth providers there are a few global settings # app_secret: 'YOUR APP SECRET', # args: { scope: 'user:email' } } ``` + 3. Change `enabled` to `true`. 4. Consider the next two configuration options: `allow_single_sign_on` and `block_auto_created_users`. * `allow_single_sign_on` defaults to `false`. If `false` users must be created manually or they will not be able to diff --git a/doc/permissions/permissions.md b/doc/permissions/permissions.md index ac4bdefddd5..9be6423f667 100644 --- a/doc/permissions/permissions.md +++ b/doc/permissions/permissions.md @@ -27,7 +27,7 @@ If a user is a GitLab administrator they receive all permissions. |Remove protected branches| |||✓|✓| |Edit project| |||✓|✓| |Add Deploy Keys to project| |||✓|✓| -|Confiure Project Hooks| |||✓|✓| +|Configure Project Hooks| |||✓|✓| |Switch visibility level| ||||✓| |Transfer project to another namespace| ||||✓| |Remove project| ||||✓| diff --git a/doc/public_access/public_access.md b/doc/public_access/public_access.md index bf9d2784aff..76d83e6f3b6 100644 --- a/doc/public_access/public_access.md +++ b/doc/public_access/public_access.md @@ -4,7 +4,7 @@ Internal projects will only be available to authenticated users. #### Public projects Public projects can be cloned **without any** authentication. -It will also be listen on the [public access directory](/public). +It will also be listed on the [public access directory](/public). **Any logged in user** will have [Guest](/help/permissions) permissions on the repository. #### Internal projects diff --git a/doc/raketasks/README.md b/doc/raketasks/README.md index 9aa80af12cc..6be24f0102a 100644 --- a/doc/raketasks/README.md +++ b/doc/raketasks/README.md @@ -1,6 +1,7 @@ + [Backup restore](backup_restore.md) + [Cleanup](cleanup.md) + [Features](features.md) -+ [Maintenance](maintenance.md) ++ [Maintenance](maintenance.md) and self-checks + [User management](user_management.md) + [Web hooks](web_hooks.md) ++ [Import](import.md) of git repositories in bulk diff --git a/doc/raketasks/import.md b/doc/raketasks/import.md new file mode 100644 index 00000000000..e11328dc5ce --- /dev/null +++ b/doc/raketasks/import.md @@ -0,0 +1,28 @@ +### Import bare repositories into GitLab project instance + +Notes: + +* project owner will be a first admin +* groups will be created as needed +* group owner will be the first admin +* existing projects will be skipped + +How to use: + +1. copy your bare repos under git repos_path (see `config/gitlab.yml` gitlab_shell -> repos_path) +2. run the command below + +``` +bundle exec rake gitlab:import:repos RAILS_ENV=production +``` + +Example output: + +``` +Processing abcd.git + * Created abcd (abcd.git) +Processing group/xyz.git + * Created Group group (2) + * Created xyz (group/xyz.git) +[...] +``` diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md index 3033d8c46b4..907c9352c59 100644 --- a/doc/raketasks/maintenance.md +++ b/doc/raketasks/maintenance.md @@ -24,9 +24,9 @@ Version: 5.1.0.beta2 Revision: 4da8b37 Directory: /home/git/gitlab DB Adapter: mysql2 -URL: http://localhost -HTTP Clone URL: http://localhost/some-project.git -SSH Clone URL: git@localhost:some-project.git +URL: http://example.com +HTTP Clone URL: http://example.com/some-project.git +SSH Clone URL: git@example.com:some-project.git Using LDAP: no Using Omniauth: no @@ -110,32 +110,3 @@ If necessary, remove the `tmp/repo_satellites` directory and rerun the command b ``` bundle exec rake gitlab:satellites:create RAILS_ENV=production ``` - -### Import bare repositories into GitLab project instance - -Notes: - -* project owner will be a first admin -* groups will be created as needed -* group owner will be the first admin -* existing projects will be skipped - -How to use: - -1. copy your bare repos under git repos_path (see `config/gitlab.yml` gitlab_shell -> repos_path) -2. run the command below - -``` -bundle exec rake gitlab:import:repos RAILS_ENV=production -``` - -Example output: - -``` -Processing abcd.git - * Created abcd (abcd.git) -Processing group/xyz.git - * Created Group group (2) - * Created xyz (group/xyz.git) -[...] -``` diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 9dbe62f1210..514d73517b2 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -1,15 +1,36 @@ -# Things to do when creating new monthly minor or major release -NOTE: This is a guide for GitLab developers. If you are trying to install GitLab see the latest stable [installation guide](install/installation.md) and if you are trying to upgrade, see the [upgrade guides](update). +# Monthly Release +NOTE: This is a guide for GitLab developers. -## Install guide up to date? +# **15th - Code Freeze & Release Manager** -* References correct GitLab branch `x-x-stable` and correct GitLab shell tag? +### **1. Stop merging in code, except for important bugfixes** -## Make upgrade guide +### **2. Release Manager** -### From x.x to x.x +A release manager is selected that coordinates the entire release of this version. The release manager has to make sure all the steps below are done and delegated where necessary. This person should also make sure this document is kept up to date and issues are created and updated. -#### 0. Any major changes? Database updates? Web server change? File structure changes? +# **18th - Releasing RC1** + +The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub. + +### **1. Create an issue for RC1 release** + +### **2. Update the installation guide** + +1. Check if it references the correct branch `x-x-stable` (doesn't exist yet, but that is okay) +2. Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) +3. Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) +4. There might be other changes. Ask around. + +### **3. Create an update guide** + +It's best to copy paste the previous guide and make changes where necessary. The typical steps are listed below with any points you should specifically look at. + +#### 0. Any major changes? +List any major changes here, so the user is aware of them before starting to upgrade. For instance: +- Database updates +- Web server changes +- File structure changes #### 1. Make backup @@ -17,9 +38,9 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab #### 3. Do users need to update dependencies like `git`? -- Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) +- Check if the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) changed since the last release. -- Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) +- Check if the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) changed since the last release. #### 4. Get latest code @@ -29,7 +50,7 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab #### 7. Any config files updated since last release? -Check if any of these changed since last release (~22nd of last month depending on when last release branch was created): +Check if any of these changed since last release: * https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/nginx/gitlab * https://gitlab.com/gitlab-org/gitlab-shell/commits/master/config.yml.example @@ -40,13 +61,14 @@ Check if any of these changed since last release (~22nd of last month depending #### 8. Need to update init script? -Check if changed since last release (~22nd of last month depending on when last release branch was created): https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/init.d/gitlab +Check if the init.d/gitlab script changed since last release: https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/init.d/gitlab #### 9. Start application #### 10. Check application status -## Make sure the code quality indicatiors are good +### **4. Code quality indicatiors** +Make sure the code quality indicators are green / good. * [![build status](http://ci.gitlab.org/projects/1/status.png?ref=master)](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) @@ -58,32 +80,88 @@ Check if changed since last release (~22nd of last month depending on when last * [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) -## Make a release branch +### **5. Set VERSION** -After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: +Set VERSION tot x.x.0.rc1 -* 1-7th: official merge window (see contributing guide) -* 8-14th: work on bugfixes, sponsored features and GitLab EE -* 15th: code freeze (stop merging into master except essential bugfixes) -* 18th: release candidate 1 (VERSION x.x.0.rc1, annotated tag and tweet about x.x.0.rc1, release on GitLab Cloud) -* 20st: optional release candidate 2 (x.x.0.rc2, only if rc1 had problems) -* 22nd: release (VERSION x.x.0, create x-x-stable branch, annotated tag tag, blog and tweet) -* 23nd: optional patch releases (x.x.1, x.x.2, etc., only if there are serious problems) -* 24-end of month: release GitLab EE and GitLab CI -# Write a blog post +### **6. Tag** -* Mention what GitLab is on the second line: GitLab is open source software to collaborate on code. -* Select and thank the the Most Valuable Person (MVP) of this release. -* Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible. +Create an annotated tag that points to the version change commit. +``` +git tag -a vx.x.0.rc1 -m 'Version x.x.0.rc1' +``` + +### **7. Tweet** + +Tweet about the RC release: + +> GitLab x.x.x.rc1 is out. This is a release candidate intended for testing only. Please let us know if you find regressions. + +### **8. Update Cloud** + +Merge the RC1 code into Cloud. Once the build is green, deploy in the morning. + +It is important to do this as soon as possible, so we can catch any errors before we release the full version. + + +# **22nd - Release CE and EE** -# Tweet +For GitLab EE, append -ee to the branches and tags. -Send out a tweet to share the good news with the world. For a major/minor release, list the features in short and link to the blog post. +`x-x-stable-ee` -For a RC, make sure to explain what a RC is. +`v.x.x.0-ee` + +### **1. Create x-x-stable branch and push to the repositories** + +``` +git checkout master +git pull +git checkout -b x-x-stable +git push <remote> x-x-stable +``` + +### **2. Build the Omnibus packages** +[Follow this guide](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md) + +### **3. QA** +Use the omnibus packages to test using [this guide](https://dev.gitlab.org/gitlab/gitlab-ee/blob/master/doc/release/manual_testing.md) + + +### **4. Fix anything coming out of the QA** + +### **5. Set VERSION to x.x.0** + +### **6. Create annotated tag vx.x.0** +``` +git tag -a vx.x.0 -m 'Version x.x.0' +``` + +### **7. Push VERSION + Tag to master, merge into x-x-stable** +``` +git push origin master +``` + +Next, merge the VERSION into the x-x-stable branch. + +### **8. Push to remotes** + +For GitLab CE, push to dev, GitLab.com and GitHub. + +For GitLab EE, push to the subscribers repo. + +NOTE: You might not have the rights to push to master on dev. Ask Dmitriy. + +### **9. Publish blog for new release** +* Mention what GitLab is on the second line: GitLab is open source software to collaborate on code. +* Select and thank the the Most Valuable Person (MVP) of this release. +* Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible. -A patch release tweet should specify the fixes it brings and link to the corresponding blog post. +### **10. Tweet to blog** +Send out a tweet to share the good news with the world. List the features in short and link to the blog post. +# **23rd - Optional Patch Release** +# **25th - Release GitLab CI** diff --git a/doc/system_hooks/system_hooks.md b/doc/system_hooks/system_hooks.md index 76ca2a59911..5c8daf466ab 100644 --- a/doc/system_hooks/system_hooks.md +++ b/doc/system_hooks/system_hooks.md @@ -16,6 +16,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser "path": "stormcloud", "path_with_namespace": "jsmith/stormcloud", "project_id": 74, + "project_visibility": "private", } ``` @@ -31,6 +32,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser "path": "underscore", "path_with_namespace": "jsmith/underscore", "project_id": 73, + "project_visibility": "internal", } ``` @@ -38,14 +40,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ```json { - "created_at": "2012-07-21T07:30:56Z", - "event_name": "user_add_to_team", - "project_access": "Master", - "project_id": 74, - "project_name": "StoreCloud", - "project_path": "storecloud", - "user_email": "johnsmith@gmail.com", - "user_name": "John Smith", + "created_at": "2012-07-21T07:30:56Z", + "event_name": "user_add_to_team", + "project_access": "Master", + "project_id": 74, + "project_name": "StoreCloud", + "project_path": "storecloud", + "user_email": "johnsmith@gmail.com", + "user_name": "John Smith", + "project_visibility": "private", } ``` @@ -53,14 +56,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ```json { - "created_at": "2012-07-21T07:30:56Z", - "event_name": "user_remove_from_team", - "project_access": "Master", - "project_id": 74, - "project_name": "StoreCloud", - "project_path": "storecloud", - "user_email": "johnsmith@gmail.com", - "user_name": "John Smith", + "created_at": "2012-07-21T07:30:56Z", + "event_name": "user_remove_from_team", + "project_access": "Master", + "project_id": 74, + "project_name": "StoreCloud", + "project_path": "storecloud", + "user_email": "johnsmith@gmail.com", + "user_name": "John Smith", + "project_visibility": "private", } ``` diff --git a/doc/update/6.0-to-6.7.md b/doc/update/6.0-to-6.8.md index aa1b388fa9a..5c71e99aa52 100644 --- a/doc/update/6.0-to-6.7.md +++ b/doc/update/6.0-to-6.8.md @@ -1,4 +1,4 @@ -# From 6.0 to 6.7 +# From 6.0 to 6.8 # In 6.1 we remove a lot of deprecated code. # You should update to 6.0 before installing 6.1 or higher so all the necessary conversions are run. @@ -33,7 +33,7 @@ sudo -u git -H git fetch --all For Gitlab Community Edition: ```bash -sudo -u git -H git checkout 6-7-stable +sudo -u git -H git checkout 6-8-stable ``` OR @@ -41,7 +41,7 @@ OR For GitLab Enterprise Edition: ```bash -sudo -u git -H git checkout 6-7-stable-ee +sudo -u git -H git checkout 6-8-stable-ee ``` @@ -57,7 +57,7 @@ sudo apt-get install logrotate ```bash cd /home/git/gitlab-shell sudo -u git -H git fetch -sudo -u git -H git checkout v1.9.1 # Addresses multiple critical security vulnerabilities +sudo -u git -H git checkout v1.9.3 # Addresses multiple critical security vulnerabilities ``` ### 5. Install libs, migrations, etc. @@ -90,11 +90,12 @@ sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites TIP: to see what changed in gitlab.yml.example in this release use next command: ``` -git diff 6-0-stable:config/gitlab.yml.example 6-7-stable:config/gitlab.yml.example +git diff 6-0-stable:config/gitlab.yml.example 6-8-stable:config/gitlab.yml.example ``` -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-7-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-7-stable/config/unicorn.rb.example but with your settings. +* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/config/gitlab.yml.example but with your settings. +* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/config/unicorn.rb.example but with your settings. +* Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/lib/support/nginx/gitlab but with your settings. * Copy rack attack middleware config ```bash diff --git a/doc/update/6.6-to-6.7.md b/doc/update/6.6-to-6.7.md index 0f39c037c9f..61a63057d08 100644 --- a/doc/update/6.6-to-6.7.md +++ b/doc/update/6.6-to-6.7.md @@ -64,6 +64,10 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab # Update the logrotate configuration (keep logs for 90 days instead of 52 weeks) sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab +# Compress existing .log.1 files because we turned off delaycompress in logrotate +sudo -u git -H gzip /home/git/gitlab/log/*.log.1 +sudo -u git -H gzip /home/git/gitlab-shell/gitlab-shell.log.1 + # Close access to gitlab-satellites for others sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites ``` diff --git a/doc/update/6.7-to-6.8.md b/doc/update/6.7-to-6.8.md index 57918bca82d..cb19d235819 100644 --- a/doc/update/6.7-to-6.8.md +++ b/doc/update/6.7-to-6.8.md @@ -1,4 +1,4 @@ -# From 6.6 to 6.7 +# From 6.7 to 6.8 ### 0. Backup @@ -9,7 +9,9 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ### 1. Stop server - sudo service gitlab stop +```bash +sudo service gitlab stop +``` ### 2. Get latest code @@ -37,7 +39,7 @@ sudo -u git -H git checkout 6-8-stable-ee ```bash cd /home/git/gitlab-shell sudo -u git -H git fetch -sudo -u git -H git checkout v1.9.1 +sudo -u git -H git checkout v1.9.3 ``` ### 4. Install libs, migrations, etc. @@ -60,9 +62,7 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS # Update init.d script sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab - -# Update the logrotate configuration (keep logs for 90 days instead of 52 weeks) -sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab +sudo chmod +x /etc/init.d/gitlab # Close access to gitlab-satellites for others sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites @@ -90,19 +90,12 @@ If you are using HTTPS, disable gzip as in [this commit](https://gitlab.com/gitl To improve performance, enable gzip asset compression as seen [in this commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/8af94ed75505f0253823b9b2d44320fecea5b5fb). -### 6. Update Init script - -```bash -sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab -sudo chmod +x /etc/init.d/gitlab -``` - -### 7. Start application +### 6. Start application sudo service gitlab start sudo service nginx restart -### 8. Check application status +### 7. Check application status Check if GitLab and its environment are configured correctly: @@ -114,10 +107,10 @@ To make sure you didn't miss anything run a more thorough check with: If all items are green, then congratulations upgrade is complete! -## Things went south? Revert to previous version (6.6) +## Things went south? Revert to previous version (6.7) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 6.5 to 6.6`](6.5-to-6.6.md), except for the database migration +Follow the [`upgrade guide from 6.6 to 6.7`](6.6-to-6.7.md), except for the database migration (The backup is already migrated to the previous version) ### 2. Restore from the backup: diff --git a/doc/update/6.8-to-6.9.md b/doc/update/6.8-to-6.9.md new file mode 100644 index 00000000000..a5e644b8a07 --- /dev/null +++ b/doc/update/6.8-to-6.9.md @@ -0,0 +1,96 @@ +# From 6.8 to 6.9 + +### 0. Backup + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production +``` + +### 1. Stop server + +```bash +sudo service gitlab stop +``` + +### 2. Get latest code + +```bash +cd /home/git/gitlab +sudo -u git -H git fetch --all +``` + +For Gitlab Community Edition: + +```bash +sudo -u git -H git checkout 6-9-stable +``` + +OR + +For GitLab Enterprise Edition: + +```bash +sudo -u git -H git checkout 6-9-stable-ee +``` + +### 3. Update gitlab-shell (and its config) + +```bash +cd /home/git/gitlab-shell +sudo -u git -H git fetch +sudo -u git -H git checkout v1.9.4 +``` + +### 4. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL installations (note: the line below states '--without ... postgres') +sudo -u git -H bundle install --without development test postgres --deployment + +# PostgreSQL installations (note: the line below states '--without ... mysql') +sudo -u git -H bundle install --without development test mysql --deployment +``` + +### 5. Update config files + +#### New configuration options for gitlab.yml + +There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml if desired. + +``` +git diff 6-8-stable:config/gitlab.yml.example 6-9-stable:config/gitlab.yml.example +``` + +### 6. Start application + + sudo service gitlab start + sudo service nginx restart + +### 7. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + +If all items are green, then congratulations upgrade is complete! + +## Things went south? Revert to previous version (6.8) + +### 1. Revert the code to the previous version +Follow the [`upgrade guide from 6.7 to 6.8`](6.7-to-6.8.md), except for the database migration +(The backup is already migrated to the previous version) + +### 2. Restore from the backup: + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production +``` +If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above. diff --git a/doc/update/README.md b/doc/update/README.md index 06e3764616f..9ce48a019e8 100644 --- a/doc/update/README.md +++ b/doc/update/README.md @@ -1,5 +1,5 @@ -+ [The indivual upgrade guides](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update) -+ [Uprader](upgrader.md) ++ [The individual upgrade guides](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update) ++ [Upgrader](upgrader.md) + [Ruby](ruby.md) + [Patch versions](patch_versions.md) + [MySQL to PostgreSQL](mysql_to_postgresql.md) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 9a324545eb0..acd1e33f599 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -1,9 +1,96 @@ -# Use the shell commands below to convert a MySQL GitLab database to a PostgreSQL one. +# Migrating GitLab from MySQL to Postgres + +If you are replacing MySQL with Postgres while keeping GitLab on the same +server all you need to do is to export from MySQL, import into Postgres and +rebuild the indexes as described below. If you are also moving GitLab to +another server, or if you are switching to omnibus-gitlab, you may want to use +a GitLab backup file. The second part of this documents explains the procedure +to do this. + +## Export from MySQL and import into Postgres + +Use this if you are keeping GitLab on the same server. ``` -git clone https://github.com/lanyrd/mysql-postgresql-converter.git +sudo service gitlab stop + +# Update /home/git/gitlab/config/database.yml + +git clone https://github.com/gitlabhq/mysql-postgresql-converter.git cd mysql-postgresql-converter mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production python db_converter.py databasename.mysql databasename.psql psql -f databasename.psql -d gitlabhq_production + +# Rebuild indexes (see below) + +sudo service gitlab start +``` + + +## Rebuild indexes + +The lanyrd database converter script does not preserve all indexes, so we have +to recreate them ourselves after migrating from MySQL. It is not necessary to +shut down GitLab for this process. + +``` +# Clone the database converter on your Postgres-backed GitLab server +cd /tmp +git clone https://github.com/gitlabhq/mysql-postgresql-converter.git + +# Stash changes to db/schema.rb to make sure we can find the right index statements +cd /home/git/gitlab +sudo -u git -H git stash + +# Generate the `CREATE INDEX CONCURRENTLY` statements based on schema.rb +cd /tmp/mysql-to-postgresql-converter +ruby index_create_statements.rb /home/git/gitlab/db/schema.rb > index_create_statements.psql + +# Execute the SQL statements against the GitLab database +sudo -u git psql -f index_create_statements.psql -d gitlabhq_production +``` + +## Converting a GitLab backup file from MySQL to Postgres + +GitLab backup files (<timestamp>_gitlab_backup.tar) contain a SQL dump. Using +the lanyrd database converter we can replace a MySQL database dump inside the +tar file with a Postgres database dump. This can be useful if you are moving to +another server. + +``` +# Stop GitLab +sudo service gitlab stop + +# Create the backup +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production + +# Note the filename of the backup that was created. We will call it +# TIMESTAMP_gitlab_backup.tar below. + +# Move the backup file we will convert to its own directory +sudo -u git -H mkdir -p tmp/backups/postgresql +sudo -u git -H mv tmp/backups/TIMESTAMP_gitlab_backup.tar tmp/backups/postgresql/ + +# Create a separate database dump with PostgreSQL compatibility +cd tmp/backups/postgresql +sudo -u git -H mysqldump --compatible=postgresql --default-character-set=utf8 -r gitlabhq_production.mysql -u root gitlabhq_production + +# Clone the database converter +sudo -u git -H git clone https://github.com/lanyrd/mysql-postgresql-converter.git + +# Convert gitlabhq_production.mysql +sudo -u git -H mkdir db +sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_production.mysql db/database.sql + +# Replace the MySQL dump in TIMESTAMP_gitlab_backup.tar. + +# Warning: if you forget to replace TIMESTAMP below, tar will create a new file +# 'TIMESTAMP_gitlab_backup.tar' without giving an error. + +sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql + +# Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab +# installation. Remember to recreate the indexes after the import. ``` diff --git a/doc/update/ruby.md b/doc/update/ruby.md index 9d0cafb3f05..e98167f6b66 100644 --- a/doc/update/ruby.md +++ b/doc/update/ruby.md @@ -1,6 +1,6 @@ # Updating Ruby from source -This guide explains how to update Ruby in case you installed it from source according to the instructions in https://gitlab.com/gitlab-org/gitlab-ce/blob/masterdoc/install/installation.md#2-ruby . +This guide explains how to update Ruby in case you installed it from source according to the [instructions](../install/installation.md#2-ruby). ### 1. Look for Ruby versions This guide will only update `/usr/local/bin/ruby`. You can see which Ruby binaries are installed on your system by running: @@ -36,7 +36,7 @@ sudo gem install bundler ``` ### 5. Reinstall GitLab gem bundle -Just to be sure we will reinstall the gems used by GitLab. Note that the `bundle install` command [depends on your choice of database](https://gitlab.com/gitlab-org/gitlab-ce/blob/masterdoc/install/installation.md#install-gems). +Just to be sure we will reinstall the gems used by GitLab. Note that the `bundle install` command [depends on your choice of database](../install/installation.md#install-gems). ```bash cd /home/git/gitlab diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md index fd45154ac82..72a94f67b3c 100644 --- a/doc/update/upgrader.md +++ b/doc/update/upgrader.md @@ -46,4 +46,8 @@ If all items are green, then congratulations upgrade is complete! You've read through the entire guide, and probably did all the steps manually. Here is a one liner for convenience, the next time you upgrade: - cd /home/git/gitlab; sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; sudo service gitlab stop; sudo -u git -H ruby script/upgrade.rb -y; sudo service gitlab start; sudo service nginx restart; sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production +```bash +cd /home/git/gitlab; sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; \ + sudo service gitlab stop; sudo -u git -H ruby script/upgrade.rb -y; sudo service gitlab start; \ + sudo service nginx restart; sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production +``` diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index f80891e264d..4c06bc4d444 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -2,16 +2,16 @@ Project web hooks allow you to trigger an URL if new code is pushed or a new iss --- -You can configure web hook to listen for specific events like pushes, issues, merge requests. -GitLab will send POST request with data to web hook URL. -Web Hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. +You can configure web hooks to listen for specific events like pushes, issues or merge requests. +GitLab will send a POST request with data to the web hook URL. +Web hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. If you send a web hook to an SSL endpoint [the certificate will not be verified](https://gitlab.com/gitlab-org/gitlab-ce/blob/ccd617e58ea71c42b6b073e692447d0fe3c00be6/app/models/web_hook.rb#L35) since many people use self-signed certificates. --- #### Push events -Triggered when you push to the repository except pushing tags. +Triggered when you push to the repository except when pushing tags. **Request body:** @@ -25,16 +25,16 @@ Triggered when you push to the repository except pushing tags. "project_id": 15, "repository": { "name": "Diaspora", - "url": "git@localhost:diaspora.git", + "url": "git@example.com:diaspora.git", "description": "", - "homepage": "http://localhost/diaspora" + "homepage": "http://example.com/diaspora" }, "commits": [ { "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "message": "Update Catalan translation to e38cb41.", "timestamp": "2011-12-12T14:27:31+02:00", - "url": "http://localhost/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", + "url": "http://example.com/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "author": { "name": "Jordi Mallach", "email": "jordi@softcatala.org" @@ -44,7 +44,7 @@ Triggered when you push to the repository except pushing tags. "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "message": "fixed readme", "timestamp": "2012-01-03T23:36:29+02:00", - "url": "http://localhost/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "url": "http://example.com/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "author": { "name": "GitLab dev user", "email": "gitlabdev@dv6700.(none)" @@ -84,7 +84,7 @@ Triggered when a new issue is created or an existing issue was updated/closed/re #### Merge request events -Triggered when a new merge request is created or an existing merge request was updated/merges/closed. +Triggered when a new merge request is created or an existing merge request was updated/merged/closed. **Request body:** @@ -112,3 +112,34 @@ Triggered when a new merge request is created or an existing merge request was u } } ``` + +#### Example webhook receiver + +If you want to see GitLab's webhooks in action for testing purposes you can use +a simple echo script running in a console session. + +Save the following file as `print_http_body.rb`. + +```ruby +require 'webrick' + +server = WEBrick::HTTPServer.new(Port: ARGV.first) +server.mount_proc '/' do |req, res| + puts req.body +end + +trap 'INT' do server.shutdown end +server.start +``` + +Pick an unused port (e.g. 8000) and start the script: `ruby print_http_body.rb +8000`. Then add your server as a webhook receiver in GitLab as +`http://my.host:8000/`. + +When you press 'Test Hook' in GitLab, you should see something like this in the console. + +``` +{"before":"077a85dd266e6f3573ef7e9ef8ce3343ad659c4e","after":"95cd4a99e93bc4bbabacfa2cd10e6725b1403c60",<SNIP>} +example.com - - [14/May/2014:07:45:26 EDT] "POST / HTTP/1.1" 200 0 +- -> / +``` |