Chapter Four: Adventures in a Container
Well Adventurer, let's take stock of what we've done. You've learned what a container is and how to launch one, how to get a database running and its implications for auto vs. manual scaling, and how to link containers to launch a Wordpress install with linked mysql database. Not too shabby!
She's right, actually. I hadn't noticed with all the delightful banter back and forth, but we've made great progress. But...
Adventurer, I notice some hesitation. Have you forgotten that I can read (some of) your thoughts?
- (See the now classic "Chapter Two: All Your (Data-) Base Are Belong To...," winner of Best In-line Comedy at the 2015 Documentation Writers' Guild Awards.)
What troubles you?
-> Well, Alana, you still haven't told me how you ended up down here. What made you leave Alauda, cloud of all clouds?
- (Dear Reader, a friendly note from your
narratordocumentation writer. We've chosen "->" to represent when our Adventurer -- that would be you -- speaks outloud, and the italics when you are thinking thoughts, no doubt ponderous and significant, to yourself.)
That's strange. Alana seems...embarrassed?
-> Don't worry, Alana, you can tell me. After all, if you're going to teach me all there is to know about the cloud we're going to be questing together for a while...
Hm, you make a fair point land lubber, a fair point. I tell you what, finish this tutorial and I'll think about it.
-> No fair!
Come now, there's lots to learn, and we've still got a ways to go. Once we make some more progress, when the time is right, I'll let you know. It's a story worth earning!
After this chapter you'll know how to
Stop / Scale / Redeploy / Delete a Service
SSH into a container
Let's get started.
Doing Things to Running Services
We can tweak configured services in several ways. Stopping a running Service...stops it! You'll lose any data if it is a Stateless service (does not have a storage volume attached), so keep that in mind. If you want to attach a storage volume that option is available when you are configuring your service, as was reviewed in Chapter 2: All Your (Data-) Base Are Belong To....
Redeploy is an interesting one. If all it did was restart the container that would seem weird. "Restart" would have been a better name. Let's click it and find out what happens.
Holy wall of text, Batman Alana!
Shh, quiet your speeding heart, Adventurer. Over time you will come to value these nuggets of wisdom, dropped like so many pearls throughout an erstwhile dry and lifeless series of screenshots known as "documentation."
Hah, wisdom? More like puffed up self-important blather--
What's that Adventurer? Speak up. I can't hear you...
-> Uh, nothing. Sorry, could you explain what's going on with Images and Tags here?
Of course, Adventurer, of course. Images are what make the Container universe run. A Container is just a shell for holding an Image. The Image defines what will be running in the Container - a web server, a database, an image processing service, an ftp server, you name it. The Image holds all the dependencies necessary for the Service to run.
These dependencies are described in the Dockerfile, a kind of "recipe that tells Docker how to build the container." You can read more about Dockerfile syntax here.
-> Okay, I think I get it. So what's up with Image Tags?
Tags let you know which version of an Image you want to use. Maybe you're fine with the most recent one - "latest" is for you. But maybe you want to use a previous or special version. Just pick the tag that corresponds to the one you want to use.
-> Ah, I get it. So if we want to Redeploy using a different version of this Image, we'd just hit Redeploy and choose the appropriate Image Tag!
That's it! Do you want to take a guess as to what Delete does?
-> Haha, very funny.
Good, just one thing you should know - there is no undo for Delete. All data - including data on Stateful Services' attached storage volumes - will be erased.
Scaling Services
You already know the difference between auto-scaling (where Alauda.io handles scaling up/down the number of Instances as load varies) and manual scaling, but did you know that you must parameterize auto-scaling?
-> Huh? No I didn't. Pray tell, how does one do that?
Since you asked so nicely, Adventurer, I'd be happy to. If you click on over to the Instances pane of a running Service, you'll find the option to choose Auto Scale. Once you click it you'll see your options.
-> Alana, that looks complicated...
Oh it totally is. But the flipside is that you get precise control. Simply choose a metric, like CPU utilization, and then tell Alauda how you want to scale it.
When the metric crosses your lower threshold Alauda will add instances until the number of instances hits your max instances. Alauda will add instances in batches whose size is determined by your increase delta. The same applies for scaling down. You can even choose the mean, min, or max of your metric (metric status) as the trigger for scaling.
Manual scaling, on the other hand, is quite straightforward.
SSH into a Container
Okay Adventurer, are you ready? This one's gonna go by fast, all in one breath, with no breaks between!
Really, can Alana even do that/ I feel like she has to stop every ten seconds to drop a 'pearl of wisdom' on me...
Yes Adventurer, I can do it! Here goes, how to SSH into a Container...
Just had to get that sassy walrus in there, huh?
Yes, that was a haiku. You're welcome.
Is it actually a haiku? If I remember correctly, the first line has to have--
5-7-5.
-> Huh?
It's five syllables for the first line, seven for the second, and five for the last.
-> Oh. Yeah, thanks.
Man, it's always weird when she does that mind-reading stuff...
Well that's it Adventurer. Until next time, this has been another daring episode of--
-> Wait! What about telling me why you fell from Alauda and came down to Earth?
Hm, next time Adventurer, next time...