We use Teamwork every day to manage our software development work for our clients. I am always interested in pushing Teamwork a little further to see if we can perform more and more tasks within the application so that it is transparent and accessible to our clients, co-workers…and save some time too!
In a previous post, I wrote about using Teamwork as an email support system and using a 3rd party API to perform sentiment analysis to help prioritise tasks. That was just the first step.
A lot of my day to day work goes a little bit beyond software development and into infrastructure, or ‘devops’, especially at the beginning of a new project. I wanted to see if I could perform a few infrastructure related tasks from within Teamwork, to automate the process a little more and even allow my co-workers to perform these actions too even if they are not comfortable with server environments, DNS Settings, SSH access and so on.
Some of the routine tasks that fall under the ‘devops’ umbrella which I can automate and trigger from within Teamwork include registering domain names, using Amazon’s Route53 for managing the nameservers/DNS for the domain, setting up sub domains and pointing a (sub) domain to an appropriate IP address on a server.
The general workflow is:
When a new task is added to Teamwork, a ‘hook’ POST’s the details of the task to a PHP script I have created.
This PHP script parses the task details and looks out for particular keywords to perform actions on in the task text. I have it set up to look for the following commands:
(I have prefixed the commands with ‘murbot’, short for ‘murrion robot’, mainly for fun but also to make sure to differentiate it from a regular task, just in case a client adds some text to a task and accidentally registers an odd domain name!).
- murbot: register domain domain.com (a Teamwork hook calls a remote PHP script and the chosen domain is purchased (if possible) with namecheap.com, thanks to their very easy to use API. ) (The domain is set up with Murrion contact/technical/billing details)
- murbot: use route53 for domain.com (a hook calls the PHP script and a hosted zone is created on Amazon Route53. 4 Nameservers are provided by Route53 and those are used to update NameCheap.com, so it knows to use Route53 for future DNS settings)
- murbot: create recordset for 192.168.1.2 (a hook calls the PHP script again and a RecordSet is created on Amazon’s route 53 to point the domain name to the IP address of the server when the web application will reside.
At this point, the necessary domain/DNS stuff is created for a new project in seconds. Any results from the API calls are added as comments to the task and the task is closed.
There is more to do on the server side, such as creating virtual hosts, folders, permissions, users, databases, but that’s for another blog post!
Some other actions I am working on include:
- Murbot: use ses for domain.com (this would create the appropriate TXT and DKIM CNAME DNS records in Route53 to use the domain name with Amazon’s Simple Email Service)
- Murbot: create subdomain test.domain.com for 192.168.1.2 (this would add the appropriate A name DNS record in Route53 and point the sub domain to the appropriate IP address)
Of course, each of these commands needs to be learned by anyone on the team that wants to use them, but it’s a lot quicker and safer to learn and action these items from the safety of Teamwork, rather than logging in and out of different services.
All of this is possible thanks to:
- Teamwork: https://www.teamwork.com/
- Teamwork Hooks: http://developer.teamworkpm.net/webhooksoverview
- NameCheap’s API: https://www.namecheap.com/support/api/intro.aspx
- Amazon’s Route 53: http://docs.aws.amazon.com/Route53/latest/APIReference/Welcome.html
- Amazon Simple Email Service (SES): http://docs.aws.amazon.com/ses/latest/DeveloperGuide/Welcome.html