How to create a new plugin (vultr dns)

Discussion in 'Plugins/Modules/Addons' started by pannet1, Nov 2, 2017.

  1. pannet1

    pannet1 Member

    hi @till + others,

    can you please guide me on how to create a plugin for ispconfig.

    Requirement:
    I have a dns service offered by the vps soution provider vultr.com. ispconfig client books domain outside and points to nameservers of vultr. They do not have access to my vultr.com vps panel directly. However, vultr.com exposes their api to me, which inturn can be leveraged by my ispconfig clients.

    Vultr API
    sample api call for adding new domain example.com is given below
    Code:
    curl -H 'API-Key: YOURKEY' https://api.vultr.com/v1/dns/create_domain --data 'domain=example.com' --data 'serverip=127.0.0.1'
    
    As you can see its very simple and transparent rather than having to run my own master slave setup with 2 nameservers. I think if I am able to copy the bind plugin and alter it to make api calls to vultr.com before updating to local database, I will be able to achieve what I intend.

    Can you please guide me on how to go about it (or) suggest alternatives. The benefit for howtoforge would be lot of new vultr clients will be choosing ispconfig as their number 1 choice of control panel, IMHO.

    Thanks.
     
  2. pannet1

    pannet1 Member

    Bumping this again.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Basically, you described the right steps already. Take the BIND Plugin (or the powerdns plugin which is basically a wrapper similar to what you try t achieve), save it under a different name, change the class name inside the file to match the new file name, remove the BIND code and replace it with function calls to the vultr api and don't forget to disable the BINF plugin by removing the symlink in plugins-enabled directory and add a symlink to your plugin in plugins-enabled.
     
    pannet1 likes this.
  4. pannet1

    pannet1 Member

    @till

    wow. thank you.

    i have seen table structure on top of the plugin files (powerdns) . what is it for. should i manually insert the tables (after creating similar my own table structure) into the ispconfig database.

    can you point me to any thread which explains this process in greater depth? i will do this soon and advise my success asap.

    thanks

     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    This is for powerdns only, it is not useful for what you plan to do with the vultr api. I don't think that your plugin needs any additional tables like the ones for powerdns as yo're using an api.

    There is no tutorial available on that topic, just various threads in the dev forum.
     
  6. pannet1

    pannet1 Member

    Thanks again @till,

    I think i need to use same db structure like that of bind because the end users does not have access to the my vultr vps panel. so i need to somehow duplicate the vps panel domain tab and show it in ispconfig panel. also vps panel has every website's DNS record and there is no user level filter there.

    Really you gave me things to start. Reverting ...

     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Weare talking about a server side plugin here, so you don't have to take care about clients, the ISPConfig interface or how to store data as that#s all there already. The data is stored in ISPConfig for the dns records, so you don't have to change anything there in my opinion. In the plugin, you get all required data as array. Just take the BIND plugin or the powerdns plugin as basis, replace it's code with calls to the vultr api to use the vultr dns servers as DNS backend instead of a local bind or powerdns server.
     
  8. pannet1

    pannet1 Member

    @till,

    i am back with the wrapper for vultr api (attached). now i want to know how to tie up this with the ispconfig front end (DNS tab or someother). Or this one .... functions from a seperate UI (like powerdns) for example. can you please elaborate on this. sorry for my inexperience.

    basically the 5 seperate api calls curl calls are now eloberated into a big php file (attached). please help/guide
     

    Attached Files:

  9. till

    till Super Moderator Staff Member ISPConfig Developer

    This vultr api managed dns, right? In that case, you don't have to do anything with the ISPConfig interface. Just create a server plugin as I described above that calls this api functions. server plugins are automatically connected to the ispconfig interface, so when you add a dns record in ispconfig, the server plugin get's called and creates the aproproate dns with the vultr api.
     

Share This Page