JonasProgrammer / docker-machine-driver-hetzner

Docker machine driver for the new hetzner cloud API
https://jonasprogrammer.github.io/docker-machine-driver-hetzner/
MIT License
434 stars 54 forks source link

[BUG] Server doesn't start automatically #81

Closed zek closed 2 years ago

zek commented 2 years ago

Hello,

When I set networks by HETZNER_NETWORKS env variable, after the server created it doesn't start automatically. I had to start it manually throught hetzner panel.

JonasProgrammer commented 2 years ago

Hi,

sorry for the inconvenience. This seems rather odd... building the network config should not affect the server creation whatsoever. The network IDs to be added are gathered beforehand and then given to the CreateServer call -- so given the order of operation, there should be no impact. There is an optional flag indicating whether the server should be started or not, but it defaults to true and we never set it in the past.

Could you maybe try creating a server connected to an existing net with the official hcloud tool and see if it behaves differently? Right now I fail to see how the driver code would cause the behaviour you described, but perhaps I'm overlooking something.

zek commented 2 years ago

Hey thanks for quick response,

hcloud server create  --name test --image "ubuntu-20.04" --type cx11 --network "my-network"

I tested it out and server started without any problem.

image

With docker-machine-driver-hetzner, I had to start it on hetzner panel

image
JonasProgrammer commented 2 years ago

Very strange indeed. I just tried with a fresh test project and for me everything works as expected (though I had to specify at least one network via command line argument instead of the environment variable due to an unrelated bug #37). It worked with both a single network provided via command line, as well as two -- one of which was provided via environment variable.

The only thing I could see in the cloud panel was that the server sometimes did take a little more time after creation, before it actually spun up... but still, it was like under a minute between creation and automatic start.

Anyways, as I'm currently out of ideas, I have just released 3.7.1 with updated dependencies. I was unable to reproduce the problem with neither a 3.7.0 build downloaded from GitHub nor my local 3.7.1 build. But maybe you can give it a shot so we can strike outdated library versions from the list of possible causes.

zek commented 2 years ago

Thank you so much I found the problem. I had networks definition both on env and argument. I removed the HETZNER_NETWORKS from the env. Somehow they're colliding with each other.

JonasProgrammer commented 2 years ago

Glad you were able to figure it out. If it is indeed the same network being specified more than once that causes the issue, I think that is a bug on the API side of things. I'll do a few experiments tomorrow and if that indeed causes the issue and perhaps file a ticket with Hetzner.

JonasProgrammer commented 2 years ago

@zek Just to let you know, your suffering was not pointless; the underlying issue is fixed now. hetznercloud/hcloud-go#196