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

Manage DNS records #63

Open
juasiepo opened this issue Sep 6, 2013 · 4 comments
Open

Manage DNS records #63

juasiepo opened this issue Sep 6, 2013 · 4 comments

Comments

@juasiepo
Copy link

juasiepo commented Sep 6, 2013

It would be nice be able to manage DNS records using tugboat too

I am doing a workaround (sorry not good at ruby) right now using:

tugboat create server.domain.tld -i 303619 -r 2 -k 32527
Wait till server becomes active:
tugboat wait server.domain.tld --state active
Get the IP address from
tugboat info "#{SERVER_TO_DEPLOY}" |grep IP|awk {'print $2'}

And then use a curl script (using digital ocean API) to update DNS records.

I forked the repository to see if I can do it by myself but I don't know where to start.
Any tip or idea?

Thanks for your time

@pearkes
Copy link
Collaborator

pearkes commented Sep 6, 2013

Juan! Great idea.

Here's the general overview for how the tugboat internals work. There are 4 main components you need to understand:

CLI Interface

We use a ruby gem called thor to handle the nitty gritty of the command line interface. This includes options (--name) and parameters (tugboat create FOO, where FOO is a parameter).

Here's an example of a command in the CLI interface: https://github.com/pearkes/tugboat/blob/master/lib/tugboat/cli.rb#L302-L323

Middleware Sequences

The CLI interface calls a middleware sequence, in this case: https://github.com/pearkes/tugboat/blob/master/lib/tugboat/middleware.rb#L220-L228

That file autoloads a bunch of middleware classes...we call those steps in this case.

Middleware Steps

Each step is pretty simple. You call it like this, and then the actual step looks like so: https://github.com/pearkes/tugboat/blob/master/lib/tugboat/middleware/wait_for_state.rb

"Environment"

All of this middleware requires something like "shared state". Basically, if I'm going to call the WaitForState step, I need to have a droplet_id in the environment for WaitForState to pick up. How does it get there? There's a step called FindDroplet that gets called prior to WaitForState. It does the heavy lifting of finding the right droplet (including dealing with multiple droplets. You can see how it deposits the ID into the env here.

You'll also need to interact with the digital_ocean gem, which is how we talk to the DO API. You can see examples of that in just about every step.

Hope that helps! Let me know if things are still unclear. :)

@nofxx
Copy link

nofxx commented Nov 22, 2013

This is a nice addition. But really painful to deploy some UI as CLI for this.
Here's an idea:
We could read .zone files, like sync a folder!
You just edit you DNS in yr editor! tugboat dns list tugboat dns sync.
Maybe ~/.tugboat/dns/....

@pearkes
Copy link
Collaborator

pearkes commented Nov 22, 2013

@nofxx I would typically prefer to just abuse their API for this – just as we do with the droplets.

But, I see the point you have on how complex it would get.

Could we do something like:

$ tugboat records foobar.com -r A -i 33.33.33.33

Which would add an A record?

We could start with minimal feature set – i.e just adding/overwriting records for existing domains, the most common use case.

@mxdpeep
Copy link

mxdpeep commented Nov 3, 2014

I'd suggest to use CloudFlafre API for DNS and DDoS/CDN support, not Digital Ocean (BTW they use CloudFlare too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants