nix-community / nixops-digitalocean

NixOps Digitalocean plugin [maintainer=@Kiwi]
GNU Lesser General Public License v3.0
19 stars 10 forks source link

Newly provisioned droplets fail on first reboot #10

Closed ydlr closed 3 years ago

ydlr commented 3 years ago

Newly provisioned droplets become unreachable after applying nixos-infect and rebooting.

I haven't really looked into the cause yet, but when this happened a couple years ago, the problem was that DigitalOcean renamed the network interfaces.

The likely solution is to update to the bundled nixos-infect script not to hardcode interface names. This is the approach now taken upstream. See https://github.com/elitak/nixos-infect

Kiwi commented 3 years ago
-        # Not sure when I'd have more than one interface from the DO
-        # API but networks is an array nevertheless.
-        self.default_gateway = droplet.networks["v4"][0]["gateway"]
+        for n in droplet.networks["v4"]:
+            if n["ip_address"] == self.public_ipv4:
+                self.default_gateway = n["gateway"]

something like this should fix it. they enabled private networking by default so there's an extra interface and it screws the routes up. this is what i mentioned on your PR for the start/stop.

ydlr commented 3 years ago

Thank you. You saved me a couple hours of trying to figure out what changed. I am bookmarking https://developers.digitalocean.com/documentation/changelog/ so I'm not caught by surprise, next time.

ydlr commented 3 years ago

Fixed in #9