19.12.2017 Views

ADMIN+Magazine+Sample+PDF

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Virtualization<br />

Package Your Scripts<br />

© Cathy Yeulet, 123RF.com<br />

Bundle your custom apps in a Debian package<br />

It’s a Wrap<br />

Get standard scripts and custom applications into the cloud with the<br />

debian packaging system. By Dan Frost<br />

You’ve got a cloud. It’s great. You<br />

can scale, and you’ve got redundancy.<br />

But you have about 20 scripts for a<br />

bunch of tasks (e.g., one for when<br />

an instance is booted up and another<br />

for when its IP changes) and these<br />

scripts aren’t getting any shorter,<br />

they’re getting better and longer. If<br />

you want to manage them in your<br />

favorite versioning software (which I<br />

hope is Git, but might be something<br />

else), how do you get that onto the<br />

new instances simply?<br />

Enter the not-new-at-all technology of<br />

Debian packages. They are straightforward<br />

to use across any Debianbased<br />

Linux and simple to create, and<br />

they provide an ideal way of contain-<br />

ing and releasing your scripts.<br />

In this article, I’ll show how to create<br />

Debian packages and how to install<br />

them (which you probably already<br />

know). And, I’ll explain how the<br />

process will make you feel more comfortable<br />

about pushing changes live<br />

across your cloud. I talked to cloudy<br />

people about how to get code onto<br />

new instances, and I tried lots of different<br />

things, but the Debian package<br />

is such a solid, reliable format that I<br />

just had to share it.<br />

Debian Packages<br />

Debian packages are simply archives<br />

that are very easy to install, usually in<br />

one line. If you’ve ever worked with<br />

packages in Ubuntu or any other Debian-related<br />

Linux, you’ve probably<br />

needed to download a package from<br />

an online source and install it:<br />

apt‐get install blarblar.deb<br />

On the inside, a Debian package is<br />

an archive of binary files, scripts, and<br />

any other resources an application<br />

needs, plus a handful of control files<br />

that the various command-line tools<br />

use to install the package.<br />

Because this standard package format<br />

is so easy to install on any Debianbased<br />

Linux, it’s a great way to get<br />

standard scripts and custom applications<br />

into the cloud. Often you need a<br />

few lines to configure a new instance<br />

or to connect the instance to the rest<br />

of your cloud, and storing all those<br />

scripts in a package keeps things very<br />

neat.<br />

The parts of a Debian package I’m<br />

most interested in are the control<br />

files, which live in a directory called<br />

DEBIAN. Control files tell Debian all<br />

about what the package contains,<br />

48 Admin 01 www.admin-magazine.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!