Simplify Your Linode Deployment with StackScript Automation

Mark Korsak
Linode Cube
Published in
3 min readOct 4, 2016

One of my favorite features of Linode is its StackScripts. This community-focused tool simplifies a Linode’s deployment process and puts it at your command, beginning with your configuration of choice and running all the way through starting entire fleets of systems.

StackScripts are snippets of code that can be run when a Linode is first created. These scripts are written in bash; although, you could use any other language if you first create the ability to run that preferred language from within your bash script.

Additionally, you can declare space for variables to be used in the StackScript, such as the prompt for a MySQL root password, seen here:

Manage Your StackScripts

To start writing your own StackScript, you’ll need to click on “Deploy an Image” from the Linodes tab on the Linode Manager, then click on “Deploying using StackScripts.”

From this page you can see a list of all available StackScripts, along with an option to manage your own. You can choose to deploy any of your existing StackScripts, edit them, or create new ones.

When managing your StackScripts, you can make modifications to the code, control the privacy of your script, select valid distributions, and more. You should also periodically check on all public scripts you maintain and validate them for new operating systems that are released when appropriate. Users will only be able to deploy your StackScript with distributions that you have specifically validated for deployment.

Alternate Deployment Options

Even if StackScripts don’t turn out to be your thing, Linode still has options to help automate deployment. You can alternately use the many useful parameters found in Linode’s API and CLI (Command Line Interface) to deploy Linodes to your account.

Using the Create from Distribution method in the API, you can automatically deploy to your Linode. The advantage behind deploying via the API (also available in the CLI) is that you can specify — upon Linode creation — that your SSH key automatically loads onto the server. This way, once your Linode is booted, you’ll be able to immediately and securely log in via your SSH key.

Of course, if you prefer the ability to provide an SSH key by default, you can write a custom StackScript and even put code in this script to disable root login, among other configurable, security-based features.

Community Sharing

Any StackScript you create can be shared with and deployed by anyone throughout Linode’s entire community. That being said, you can also choose to keep a StackScript private, particularly if it’s specially designed with proprietary information or a setup that would be of little use to others.

The StackScript owner remains in full control of its public version, marking off which distributions support it, and editing it as needed. Users who choose a StackScript do so at their own risk, but since a StackScript is run on a different server, it can be redeployed easily should any issues arise.

My recommendation? Linode deployment can’t get any simpler or more secure than by using StackScripts. Try writing your own StackScripts, and see how you can help speed up deployment of your infrastructure. Furthermore, check out our list of public StackScripts at https://www.linode.com/stackscripts, and maybe you’ll find a new idea for a Linode you will want to deploy.

Let us know what you discover!

--

--

Mark Korsak
Linode Cube

Owner of @CLASHTournament | Nat'l Esports Event Host and Media Producer | @ScreenwaveMeida Esports Coordinator