Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot host ec2 instance on root domain #42

Open
justinlovinger opened this issue Mar 7, 2020 · 1 comment
Open

Cannot host ec2 instance on root domain #42

justinlovinger opened this issue Mar 7, 2020 · 1 comment

Comments

@justinlovinger
Copy link

Given deployment.route53.hostName = domain-name.root, running nixops deploy gives error "Exception: hosted zone for com not found".

The full exception is

webserver..> sending Route53 DNS: example.com A 18.218.14.24
Traceback (most recent call last):
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/bin/..nixops-wrapped-wrapped", line 991, in <module>
    args.op()
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/bin/..nixops-wrapped-wrapped", line 412, in op_deploy
    max_concurrent_activate=args.max_concurrent_activate)
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in deploy
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1052, in run_with_notify
    f()
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in <lambda>
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 996, in _deploy
    nixops.parallel.run_tasks(nr_workers=-1, tasks=self.active_resources.itervalues(), worker_fun=worker)
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/lib/python2.7/site-packages/nixops/parallel.py", line 44, in thread_fun
    result_queue.put((worker_fun(t), None, t.name))
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 969, in worker
    r.create(self.definitions[r.name], check=check, allow_reboot=allow_reboot, allow_recreate=allow_recreate)
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/lib/python2.7/site-packages/nixops/backends/ec2.py", line 1101, in create
    self._update_route53(defn)
  File "/nix/store/33qlsqvq92v7ny8p9af1zsvmxki5jd74-nixops-1.7/lib/python2.7/site-packages/nixops/backends/ec2.py", line 1273, in _update_route53
    raise Exception('hosted zone for {0} not found'.format(hosted_zone))
Exception: hosted zone for com not found
@justinlovinger
Copy link
Author

justinlovinger commented Mar 7, 2020

I think I found the relevant line of code. The hosted zone is obtained by stripping the first part of the DNS host name, but if the DNS host name is the hosted zone itself, then it doesn't match.

Is there any reason to strip the first part of the host name? It looks like the code already checks a subset of the host name parts when matching against a hosted zone. All that stripping the first part of the host name does is ensure you don't add a record to a hosted zone that exactly matches the host name, but I'm not sure why that would be desirable.

If I had to guess, I'd say that line probably could have changed when this commit was made.

@grahamc grahamc transferred this issue from NixOS/nixops Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant