DevOps BootCamp (DOBC) is a free course hosted by the OSU Open Source Lab. The course is dedicated to teaching core software development and systems operation skills to passionate OSU students and community members.
DOBC is always 100% free for in-person and online students.
DevOps Bootcamp’s curriculum is available for you to learn at your own pace. Get started now!
DevOps BootCamp is a single-day event with one track to help attendees kick off the year with fundamentals of system administration and software development. The hands-on workshop is designed to teach participants DevOps, a program development process that includes building, testing, and releasing software.
Please register if you’re planning on attending BootCamp this fall.
Following the Fall Kickoff, we will be hosting bi-weekly open office labs in Milne 224 in two hour blocks. These labs initially will be structured around the content on the website but will aim to be mostly hands on. OSL students and staff will be on-site to help you work through the content. Content discussed at each lab will depend on the attendees interest. We will also be opening up our Milne server room for students to learn and interact with actual hardware.
Some interesting topics we may end up discussing include (expanded on the lessons we already have on the website):
Our Milne server room includes three OpenCompute Racks donated from Facebook (includes a total of 90 compute nodes), managed network switches, and other various rack mounted server hardware.
The DevOps BootCamp content is available for free but meet-space guided lectures are offered throughout the year. Check the schedule below for our in-person lectures; each lecture covers a different part of the curriculum covering the entire course during the OSU academic school year.
Warning
If you are working ahead be aware that the schedule and slides may be subject to change. Check back regularly.
Lessons Covered | Date/Time | Location | Description |
---|---|---|---|
0 - 7 | Oct 27, 2018 9:30am-3:30pm | OSU KEC 1001 | DevOps BootCamp Fall Kickoff |
Each lab has two time slots (please choose one) to help assist with students being able to attend. All labs will in Milne 224.
Description | Slot 1 | Slot 2 |
---|---|---|
Lab #1 | Oct 31, 2018 10am-12pm | Nov 1, 2018 2-4pm |
Lab #2 | Nov 14, 2018 10am-12pm | Nov 15, 2018 2-4pm |
Lab #3 | Nov 28, 2018 10am-12pm | Nov 29, 2018 2-4pm |
We appreciate the help! To donate, go to http://osuosl.org/donate.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
DevOps is a field which takes skills from Software Development and Operations Engineering to create and run applications more effectively.
TLDR: Development + Operations == Better Services
DevOps defines 5 key pillars of success:
TLDR: Couch to DevOps in 1 school year
Discuss more advanced topics and also have hands-on with server and network equipment in our lab.
Next: Lesson 1: First Steps
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
A 10,000ft view of the world
$ONE_VARIABLE_NOTATION
<another notation for variables>
this_is(code) # everything after the octothorp is a comment!
other_code(line) // This can also be a comment. It depends on the
// language!
Code-block:
#! /usr/bin/env python
# This is a code block.
# Most of the time you can copy this code and run it exactly as is.
# It should be clear Where it 'goes' and how to run it based on
# context.
print('Hello world!')
# Copy the text after `$` into your terminal & press enter.
$ echo Hello World
Trick question: how would you read this
#!/bin/python
dogs = ['$BREED_ONE', '$BREED_TWO', '$BREED_THREE']
for breed in dogs:
print(breed)
Actually prints...
$BREED_ONE
$BREED_TWO
$BREED_THREE
Replace the $BREED_N with actual dog breeds.
#!/bin/python
dogs = ['corgie', 'pug', 'french bulldog']
for breed in dogs:
print(breed)
Actually prints...
corgie
pug
french bulldog
There are a variety of ways to run Linux!
We suggest you install Docker and Docker Compose, a tool which makes it easy to run small Linux Containers on your system in a safe sandbox without requiring to install Linux on your own machine. This is the same setup we used in the lecture.
Make sure you read the install documentation for Docker to ensure your system supports running it and have the required BIOS settings enabled.
After you have it installed, run this to start a container:
$ git clone https://github.com/DevOpsBootcamp/Bootcamp-Exercises.git
$ cd Bootcamp-Exercises
$ docker-compose up -d
$ docker-compose run -p 8080:8080 dobc bash
You can log out by typing exit and then enter which will stop the container.
To stop the container, run the following:
$ docker-compose kill
$ docker-compose rm --all
Feel free to try other Docker images, some that we recommend include:
To run those, do the following:
$ docker run -it --rm <docker image name> bash
You can find have more images at the Docker Hub. We also recommend you read Getting started with Docker to have a better understanding of how it works.
Instead of using Docker, you can also run a Linux Virtual Machines on your computer. This will give you a full Linux environment as if it were on a real machine.
We suggest you install Vagrant, a tool which makes it easy to run and acquire Virtual Machines.
You may also need to install VirtualBox or install VMWare (Requires TEACH access) a tool necessary for Vagrant to function.
After you get Vagrant and either VirtualBox or VMWare installed, clone our vagrant repo (make sure you install Git first!) and then start the VM:
$ git clone https://github.com/DevOpsBootcamp/vagrant.git
$ cd vagrant
$ vagrant up
$ vagrant ssh
The Windows Subsystem for Linux (Bash on Windows) allows you to run userspace Linux software on Windows, while using less resources than a virtual machine.
If you installed the Fall Creators Update for Windows 10, you can install one or more Linux distributions through the Windows Store.
Challenge Change your password on your Linux machine.
$ passwd
Changing password for user <user>.
Changing password for <user>.
(current) UNIX password: # Enter old password, hidden
New password: # Enter new password, also hidden
Retype new password:
passwd: all authentication tokens updated successfully.
Don’t forget: when you login next time, use the new password you just set.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Slackware
ArchLinux
Required course for all CS Students at OSU.
Required course for all CS Students at OSU.
OSDev.org is a wiki dedicated to helping people develop their own operating systems. It’s a big leap from this lesson, but great if you’re interested in learning the nitty-gritty.
Operating Systems Design and Implementation by Andrew S. Tanenbaum is a classic in the world of OS Development. It’s also a big leap, but can teach you more about how Operating Systems work than you ever thought there was to know.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
$ <program> --help
$ <program> -h
Most programs allow you to pass a help flag which will print out basic usage. This is useful as a quick reference for how to use the program.
$ man <program>
$ man man
MAN(1) Manual pager utils MAN(1)
NAME
man - an interface to the on-line reference manuals
SYNOPSIS
man [-C file] [-d] [-D] [--warnings[=warnings]] [-R
encoding] [-L locale] [-m system[,...]] [-M path] [-S list]
[-e extension] [-i|-I] [...]
DESCRIPTION
man is the system's manual pager. Each page argument given
to man is normally the name of a program, utility or
function. The manual page [...]
man pages are also organized by section. To read man page for a program/library in a specific section type man # <program or library> where # is the section number.
For instance:
$ man 2 open # Displays the kernel documentation for open (section 2)
$ man open # Displays the documentation for openvt (section 1)
If there is a collision in man-page naming (like open and open()) man will pick the page which appears in the lowest-value section.
Note
Some distros use info instead of man. To learn more about the info command, see Further Reading.
Projects also document themselves beyond the manpage. These can include tutorials, a README, and Q&A. If you need more information about a tool or a specific answer these docs will probably be your best bet.
These docs may also answer any technical or contributing questions. These docs can be updated more frequently than local man pages so should also be referred to for bleeding-edge information.
Communication is very important for DevOps engineers. Whether they are talking to their own team or working either external projects they use.
It’s important to be familiar with the chat platforms that these projects use which include:
To get on IRC, Use irssi or weechat in screen:
# This step is optional, but persistent IRC is cool
$ ssh <username>@<a remote linux server>
# start screen with the name 'irc'
$ screen -S irc
# start your client in the 0th window of the screen session
$ irssi
# or
$ weechat-curses
# exit irc screen with CTRL+a, CTRL+d
# exit ssh session with CTRL+d or 'exit'
# to get back to irc:
$ ssh <username>@<preferred shell host>
$ screen -dr IRC
If you’re not interested in using the command line there also an assortment of graphical IRC clients including Hexchat, MIRC, and KiwiIRC. Look those up if you’re interested in them.
There are also a variety of mobile clients for each platform that work well enough. You can also use a mobile SSH client and connect to your server in a pitch.
Unfortunately IRC isn’t very mobile friendly.
In the IRC client run these commands (irssi):
/connect irc.freenode.net
/nick <myawesomenickname>
/msg nickserv register <password> <email>
/nick <myawesomenickname>
/msg nickserv identify <password>
/join #devopsbootcamp
For weechat, do the following:
/server add freenode irc.freenode.net
/connect freenode
/nick <myawesomenickname>
/msg nickserv register <password> <email>
/nick <myawesomenickname>
/msg nickserv identify <password>
/join #devopsbootcamp
Command | Description |
---|---|
/list | Reports all the channels on a server. |
/topic | Reports current channel topic. |
/names | Reports nicks of users in channel. |
/join <channel> | Join a new channel. |
/whois <nick> | Learn about a person. |
/msg | Directly message an individual. |
/help <command> | Provides help for commands |
Tab-completion works with nicks
You get a hi-light when your name is said.
Symbols (@, +) are not part of names, show status in channel.
chanserv and nickserv are robots.
- /msg nickserv help to get nick help.
- /msg chanserv help to get channel help.
Term | Description |
---|---|
channel | Chat rooms with with ‘#’ prefixed in front of their names |
ping/pong | ‘I would like to tell you something.’ / ‘I’m here, tell it to me.’ |
tail | ~ |
hat | ‘@’ Denotes admin status in a channel. |
nick | Your name. |
netsplit | When the IRC servers lose connection with each other. |
kick/ban/k-line | Force someone off the channel or server, typically for abuse |
Modern messaging platform which featureful desktop and mobile clients
It’s okay to ask for help. Here are some things to keep in mind:
Contributions = expertise + time
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
You, right now.
$ whoami # your username
$ who # who is logged in?
$ w # who is here and what are they doing?
$ id # user ID, group ID, and groups you're in
Not just people: Apache, Mailman, ntp. “system users”
/etc/passwd:
root:x:0:0:root:/root:/bin/bash
username:password:uid:gid:uid info:home directory:shell
As someone interacting with servers, even as a developer, it’s necessary to understand how to manage users and groups on a Linux machine.
To view all user information on a system check the file /etc/passwd:
$ cat /etc/passwd
# username:x:UID:GID:GECOS:homedir:shell
To add, delete, and change the password of a user respectively run the following commands:
$ useradd <user_name> # vs adduser, the friendly Ubuntu version
$ userdel <user_name>
$ passwd
To add a group, or the permissions of a user/group run groupmod, usermod, and groupmod respectively. Similarly to /etc/passwd, /etc/group carries group information.
$ groupadd
$ usermod
$ groupmod
$ cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
# group name:password or placeholder:GID:member,member,member
Users won’t be active in new group until they “log back in”
/etc/shadow, not /etc/passwd
user@localhost ~ $ ls -l /etc/ | grep shadow
-rw-r----- 1 root shadow 1503 Nov 12 17:37 shadow
$ sudo su -
$ cat /etc/shadow
daemon:*:15630:0:99999:7:::
bin:*:15630:0:99999:7:::
sys:*:15630:0:99999:7:::
mail:*:15630:0:99999:7:::
# name:hash:time last changed: min days between changes: max days
# between changes:days to wait before expiry or disabling:day of
# account expiry
$ chage # change when a user's password expires
Warning
Acting as root is dangerous! You can accidentally delete your filesystem, forcing you to completely re-install your OS! Type carefully.
Consult man 5 sudoers for more information:
# User alias specification
User_Alias DOBC_ADMIN = lance, teacher
User_Alias DOBC_STUDENT = john, jane
# Runas alias specification
Runas_Alias ADMIN = root, sysadmin
Runas_Alias STUDENT = httpd
# Host alias specification
Host_Alias OSU_NET = 128.193.0.0/16
Host_Alias SERVERS = www, db
# Cmnd alias specification
Cmnd_Alias KILL = /bin/kill
Cmnd_Alias SU = /bin/su
# User privilege specification
root ALL = (ALL) ALL
DOBC_ADMIN ALL = NOPASSWD: ALL
DOBC_STUDENT OSU_NET = (STUDENT) KILL, SU
$ su joe # become user joe, with THEIR password
$ su # become root, with root's password
$ sudo su - # become root, with your password
$ sudo su joe # become user joe with your password
A dash after su provides an environment similar to what the user would expect. Typically a good practice to always use su -
Trying to run commands which require root permissions as a regular user can be a problem. However, sudo authorizes you to do commands based on your permissions. For example:
[dobc@dobc ~]$ yum install httpd # Runs command as `dobc` user.
Loaded plugins: fastestmirror, ovl
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/__db.002'
You need to be root to perform this command.
[dobc@dobc ~]$ sudo yum install httpd # Runs command as `root` user.
password:
Loaded plugins: fastestmirror, ovl
[... installs correctly ...]
$ sudo su -
$ useradd lance
# better to use visudo instead
$ echo "lance ALL = (ALL) ALL" >> /etc/sudoers
$ passwd lance
Changing password for user lance.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
$ su - lance
$ mkdir bootcamp
$ sudo groupadd devops
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for lance:
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Everything in Linux is a file... except the things that aren’t.
Files have:
Owner | atime, ctime, mtime |
Group | POSIX ACLs |
Permissions | Spinlock |
Inode | i_ino |
Size | read, write and link count |
Filename |
$ ls -il
total 8
2884381 drwxrwxr-x 5 test test 4096 Nov 6 11:46 Documents
2629156 -rw-rw-r-- 1 test test 0 Nov 13 14:09 file.txt
2884382 drwxrwxr-x 2 test test 4096 Nov 6 13:22 Pictures
Yes. Except the things that aren’t...
This functionality isn’t just limited to the shell! Let’s say you’re programming an interface for a device that streams data from a sensor. Using the “Everything is a file” philosophy, we could read data from the device like so:
int read_device_data(int device_file_pointer) {
// Open a connection to the device
int * stream = open(device_file_pointer);
// Write the stream of data to the screen
write(STDOUT, stream);
// Do some other stuff with that data
// Close the data stream
close(stream);
return EXIT_SUCCESS;
}
$ ls -l
crw-rw-rw- 1 root tty 5, 0 Jan 6 13:45 /dev/tty
brw-rw---- 1 root disk 8, 0 Dec 21 14:12 /dev/sda
srw-rw-rw- 1 root root 0 Dec 21 14:13 /var/run/acpid.socket
prw------- 1 lance lance 0 Jan 5 17:44 /var/run/screen/S-lance/12138.ramereth
lrwxrwxrwx 1 root root 4 Nov 25 09:26 /var/run -> /run
$ stat /etc/services
File: `/etc/services'
Size: 19303 Blocks: 40 IO Block: 4096 regular file
Device: fc00h/64512d Inode: 525111 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2015-01-07 08:22:43.768316048 -0800
Modify: 2012-05-03 09:01:30.934310452 -0700
Change: 2012-05-03 09:01:30.982310456 -0700
Birth: -
.jpg, .txt, .py
Not necessary, more of a recommendation.
File contains information about its encoding
$ ls
some_text_file squirrel
$ file some_text_file
some_text_file: ASCII text
$ file squirrel
squirrel: JPEG image data, JFIF standard 1.01
$ ls -l
drwxrwxr-x 5 test test 4096 Nov 6 11:46 Documents
-rw-rw-r-- 1 test test 0 Nov 13 14:09 file.txt
drwxrwxr-x 2 test test 4096 Nov 6 13:22 Pictures
---------- - ---- ---- ---- ------------ --------------
| | | | | | |
| | | | | | File Name
| | | | | +--- Modification Time
| | | | +------------- Size (in bytes)
| | | +----------------------- Group
| | +-------------------------------- Owner
| +------------------------------------- References Count
+---------------------------------------------- File Permissions
& Type
You can edit the metadata of a file with various commands, but some of the most useful commands are chown, chmod, and chgrp commands. These commands allow you to edit the owner, the read/write/execute, and the group permissions of a file respectively.
# Change the owner of myfile to "root".
$ chown root myfile
# Change the owner of myfile to "root" and group to "staff".
$ chown root:staff myfile
# Change the owner of /mydir and subfiles to "root".
$ chown -hR root /mydir
# Make the group devops own the bootcamp dir
$ chgrp -R devops /home/$yourusername/bootcamp
+-----+--------+-------+
| rwx | Binary | Octal |
+-----+--------+-------+
| --- | 000 | 0 |
| --x | 001 | 1 |
| -w- | 010 | 2 |
| -wx | 011 | 3 |
| r-- | 100 | 4 |
| r-x | 101 | 5 |
| rw- | 110 | 6 |
| rwx | 111 | 7 |
+-----+--------+-------+
Example:
$ chmod ug+x my_script.sh
# Adds the permission to execute the file to its
# owner user and owner group.
$ chmod o-w myfile.txt
# Removes the permission to write to the file
# from users other than its owners.
For instance:
$ ls -lh my-script
-r-xr-xr-x 1 username username 1.9K Sep 27 09:44 my-script
$ cat my-script
#!/bin/bash
# The above line tells Linux how to invoke the script on my behalf.
echo 'This is a script being run without using bash!'
$ ./my-script # my-script is invoked just like a compiled binary!
This is a script being run without using bash!
Directories are also files!
$ ls -alh | grep foobarbaz
drw-rw-rw- 2 voigte voigte 4.0K Sep 29 10:47 foobarbaz
# Below is the literal output, not pseudo-output
$ ls -alh foobarbaz
ls: cannot access foobarbaz/.: Permission denied
ls: cannot access foobarbaz/..: Permission denied
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
# create empty file called foo
$ touch foo
$ touch bootcamp/emptyfile
$ ls -alh bootcamp/emptyfile
-rw-rw-r-- 1 dobc dobc 0 Nov 3 22:38 bootcamp/emptyfile
# You may need to create the devops group.
$ sudo chown dobc:devops bootcamp/emptyfile
# Alternatively, you can also do the following
$ sudo chgrp devops bootcamp/emptyfile
$ touch allperms
$ chmod ugo+rwx allperms
$ ls -l allperms
-rwxrwxrwx 1 dobc dobc 0 Nov 3 22:39 allperms
Bonus: What’s another way of giving a file all permissions?
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Everything that isn’t hardware.
$ ldd /usr/bin/nano
linux-vdso.so.1 => (0x00007ffc1fdcd000)
libncursesw.so.5 => /lib64/libncursesw.so.5 (0x00007ff2cfaee000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007ff2cf8c4000)
libc.so.6 => /lib64/libc.so.6 (0x00007ff2cf500000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ff2cf2fc000)
/lib64/ld-linux-x86-64.so.2 (0x000055e46c4b4000)
Take care of installation and removal of software
.rpm
.deb
Yum
Apt
Examples:
How to install a package from source:
$ sudo yum install git gcc make ncurses-devel
$ git clone https://github.com/mtoyoda/sl.git
$ cd sl
$ make
gcc -O -o sl sl.c -lncurses
$ mkdir -p ~/local/bin
$ cp sl ~/local/bin/
$ echo "export PATH=$HOME/local/bin:$PATH" >> ~/.bashrc
$ source ~/.bashrc
$ whereis sl
sl: /home/dobc/local/bin/sl
$ sl
$ grep --version
grep (GNU grep) 2.20
$ which grep
alias grep='grep --color=auto'
/usr/bin/grep
$ wget http://mirrors.kernel.org/gnu/grep/grep-3.1.tar.xz
$ tar -Jxvf grep-3.1.tar.xz
$ cd grep-3.1
$ ./configure --prefix=$HOME/local/
$ make
$ make install
$ hash -r
$ grep --version
grep (GNU grep) 3.1
$ which grep
alias grep='grep --color=auto'
~/local/bin/grep
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
VCS is how one tracks changes, modifications, and updates to source files over time. Creating a history of changes for a project over time.
Git is a Free and Open Source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. ( https://git-scm.com )
$ git config --global user.name "My Name"
$ git config --global user.email "myself@gmail.com"
$ git config --global core.editor "nano"
Create a project with Git:
$ mkdir my-project
$ cd my-project # Always run `git init` inside of a project folder!
$ git init # Never inside of your home directory.
Add and commit a file to your project with Git:
$ touch newfile.txt
$ git add newfile.txt
$ git commit # Edit message in Nano, save the file, exit to commit.
To see which files are staged, unstaged, or untracked:
$ git status
To look through your repository history:
$ git log
To create and checkout a branch:
#Note the `*` which indicates the current branch
$ git checkout -b "new-branch"
$ git branch
master
* new-branch
Checkout a new feature branch on your repository.
$ git checkout -b "add-awesome-feature"
Create/Edit files on the new branch.
$ echo "Some awesome text" > awesomefile.txt $ git status # On branch add-awesome-feature # Untracked files: ... # awesomefile.txt ... $ git add awesomefile.txt $ git commit -m "Short awesome commit message"
View the diff between the two.
$ git diff master diff --git a/awesomefile.txt b/awesomefile.txt new file mode 100644 index 0000000..08cec7f --- /dev/null +++ b/awesomefile.txt @@ -0,0 +1 @@ +Some awesome text
Locally merge the changes from your new branch into Master.
$ git checkout master $ git merge add-awesome-feature Updating 459de26..5c4ca48 Fast-forward awesomefile.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 awesomefile.txt
Everybody uses VCS differently. Choose the workflow that works best for everybody involved.
To contribute to someone else’s repository you first need to clone the repo.
$ cd /path/to/my/projects
$ git clone <some git url>
$ cd <new repo directory>
$ ls
Once you clone a repository you can make as many local changes as you want without affecting the original (central) copy. You can experiment and work without the original owner even knowing what you’re doing!
$ cd ~
$ git clone https://github.com/DevOpsBootcamp/tinsy-flask-app.git
$ cd tinsy-flask-app
See http://git.io/vcVmB for more details about the tinsy-flask-app repository.
#Setup python virtual environment
$ virtualenv venv
$ source venv/bin/activate
(venv) $ pip install -r requirements.txt
#Run server
(venv) $ python script.py
#When finished, deactivate virtual environment
(venv) $ deactivate
$
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Programming is a big topic.
function f(x):
# This line is a comment, not run by the computer.
# Comments are only for human eyes.
if x is less than than 5
print "x is less than 5"
else if x is less than than 10
print "x is greater than five and less than 10"
else
print "x is greater than 10"
>>> x = "value"
>>> print(x)
value
>>> x = "different value"
>>> print(x)
different value
Data types dictate how a piece of data should be handled within a program.
Flow Control allows you to execute code only if certain conditions are met.
Conditionals are used to tell the program when to execute commands.
In pseudocode, they usually look something like
if some conditional statement is true
do something
else if some other conditional
do something else
else
do a final thing
Loops are used to do multiple things, usually an indefinite number of things.
For instance:
for every element, let's call it "foo", in a list "my_list"
if foo is greater than five
print(foo)
else
print(foo + " is too small")
While loops execute indefinitely (while something continues to be true).
For loops iterate over a list (array) of elements or to a specific number.
>>> user_input = get_input("Where would you like to go today? ")
>>> -> Where would you like to go today? Nebraska
>>> print(user_input)
>>> -> nebraska
>>> print(reverse(user_input))
>>> -> aksarben
function read_file(x):
# Also check that it exists! How convenient!
if file_exists(x)
v = read_file_to_string(x)
return v
else
print("file does not exist")
return Null
struct dog {
breed: String
height: Float
color: String
age: Integer
}
spot = struct dog # Create a new variable of type `struct dog`
spot.breed = "corgie" # Assign each member a variable.
spot.height = 1.5
spot.color = "Blond"
spot.age = 1
print(spot.breed, spot.height, spot.color, spot.age)
class chair():
function init(material):
self.material = material
function rock():
print("The ", self.material, " chair rocks slowly.")
>>> my_chair = chair.init("plastic")
>>> my_chair.rock()
>>> -> The plastic chair rocks slowly.
import math_lib
print(math_lib.pi, math_lib.pow(2, 5), math_lib.tan(79.3))
# prints out "3.14 32 .951"
$ sudo <apt or yum> install python
Type | Example |
boolean | True |
integer | 7 |
long | 18,446,744,073,709,551,615 |
float | 12.4 |
string | "Hello World!" |
list | ['first', 'second'] |
dict (map) | {'key1': 'value', 'key2', 'value2'} |
tuple | ('value','paired value') |
object | anObjects.variable == <value> |
None |
# This is a comment
boolean = True # boolean
name = "Lucy" # string
age = 20 # integer
pi = 3.14159 # float
alphabet = ['a', 'b', 'c']
dictionary = {"pi":3.14159, "sqrt 1":1}
winter = ('December', 'January', 'February', 'March')
print(name + " is " + str(age+1) + " this " winter[3])
Open a REPL (Read Evaluate Print Loop):
$ python
>>> print("I'm in a REPL!")
>>> name = # <Your name>
>>> age = # <Your age>
>>> print(name + " is " + str(age))
>>> # We need to convert age from int to string so it can print!
if name == "Lucy":
for month in winter:
print name + " doesn't like " + month
else:
print "My name isn't Lucy!"
There are a few ways to use other code in your code:
from math import pi
x = pi
from math import *
x = pi
There are hundreds of Python libraries. If you’re trying to do something and think “This has probably been solved...”, Google it!
Some libraries to know:
$ sudo apt-get install python-virtualenv
$ sudo yum install
# In each project you work on, you'll want to run
$ virtualenv venv
$ source venv/bin/activate
(venv)$ pip install <package>
(venv)$ deactivate
Formalize the last TODO by writing them in Python.
Prove the program works by running the code!
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Frameworks are collections of classes, functions, and constants designed to make completing a task easier.
Types of frameworks include:
To take care of the boring stuff.
Use a framework if you are making a cookie cutter application.
If a framework exists for what you’re doing, consider using it.
Things to keep in mind when looking for a framework:
Good frameworks usually have:
- Good documentation
- Active developers
- A helpful community
There are two types of websites: Static and Dynamic.
@app.route('/accounts/<account_name>', methods=['DELETE'])
def delete_account(account_name):
if authenticated() and authorized():
database.remove_account(account_name)
return 'Success', 200
else
return 'Failure', 401
<!DOCTYPE HTML>
<html>
<head>
<title>Template Example</title>
</head>
<body>
<p>Your lucky number today is {{ number }}!</p>
</body>
</html>
render_template("template.html", number=random.randint(0, 99))
Your lucky number today is 42!
...
<body>
{% for message in messages %}
<p>{{ message }}</p>
{% endfor %}
</body>
...
messages = ["Welcome!", "Test Message", "Vim > Emacs"]
render_template("template2.html", messages=messages)
Welcome!
Test Message
Vim > Emacs
GET http://web.site/page.html HTTP/1.1
HTTP/1.1 200 OK
Content-Type: text/html
...
<!DOCTYPE HTML>
...
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
def add_double(x, y):
return 2*(x+y)
def test_add_double():
expect(add_double(1, 2) == 6)
Most tests consist of the same general structure:
Simulating behavior external to a program so your tests can run independently of other platforms.
You’re testing your program, not somebody else’s. Mock other people’s stuff, not your own.
$ run tests
Finding tests...
Running tests in tests/foo.ext
Running tests in tests/bar.ext
Running tests in misc/test_baz.ext
While you can write tests the hard way:
var = some_function(x)
if var == expected_output:
continue
else
print("Test X failed!")
$ run test
Test 5 failed!
It’s usually easier to use a framework.
def simple_test():
expect(some_function(x), expected_output)
$ run tests
....x.....
Test 5 failed.
Debug information:
...
def tests_setup():
connect to database
populate database with test data
def tests_teardown():
delete all data from test database
disconnect from database
def some_test()
setup is called automatically
use data in database
assert something is true
teardown is run automatically
Let’s suppose that we want to add a new view to the Flask app we created in the Frameworks lesson’s TODO. When the user enters the url /hello/<name>, where “name” is any string of the user’s choice, the view should return “Hello <name>!!” BEFORE you actually write this view, write a test that will test the desired functionality first– i.e., test that your hello.py returns “Hello bob!!” when “bob” is provided as the name variable. AFTERWARDS, implement the actual view to make your test(s) pass.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Continuous Integration is a name for any kind of automated tool that performs the following tasks:
Travis CI is very popular among Github users because it is easy to setup with Github projects and integrates well with Github workflows. It’s also free for Open Source projects, although the service itself is not Open Source.
Runs test suites for:
Jenkins is a more powerful version of Travis, but as a result is more complicated to use and set up. While you can pay to use a public instance of Jenkins, it is more common to run your own instance of Jenkins.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
- se·cu·ri·ty ( siˈkyo͝oritē/ ) [ noun ]
The state of being free from danger or threat.
The safety of a state or organization against criminal activity such as terrorism, theft, or espionage.
There are three main types of security in computing:
Security pertaining to networked services (websites, databases, etc).
Each of these encompasses a field of computer security unto itself. We will at least mention each of them in more detail, but we will focus on network security in this course.
Threat models allow you to focus and limit your security resources on what is necessary instead of what is possible.
Threat models are the assessment of which attacker you are protecting against. This is so you don’t spend too much time in a panic attack trying to protect your tiny webapp from the NSA.
Access Control is a framework for controlling who has access to what resources on a system. There are many ways to implement Access Control, but the three basic principles of Access Control are Identification, Authentication, and Authorization.
Passwords are a necessary part of security. They aren’t great though for a few reasons.
Code Injection is the act of inserting code into a running process (website, webapp, word processor, etc.) with malicious intention.
+-----------+----------------------------------------+
| username: | admin |
+-----------+----------------------------------------+
| password: | pass' || true); DROP TABLE STUDENTS;-- |
+-----------+----------------------------------------+
<img onerror=alert("Tracking your IP with a GUI interface!");>
<img src="http://example.com/?action="Delete All Accounts">
Some of these attacks are very hard to fight against, but they all have industry-tested solutions that are easy enough to implement in an application of your own.
Web Server attacks take advantage in vulnerabilities of specific versions or default configurations of webservers.
If you think you encountered a bug, make sure you can replicate it. If you can’t how can you expect the developers to recreate it?
Provide examples – it’s basically a bug report, but through private channels (not public tracker yet!)
Google waits 90 days to announce a bug after informing the developers.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Imagine a kitchen cupboard program that stores food currently in stock, where it is, recipes using it, expiration dates, etc.
<Table 1>
+---------------+-----------+-----------+
| <Primary key> | <Field 1> | <Field 2> |
+---------------+-----------+-----------+
| 1 | value | value` |
| ... | ... | ... |
+---------------+-----------+-----------+
<Table 2>
+---------------+-----------+--------------------------+
| <Primary key> | <Field 1> | <Foreign key to Table 1> |
+---------------+-----------+--------------------------+
| 1 | val | 7 |
| ... | ... | ... |
+---------------+-----------+--------------------------+
<Table 1>
+------------------+------------------+
| <Name> | <Major> |
+------------------+------------------+
| Linus Torvalds | Computer Science |
| Richard Stallman | Computer Science |
+------------------+------------------+
<Table 2>
+------------------+--------------+----------------+
| <Major> | <School> | <Advisor Name> |
+------------------+--------------+----------------+
| Computer Science | Engineering | Dennis Ritchie |
+------------------+--------------+----------------+
<Table 1> JOIN <Table 2>
+------------------+------------------+-------------+----------------+
| <Name> | <Major> | <School> | <Advisor Name> |
+------------------+------------------+-------------+----------------+
| Linus Torvalds | Computer Science | Engineering | Dennis Ritchie |
| Richard Stallman | Computer Science | Engineering | Dennis Ritchie |
+------------------+------------------+-------------+----------------+
When you have to work with a lot of well structured data.
There are two broad types of databases.
Schemas are how you define what a table looks like, what data will populate it, and what each field will be called. The schema also defines relationships between tables; more or less the blueprint of your database.
CREATE TABLE nobel (
id int(11)
NOT NULL
AUTO_INCREMENT,
yr int(11),
subject varchar(15),
winner varchar(50)
)
ENGINE = InnoDB;
Migrations are the process of updating tables and fields in your database. Since databases might need to change in the future (you never know!) you can create and run a migrations to modify your schema as needed.
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial')
]
operations = [
migrations.AddField("Nobel", "topic", models.CharField(80))
]
There are many tools out there that allow you to avoid writing raw SQL, but it’s always good to know the syntax. One day you may need to write raw SQL queries, and at the very least you’ll need to read SQL for debugging purposes.
Select statements get data from the database which matches the requirements you have.
SELECT
yr, subject, winner
FROM
nobel
WHERE
yr = 1960 AND subject='medicine';
+------+------------+-------------------------------+
| yr | subject | winner |
+------+------------+-------------------------------+
| 1960 | "medicine" | "Sir Frank Macfarlane Burnet" |
| 1960 | "medicine" | "Sir Peter Brian Medawar" |
+------+------------+-------------------------------+
Insert statements create an entry into a table and populate the fields appropriately.
INSERT INTO
nobel
VALUES
('2013','Literature','Herta Müller');
+-----+------+--------------+----------------+
| id | yr | subject | winner |
+-----+------+--------------+----------------+
| ... | ... | ... | ... |
| 873 | 2013 | "Literature" | "Herta Müller" |
| ... | ... | ... | ... |
+-----+------+--------------+----------------+
Update statements modify an existing entry in a table.
UPDATE
nobel
SET
winner='Andrew Ryan'
WHERE
subject='Peace' AND yr='1951';
+-----+------+---------+----------------+
| id | yr | subject | winner |
+-----+------+---------+----------------+
| ... | ... | ... | ... |
| 120 | 1951 | "Peace" | "Andrew Ryan" |
| ... | ... | ... | ... |
+-----+------+---------+----------------+
Delete statements... You can guess what a delete statement does I bet.
DELETE FROM
nobel
WHERE
yr = 1989 AND subject = 'peace';
Craft a query to get the following data out of our Nobel table:
Don’t worry about getting it exactly right! Craft pseudo-SQL!
SELECT winner FROM nobel
WHERE yr=1952 AND subject='medicine'; #(Selman A. Wksman)
SELECT * FROM nobel
WHERE yr=1903 AND subject='physics'; #(3)
SELECT * FROM nobel
WHERE winner='Linus Pauling'; #(2)
SELECT COUNT(*) FROM nobel
AS n0 INNER JOIN nobel AS n1 on n0.winner=n1.winner
AND (n0.yr!=n1.yr or n0.subject!=n1.subject); #(16)
Now that we have belabored the theory of databases and SQL, lets actually start doing work with databases.
Throughout this exercise we will load it up with some data (nobel.sql.gz) and learn to interact with it via the command line interface.
# Create a table for Nobel prizes
$ mysqladmin -u root create nobel
# Get the database from the osl server
$ wget http://osl.io/nobel -O nobel.sql.gz
# Gunzip the file and import it into the nobel db
$ gunzip nobel.sql.gz
$ mysql nobel < nobel.sql
# OR do it in one step!
$ zcat nobel.sql.gz | mysql nobel
# Open up mysql shell to execute queries
$ mysql nobel
# List all the tables
SHOW TABLES;
# Print the layout of the database to the screen
DESCRIBE nobel;
Now that you have a working database you have a few options for how you want to use it.
We’ve already done this in the previous exercise. You use your choice of program to interact with the database exclusively via SQL and run the queries you want. This is rarely the way to go and isn’t very useful for most applications. The SQL language is only good for doing database stuff.
mysql> SELECT subject, yr, winner FROM nobel
WHERE yr=1960;
+------+------------+-----------------------------+
| yr | subject | winner |
+------+------------+-----------------------------+
| 1960 | Chemistry | Willard F. Libby |
| 1960 | Literature | Saint-John Perse |
| ... | ... | ... |
+------+------------+-----------------------------+
See nobel.py
#!/usr/bin/python
import MySQLdb
import os
db = MySQLdb.connect(
os.environ['MYSQL_PORT_3306_TCP_ADDR'],
'root',
os.environ['MYSQL_ENV_MYSQL_ROOT_PASSWORD'],
"nobel"
)
cursor = db.cursor()
cursor.execute("SELECT subject, yr, winner FROM nobel WHERE yr = 1960")
data = cursor.fetchall()
for winner in data:
print "%s winner in %s: %s " % (winner[0], winner[1], winner[2])
db.close()
# SELECT * FROM nobel WHERE yr = 1960
for subject, yr, winner in session.query(Nobel).filter_by(yr=1960):
print "%s winner in %s: %s " % (subject, yr, winner)
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Code analysis tools are some of the most important tools in a developer’s arsenal when it comes to finding and fixing bugs. Code analysis tools come in two flavors:
Debuggers are interactive dynamic analysis tools that are used to inspect your code as it runs.
C/C++ Tools
GDB
Valgrind
Python Tools
PDB
NodeJS Tools
node debug
Node Inspector
Linters inspect your code and flags suspicious usage. This can be to enforce a style guide or to flag code which will probably not compile or break the program when it is running.
src/times.js: line 407, col 20, Expected '{' and instead saw 'return'.
src/times.js: line 415, col 49, Missing semicolon.
src/times.js: line 407, col 58, 'error' is not defined.
Name Stmts Miss Cover Missing
-------------------------------------------------------
my_program.py 20 4 80% 33-35, 39
my_other_module.py 56 6 89% 17-23
-------------------------------------------------------
TOTAL 76 10 87%
IDEs are programs used to help developers get their job done by integrating many essential tools into one ecosystem.
The Linux kernel style guidelines are actually fun to read:
“First off, I’d suggest printing out a copy of the GNU coding standards, and NOT read it. Burn them, it’s a great symbolic gesture.”
NASA’s Jet Propulsion Laboratory style guidelines are very short and are concerned with automated tooling to do code analysis:
“All loops shall have a statically determinable upper-bound on the maximum number of loop iterations.”
Dependency isolation is the process of – wait for it – isolating the dependencies of a project. This is a surprisingly hard problem and many consider it largely unsolved.
Setup and enter the virtual environment.
$ virtualenv <virtualenv name>
New python executable in /path/to/<venv name>/bin/python
Installing setuptools, pip, wheel...
done.
$ source <venv name>/bin/activate
Install a package. This installs it in the current working directory and so does not ask for root permissions.
(<venv name>) $ pip install flask
[...]
To list all packages in the venv:
(<venv name>) $ pip freeze
click==6.7
Flask==1.0.2
itsdangerous==0.24
Jinja2==2.10
MarkupSafe==1.0
Werkzeug==0.14.1
Deactivate (leave) the venv.
(<venv name>) $ deactivate
$
A Carbon Copy of the Production Environment(s)
Development servers are used to test that your code works in a real environment, with a real server, and real data. You shouldn’t throw your code up on a production website to see if it works, so a development server is as close to the real thing as you can get.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Use it for learning purposes at your own peril.
If you have any feedback, please fill out our General Feedback Survey.
HOSTS.TXT circa 1977:
MIT 1
Yale 2
Harvard 3
ATT 4
...
HOSTS.TXT a few years later:
...
joeBillson 14895
susan-gill 15832
...
Acronym | Name |
A, AAAA | IP Addresses |
MX | SMTP Mail Exchangers |
NS | Name Servers |
SOA | DNS Zone Authority |
PTR | Pointers for Reverse DNS Lookups |
CNAME | Domain Name Aliases |
The A record is used to map an IP address to a domain name. This is as close to a ‘regular’ record as you can get.
osuosl.org. 300 IN A 140.211.15.183
The MX record is for tracking mail servers.
osuosl.org. 3600 IN MX 5 smtp3.osuosl.org.
osuosl.org. 3600 IN MX 5 smtp4.osuosl.org.
osuosl.org. 3600 IN MX 5 smtp1.osuosl.org.
osuosl.org. 3600 IN MX 5 smtp2.osuosl.org.
Servers with a NS record are allowed to speak with authority on a domain and DNS requests.
osuosl.org. 86258 IN NS ns1.auth.osuosl.org.
osuosl.org. 86258 IN NS ns2.auth.osuosl.org.
osuosl.org. 86258 IN NS ns3.auth.osuosl.org.
SOA is the record for proving authority over a site or zone.
osuosl.org. 86400 IN SOA ns1.auth.osuosl.org. ...
CNAME is an record for aliasing old names to redirect to new names.
bar.example.com. 86400 IN CNAME foo.example.com
Tells you there is no answer to a query:
Host something.invalid.osuosl.org not found: 3(NXDOMAIN)
Some ISPs and others never serve NXDOMAINS, instead they point you at themselves.
$ dig ns .
;; ANSWER SECTION:
. 512297 IN NS i.root-servers.net.
. 512297 IN NS e.root-servers.net.
. 512297 IN NS d.root-servers.net.
. 512297 IN NS j.root-servers.net.
. 512297 IN NS b.root-servers.net.
. 512297 IN NS a.root-servers.net.
. 512297 IN NS f.root-servers.net.
. 512297 IN NS h.root-servers.net.
. 512297 IN NS g.root-servers.net.
. 512297 IN NS c.root-servers.net.
. 512297 IN NS m.root-servers.net.
. 512297 IN NS k.root-servers.net.
. 512297 IN NS l.root-servers.net.
dig is a command-line tool for performing DNS lookups.
Syntax:
dig @server name type
Examples:
dig @ns1.osuosl.org osuosl.org A
First we query a NS record for .:
$ dig ns .
;; QUESTION SECTION:
;. IN NS
;; ANSWER SECTION:
. 518400 IN NS i.root-servers.net.
. 518400 IN NS a.root-servers.net.
. 518400 IN NS l.root-servers.net.
. 518400 IN NS f.root-servers.net.
. 518400 IN NS b.root-servers.net.
etc...
Next we query NS for org.:
$ dig ns com. @a.root-servers.net
;; QUESTION SECTION:
;org. IN NS
;; AUTHORITY SECTION:
org. 172800 IN NS a0.org.afilias-nst.info.
org. 172800 IN NS a2.org.afilias-nst.info.
etc...
;; ADDITIONAL SECTION:
a0.org.afilias-nst.info. 172800 IN A 199.19.56.1
etc...
Next we query NS for osuosl.org.:
$ dig ns osuosl.org. @199.19.56.1
;; QUESTION SECTION:
;osuosl.org. IN NS
;; AUTHORITY SECTION:
osuosl.org. 86400 IN NS ns3.auth.osuosl.org.
osuosl.org. 86400 IN NS ns2.auth.osuosl.org.
osuosl.org. 86400 IN NS ns1.auth.osuosl.org.
;; ADDITIONAL SECTION:
ns1.auth.osuosl.org. 86400 IN A 140.211.166.140
ns2.auth.osuosl.org. 86400 IN A 140.211.166.141
ns3.auth.osuosl.org. 86400 IN A 216.165.191.53
Next we query A for osuosl.org.:
$ dig a osuosl.org. @140.211.166.140
;; QUESTION SECTION:
;osuosl.org. IN A
;; ANSWER SECTION:
osuosl.org. 300 IN A 140.211.15.183
;; AUTHORITY SECTION:
osuosl.org. 86400 IN NS ns1.auth.osuosl.org.
osuosl.org. 86400 IN NS ns2.auth.osuosl.org.
osuosl.org. 86400 IN NS ns3.auth.osuosl.org.
;; ADDITIONAL SECTION:
ns1.auth.osuosl.org. 86400 IN A 140.211.166.140
ns2.auth.osuosl.org. 86400 IN A 140.211.166.141
ns3.auth.osuosl.org. 3600 IN A 216.165.191.53
Can you traverse the DNS tree to get to these websites? Give it a try!
- github.com
- web.archive.org
- en.wikipedia.org
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
“Configuration management is the process of standardizing resource configurations and enforcing their state across IT infrastructure in an automated yet agile manner.”
- Puppet Labs
user { 'audience':
ensure => present,
}
In the beginning there were no computers.
Then many years passed and eventually we built the first computer.
Then a few years after that we had more computers than we really had time to manage. Things got out of hand pretty quick.
packages [nginx, python, vim]
state installed
update true
service nginx
state enabled
alert service myapp_daemon
package "apache" do
package_name "httpd"
action :install
end
service "apache" do
action [:enable, :start]
end
Note
Since chef uses Ruby you can do loops and other cool Ruby-isms in your configuration management. This can be a gift and a curse.
package { "apache":
name => "httpd",
ensure => present,
}
service { "apache":
name => "apache",
ensure => running,
enable => true,
require => Package["apache"],
}
Note
Since Puppet designed its own language you are more limited in what you can express, but this isn’t always a bad thing. It’s feature rich and can do pretty much anything that Chef can.
- hosts: all
tasks:
- name: Install Apache
yum:
name: httpd
state: present
- name: Start Apache Service
service:
name: httpd
state: running
enabled: yes
Note
Ansible’s language is Yaml, which is basically JSON but easier to read and write. This is similar to Puppet in it limits the possible functionality, but again: these tools all achieve the same result, they just get there in different ways.
Ansible’s Documentation is comprehensive and contains an easy-to-follow “Getting Started” guide.
Kitchen-CI is a Chef oriented testing system
concepts
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
[vm] # ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.6 110564 3164 ? Ss 2015 11:17 /lib/systemd/systemd --system --deserialize 15
root 2 0.0 0.0 0 0 ? S 2015 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 2015 3:55 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< 2015 0:00 [kworker/0:0H]
[... 120+ more lines ...]
[host] # ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 200328 5208 ? Ss Aug25 0:44 /sbin/init
root 2 0.0 0.0 0 0 ? S Aug25 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Aug25 0:05 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< Aug25 0:00 [kworker/0:0H]
[... 240+ more lines ...]
[container] $ ps aux
PID USER TIME COMMAND
1 root 0:00 sh
6 root 0:00 ps aux
Virtual Machines | Containers |
Complete process isolation | Fast startup |
‘Battle Tested’ | Little overhead |
Virtual Machines | Containers |
Slightly more overhead. | Security concerns. |
Slow startup. | No cross-kernel emulation. |
Cross-kernel emulation. |
Virtual Machines | Containers |
VirtualBox | Docker |
VMWare | Rkt |
An Open Source VM Manager.
Widely used and supported on Linux, Mac, and Windows.
A closed source VM Manager.
VMWare is a widely used and tends to have better performance than Virtual Box. While it can emulate Linux it does not work natively on Linux.
The Kernel-based Virtual Machine.
Linux’s native infrastructure for handling Virtual Machines and emulation. Usually used in a larger emulation program, not alone.
The de facto CLI tool for creating and using containers.
Very popular and well integrated into other tools.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
[...] a model for enabling ubiquitous, on-demand access to a shared pool of configurable computing resources.
Clouds can be great tools, but they have some disadvantages:
AWS provides a lot of services, not all of which are named very well. This article explains what each service does in plain English.
Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Share the Love (and the Code)
Find a project
Read Contributing and Getting Started docs
Look at list of issues
Do a thing!
- Write a test
- Fix a typo
- Deploy and update the installation docs
Licenses to use:
Licenses to *not* use:
DevOps is a hybrid of skills from both Software Development (Dev) and Computer Operations (Ops) intended to meet the unique demands of cloud computing. Software Developer and Systems Administrator are no longer mutually exclusive job titles. Devs need more Ops knowledge to understand how their application will run in the real world. Admins need more Dev knowledge to design infrastructure that fit an app’s needs efficiently and effectively. To top it off site reliability engineers and many modern security roles require at least a little background in both development and operations.
DevOps BootCamp is an OSU Open Source Lab program dedicated to teaching core software development and systems operation skills. The program is free and open to any interested OSU students, community member, and online go-getter. DevOps BootCamp provides a comprehensive Open Source education that is outside the scope of regular Linux Users Group meetings and OSU Coursework.
Our goal is to make the DevOps BootCamp program accessible to students and community members from all backgrounds. Students should:
Attendance is not mandatory but highly suggested to get the most out of DOBC; We will not spend class time reviewing material for those who skip a lecture and each classes curriculum will build on what you learned the previous session. All curriculum will be available online before and after class sessions to get caught up.
BootCamp mentors will be available at scheduled times outside of regular classes to help answer any questions about the training program’s content. If you attend a lesson and don’t understand something then you are encouraged to ask that question during the meeting since others are likely have the same question.
As the course progresses, you will need a laptop. We hope and recommend that you decide to set up your laptop to dual-boot to Linux as the course progresses, but it is not required. If you don’t own a laptop and are an OSU student you can check out a laptop from the OSU Library for at least 24 hours at a time.
As long as your laptop is new enough to boot from USB and connect to a wireless network the exact specifications do not matter. You will be provided with a remote virtual machine with which to do all class projects.
If you are not an OSU student and do not have access to a working laptop, contact the DevOps BootCamp (email devopsbootcamp) organizers and they will see whether one can be loaned out to you.
Join the mailing list for updates.
Feel free to also join us on Slack. If you sign up using your OSU email address, you’ll automatically get added without any invitation. If you don’t have an email address from from the allowed domains, please let us know and we’ll get you invited!
Join us on irc.freenode.net in #devopsbootcamp (students will be setting up an IRC network for the program early in the program).
If you’d like to help edit this site, email devopsbootcamp or ping anyone in #devopsbootcamp on Freenode with your GitHub username to get access to the web site repo. You’ll also want to learn the ReStructured Text markup language to edit the site, if you don’t already know it.
Secure Shell (SSH) provides a secure channel to access a Linux machine remotely via command line.
Windows doesn’t come with an ssh client natively, however you can download and install PuTTY to give you a nice SSH client.
If you’re already running Linux or have a Mac laptop, you already have an ssh installed. For the Mac, simply open up the Terminal.app. For Linux, you can use something like Gnome Terminal, Terminator or xterm to name a few.
Docker is a software technology which provides the use of containers which is kind of a light form of virtual machines. It’s used quite a bit in DevOps to setup development environments along with a variety of other uses. In addition to Docker, we’re going to be using Docker Compose which is used for running multi-container environment. For DevOps Bootcamp, we’re going to be using Docker in a variety of ways from acting as a simple Linux machine, to hosting applications.
Docker can be installed on Windows, Mac and a variety of Linux operating systems (Ubuntu, Debian, CentOS, Fedora). Please be sure you read the installation instructions closely to ensure your system supports running Docker and has the needed BIOS features enabled. If you have any trouble getting it installed, feel free to ask in our Slack channel.
Docker Compose can be installed on Windows, Mac and a variety of Linux operating systems. Please read the installation instructions for your platform carefully.
First you need you need to clone the Bootcamp-Exercises repository:
$ git clone https://github.com/DevOpsBootcamp/Bootcamp-Exercises.git
Once you have Docker and Docker Compose installed and running and also have the Bootcamp-Exercises repository cloned, you can spin up a Docker image we’ve created for DOBC by running the following from the root of the repository directory:
$ cd Bootcamp-Exercises
$ docker-compose up -d
$ docker-compose run -p 8080:8080 dobc bash
You can log out by typing exit and then enter which will stop the container.
To stop the container, run the following:
$ docker-compose kill
$ docker-compose rm --all
The DevOps BootCamp content is available for free but meet-space guided lectures are offered throughout the year. Check the schedule below for our in-person lectures; each lecture covers a different part of the curriculum covering the entire course during the OSU academic school year.
Warning
If you are working ahead be aware that the schedule and slides may be subject to change. Check back regularly.
Lessons Covered | Date/Time | Location | Description |
---|---|---|---|
0 - 7 | Oct 27, 2018 9:30am-3:30pm | OSU KEC 1001 | DevOps BootCamp Fall Kickoff |
Each lab has two time slots (please choose one) to help assist with students being able to attend. All labs will in Milne 224.
Description | Slot 1 | Slot 2 |
---|---|---|
Lab #1 | Oct 31, 2018 10am-12pm | Nov 1, 2018 2-4pm |
Lab #2 | Nov 14, 2018 10am-12pm | Nov 15, 2018 2-4pm |
Lab #3 | Nov 28, 2018 10am-12pm | Nov 29, 2018 2-4pm |
If you’re reading this it means you’re interested in running DOBC yourself. It may have been passed on to you, or you may just like the curriculum and want to use it to start your own DOBC. Either way, thank you for reading this!
This page is a growing checklist, warning, notes, and fables from those teaching and contributing to DOBC. If you read this, heed it’s warnings and take it’s lessons to heart you will no doubt be on your way to success.
As a lecturer you won’t always teach perfectly. You won’t get it perfect the first, second, third, or even last time – but you should always strive for perfection.
Take notes on what could have gone better, questions that were asked, and confusions students had. The DOBC curriculum can be very dense and sometimes it skims over important stuff. During each lesson be sure to improve the curriculum based on your notes. Whoever teaches it next time will thank you.