DR: simplify the setup flow

We already have reduced the number of steps required to setup Geo and DR in 9.0 and 9.1. Can we simplify it even more? The idea would be to have 4 commands to enter, and users won't have to edit gitlab.rb at all.

Step 1 on primary node

$ sudo gitlab-ctl setup-geo-primary
Indicate a password for the Postgre automated user who will replicate data between nodes:
<PROMPT>
Indicate the IP address of the secondary node:
<PROMPT>
Do you want to add another secondary node? y/N 
The primary node is now setup.

Step 2 on secondary node

$ sudo gitlab-ctl setup-secondary-node
What is the IP address of the primary node?
<PROMPT>
What is the password of the automated user that replicate data between nodes?
<PROMPT>
The connection to the database of the primary node is successful.
Configuring the secondary node.
The secondary node is now setup.

Step 3 on primary node

$ sudo gitlab-rake geo:db:show_encryption_key
Copy the following key and proceed to next step: <key>

Step 4 on secondary node

$ sudo gitlab-ctl enable-secondary-node --encryption_key=<primary-encryption-key>
The secondary node is now enabled. To activate it, copy the following SSH key 
and visit the primary node Admin Area ➔ Geo Nodes (/admin/geo_nodes). Paste it 
there.

Description

Step 1:

  • This step is an updated version of gitlab-ctl set-geo-primary-node
  • It will also do the following
    • Automate the alteration of the gitlab_replicator user
    • Add in gitlab.rb the IP address of the primary (automatically gathered) and IP address of the secondary (through CLI prompt)
    • Execute the content of the current gitlab-ctl set-geo-primary-node command, because it doesn't have to be triggered later in the process
    • trigger a reconfigure automatically

Step 2:

  • Can we automate the update of the known_hosts file of the secondary node? If we ask for the IP address of the primary node, we could automate sudo -u git -H ssh git@<primary-node-url>
  • Then the command will execute gitlab-ctl replicate-geo-database --host=1.2.3.4 with the IP address of the primary.

Step 4:

  • A new CLI command to set the encryption key returned from the step 3. This will set the key in gitlab-secrets.json, add geo_postgresql['enable'] = true in gitlab.rb, and reconfigure the instance.
  • It will output the id_rsa.pub to the user so it can be paste in the geo node view.
  • It will execute gitlab-rake gitlab:shell:setup
Assignee Loading
Time tracking Loading