Chapter 1
How to…
This chapter offers some guidance on getting the most from this book.
1.1 …read this book
If I was being flippant I might say, “with your eyes” but I’m bigger than that so instead I will suggest some ways you might use this material.
This book is organised as a single narrative course centred around the technology that supports DevOps. If you start on page one, read through each page and follow along with all the material, you should end up being proficient with the entire IT System Lifecycle Management.
This book contains mistakes. Deliberate mistakes (and no doubt some mistakes that I did not intend, that’s life). Sometimes we will do things more than once. WTF? In most educational material we are presented with ‘perfect’ solutions, this is not realistic. The real world sucks. It changes constantly and today’s ideal solution is okay but tomorrow the boss (or customer) decides new technology is desirable how do we handle this? This is were some soft skills may be required to persuade them to change their mind. Assuming we cannot persuade them to change we need to plan and execute a migration from the older solution to the new solution. Rather than avoid this sort of complexity this course takes it head on.
This course is focussed on concepts rather than specific technologies. Yes, we use specific tools but the aim is to understand the approach to DevOps, learning how to confront and solve problems rather than simply ‘press this button’, ‘put this value here’ type tutorials (again, yes, there is some of this sort of material, especially early on, but the focus always remains on the concepts involved not merely how to finish specific tasks). Following tutorials is fine but generally we only learn one thing, how to do the one task in the tutorial. This is of limited use. Learning the core idea behind the tutorial means you can apply what is learned in novel circumstances.
For example, we use VirtualBox as our virtual machine hypervisor. What if your organisation uses VMWare or Windows Hyper-V? No problem if you understand the core concepts of virtualisation it should be a simple matter of translating your knowledge to a new set of operations (figuring out which menu items or commands get you the result you want). If you understand the core concepts then you can figure out the button pressing parts by reading the manual for the tool. Its like understanding variables in programming, once you know what a variable is then figuring out variables in programming language X is largely a matter of syntax.
Don’t have time to follow along from the start? Perhaps you already know enough about networks and feel confident skipping that material. No problem. At the start of each section you will find details of how to create an appropriate environment for that section (see §1.3). These ‘checkpoints’ also mean that if you mess up you can simply throw your environment away, recreate it using the closest checkpoint and continue with the course. In fact I encourage you to mess up your environment. You will learn much more by ‘playing’. So set up and environment, mess around with your own ideas and then, when you are ready to do the next part of the course, either restore your own saved snapshots or tear down the environment and build a new one using the provided checkpoint code.
If you are more interested in the philosophical and organisational aspect of DevOps then take a look at this book’s companion Devops from Scratch (Organisation)[Boo20a]
Having difficulty? No problem. Ask for help. Someone in the community may help and since I am in the community I can also help clarify things. If enough people are confused by the material then obviously I messed up and need to rewrite that material to be more clear; it shall be done.
Other books are available with more detailed material. Trying to cover all of the many complex topics under the IT System Lifecycle Management rubric would make this book not only much larger but also less focussed. My solution is to write books to deep-dive into related topics and reference those books from this one where appropriate. This way I hope you will find all the guidance you need either here or in one of the supporting books.
All of these books undergo constant maintenance (hopefully improvement), my only goal is to make the material more clear and more accessible over time.
1.2 …get the most from this book
Firstly, forget DevOps. Seriously, ignore it. Although this book uses the term DevOps (mostly for marketing reasons) it is really more general, it is about how to do IT System Lifecycle Management more effectively. DevOps is a distraction at worst and only a small part of successful IT System Lifecycle Management at best.
Do the examples! You’ll get much more from the material by following along and investigating for yourself.
1.3 …manage your workspace
We are going to be doing a lot of practical work throughout this book so it is worthwhile considering how we will manage our workspace.
A lot of this section will only make sense once you have read about the tools Git, VirtualBox, and Vagrant but I’m assembling basic advice here to make it easier to refer back to later.
1.3.1 Initial setup of your workspace
If you follow this book from page one to the end you should find your workspace is always in sync with whatever the book is dealing with but practically many of you will jump to sections of particular interest, skipping many sections. Anticipating this I’ve put in plenty of checkpoints. All of the material (including checkpoints) is held in a single Git repository, so I recommend getting that first.
Assuming you have installed Git (see §2.4) you can create your project workspace.
1mkdir dfs 2cd dfs 3git clone https://gitlab.com/saltyvagrant.classes/dfs-material.git 4mkdir classroom 5mkdir archive
Your dfs workspace now contains three directories; dfs-material holds all this books accompanying material, classroom is where you will follow along with the course, and archive is where we will store various backup files.
Throughout this book I use the dfs directory as the root of your workspace. Any path that does not explicitly start from the dfs root assumes you are following instructions from the last checkpoint and are relative to whichever directory you should be in at the time.
1cd dfs 2cd dfs/classroom 3cd ../dfs-material 4cd dfs 5cd classroom
Lines 1, 2, and 4 each start with dfs and are therefore not really relative to your current working directory. You should take these to be absolute directories rooted at your workspace root dfs.
Line 3 is relative you your current working directory (in this example dfs/classroom) and is refering to dfs/dfs-material (since the parent of dfs/classroom it dfs and dfs-material is to be found directly under this directory).
Line 5 is again relative to your current working directory. As you just moved to dfs (line 4) this refers to your classroom directory under that root.
1.3.2 Regular activities
There are a number of actions you may want to repeat throughout this course. Rather than repeat them in full each time I present them here and simply refer to these entries as necessary.
1.3.2.1 Snapshot Classroom
If you are following the advice given above and ‘playing’ with your classrooms then I suggest your take a snapshot of your environment just before you start to play. This way you can quickly reset your classroom back you a point where it is ready for you to continue following along with this course.
- Folllow along with this course.
- Decide to ‘play’ for a while so take a snapshot.
1cd dfs/classroom 2vagrant snapshot save class_<date>
Replace <date> with the date of the snapshot (I recommend using a YYMMDD format as this sorts properly). For example, if today where December 3rd 2020 and I wanted to backup my classroom I would use the following.
1cd dfs/classroom 2vagrant snapshot save class_201203
- Play with your classroom environment.
- Decide to resume the course as described in this book.
- Restore your classroom to the saved snapshot.
1cd dfs/classroom 2vagrant snapshot restore class_<date>
Where <date> is the date of the snapshot to be restored. For example, to restore the snapshot from December 3rd 2020 we created earlier I would use the following.
1cd dfs/classroom 2vagrant snapshot restore class_201203
- Resume course.
One other useful snapshot command is list, this can be used to show your previously saved snapshots (useful if, like me, your forget this sort of thing).
1cd dfs/classroom 2vagrant snapshot list
1.3.2.2 Checkpoint Classroom
If you get lost in the material you can reset your classroom to one of the checkpoints in the book. This will clean up you classroom directory ensuring you are ready to proceed with the book’s follow-along lessons.
- Shutdown any running classroom VMs
1cd dfs/classroom 2vagrant halt
- Backup your current classroom
1cd dfs 2mv classroom archive/classroom_<date>
Replace <date> with the date of the backup (I recommend using a YYYMMDD format as this sorts properly). For example, if today where December 3rd 2020 and I wanted to backup my classroom I would us the following1.
1cd dfs 2mv classroom archive/classroom_20201203
- Copy the relevant material from dfs-material
- Start up the classroom
1vagrant up
This will start up any VMs required for the classes.
1.3.2.3 Update material
This book, and consequently the accompanying material, is continually being updated2. You will want to periodically update your workspace to get these updates, so here’s what I recommend you do just before you start any session.
1cd dfs/dfs-material 2git pull
This will update the course material.
- What if this updates material I’ve already used?
- This should not cause problems in most cases. However, occasionally I will make significant revisions to the book and consequently you may see larger changes than usual. Assuming you are using the recommended workspace layout (see §1.3.1), the checkpoint script can be used to test your current environment against the current checkpoint.
1cd dfs/classroom 2vagrant ssh -c 'checkpoint verify'
Occasionally the checkpoint script will identify changes that requires one of more VMs to be recreated. Since the checkpoint script runs inside one of your classroom VMs it cannot preform operations on your host computer. In these circumstances the script will provide instructions to be run on your host to update your classroom.
If this verify fails there are two potential solutions.
- Scrub your current classroom and return to the nearest checkpoint.
- If the checkpoint verify can update your classroom it will offer a ‘fix [y/N]?’ prompt. If you enter a ‘Y’ then the checkpoint script will update your current classroom (and any VMs in that classroom).