...@@ -74,7 +74,7 @@ module IssuablesHelper ...@@ -74,7 +74,7 @@ module IssuablesHelper
end end
end end
def serialize_issuable(issuable, serializer: nil) def serialize_issuable(issuable, opts = {})
serializer_klass = case issuable serializer_klass = case issuable
when Issue when Issue
IssueSerializer IssueSerializer
...@@ -84,7 +84,7 @@ module IssuablesHelper ...@@ -84,7 +84,7 @@ module IssuablesHelper
serializer_klass serializer_klass
.new(current_user: current_user, project: issuable.project) .new(current_user: current_user, project: issuable.project)
.represent(issuable, serializer: serializer) .represent(issuable, opts)
.to_json .to_json
end end
... ...
......
...@@ -60,7 +60,7 @@ module Emails ...@@ -60,7 +60,7 @@ module Emails
# `note_id` is a `Note` when originating in `NotifyPreview` # `note_id` is a `Note` when originating in `NotifyPreview`
@note = note_id.is_a?(Note) ? note_id : Note.find(note_id) @note = note_id.is_a?(Note) ? note_id : Note.find(note_id)
@project = @note.project @project = @note.project
@group = @note.noteable.try(:group) @group = @project.try(:group) || @note.noteable.try(:group)
if (@project || @group) && @note.persisted? if (@project || @group) && @note.persisted?
@sent_notification = SentNotification.record_note(@note, recipient_id, reply_key) @sent_notification = SentNotification.record_note(@note, recipient_id, reply_key)
... ...
......
...@@ -254,6 +254,10 @@ class Issue < ApplicationRecord ...@@ -254,6 +254,10 @@ class Issue < ApplicationRecord
merge_requests_closing_issues.count merge_requests_closing_issues.count
end end
def labels_hook_attrs
labels.map(&:hook_attrs)
end
private private
def ensure_metrics def ensure_metrics
... ...
......
...@@ -457,7 +457,7 @@ class Note < ApplicationRecord ...@@ -457,7 +457,7 @@ class Note < ApplicationRecord
end end
def banzai_render_context(field) def banzai_render_context(field)
super.merge(noteable: noteable) super.merge(noteable: noteable, system_note: system?)
end end
def retrieve_upload(_identifier, paths) def retrieve_upload(_identifier, paths)
... ...
......
...@@ -114,7 +114,10 @@ class MergeRequestWidgetEntity < IssuableEntity ...@@ -114,7 +114,10 @@ class MergeRequestWidgetEntity < IssuableEntity
presenter(merge_request).ci_status presenter(merge_request).ci_status
end end
expose :issues_links do # Rendering and redacting Markdown can be expensive. These links are
# just nice to have in the merge request widget, so only
# include them if they are explicitly requested on first load.
expose :issues_links, if: -> (_, opts) { opts[:issues_links] } do
expose :assign_to_closing do |merge_request| expose :assign_to_closing do |merge_request|
presenter(merge_request).assign_to_closing_issues_link presenter(merge_request).assign_to_closing_issues_link
end end
... ...
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
-# haml-lint:disable InlineJavaScript -# haml-lint:disable InlineJavaScript
:javascript :javascript
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.mrWidgetData = #{serialize_issuable(@merge_request, serializer: 'widget')} window.gl.mrWidgetData = #{serialize_issuable(@merge_request, serializer: 'widget', issues_links: true)}
window.gl.mrWidgetData.squash_before_merge_help_path = '#{help_page_path("user/project/merge_requests/squash_and_merge")}'; window.gl.mrWidgetData.squash_before_merge_help_path = '#{help_page_path("user/project/merge_requests/squash_and_merge")}';
window.gl.mrWidgetData.troubleshooting_docs_path = '#{help_page_path('user/project/merge_requests/index.md', anchor: 'troubleshooting')}'; window.gl.mrWidgetData.troubleshooting_docs_path = '#{help_page_path('user/project/merge_requests/index.md', anchor: 'troubleshooting')}';
... ...
......
---
title: Fix missing API notification flags for Microsoft Teams
merge_request: 29824
author: Seiji Suenaga
type: fixed
---
title: Include the GitLab version in the cache key for Gitlab::JsonCache
merge_request: 29938
author:
type: fixed
---
title: Fixed 'diff version changes' link not working
merge_request: 29825
author:
type: fixed
---
title: Fix label serialization in issue and note hooks
merge_request: 29850
author:
type: fixed
---
title: Fix comment emails not respecting group-level notification email
merge_request:
author:
type: fixed
---
title: Omit issues links in merge request entity API response
merge_request: 29917
author:
type: performance
---
title: Silence backup warnings when CRON=1 in use
merge_request: 30033
author:
type: fixed
---
title: Prevent EE backport migrations from running if CE is not migrated
merge_request: 30002
author:
type: fixed
...@@ -117,6 +117,8 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] ...@@ -117,6 +117,8 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
end end
def up def up
check_schema!
create_missing_tables create_missing_tables
update_appearances update_appearances
...@@ -868,6 +870,52 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] ...@@ -868,6 +870,52 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
remove_column_if_exists(:geo_nodes, :internal_url) remove_column_if_exists(:geo_nodes, :internal_url)
end end
# Some users may have upgraded to EE at some point but downgraded to
# CE v11.11.3. As a result, their EE tables may not be in the right
# state. Here we check for these such cases and attempt to guide the
# user into recovering from this state by upgrading to v11.11.3 EE
# before installing v12.0.0 CE.
def check_schema!
# The following cases will fail later when this migration attempts
# to add a foreign key for non-existent columns.
columns_to_check = [
[:epics, :parent_id], # Added in GitLab 11.7
[:geo_event_log, :cache_invalidation_event_id], # Added in GitLab 11.4
[:vulnerability_feedback, :merge_request_id] # Added in GitLab 11.9
].freeze
columns_to_check.each do |table, column|
check_ee_columns!(table, column)
end
end
def check_ee_columns!(table, column)
return unless table_exists?(table)
return if column_exists?(table, column)
raise_ee_migration_error!(table, column)
end
def raise_ee_migration_error!(table, column)
message = "Your database is missing the '#{column}' column from the '#{table}' table that is present for GitLab EE."
message +=
if ::Gitlab.ee?
"\nUpgrade your GitLab instance to 11.11.3 EE first!"
else
<<~MSG
Even though it looks like you're running a CE installation, it appears
you may have installed GitLab EE at some point. To migrate to GitLab 12.0:
1. Install GitLab 11.11.3 EE
2. Install GitLab 12.0.x CE
MSG
end
raise Exception.new(message)
end
def create_missing_tables def create_missing_tables
create_table_if_not_exists "approval_merge_request_rule_sources", id: :bigserial do |t| create_table_if_not_exists "approval_merge_request_rule_sources", id: :bigserial do |t|
t.bigint "approval_merge_request_rule_id", null: false t.bigint "approval_merge_request_rule_id", null: false
... ...
......
...@@ -65,6 +65,7 @@ larger one. ...@@ -65,6 +65,7 @@ larger one.
- 1 Redis node - 1 Redis node
- 1 NFS/Gitaly storage server - 1 NFS/Gitaly storage server
- 2 or more GitLab application nodes (Unicorn, Workhorse, Sidekiq) - 2 or more GitLab application nodes (Unicorn, Workhorse, Sidekiq)
- 1 Monitoring node (Prometheus, Grafana)
#### Installation Instructions #### Installation Instructions
...@@ -76,6 +77,7 @@ you can continue with the next step. ...@@ -76,6 +77,7 @@ you can continue with the next step.
1. [Redis](redis.md#redis-in-a-scaled-environment) 1. [Redis](redis.md#redis-in-a-scaled-environment)
1. [Gitaly](gitaly.md) (recommended) or [NFS](nfs.md) 1. [Gitaly](gitaly.md) (recommended) or [NFS](nfs.md)
1. [GitLab application nodes](gitlab.md) 1. [GitLab application nodes](gitlab.md)
1. [Monitoring node (Prometheus and Grafana)](monitoring_node.md)
### Full Scaling ### Full Scaling
...@@ -90,6 +92,7 @@ in size, indicating that there is contention or not enough resources. ...@@ -90,6 +92,7 @@ in size, indicating that there is contention or not enough resources.
- 2 or more NFS/Gitaly storage servers - 2 or more NFS/Gitaly storage servers
- 2 or more Sidekiq nodes - 2 or more Sidekiq nodes
- 2 or more GitLab application nodes (Unicorn, Workhorse) - 2 or more GitLab application nodes (Unicorn, Workhorse)
- 1 Monitoring node (Prometheus, Grafana)
## High Availability Architecture Examples ## High Availability Architecture Examples
...@@ -133,6 +136,7 @@ the contention. ...@@ -133,6 +136,7 @@ the contention.
- 3 Consul/Sentinel nodes - 3 Consul/Sentinel nodes
- 2 or more GitLab application nodes (Unicorn, Workhorse, Sidekiq, PGBouncer) - 2 or more GitLab application nodes (Unicorn, Workhorse, Sidekiq, PGBouncer)
- 1 NFS/Gitaly server - 1 NFS/Gitaly server
- 1 Monitoring node (Prometheus, Grafana)
![Horizontal architecture diagram](img/horizontal.png) ![Horizontal architecture diagram](img/horizontal.png)
...@@ -192,6 +196,7 @@ with the added complexity of many more nodes to configure, manage and monitor. ...@@ -192,6 +196,7 @@ with the added complexity of many more nodes to configure, manage and monitor.
- 2 or more API nodes (All requests to `/api`) - 2 or more API nodes (All requests to `/api`)
- 2 or more Web nodes (All other web requests) - 2 or more Web nodes (All other web requests)
- 2 or more NFS/Gitaly servers - 2 or more NFS/Gitaly servers
- 1 Monitoring node (Prometheus, Grafana)
![Fully Distributed architecture diagram](img/fully-distributed.png) ![Fully Distributed architecture diagram](img/fully-distributed.png)
...@@ -205,4 +210,5 @@ separately: ...@@ -205,4 +210,5 @@ separately:
1. [NFS Client and Host setup](nfs_host_client_setup.md) 1. [NFS Client and Host setup](nfs_host_client_setup.md)
1. [Configure the GitLab application servers](gitlab.md) 1. [Configure the GitLab application servers](gitlab.md)
1. [Configure the load balancers](load_balancer.md) 1. [Configure the load balancers](load_balancer.md)
1. [Monitoring node (Prometheus and Grafana)](monitoring_node.md)
...@@ -82,6 +82,7 @@ deploy the bundled PostgreSQL. ...@@ -82,6 +82,7 @@ deploy the bundled PostgreSQL.
1. Note the PostgreSQL node's IP address or hostname, port, and 1. Note the PostgreSQL node's IP address or hostname, port, and
plain text password. These will be necessary when configuring the GitLab plain text password. These will be necessary when configuring the GitLab
application servers later. application servers later.
1. [Enable monitoring](#enable-monitoring)
Advanced configuration options are supported and can be added if Advanced configuration options are supported and can be added if
needed. needed.
...@@ -399,6 +400,7 @@ check the [Troubleshooting section](#troubleshooting) before proceeding. ...@@ -399,6 +400,7 @@ check the [Troubleshooting section](#troubleshooting) before proceeding.
``` ```
1. [Reconfigure GitLab] for the changes to take effect. 1. [Reconfigure GitLab] for the changes to take effect.
1. [Enable Monitoring](#enable-monitoring)
> Please note: > Please note:
> >
...@@ -1086,6 +1088,25 @@ the previous section: ...@@ -1086,6 +1088,25 @@ the previous section:
the `gitlab` database user the `gitlab` database user
1. [Reconfigure GitLab] for the changes to take effect 1. [Reconfigure GitLab] for the changes to take effect
## Enable Monitoring
> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0.
If you enable Monitoring, it must be enabled on **all** database servers.
1. Create/edit `/etc/gitlab/gitlab.rb` and add the following configuration:
```ruby
# Enable service discovery for Prometheus
consul['monitoring_service_discovery'] = true
# Set the network addresses that the exporters will listen on
node_exporter['listen_address'] = '0.0.0.0:9100'
postgres_exporter['listen_address'] = '0.0.0.0:9187'
```
1. Run `sudo gitlab-ctl reconfigure` to compile the configuration.
## Troubleshooting ## Troubleshooting
#### Consul and PostgreSQL changes not taking effect. #### Consul and PostgreSQL changes not taking effect.
... ...
......
...@@ -19,3 +19,28 @@ Continue configuration of other components by going back to: ...@@ -19,3 +19,28 @@ Continue configuration of other components by going back to:
- [Scaled Architectures](README.md#scalable-architecture-examples) - [Scaled Architectures](README.md#scalable-architecture-examples)
- [High Availability Architectures](README.md#high-availability-architecture-examples) - [High Availability Architectures](README.md#high-availability-architecture-examples)
## Enable Monitoring
> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0.
1. Create/edit `/etc/gitlab/gitlab.rb` and add the following configuration:
```ruby
# Enable service discovery for Prometheus
consul['enable'] = true
consul['monitoring_service_discovery'] = true
# Replace placeholders
# Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z
# with the addresses of the Consul server nodes
consul['configuration'] = {
retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z),
}
# Set the network addresses that the exporters will listen on
node_exporter['listen_address'] = '0.0.0.0:9100'
gitaly['prometheus_listen_addr'] = "0.0.0.0:9236"
```
1. Run `sudo gitlab-ctl reconfigure` to compile the configuration.
...@@ -76,6 +76,8 @@ ...@@ -76,6 +76,8 @@
registry['gid'] = 9002 registry['gid'] = 9002
``` ```
1. [Enable monitoring](#enable-monitoring)
> **Note:** To maintain uniformity of links across HA clusters, the `external_url` > **Note:** To maintain uniformity of links across HA clusters, the `external_url`
on the first application server as well as the additional application on the first application server as well as the additional application
servers should point to the external url that users will use to access GitLab. servers should point to the external url that users will use to access GitLab.
...@@ -88,7 +90,8 @@ ...@@ -88,7 +90,8 @@
[Nginx documentation](http://docs.gitlab.com/omnibus/settings/nginx.html#enable-https) [Nginx documentation](http://docs.gitlab.com/omnibus/settings/nginx.html#enable-https)
for more information. for more information.
> >
> **Note:** It is best to set the `uid` and `gid`s prior to the initial reconfigure of GitLab. Omnibus will not recursively `chown` directories if set after the initial reconfigure. > **Note:** It is best to set the `uid` and `gid`s prior to the initial reconfigure
of GitLab. Omnibus will not recursively `chown` directories if set after the initial reconfigure.
## First GitLab application server ## First GitLab application server
...@@ -129,6 +132,46 @@ need some extra configuration. ...@@ -129,6 +132,46 @@ need some extra configuration.
1. Run `sudo gitlab-ctl reconfigure` to compile the configuration. 1. Run `sudo gitlab-ctl reconfigure` to compile the configuration.
## Enable Monitoring
> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0.
If you enable Monitoring, it must be enabled on **all** GitLab servers.
1. Create/edit `/etc/gitlab/gitlab.rb` and add the following configuration:
```ruby
# Enable service discovery for Prometheus
consul['enable'] = true
consul['monitoring_service_discovery'] = true
# Replace placeholders
# Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z
# with the addresses of the Consul server nodes
consul['configuration'] = {
retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z),
}
# Set the network addresses that the exporters will listen on
node_exporter['listen_address'] = '0.0.0.0:9100'
gitlab_workhorse['prometheus_listen_addr'] = '0.0.0.0:9229'
sidekiq['listen_address'] = "0.0.0.0"
unicorn['listen'] = '0.0.0.0'
# Add the monitoring node's IP address to the monitoring whitelist and allow it to scrape the NGINX metrics
# Replace placeholder
# monitoring.gitlab.example.com
# with the addresses gathered for the monitoring node
gitlab_rails['monitoring_whitelist'] = ['monitoring.gitlab.example.com']
nginx['status']['options']['allow'] = ['monitoring.gitlab.example.com']
```
1. Run `sudo gitlab-ctl reconfigure` to compile the configuration.
> **Warning:** After changing `unicorn['listen']` in `gitlab.rb`, and running `sudo gitlab-ctl reconfigure`,
it can take an extended period of time for unicorn to complete reloading after receiving a `HUP`.
For more information, see the [issue](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4401).
## Troubleshooting ## Troubleshooting
- `mount: wrong fs type, bad option, bad superblock on` - `mount: wrong fs type, bad option, bad superblock on`
... ...
......
# Configuring a Monitoring node for Scaling and High Availability
> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0.
## Standalone Monitoring node using GitLab Omnibus
The GitLab Omnibus package can be used to configure a standalone Monitoring node running Prometheus and Grafana.
The monitoring node is not highly available. See [Scaling and High Availability](README.md)
for an overview of GitLab scaling and high availability options.
The steps below are the minimum necessary to configure a Monitoring node running Prometheus and Grafana with
Omnibus:
1. SSH into the Monitoring node.
1. [Download/install](https://about.gitlab.com/installation) the Omnibus GitLab
package you want using **steps 1 and 2** from the GitLab downloads page.
- Do not complete any other steps on the download page.
1. Edit `/etc/gitlab/gitlab.rb` and add the contents:
```ruby
external_url 'http://gitlab.example.com'
# Enable Prometheus
prometheus['enable'] = true
prometheus['listen_address'] = '0.0.0.0:9090'
prometheus['monitor_kubernetes'] = false
# Enable Grafana
grafana['enable'] = true
grafana['admin_password'] = 'toomanysecrets'
# Enable service discovery for Prometheus
consul['enable'] = true
consul['monitoring_service_discovery'] = true
# Replace placeholders
# Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z
# with the addresses of the Consul server nodes
consul['configuration'] = {
retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z),
}
# Disable all other services
gitlab_rails['auto_migrate'] = false
alertmanager['enable'] = false
gitaly['enable'] = false
gitlab_monitor['enable'] = false
gitlab_workhorse['enable'] = false
nginx['enable'] = true
postgres_exporter['enable'] = false
postgresql['enable'] = false
redis['enable'] = false
redis_exporter['enable'] = false
sidekiq['enable'] = false
unicorn['enable'] = false
node_exporter['enable'] = false
```
1. Run `sudo gitlab-ctl reconfigure` to compile the configuration.
## Migrating to Service Discovery
Once monitoring using Service Discovery is enabled with `consul['monitoring_service_discovery'] = true`,
ensure that `prometheus['scrape_configs']` is not set in `/etc/gitlab/gitlab.rb`. Setting both
`consul['monitoring_service_discovery'] = true` and `prometheus['scrape_configs']` in `/etc/gitlab/gitlab.rb`
will result in errors.