Scripts, kiddies.

Scripts, kiddies.

by Mike Ricotta - January 3, 2017

Pop quiz: I’ve got a thousand line text file that needs to be put into a spreadsheet. What do you do? Answer: write a script.

A script is something that automates tasks that otherwise could be done manually (often at great time expense). I’ll bet you’ve written scripts yourself to automate a bunch of tasks that would otherwise take up all your time.

But it’s not many of us that know how deep the scripting rabbit hole goes. Let’s explore.

You want to start a new project on the web. It’s not anything to sneer at: a few different servers, a few different websites, a team of developers. First things first, you need a project management tool– you want to set up a timeline. So you install Jira somewhere and set it up so that everyone has access to it, and start assigning tasks. It would be easier, though, if a script could take care of that for you.

Then, of course, you need a development environment. All the servers have to be set up. You spin up some instances on Amazon AWS, and your IT guy starts installing the tools you’ll need. PHP, MySQL, Node, etc. — there’s quite a long list. As I’m sure you’re aware, instead of doing that manually, it would save you quite some time to use a script that could do all of that with a single click.

Now you need some repositories for your code. Your developers set up the repos on BitBucket and make their first commit. They create the different branches they’ll need and set up webhooks to have the servers automatically pull changes. There’s no reason that all this can’t be done with a script, automatically.

I’m sure you’re starting to see a pattern.

Everything that I’ve described above and much more can be done in a single step if enough scripts and APIs are leveraged. Anything from updating WordPress plugins to checking for deprecated code can be done by a script.

Of course, these are a lot of scripts to write, but once they’ve been written, it’s an enormous timesaver. My favorite example is server audits: There is a huge number of repetitive and tedious work involved in maintenance of a web project, especially with version control. Which tools are installed on which server? Which tools are up-to-date, and what must be updated? What framework/plugins are installed? What is the status of the memory on the server? All of this is checked often, and usually manually. As the number of servers increase, it becomes increasingly annoying to deal with all these tasks. Then, of course, as languages change, you must make sure that none of the code is deprecated, which involves lots of tedious grep scripts.

So we wrote scripts to do all of that. What used to take hours of work now takes a single click, and neat records are automatically kept.

That’s the magic of scripts. Thousands of them run every day to save days of work so that teams can be more productive and less prone to error. Beneath all of the fancy terminology, that is what’s at the heart of many DevOps tools.

And our platform, DOSA, takes full advantage of them.