alexgaribay / libcluster_gae

MIT License
23 stars 1 forks source link

Doesn't work with internal Zonal DNS #1

Open tpbowden opened 5 years ago

tpbowden commented 5 years ago

By default, appengine instances all run on zonal DNS, which means the format provided by this library doesn't work as it assumes everything uses project-wide global DNS which Google Cloud recommends against using any more and disables by default. If it's not possible to use the correct type of DNS name, it might be worth adding to the readme that VmDnsSetting=GlobalOnly must be set at the project level for this library to work.

Alternatively, would it be possible to use IP addresses instead of internal hostnames?

https://cloud.google.com/compute/docs/internal-dns

bruce commented 4 years ago

I'm encountering this issue as well. @tpbowden, did you manage to get this working? (I'm not finding setting VmDnsSetting=GlobalOnly or VmDnsSetting=ZonalPreferred helping, either).

@alexgaribay, any suggestions?

alexgaribay commented 4 years ago

I’ll take a look to fix it.

bruce commented 4 years ago

@alexgaribay Thanks!

alexgaribay commented 4 years ago

I have a local branch that can correctly get the name of an instance regardless of zonal DNS configuration. The problem now is that I can't seem to get the nodes to reach each other anymore. I'll keep investigating but wanted to provide an update.

laksamanakeris commented 4 years ago

@alexgaribay Thanks for the update.

bruce commented 4 years ago

@alexgaribay Thanks for the update; any luck?

ericrwolfe commented 4 years ago

It seems the App Engine Admin API isn't returning the vmZoneName parameter for the instances (as documented), so it's not possible to build the proper zonal DNS address: [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal.

I filed a bug report with Google here: https://issuetracker.google.com/issues/156957580

dbradleyfl commented 4 years ago

For others that stumble on this issue:

I also wasn't able to get this libcluster strategy to work for the reasons explained above.

I was able to circumvent the issue (at least for my use-case) by getting rid of libcluster and libcluster_gae and implementing the Redis PubSub adapter as explained here and documented here. It is ridiculously easy to spin up a Redis instance on GCP and the adapter works seamlessly. My Phoenix application nodes were able to automatically connect to the Redis instance, and thus each other, with the following config in application.ex (applied in production only which means I don't need to run Redis locally for development):

{
  Phoenix.PubSub,
  name: MyApp.PubSub,
  adapter: Phoenix.PubSub.Redis,
  host: IP_OF_REDIS_INSTANCE,
  node_name: Ecto.UUID.generate # The name didn't seem to matter here, as long as it was unique to the cluster
}