do the dns setup earlier, as soon as the vm is ready, to give enough time for the DNS record to propagate

This commit is contained in:
Samuel Beaulieu 2022-07-28 13:22:11 -05:00
parent 6c0e7ac12b
commit 4153391eaf
No known key found for this signature in database
GPG key ID: 12030F74136D0F34

View file

@ -265,20 +265,21 @@ module Vmpooler
instance_id = batch_instance.first.instance_id instance_id = batch_instance.first.instance_id
connection.client.wait_until(:instance_running, { instance_ids: [instance_id] }) connection.client.wait_until(:instance_running, { instance_ids: [instance_id] })
@logger.log('s', "[>] [#{pool_name}] '#{new_vmname}' instance running") @logger.log('s', "[>] [#{pool_name}] '#{new_vmname}' instance running")
created_instance = get_vm(pool_name, new_vmname)
dns_setup(created_instance) if domain
### System status checks ### System status checks
# This check verifies that your instance is reachable. Amazon EC2 tests that network packets can get to your instance. # This check verifies that your instance is reachable. Amazon EC2 tests that network packets can get to your instance.
### Instance status checks ### Instance status checks
# This check verifies that your instance's operating system is accepting traffic. # This check verifies that your instance's operating system is accepting traffic.
connection.client.wait_until(:instance_status_ok, { instance_ids: [instance_id] }) connection.client.wait_until(:instance_status_ok, { instance_ids: [instance_id] })
@logger.log('s', "[>] [#{pool_name}] '#{new_vmname}' instance ready to accept traffic") @logger.log('s', "[>] [#{pool_name}] '#{new_vmname}' instance ready to accept traffic")
created_instance = get_vm(pool_name, new_vmname)
@redis.with_metrics do |redis| @redis.with_metrics do |redis|
redis.hset("vmpooler__vm__#{new_vmname}", 'host', created_instance['private_dns_name']) redis.hset("vmpooler__vm__#{new_vmname}", 'host', created_instance['private_dns_name'])
end end
if domain if domain
dns_setup(created_instance)
provision_node_aws(created_instance['name'], pool_name, new_vmname) if to_provision(pool_name) == 'true' || to_provision(pool_name) == true provision_node_aws(created_instance['name'], pool_name, new_vmname) if to_provision(pool_name) == 'true' || to_provision(pool_name) == true
elsif to_provision(pool_name) == 'true' || to_provision(pool_name) == true elsif to_provision(pool_name) == 'true' || to_provision(pool_name) == true
provision_node_aws(created_instance['private_dns_name'], pool_name, new_vmname) provision_node_aws(created_instance['private_dns_name'], pool_name, new_vmname)