[MUSIC PLAYING]
ERIC JOHNSON: Hi, I'm Eric, an engineering manager at Google,
working on open source integrations for Google Cloud
Platform.
This is the first, in a short series of videos,
talking about some of the great open source tools by HashiCorp,
and how they can be used with Google Cloud Platform.
[LASER BEAM]
Each video will focus on a specific tool,
but will be part of an overall demo
that we'll keep adding to with each new video in the series.
And over Hangouts, I have with me
today Arden [? Yakamenko, ?] a Googler based
in Sydney, and Chris Roberts, an engineer at HashiCorp
based in Portland, Oregon.
Thanks for joining me today, fellows.
Here's the background story for this series.
Each video will have a different set of guest speakers.
But let's imagine they're part of a small game studio
and are working on their next project, a 1980s retro style
space game, but updated the plan a web
with multi-player support.
It's been designed to have a separate JavaScript front end
and back end server written in the Go programming language.
Through the next few videos, we'll
follow the project along from the development phase
up through a demo to the CEO, and then
finally the big launch.
But for today's video, we're still
in the development phase of the project
with a couple of developers actively
working on writing the code.
So where do the HashiCorp tools fit into this?
Today we'll start with Vagrant.
Chris, can you tell us a little bit about Vagrant
and what problems it solves?
CHRIS ROBERTS: Sure.
Vagrant is a tool primarily used by software developers.
It provides an easy and repeatable way
to create custom developer environments.
Vagrant has been around for a long time
and brings together the well known worlds
of VMs and operating systems, along
with some of the same patterns, you
may have heard about with Docker,
but without having to adopt a new container-centric world.
ERIC JOHNSON: Thanks, Chris.
I think we've all heard stories, or experienced this ourselves,
of working at places where developers create
their environments by copying and pasting
a bunch of shell commands from some internal wiki page.
Vagrant essentially replaces those set up instructions
with a single configuration file that
can be put under version control and treated just
like your code.
Correct me if I'm wrong, but a common use
case is for developers to use Vagrant
to spin up local VMs if they have
VirtualBox or VMware installed.
CHRIS ROBERTS: Yes, that's correct.
With local VMs, the developer isn't cluttering up
their host's operating system with a bunch of extra software,
or having to run a specific operating system.
It's easy to create and destroy these VMs too.
What can start to get tricky, though,
is when developers want to collaborate using a local VM.
And while Vagrant does have a share feature,
that may not always be a viable option.
SPEAKER 3: So, they can use a remote VM that they can share.
This is where GCP integration with Vagrant comes in.
Google Cloud Platform has many different services
ranging from big data and machine learning,
all the way down to infrastructure offerings
such as our VM service, Compute Engine.
Let's get started with how developers can use Vagrant
to spin up a shared GCP VM.
CHRIS ROBERTS: First, go to vagrantup.com and download
the version for your local system.
SPEAKER 3: Next, go to cloud.google.com/free-trial
to create a Google Cloud Platform account,
if you don't already have one.
Next, you'll need to enable the Google Compute Engine API.
A service account and a corresponding JSON credential
file will need to be created as well.
Now we'll spin up a Google Compute Engine
instance with my hyperspace video game
and develop and environment.
Ready to go.
Don't forget to install the Vagrant Google driver using
Vagrant's plug in command.
I'll do that with a Vagrant up-command
with Google providers specified.
Of course, for Vista work, I'll need to create my Vagrant
file first.
Chris, can you walk us through our Vagrant file?
CHRIS ROBERTS: Sure.
First, we define the provider information
to access the GCE API.
This includes a project ID, client email,
and user information.
Next, we provide details for the type of instance
we want Vagrant to create and set the SSH
information to allow access.
Using Vagrant sync folders, we're
able to push the local source code to the new instance.
And finally, a provisioning script
is used to create the new instance.
Here, a simple shell provisioner runs an in-line script
on the remote instance.
Vagrant also supports other provisioners,
like Chef and Puppet, for more complex instance configuration.
Now let's see how the GCE instance is coming along.
SPEAKER 3: Okay, now that the Vagrant-up has finished,
you can see in the console that I have a new GCE VM running.
When I click on its public IP address,
you can see that the game is up and working.
Vagrant and GCE make a great combination for us
in areas like this, when you have multiple developers
needing access to the same VM.
GCE will store users' SSH keys and metadata,
and those keys are propagated to the VM to allow remote access.
CHRIS ROBERTS: Yes, with a quick Vagrant SSH,
you can see there are multiple users in the home
directory, each with their own SSH key to access the VM.
You can also see that Arden's source code was copied
at the VM, and [? serve ?] hyperspace directory,
as was specified in his Vagrant file.
So that was pretty quick--
almost as fast as spinning up a local VM.
ERIC JOHNSON: Yeah, that looked really easy.
Now for those looking to get started for their first time,
where is the best place for them to learn more?
CHRIS ROBERTS: Sure.
To get started with Vagrant or to learn more,
check out vagrantup.com.
ERIC JOHNSON: Thanks for watching.
Check out our last video in the series playlist
and don't forget to subscribe to the channel.