DevelopingSpace / starchart

A self-serve tool for managing custom domains and certificates
MIT License
20 stars 13 forks source link

Create DNS Flow skeleton like Certs Flow #270

Closed humphd closed 1 year ago

humphd commented 1 year ago

We've got two very similar, and related, processes to manage:

Both now have an API:

The Certificates have an asynchronous flow, made-up of various sub-jobs: https://github.com/DevelopingSpace/starchart/tree/main/app/queues/certificate.

We need the same sort of thing for DNS. There is some work in https://github.com/DevelopingSpace/starchart/blob/main/app/lib/domains.server.ts that might help with this, but what we really need to do is break down the process of working with DNS (Route53, MySQL, Notifications, etc) as a series of async jobs that can be performed in the background, and linked together as a flow.

Without this, we're going to waste a lot of time trying to hook everything together, so I'd like to prioritize the work, and get it started as soon as possible.

@dadolhay has the most experience thinking in terms of distinct, async jobs, so perhaps he can throw some thoughts in here.

@Genne23v are you interested in working on this?

Whoever does work on it, I'd highly recommend we do this in stages like @dadolhay did with the certs flow: build the skeleton, then build the individual workers to connect back to our existing APIs. I'd like to avoid having someone go off for a month and try to build this without feedback.

To get the ball rolling, here's a draft of the process:

  1. addDnsRecord() (or update, delete) takes record details and creates a new flow. A record is immediately put into MySQL with the state indicating that it's in process, so the front-end can begin to query for that data (and state)
  2. A call to Route53 is made
  3. We ask Route53 when it's done using the SDK API (might take 2 or 3 tries)
  4. When the record is done, we update the MySQL data with the new status (could be error or ok)
  5. We send the user whatever notification(s) are necessary to let them know what has happened

What am I missing?

Genne23v commented 1 year ago

@humphd I should've let you know that I'm working on this. It took much longer than I thought as I struggled with some errors. I just pushed #274 to resolve this issue. Although notification is missing in my code.

humphd commented 1 year ago

Thanks @Genne23v.