I added a domain to my personal organisation using the following command:
flyctl domains add personal staging.mysite.com
This domain is now no longer needed, but I’m unsure how to remove it, as there are no
domains remove or
domains delete commands.
I think I also don’t need other domain records that I created, as they seem to only be necessary when using Fly’s own nameservers (I am using NS1) however I didn’t initially realise this from reading the docs.
Can you confirm if it’s necessary to add a domain when using non-Fly nameservers, and confirm whether or not it’s possible to remove a domain that’s no longer needed?
You only need to use domains when using fly’s DNS or registering a domain. To add SSL to your apps you want
flyctl certs. Domains is in preview and I don’t remember why there isn’t a delete command yet, but I can remove it for you. Could you DM me your org name or email?
I’m not sure how to send a DM (maybe I don’t have permissions being a newish forum user?), however my org name is ‘David Bailey’ with the
personal slug, and my account is the owner of the app
davidbailey-codes. Seeing as I’m not using Fly DNS, I’m happy for you to remove all the domains I added (*.davidbailey.codes)
Alright, domains are all deleted.
I think you can see a message button by clicking on another user’s name, but you’re right permissions might be hiding it. Need to investigate.
Has the feature to move/remove a domain already been added? I’m doing a bit of spring cleaning after testing fly to move things in production and would like to setup the orgs, domains a bit more properly.
Loving fly btw!
Not yet, but I’ll take care of it if you DM me a list what what to remove or what to move and where.
Will this asymmetry in the CLI be eliminated, e.g. I can add/register domains, but not remove them myself thereafter?
Actually, similar asymmetry exists with organizations in the current WebUI. However, the CLI supports both add and delete of organizations.
Why should it be different with domains?
Edit: I just noticed that the GraphQL API already exposes DeleteDomain(), next to DeleteOrganisation(), see tab “DOCS” in its Playground.
Are there any reasons not to expose it via the CLI as well, or to use in a Terraform Provider which @DAlperin is developing?
Yeah, I currently use those apis in the terraform provider I believe. But agree it would be nice for debugging/fixing to have access via the cli. @hb9cwp if you wanted I think it would be pretty easy to PR this in to flyctl.
Here is the relevant file with the line showing how domains are created via the api, you should only have to modify it a bit flyctl/domains.go at master · superfly/flyctl · GitHub
Indeed, I am just trying to get the hang of it by looking at Response after sending Queries & Mutations by curl and in the GraphQL Playground to the API endpoint, as documented in Domain Reseller Guide that was announced here.
Also, I have been looking at GraphQL API client libraries that are written in Go, such as this one, which would go well together with the Terraform Provider SDK in Go…
Although Spacelift’s Terraform Provider uses another (older?) GraphQL API client library, this appears to be a neat way to build Terraform providers for platforms that expose GraphQL API endpoints, such as Fly.
I use this graphql library for the provider: GitHub - Khan/genqlient: a truly type-safe Go GraphQL client
The reason I didn’t build on those examples are because graphql is the easy part. The slightly more difficult part is writing the logic to reconcile resources. One terraform resource might make multiple different requests and compile them in to the terraform schema. It’s easier for me to just have complete control, because it removes a lot of overhead for me to learn.