Merge branch '2952-roles-for-pg-ha' into 'master'
Resolve "Use roles for PG HA components" See merge request gitlab-org/omnibus-gitlab!2134
This commit is contained in:
commit
d7d0f32abf
|
@ -74,3 +74,23 @@ for configuration steps.
|
|||
application as a Geo Secondary
|
||||
|
||||
*By default, enables all of GitLab's default single node services. (Nginx, Unicorn, Redis, Sidekiq, etc)*
|
||||
|
||||
### Postgres Roles
|
||||
|
||||
Documentation on the user of the Postgres Roles can be found in [Configuring Postgres HA](https://docs.gitlab.com/ee/administration/high_availability/database.html#configure-using-omnibus-for-high-availability)
|
||||
|
||||
- **postgres_role**
|
||||
|
||||
Enables the postgresql, repmgr, and consul services on the machine
|
||||
|
||||
*By default, enables no other services.*
|
||||
- **pgbouncer_role**
|
||||
|
||||
Enables the pbouncer and consul services on the machine
|
||||
|
||||
*By default, enables no other services.*
|
||||
- **consul_role**
|
||||
|
||||
Enables the consul service on the machine
|
||||
|
||||
*By default, enables no other services.*
|
||||
|
|
|
@ -34,6 +34,9 @@ module Gitlab
|
|||
role('redis_slave')
|
||||
role('geo_primary', manage_services: false).use { GeoPrimaryRole }
|
||||
role('geo_secondary', manage_services: false).use { GeoSecondaryRole }
|
||||
role('postgres').use { PostgresRole }
|
||||
role('pgbouncer').use { PgbouncerRole }
|
||||
role('consul').use { ConsulRole }
|
||||
|
||||
## Attributes directly on the node
|
||||
attribute('registry', priority: 20).use { Registry }
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright:: Copyright (c) 2017 GitLab Inc.
|
||||
# License:: Apache License, Version 2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
module ConsulRole
|
||||
def self.load_role
|
||||
return unless Gitlab['consul_role']['enable']
|
||||
|
||||
Services.enable_group('consul_role')
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright:: Copyright (c) 2017 GitLab Inc.
|
||||
# License:: Apache License, Version 2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
module PgbouncerRole
|
||||
def self.load_role
|
||||
return unless Gitlab['pgbouncer_role']['enable']
|
||||
|
||||
Services.enable_group('pgbouncer_role')
|
||||
end
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
# Copyright:: Copyright (c) 2017 GitLab Inc.
|
||||
# License:: Apache License, Version 2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
module PostgresRole
|
||||
def self.load_role
|
||||
return unless Gitlab['postgres_role']['enable']
|
||||
|
||||
Gitlab['repmgr']['enable'] = true
|
||||
Services.enable_group('postgres_role')
|
||||
end
|
||||
end
|
|
@ -29,10 +29,10 @@ module Services
|
|||
service 'gitaly', groups: [DEFAULT_GROUP, 'rails']
|
||||
service 'redis', groups: [DEFAULT_GROUP, 'redis', 'redis_node']
|
||||
service 'redis_exporter', groups: [DEFAULT_GROUP, 'redis', 'redis_node', 'prometheus']
|
||||
service 'postgresql', groups: [DEFAULT_GROUP, 'postgres']
|
||||
service 'postgresql', groups: [DEFAULT_GROUP, 'postgres', 'postgres_role']
|
||||
service 'nginx', groups: [DEFAULT_GROUP]
|
||||
service 'prometheus', groups: [DEFAULT_GROUP, 'prometheus']
|
||||
service 'postgres_exporter', groups: [DEFAULT_GROUP, 'prometheus', 'postgres']
|
||||
service 'postgres_exporter', groups: [DEFAULT_GROUP, 'prometheus', 'postgres', 'postgres_role']
|
||||
service 'mailroom'
|
||||
service 'gitlab_pages'
|
||||
service 'mattermost'
|
||||
|
@ -44,9 +44,9 @@ module Services
|
|||
service 'sentinel', groups: ['redis']
|
||||
service 'geo_logcursor', groups: ['geo']
|
||||
service 'geo_postgresql', groups: %w(geo postgres)
|
||||
service 'pgbouncer', groups: ['postgres']
|
||||
service 'repmgrd', groups: ['postgres']
|
||||
service 'consul', groups: ['ha']
|
||||
service 'pgbouncer', groups: %w(postgres pgbouncer_role)
|
||||
service 'repmgrd', groups: %w(postgres postgres_role)
|
||||
service 'consul', groups: %w(consul_role ha pgbouncer_role postgres_role)
|
||||
service 'sidekiq_cluster', groups: ['sidekiq']
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue