From 0a943de1b588edae69c4ab44708fc28b162ad5cb Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Thu, 24 Jun 2021 09:47:47 -0400
Subject: [PATCH] Harmonize the pieces of the localdev workflow

It is no longer required to add IP addresses to the Vagrant-generated ssh
configuration because the Vagrant-configured hostnames now match up with the
names morph will try to use to connect to the VMs.
---
 morph/grid/local/README.rst  | 8 --------
 morph/grid/local/Vagrantfile | 9 ++++-----
 morph/grid/local/config.json | 2 +-
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/morph/grid/local/README.rst b/morph/grid/local/README.rst
index 34554724..f899c497 100644
--- a/morph/grid/local/README.rst
+++ b/morph/grid/local/README.rst
@@ -33,13 +33,6 @@ Use the local development environment
 
     install -d ~/.ssh ; vagrant ssh-config >> ~/.ssh/config
 
-5. Edit the generated configuration: Add the ``publicIP`` addresses from ``grid.nix`` to ssh config **Host** match blocks (**not** HostName) so the ``Host`` lines all read like::
-
-    Host payments 192.168.67.21
-      HostName 127.0.0.1
-      User vagrant
-      [...]
-
   Latest Morph honors the ``SSH_CONFIG_FILE`` environment variable (`since 3f90aa88 (March 2020, v 1.5.0) <https://github.com/DBCDK/morph/commit/3f90aa885fac1c29fce9242452fa7c0c505744ef#diff-d155ad793bd62e6ea4c44ba985049ecb13a4f4f32f799791b2bce695a16c0101>`_), so in the future this should get a bit more convenient.
 
 6. Add your SSH key to ``users.nix`` so you'll be able to log in after deploying the new configuration::
@@ -56,4 +49,3 @@ Use the local development environment
     morph upload-secrets grid.nix
 
   You should now be able to log in with the users and keys you set in your ``users.nix`` file.
-
diff --git a/morph/grid/local/Vagrantfile b/morph/grid/local/Vagrantfile
index 7ad95ca8..fd374a2c 100644
--- a/morph/grid/local/Vagrantfile
+++ b/morph/grid/local/Vagrantfile
@@ -8,7 +8,7 @@ Vagrant.configure("2") do |config|
   # For a complete reference, please see the online documentation at
   # https://docs.vagrantup.com.
 
-  config.vm.define "payments" do |config|
+  config.vm.define "payments.localdev" do |config|
     config.vm.hostname = "payments"
     config.vm.box = "esselius/nixos"
     config.vm.box_version = "20.09"
@@ -20,7 +20,7 @@ Vagrant.configure("2") do |config|
     config.vm.provision "shell", inline: "sudo mv /tmp/payments-localdev-ssl/* /var/lib/letsencrypt/live/payments.localdev/"
   end
 
-  config.vm.define "storage1" do |config|
+  config.vm.define "storage1.localdev" do |config|
     config.vm.hostname = "storage1"
     config.vm.box = "esselius/nixos"
     config.vm.box_version = "20.09"
@@ -28,7 +28,7 @@ Vagrant.configure("2") do |config|
     config.vm.network "private_network", ip: "192.168.67.22"
   end
 
-  config.vm.define "storage2" do |config|
+  config.vm.define "storage2.localdev" do |config|
     config.vm.hostname = "storage2"
     config.vm.box = "esselius/nixos"
     config.vm.box_version = "20.09"
@@ -36,7 +36,7 @@ Vagrant.configure("2") do |config|
     config.vm.network "private_network", ip: "192.168.67.23"
   end
 
-  config.vm.define "monitoring" do |config|
+  config.vm.define "monitoring.localdev" do |config|
     config.vm.hostname = "monitoring"
     config.vm.box = "esselius/nixos"
     config.vm.box_version = "20.09"
@@ -54,4 +54,3 @@ Vagrant.configure("2") do |config|
   end
 
 end
-
diff --git a/morph/grid/local/config.json b/morph/grid/local/config.json
index 4c3fd003..3d377cc0 100644
--- a/morph/grid/local/config.json
+++ b/morph/grid/local/config.json
@@ -1,4 +1,4 @@
-{ "domain": "local"
+{ "domain": "localdev"
 , "publicStoragePort": 8898
 , "ristrettoSigningKeyPath": "./secrets/ristretto.signing-key"
 , "stripeSecretKeyPath": "./secrets/stripe.secret"
-- 
GitLab