Commit 91d78fd2 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge remote-tracking branch 'ee/master' into ce-to-ee-2017-09-08

* ee/master:
  index project settings doc from other indexes
  copyedit
  fixes link
  Add a unique index on project_id to the Geo project_registry table
  Update K8s docs to match CE
  Merge branch 'docs-new-topic-projects-settings' into 'master'
  fix small typos in ldap.md
  add ce to ee instructions for 10.0
parents 6ad65d08 d9f96cbc
class Geo::ProjectRegistry < Geo::BaseRegistry class Geo::ProjectRegistry < Geo::BaseRegistry
belongs_to :project belongs_to :project
validates :project, presence: true validates :project, presence: true, uniqueness: true
scope :dirty, -> { where(arel_table[:resync_repository].eq(true).or(arel_table[:resync_wiki].eq(true))) } scope :dirty, -> { where(arel_table[:resync_repository].eq(true).or(arel_table[:resync_wiki].eq(true))) }
......
---
title: Geo - Add a unique index on project_id to the Geo project_registry table
merge_request: 2850
author:
type: fixed
class RemoveDuplicatesFromProjectRegistry < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
execute <<-SQL
WITH good_rows AS (
SELECT project_id, MAX(id) as max_id
FROM project_registry
GROUP BY project_id
HAVING COUNT(*) > 1
)
DELETE FROM project_registry duplicated_rows
USING good_rows
WHERE good_rows.project_id = duplicated_rows.project_id
AND good_rows.max_id <> duplicated_rows.id;
SQL
end
def down
end
end
class AddUniqueIndexToProjectIdOnProjectRegistry < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
remove_concurrent_index :project_registry, :project_id if index_exists? :project_registry, :project_id
add_concurrent_index :project_registry, :project_id, unique: true
end
def down
remove_concurrent_index :project_registry, :project_id if index_exists? :project_registry, :project_id
add_concurrent_index :project_registry, :project_id
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170627195211) do ActiveRecord::Schema.define(version: 20170906182752) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -43,7 +43,7 @@ ActiveRecord::Schema.define(version: 20170627195211) do ...@@ -43,7 +43,7 @@ ActiveRecord::Schema.define(version: 20170627195211) do
add_index "project_registry", ["last_repository_successful_sync_at"], name: "index_project_registry_on_last_repository_successful_sync_at", using: :btree add_index "project_registry", ["last_repository_successful_sync_at"], name: "index_project_registry_on_last_repository_successful_sync_at", using: :btree
add_index "project_registry", ["last_repository_synced_at"], name: "index_project_registry_on_last_repository_synced_at", using: :btree add_index "project_registry", ["last_repository_synced_at"], name: "index_project_registry_on_last_repository_synced_at", using: :btree
add_index "project_registry", ["project_id"], name: "index_project_registry_on_project_id", using: :btree add_index "project_registry", ["project_id"], name: "index_project_registry_on_project_id", unique: true, using: :btree
add_index "project_registry", ["resync_repository"], name: "index_project_registry_on_resync_repository", using: :btree add_index "project_registry", ["resync_repository"], name: "index_project_registry_on_resync_repository", using: :btree
add_index "project_registry", ["resync_wiki"], name: "index_project_registry_on_resync_wiki", using: :btree add_index "project_registry", ["resync_wiki"], name: "index_project_registry_on_resync_wiki", using: :btree
......
...@@ -53,6 +53,7 @@ Shortcuts to GitLab's most visited docs: ...@@ -53,6 +53,7 @@ Shortcuts to GitLab's most visited docs:
### Projects and groups ### Projects and groups
- [Projects](user/project/index.md): - [Projects](user/project/index.md):
- [Project settings](user/project/settings/index.md)
- [Create a project](gitlab-basics/create-project.md) - [Create a project](gitlab-basics/create-project.md)
- [Fork a project](gitlab-basics/fork-project.md) - [Fork a project](gitlab-basics/fork-project.md)
- [Importing and exporting projects between instances](user/project/settings/import_export.md). - [Importing and exporting projects between instances](user/project/settings/import_export.md).
...@@ -73,18 +74,19 @@ Shortcuts to GitLab's most visited docs: ...@@ -73,18 +74,19 @@ Shortcuts to GitLab's most visited docs:
Manage your [repositories](user/project/repository/index.md) from the UI (user interface): Manage your [repositories](user/project/repository/index.md) from the UI (user interface):
- Files - [Files](user/project/repository/index.md#files)
- [Create a file](user/project/repository/web_editor.md#create-a-file) - [Create a file](user/project/repository/web_editor.md#create-a-file)
- [Upload a file](user/project/repository/web_editor.md#upload-a-file) - [Upload a file](user/project/repository/web_editor.md#upload-a-file)
- [File templates](user/project/repository/web_editor.md#template-dropdowns) - [File templates](user/project/repository/web_editor.md#template-dropdowns)
- [Create a directory](user/project/repository/web_editor.md#create-a-directory) - [Create a directory](user/project/repository/web_editor.md#create-a-directory)
- [Start a merge request](user/project/repository/web_editor.md#tips) (when committing via UI) - [Start a merge request](user/project/repository/web_editor.md#tips) (when committing via UI)
- **(EES/EEP)** [Lock a file](user/project/file_lock.md): Lock a file to avoid merge conflicts. - **(EES/EEP)** [Lock a file](user/project/file_lock.md): Lock a file to avoid merge conflicts.
- Branches - [Branches](user/project/repository/branches/index.md)
- [Default branch](user/project/repository/branches/index.md#default-branch)
- [Create a branch](user/project/repository/web_editor.md#create-a-new-branch) - [Create a branch](user/project/repository/web_editor.md#create-a-new-branch)
- [Protected branches](user/project/protected_branches.md#protected-branches) - [Protected branches](user/project/protected_branches.md#protected-branches)
- [Delete merged branches](user/project/repository/branches/index.md#delete-merged-branches) - [Delete merged branches](user/project/repository/branches/index.md#delete-merged-branches)
- Commits - [Commits](user/project/repository/index.md#commits)
- [Signing commits](user/project/repository/gpg_signed_commits/index.md): use GPG to sign your commits. - [Signing commits](user/project/repository/gpg_signed_commits/index.md): use GPG to sign your commits.
- **(EES/EEP)** [Repository Mirroring](workflow/repository_mirroring.md) - **(EES/EEP)** [Repository Mirroring](workflow/repository_mirroring.md)
- **(EES/EEP)** [Push rules](push_rules/push_rules.md): Additional control over pushes to your project. - **(EES/EEP)** [Push rules](push_rules/push_rules.md): Additional control over pushes to your project.
......
...@@ -63,7 +63,7 @@ Copy/paste can sometimes cause problems. ...@@ -63,7 +63,7 @@ Copy/paste can sometimes cause problems.
> **Note:** The `method` value `ssl` corresponds to 'Simple TLS' in the LDAP > **Note:** The `method` value `ssl` corresponds to 'Simple TLS' in the LDAP
library. `tls` corresponds to StartTLS, not to be confused with regular TLS. library. `tls` corresponds to StartTLS, not to be confused with regular TLS.
Normally, if you specify `ssl` is will be on port 636 while `tls` (StartTLS) Normally, if you specify `ssl` it will be on port 636, while `tls` (StartTLS)
would be on port 389. `plain` also operates on port 389. would be on port 389. `plain` also operates on port 389.
**Omnibus configuration** **Omnibus configuration**
...@@ -278,7 +278,7 @@ production: ...@@ -278,7 +278,7 @@ production:
``` ```
Tip: If you want to limit access to the nested members of an Active Directory Tip: If you want to limit access to the nested members of an Active Directory
group you can use the following syntax: group, you can use the following syntax:
``` ```
(memberOf:1.2.840.113556.1.4.1941:=CN=My Group,DC=Example,DC=com) (memberOf:1.2.840.113556.1.4.1941:=CN=My Group,DC=Example,DC=com)
...@@ -294,7 +294,7 @@ omniauth-ldap. ...@@ -294,7 +294,7 @@ omniauth-ldap.
### Escaping special characters ### Escaping special characters
If the `user_filter` DN contains a special characters. For example a comma If the `user_filter` DN contains special characters. For example, a comma:
``` ```
OU=GitLab, Inc,DC=gitlab,DC=com OU=GitLab, Inc,DC=gitlab,DC=com
...@@ -302,7 +302,7 @@ OU=GitLab, Inc,DC=gitlab,DC=com ...@@ -302,7 +302,7 @@ OU=GitLab, Inc,DC=gitlab,DC=com
This character needs to be escaped as documented in [RFC 4515](https://tools.ietf.org/search/rfc4515). This character needs to be escaped as documented in [RFC 4515](https://tools.ietf.org/search/rfc4515).
Due to the way the string is parsed the special character needs to be convered Due to the way the string is parsed, the special character needs to be convered
to hex and `\\5C\\` (`5C` = `\` in hex) added before it. to hex and `\\5C\\` (`5C` = `\` in hex) added before it.
As an example the above DN would look like As an example the above DN would look like
......
# From Community Edition 10.0 to Enterprise Edition 10.0
This guide assumes you have a correctly configured and tested installation of
GitLab Community Edition 10.0. If you run into any trouble or if you have any
questions please contact us at [support@gitlab.com].
### 0. Backup
Make a backup just in case something goes wrong:
```bash
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
```
For installations using MySQL, this may require granting "LOCK TABLES"
privileges to the GitLab user on the database version.
### 1. Stop server
```bash
sudo service gitlab stop
```
### 2. Get the EE code
```bash
cd /home/git/gitlab
sudo -u git -H git remote add -f ee https://gitlab.com/gitlab-org/gitlab-ee.git
sudo -u git -H git checkout 10-0-stable-ee
```
### 3. 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 postgres development test --deployment
# PostgreSQL installations (note: the line below states '--without mysql')
sudo -u git -H bundle install --without mysql development test --deployment
# Run database migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
# Clean up assets and cache
sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
```
### 4. Start application
```bash
sudo service gitlab start
sudo service nginx restart
```
### 5. Check application status
Check if GitLab and its environment are configured correctly:
```bash
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:
```bash
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
```
If all items are green, then congratulations upgrade complete!
## Things went south? Revert to previous version (Community Edition 10.0)
### 1. Revert the code to the previous version
```bash
cd /home/git/gitlab
sudo -u git -H git checkout 10-0-stable
```
### 2. Restore from the backup
```bash
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
```
[support@gitlab.com]: mailto:support@gitlab.com
...@@ -20,6 +20,8 @@ When you create a project in GitLab, you'll have access to a large number of ...@@ -20,6 +20,8 @@ When you create a project in GitLab, you'll have access to a large number of
- [Multiple Issue Boards](https://docs.gitlab.com/ee/user/project/issue_board.html#multiple-issue-boards) (**EES/EEP**): Allow your teams to create their own workflows (Issue Boards) for the same project - [Multiple Issue Boards](https://docs.gitlab.com/ee/user/project/issue_board.html#multiple-issue-boards) (**EES/EEP**): Allow your teams to create their own workflows (Issue Boards) for the same project
- [Repositories](repository/index.md): Host your code in a fully - [Repositories](repository/index.md): Host your code in a fully
integrated platform integrated platform
- [Branches](repository/branches/index.md): use Git branching strategies to
collaborate on code
- [Protected branches](protected_branches.md): Prevent collaborators - [Protected branches](protected_branches.md): Prevent collaborators
from messing with history or pushing code without review from messing with history or pushing code without review
- [Protected tags](protected_tags.md): Control over who has - [Protected tags](protected_tags.md): Control over who has
...@@ -87,6 +89,10 @@ You can [fork a project](../../gitlab-basics/fork-project.md) in order to: ...@@ -87,6 +89,10 @@ You can [fork a project](../../gitlab-basics/fork-project.md) in order to:
from your fork to the upstream project from your fork to the upstream project
- Fork a sample project to work on the top of that - Fork a sample project to work on the top of that
## Project settings
Read through the documentation on [project settings](settings/index.md).
## Import or export a project ## Import or export a project
- [Import a project](import/index.md) from: - [Import a project](import/index.md) from:
......
# Branches # Branches
Read through GiLab's branching documentation:
- [Create a branch](../web_editor.md#create-a-new-branch)
- [Default branch](#default-branch)
- [Protected branches](../../protected_branches.md#protected-branches)
- [Delete merged branches](#delete-merged-branches)
See also:
- [GitLab Flow](../../../../university/training/gitlab_flow.md#gitlab-flow): use the best of GitLab for your branching strategies
- [Getting started with Git](../../../../topics/git/index.md) and GitLab
## Default branch
When you create a new [project](../../index.md), GitLab sets `master` as the default
branch for your project. You can choose another branch to be your project's
default under your project's **Settings > General**.
The default branch is the branched affected by the
[issue closing pattern](../../issues/automatic_issue_closing.md),
which means that _an issue will be closed when a merge request is merged to
the **default branch**_.
The default branch is also protected against accidental deletion. Read through
the documentation on [protected branches](../../protected_branches.md#protected-branches)
to learn more.
## Delete merged branches ## Delete merged branches
> [Introduced][ce-6449] in GitLab 8.14. > [Introduced][ce-6449] in GitLab 8.14.
......
...@@ -55,7 +55,7 @@ Use GitLab's [file finder](../../../workflow/file_finder.md) to search for files ...@@ -55,7 +55,7 @@ Use GitLab's [file finder](../../../workflow/file_finder.md) to search for files
## Branches ## Branches
When you submit changes in a new branch, you create a new version When you submit changes in a new [branch](branches/index.md), you create a new version
of that project's file tree. Your branch contains all the changes of that project's file tree. Your branch contains all the changes
you are presenting, which are detected by Git line by line. you are presenting, which are detected by Git line by line.
...@@ -70,8 +70,9 @@ With [GitLab Enterprise Edition](https://about.gitlab.com/gitlab-ee/) ...@@ -70,8 +70,9 @@ With [GitLab Enterprise Edition](https://about.gitlab.com/gitlab-ee/)
subscriptions, you can also request subscriptions, you can also request
[approval](https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html#merge-request-approvals) from your managers. [approval](https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html#merge-request-approvals) from your managers.
To create, delete, and branches via GitLab's UI: To create, delete, and [branches](branches/index.md) via GitLab's UI:
- [Default branches](branches/index.md#default-branch)
- [Create a branch](web_editor.md#create-a-new-branch) - [Create a branch](web_editor.md#create-a-new-branch)
- [Protected branches](../protected_branches.md#protected-branches) - [Protected branches](../protected_branches.md#protected-branches)
- [Delete merged branches](branches/index.md#delete-merged-branches) - [Delete merged branches](branches/index.md#delete-merged-branches)
......
# Project settings
You can adjust your [project](../index.md) settings by navigating
to your project's homepage and clicking **Settings**.
## General settings
Adjust your project's path and name, description, avatar, [default branch](../repository/branches/index.md#default-branch), and tags:
![general project settings](img/general_settings.png)
### Sharing and permissions
Set up your project's access, [visibility](../../../public_access/public_access.md), and enable [Container Registry](../container_registry.md) for your projects:
![projects sharing permissions](img/sharing_and_permissions_settings.png)
### Issue settings
Add an [issue description template](../description_templates.md#description-templates) to your project, so that every new issue will start with a custom template.
### Merge request settings
Set up your project's merge request settings:
- Set up the merge request method (merge commit, [fast-forward merge](https://docs.gitlab.com/ee/user/project/merge_requests/fast_forward_merge.html#fast-forward-merge-requests)). _Fast-forward is available in [GitLab Enterprise Edition Starter](https://about.gitlab.com/gitlab-ee/)._
- Merge request [description templates](../description_templates.md#description-templates).
- Enable [merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html#merge-request-approvals), _available in [GitLab Enterprise Edition Starter](https://about.gitlab.com/gitlab-ee/)_.
- Enable [merge only of pipeline succeeds](../merge_requests/merge_when_pipeline_succeeds.md).
- Enable [merge only when all discussions are resolved](../../discussions/index.md#only-allow-merge-requests-to-be-merged-if-all-discussions-are-resolved).
![project's merge request settings](img/merge_requests_settings.png)
### Service Desk
Enable [Service Desk](https://docs.gitlab.com/ee/user/project/service_desk.html) for your project to offer customer support. Service Desk is available in [GitLab Enterprise Edition Premium](https://about.gitlab.com/gitlab-ee/).
### Export project
Learn how to [export a project](import_export.md#importing-the-project) in GitLab.
### Advanced settings
Here you can run housekeeping, archive, rename, transfer, or remove a project.
require 'spec_helper' require 'spec_helper'
describe Geo::ProjectRegistry do describe Geo::ProjectRegistry do
subject { create(:geo_project_registry) }
describe 'relationships' do describe 'relationships' do
it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:project) }
end end
describe 'validations' do describe 'validations' do
it { is_expected.to validate_presence_of(:project) } it { is_expected.to validate_presence_of(:project) }
it { is_expected.to validate_uniqueness_of(:project) }
end end
describe '.failed' do describe '.failed' do
it 'returns projects where last attempt to sync failed' do it 'returns projects where last attempt to sync failed' do
project = create(:project) create(:geo_project_registry, :synced)
create(:geo_project_registry, :synced, project: project) create(:geo_project_registry, :synced, :dirty)
create(:geo_project_registry, :synced, :dirty, project: project) repository_sync_failed = create(:geo_project_registry, :repository_sync_failed)
repository_sync_failed = create(:geo_project_registry, :repository_sync_failed, project: project) wiki_sync_failed = create(:geo_project_registry, :wiki_sync_failed)
wiki_sync_failed = create(:geo_project_registry, :wiki_sync_failed, project: project)
expect(described_class.failed).to match_array([repository_sync_failed, wiki_sync_failed]) expect(described_class.failed).to match_array([repository_sync_failed, wiki_sync_failed])
end end
...@@ -23,10 +25,9 @@ describe Geo::ProjectRegistry do ...@@ -23,10 +25,9 @@ describe Geo::ProjectRegistry do
describe '.synced' do describe '.synced' do
it 'returns synced projects' do it 'returns synced projects' do
project = create(:project) create(:geo_project_registry, :synced, :dirty)
create(:geo_project_registry, :synced, :dirty, project: project) create(:geo_project_registry, :sync_failed)
create(:geo_project_registry, :sync_failed, project: project) synced_project = create(:geo_project_registry, :synced)
synced_project = create(:geo_project_registry, :synced, project: project)
expect(described_class.synced).to match_array([synced_project]) expect(described_class.synced).to match_array([synced_project])
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment