diff --git a/doc/administration/geo/replication/troubleshooting.md b/doc/administration/geo/replication/troubleshooting.md index 6fea03cc8ec1238cbb65bf37b17eedc38ddfa075..69b32c85eb3a042cf98a5e391e9d72235f83fe6a 100644 --- a/doc/administration/geo/replication/troubleshooting.md +++ b/doc/administration/geo/replication/troubleshooting.md @@ -23,12 +23,69 @@ to help identify if something is wrong: ![Geo health check](img/geo_node_healthcheck.png) -There is also an option to check the status of the **secondary** node by running a special rake task: +If the UI is not working, or you are unable to log in, you can run the Geo +health check manually to get this information as well as a few more details. +This rake task can be run on an app node in the **primary** or **secondary** +Geo nodes: + +```sh +sudo gitlab-rake gitlab:geo:check +``` + +Example output: + +``` +Checking Geo ... + +GitLab Geo is available ... yes +GitLab Geo is enabled ... yes +GitLab Geo secondary database is correctly configured ... yes +Using database streaming replication? ... yes +GitLab Geo tracking database is configured to use Foreign Data Wrapper? ... yes +GitLab Geo tracking database Foreign Data Wrapper schema is up-to-date? ... yes +GitLab Geo HTTP(S) connectivity ... +* Can connect to the primary node ... yes +HTTP/HTTPS repository cloning is enabled ... yes +Machine clock is synchronized ... yes +Git user has default SSH configuration? ... yes +OpenSSH configured to use AuthorizedKeysCommand ... yes +GitLab configured to disable writing to authorized_keys file ... yes +GitLab configured to store new projects in hashed storage? ... yes +All projects are in hashed storage? ... yes + +Checking Geo ... Finished +``` + +Current sync information can be found manually by running this rake task on any +**secondary** app node: ```sh sudo gitlab-rake geo:status ``` +Example output: + +``` +http://secondary.example.com/ +----------------------------------------------------- + GitLab Version: 11.8.1-ee + Geo Role: Secondary + Health Status: Healthy + Repositories: 190/190 (100%) + Verified Repositories: 190/190 (100%) + Wikis: 190/190 (100%) + Verified Wikis: 190/190 (100%) + LFS Objects: 35/35 (100%) + Attachments: 528/528 (100%) + CI job artifacts: 477/477 (100%) + Repositories Checked: 0/190 (0%) + Sync Settings: Full + Database replication lag: 0 seconds + Last event ID seen from primary: 2158 (about 2 minute ago) + Last event ID processed by cursor: 2158 (about 2 minute ago) + Last status report was: 4 minutes ago +``` + ## Is Postgres replication working? ### Are my nodes pointing to the correct database instance? diff --git a/ee/app/assets/javascripts/geo_nodes/components/app.vue b/ee/app/assets/javascripts/geo_nodes/components/app.vue index 5841b9f1a9192d320551fe86c57efd3414a036b5..b888bcedcae61506e9848d050f534f29d5a6d0c0 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/app.vue +++ b/ee/app/assets/javascripts/geo_nodes/components/app.vue @@ -34,6 +34,10 @@ export default { type: Boolean, required: true, }, + geoTroubleshootingHelpPath: { + type: String, + required: true, + }, }, data() { return { @@ -213,6 +217,7 @@ export default { :primary-node="node.primary" :node-actions-allowed="nodeActionsAllowed" :node-edit-allowed="nodeEditAllowed" + :geo-troubleshooting-help-path="geoTroubleshootingHelpPath" /> /* eslint-disable vue/no-side-effects-in-computed-properties */ +import { GlLink } from '@gitlab/ui'; import { s__ } from '~/locale'; import NodeDetailsSectionMain from './node_detail_sections/node_details_section_main.vue'; @@ -9,6 +10,7 @@ import NodeDetailsSectionOther from './node_detail_sections/node_details_section export default { components: { + GlLink, NodeDetailsSectionMain, NodeDetailsSectionSync, NodeDetailsSectionVerification, @@ -31,6 +33,10 @@ export default { type: Boolean, required: true, }, + geoTroubleshootingHelpPath: { + type: String, + required: true, + }, }, data() { return { @@ -80,7 +86,12 @@ export default { :node-type-primary="node.primary" />
-

{{ errorMessage }}

+

+ {{ errorMessage }} + {{ + s__('Geo|Please refer to Geo Troubleshooting.') + }} +

diff --git a/ee/app/assets/javascripts/geo_nodes/components/geo_node_item.vue b/ee/app/assets/javascripts/geo_nodes/components/geo_node_item.vue index e3313b79bfac7a316d5ab3f950571389568e0b9e..76b0cfc5a4f1247066f46273bdf6a0981bade6b8 100644 --- a/ee/app/assets/javascripts/geo_nodes/components/geo_node_item.vue +++ b/ee/app/assets/javascripts/geo_nodes/components/geo_node_item.vue @@ -1,4 +1,6 @@ @@ -31,6 +35,7 @@ export default { :primary-node="node.primary" :node-actions-allowed="nodeActionsAllowed" :node-edit-allowed="nodeEditAllowed" + :geo-troubleshooting-help-path="geoTroubleshootingHelpPath" /> diff --git a/ee/app/assets/javascripts/geo_nodes/index.js b/ee/app/assets/javascripts/geo_nodes/index.js index ea0d0dcba1ddf2aaf3fef71a3107ade759a0db6c..d4eda031201151abc73c1862252f69c47fef852c 100644 --- a/ee/app/assets/javascripts/geo_nodes/index.js +++ b/ee/app/assets/javascripts/geo_nodes/index.js @@ -24,9 +24,10 @@ export default () => { }, data() { const { dataset } = this.$options.el; + const { primaryVersion, primaryRevision, geoTroubleshootingHelpPath } = dataset; const nodeActionsAllowed = parseBoolean(dataset.nodeActionsAllowed); const nodeEditAllowed = parseBoolean(dataset.nodeEditAllowed); - const store = new GeoNodesStore(dataset.primaryVersion, dataset.primaryRevision); + const store = new GeoNodesStore(primaryVersion, primaryRevision); const service = new GeoNodesService(); return { @@ -34,6 +35,7 @@ export default () => { service, nodeActionsAllowed, nodeEditAllowed, + geoTroubleshootingHelpPath, }; }, render(createElement) { @@ -43,6 +45,7 @@ export default () => { service: this.service, nodeActionsAllowed: this.nodeActionsAllowed, nodeEditAllowed: this.nodeEditAllowed, + geoTroubleshootingHelpPath: this.geoTroubleshootingHelpPath, }, }); }, diff --git a/ee/app/assets/stylesheets/pages/geo_nodes.scss b/ee/app/assets/stylesheets/pages/geo_nodes.scss index 2df58ab9f8287e0a4b9c384afcc4f9ae6635806d..e3fea1eab76fd0cda76308ddd1df2180747414ab 100644 --- a/ee/app/assets/stylesheets/pages/geo_nodes.scss +++ b/ee/app/assets/stylesheets/pages/geo_nodes.scss @@ -85,7 +85,7 @@ .node-health-message { margin-bottom: 0; - padding: 2px $gl-padding-8; + padding: $gl-padding; background-color: $red-100; color: $red-500; } diff --git a/ee/app/helpers/ee/geo_helper.rb b/ee/app/helpers/ee/geo_helper.rb index 08fb3a5a23d331fe6e6ef9440ee365a29fb0f188..e8db6c5ad2df84104b9d4d93fcc11a4a55ee1201 100644 --- a/ee/app/helpers/ee/geo_helper.rb +++ b/ee/app/helpers/ee/geo_helper.rb @@ -30,7 +30,8 @@ def node_vue_list_properties primary_version: version.to_s, primary_revision: revision.to_s, node_actions_allowed: ::Gitlab::Database.db_read_write?.to_s, - node_edit_allowed: ::Gitlab::Geo.license_allows?.to_s + node_edit_allowed: ::Gitlab::Geo.license_allows?.to_s, + geo_troubleshooting_help_path: help_page_path('administration/geo/replication/troubleshooting.md') } end diff --git a/ee/changelogs/unreleased/mk-suggest-geo-check-in-error.yml b/ee/changelogs/unreleased/mk-suggest-geo-check-in-error.yml new file mode 100644 index 0000000000000000000000000000000000000000..7c9485cd7243fd199f5e54c9609060657981b6aa --- /dev/null +++ b/ee/changelogs/unreleased/mk-suggest-geo-check-in-error.yml @@ -0,0 +1,5 @@ +--- +title: 'Geo: Help admins diagnose configuration problems' +merge_request: 9988 +author: +type: added diff --git a/ee/spec/javascripts/geo_nodes/components/app_spec.js b/ee/spec/javascripts/geo_nodes/components/app_spec.js index 2ff12e0ca15a35041445e4493ba052a0d23e1630..3e54ba7092b89a8b4bfec872be05bc62ff946b71 100644 --- a/ee/spec/javascripts/geo_nodes/components/app_spec.js +++ b/ee/spec/javascripts/geo_nodes/components/app_spec.js @@ -26,6 +26,7 @@ const createComponent = () => { service, nodeActionsAllowed: true, nodeEditAllowed: true, + geoTroubleshootingHelpPath: '/foo/bar', }); }; diff --git a/ee/spec/javascripts/geo_nodes/components/geo_node_details_spec.js b/ee/spec/javascripts/geo_nodes/components/geo_node_details_spec.js index fd23da7ebaf91e78f322c72c0684d34db79783f1..ef33d9d0a715cf557dba41786cb4633f82545f26 100644 --- a/ee/spec/javascripts/geo_nodes/components/geo_node_details_spec.js +++ b/ee/spec/javascripts/geo_nodes/components/geo_node_details_spec.js @@ -17,6 +17,7 @@ const createComponent = ({ nodeDetails, nodeActionsAllowed, nodeEditAllowed, + geoTroubleshootingHelpPath: '/foo/bar', }); }; @@ -80,5 +81,17 @@ describe('GeoNodeDetailsComponent', () => { it('renders container elements correctly', () => { expect(vm.$el.classList.contains('card-body')).toBe(true); }); + + it('renders troubleshooting URL within error message section', done => { + vm.nodeDetails.healthy = false; + vm.errorMessage = 'Foobar'; + + vm.$nextTick(() => { + expect(vm.$el.querySelector('.node-health-message-container a').getAttribute('href')).toBe( + '/foo/bar', + ); + done(); + }); + }); }); }); diff --git a/ee/spec/javascripts/geo_nodes/components/geo_node_item_spec.js b/ee/spec/javascripts/geo_nodes/components/geo_node_item_spec.js index 8ad06463d9ddb79df14ca172882f86a83f7bf0b3..11cce25f37ae76b55bc602842167a3b2b99253fa 100644 --- a/ee/spec/javascripts/geo_nodes/components/geo_node_item_spec.js +++ b/ee/spec/javascripts/geo_nodes/components/geo_node_item_spec.js @@ -13,6 +13,7 @@ const createComponent = (node = mockNode) => { primaryNode: true, nodeActionsAllowed: true, nodeEditAllowed: true, + geoTroubleshootingHelpPath: '/foo/bar', }); }; @@ -147,8 +148,11 @@ describe('GeoNodeItemComponent', () => { vm.isNodeDetailsFailed = true; vm.errorMessage = err; Vue.nextTick(() => { - expect(vm.$el.querySelectorAll('p.health-message').length).not.toBe(0); - expect(vm.$el.querySelector('p.health-message').innerText.trim()).toBe(err); + expect(vm.$el.querySelectorAll('p.node-health-message').length).not.toBe(0); + expect(vm.$el.querySelector('p.node-health-message').innerText.trim()).toContain(err); + expect(vm.$el.querySelector('p.node-health-message a').getAttribute('href')).toBe( + '/foo/bar', + ); done(); }); }); diff --git a/ee/spec/javascripts/geo_nodes/components/geo_nodes_list_spec.js b/ee/spec/javascripts/geo_nodes/components/geo_nodes_list_spec.js index 61b1118e39638231731af6e6f2427bf9f73c90e1..638d7adb452d142494b5b1e34c3a18daf267c79f 100644 --- a/ee/spec/javascripts/geo_nodes/components/geo_nodes_list_spec.js +++ b/ee/spec/javascripts/geo_nodes/components/geo_nodes_list_spec.js @@ -11,6 +11,7 @@ const createComponent = () => { nodes: mockNodes, nodeActionsAllowed: true, nodeEditAllowed: true, + geoTroubleshootingHelpPath: '/foo/bar', }); }; diff --git a/locale/gitlab.pot b/locale/gitlab.pot index d68c680d5f99067b84edd7b5422986ebcd1123c5..911cbc9a32295124c5e8dfff4eeec3b90bd2d418 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4866,6 +4866,9 @@ msgstr "" msgid "Geo|Pending verification" msgstr "" +msgid "Geo|Please refer to Geo Troubleshooting." +msgstr "" + msgid "Geo|Project (ID: %{project_id}) no longer exists on the primary. It is safe to remove this entry, as this will not remove any data on disk." msgstr ""