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_replicatoruser - 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-nodecommand, because it doesn't have to be triggered later in the process - trigger a
reconfigureautomatically
- Automate the alteration of the
Step 2:
- Can we automate the update of the
known_hostsfile of the secondary node? If we ask for the IP address of the primary node, we could automatesudo -u git -H ssh git@<primary-node-url> - Then the command will execute
gitlab-ctl replicate-geo-database --host=1.2.3.4with 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, addgeo_postgresql['enable'] = truein gitlab.rb, and reconfigure the instance. - It will output the
id_rsa.pubto the user so it can be paste in the geo node view. - It will execute
gitlab-rake gitlab:shell:setup