-
Notifications
You must be signed in to change notification settings - Fork 2k
Conversation
@@ -363,6 +363,14 @@ func (d *Driver) Create() error { | |||
return err | |||
} | |||
|
|||
cmd, err = d.GetSSHCommand(fmt.Sprintf("sudo hostname %s", d.MachineName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this will persist reboots will it (need to update /etc/hostname
at least).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that persist on boot2docker? Perhaps we don't bother setting the hostname on boot2docker... I think the big win from this pull request is the correct name showing up in your cloud provider's admin (e.g. list of instances on EC2), not the hostname when you log in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it won't persist reboots. However one needs to update /usr/local/etc/hostname
for it to persist on a b2d image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bfirsh I'm going for naming all of the things.
Thanks for this @sthulb. The bit I'm really interested in is setting the correct name on cloud providers. E.g. on Digital Ocean, removing the concept of |
EC2 support is kind of there, I can tag an instance with the machine ID, just the internal hostname remaining. |
I moved how we set the hostname to the |
@@ -225,9 +228,32 @@ func (d *Driver) Create() error { | |||
return err | |||
} | |||
|
|||
log.Infof("Settings tags for instance") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be Debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer :)
@sthulb i like this so far -- good work! |
Great stuff. Since a driver is always attached to a machine, perhaps the name should be passed to |
@bfirsh It's something that should be considered when we need it in other places, but for now, I think leaving it on |
@bfirsh I take back my comment... azure kind of forces your idea. |
awesome! thanks -- I will check it out On Wed, Jan 7, 2015 at 6:36 AM, Simon Thulbourn notifications@github.com
|
I'm getting "sudo: unable to resolve host test-ec2" with |
I'll alter the PR to add to the hosts file also. |
@sthulb thanks |
@sthulb i'm also getting the following with azure:
It's not happening in master. |
I've fixed the sudo thing. |
So Azure likes globally unique names... so the best we can do is: |
In Azure, your VM sits inside a "Cloud Service." The cloud service must have a globally unique name, as it's used for DNS: .cloudapp.net. The VM can have any name, and that will be the hostname of the VM. |
@sthulb i think naming with a unique/timestamp is fine. it's just the cloud service and not the actual VM hostname which is what we want to name anyway. |
@sthulb sorry to be nitpicky but I'm still getting a couple |
That's fine, ... I just need to track down the origin of it... |
@ehazlett This should be good to merge now. |
@sthulb Hmm I keep getting this error with EC2:
Have you ran into that? |
Not at all. |
Hmm ok -- may be AWS. I'll try again -- thx |
Perhaps we can get @bfirsh try it too. |
@sthulb can you do a fresh build and confirm it's not doing it? It's not doing it to me in master. |
@@ -147,9 +145,24 @@ func (d *Driver) Create() error { | |||
return err | |||
} | |||
|
|||
log.Debugf("Setting hostname: %s", d.MachineName) | |||
cmd, err := d.GetSSHCommand(fmt.Sprintf( | |||
"echo \"127.0.0.1 %s\" | sudo tee -a /etc/hosts && sudo hostname %s && echo \"%s\" | sudo tee /etc/hostname", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't Digital Ocean set the hostname to be the droplet name?
@ehazlett I think I've figured out why you get it... By any chance, do you already have a security group with the same group name? |
yep. looks like it was left over from a previous run. i will remove and On Fri, Jan 9, 2015 at 2:21 PM, Simon Thulbourn notifications@github.com
|
This work sets the machine name in the Cloud API or Hypervisor. As well as setting the hostname inside the VM. I've added the machine name to the NewDriver func to allow for identification by Cloud APIs and for the driver package. Each driver will attempt to set the hostname for the VM, except for Azure, which sets it based on the DNS name. Signed-off-by: Simon Thulbourn <simon+github@thulbourn.com>
LGTM |
Improved boot2docker.go
This work sets the machine name in the Cloud API or Hypervisor. As well
as setting the hostname inside the VM.
I've added the machine name to the NewDriver func to allow for
identification by Cloud APIs and for the driver package.
Each driver will attempt to set the hostname for the VM, except for
Azure, which sets it based on the DNS name.
Refs: #59