public async Task FederateAsync(IEnumerable <string> upstreamFqdns) { var script = await File.ReadAllTextAsync("Scripts\\federate-rabbitmq.sh"); var fqdnList = string.Join(", ", upstreamFqdns.Select(f => $"\"amqp://*****:*****@{f}\"")); script = Templater.Replace(script, new Dictionary <string, string>() { { "<FQDN_LIST>", fqdnList } }); _vmHelper.UploadFileText(script, $"/home/{_vm.Username}/federate-rabbitmq.sh"); Console.WriteLine($"Running federation script on {_vm.VmName}"); await _vmHelper.RunCommandOverSsh("bash ~/federate-rabbitmq.sh"); Console.WriteLine($"Finished running federation script on {_vm.VmName}"); }
public async Task InstallAsync() { Console.WriteLine($"Provisioning {_vm.VmName}"); var installScript = await File.ReadAllTextAsync("Scripts\\install-rabbitmq.sh"); installScript = Templater.Replace(installScript, new Dictionary <string, string>() { { "<Username>", _config.RmqAdminUsername }, { "<Password>", _config.RmqAdminPassword } }); _vmHelper.UploadFileText(installScript, $"/home/{_vm.Username}/install-rabbitmq.sh"); await _vmHelper.RunCommandOverSsh("bash ~/install-rabbitmq.sh"); Console.WriteLine($"Finished provisioning {_vm.VmName}"); }
public async Task InstallAsync() { var installScript = await File.ReadAllTextAsync("Scripts\\install-appserver.sh"); _vmHelper.UploadFileText(installScript, $"/home/{_vm.Username}/install-appserver.sh"); var startScript = await File.ReadAllTextAsync("Scripts\\start-appserver.sh"); _vmHelper.UploadFileText(startScript, $"/home/{_vm.Username}/start-appserver.sh"); await _vmHelper.RunCommandOverSsh($"bash /home/{_vm.Username}/install-appserver.sh"); // Choose a "random" hostname from the list // of RMQ nodes for this datacenter var hostname = _rmqVms .OrderBy(x => Guid.NewGuid()) .Take(1) .Select(vm => vm.IpAddress.Fqdn) .Single(); var replacementValues = new Dictionary <string, string>() { { "<RmqUserName>", _config.RmqAdminUsername }, { "<RmqPassword>", _config.RmqAdminPassword }, { "<RmqHostName>", hostname }, { "<VmUserName>", _vm.Username } }; var consumerConfig = await File.ReadAllTextAsync("Scripts\\consumer-config.toml"); consumerConfig = Templater.Replace(consumerConfig, replacementValues); var producerConfig = await File.ReadAllTextAsync("Scripts\\producer-config.toml"); producerConfig = Templater.Replace(producerConfig, replacementValues); _vmHelper.UploadFileText(consumerConfig, $"/home/{_vm.Username}/Consumer/consumer-config.toml"); _vmHelper.UploadFileText(producerConfig, $"/home/{_vm.Username}/Producer/producer-config.toml"); await _vmHelper.RunCommandOverSsh($"bash /home/{_vm.Username}/start-appserver.sh"); }