Code Monkey home page Code Monkey logo

Comments (4)

pearkes avatar pearkes commented on May 20, 2024

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. :)

from tugboat.

nofxx avatar nofxx commented on May 20, 2024

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/....

from tugboat.

pearkes avatar pearkes commented on May 20, 2024

@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.

from tugboat.

mxdpeep avatar mxdpeep commented on May 20, 2024

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

from tugboat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.