WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:01.056 --> 00:00:03.806 align:middle
Now that our site is deployed - woo!

00:00:04.076 --> 00:00:06.206 align:middle
- how can we get Blackfire working on it?

00:00:07.056 --> 00:00:09.456 align:middle
Well... we already know the answer.

00:00:09.456 --> 00:00:12.866 align:middle
If you find the Blackfire Install page...

00:00:13.236 --> 00:00:17.416 align:middle
it makes it easy: I want
to install on "a server"...

00:00:17.526 --> 00:00:19.876 align:middle
and let's pretend it uses Ubuntu.

00:00:20.776 --> 00:00:26.256 align:middle
Getting Blackfire installed on your production
machine is as easy as running the commands below

00:00:26.426 --> 00:00:31.376 align:middle
to install the Blackfire PHP extension
- the Probe, install the Agent

00:00:31.596 --> 00:00:35.226 align:middle
and configure the agent with
our server id and token.

00:00:35.566 --> 00:00:36.366 align:middle
Easy peasy!

00:00:36.946 --> 00:00:43.456 align:middle
But.... some Blackfire account levels - offer
a kick-butt feature called environments.

00:00:44.216 --> 00:00:49.336 align:middle
If you have access to Blackfire environments
- or if you're able to get a "plan"

00:00:49.336 --> 00:00:52.316 align:middle
that offers environments,
I highly recommend them.

00:00:53.006 --> 00:00:56.906 align:middle
An environment is basically
an isolated Blackfire account.

00:00:57.496 --> 00:01:02.666 align:middle
When you have an environment, you send
your profiles to that environment.

00:01:03.346 --> 00:01:08.036 align:middle
The first advantage is that you can
invite multiple people to an environment,

00:01:08.336 --> 00:01:11.416 align:middle
which means that anyone can
profile your production site

00:01:11.626 --> 00:01:14.776 align:middle
and see other profiles made
by people on your team.

00:01:15.526 --> 00:01:20.776 align:middle
It also has other superpowers - ahem
, builds- that really make it shine.

00:01:21.486 --> 00:01:22.926 align:middle
So let's create an environment!

00:01:22.926 --> 00:01:27.596 align:middle
Go back to https://blackfire.io and
click on the "Environments" tab.

00:01:28.666 --> 00:01:31.606 align:middle
Actually, click on the "Organizations" tab...

00:01:31.856 --> 00:01:33.616 align:middle
that's where this all starts.

00:01:34.476 --> 00:01:38.346 align:middle
Blackfire organizations are a
bit like GitHub organizations.

00:01:39.106 --> 00:01:44.626 align:middle
With GitHub, you can subscribe to a
"plan" directly on your personal account

00:01:45.116 --> 00:01:50.876 align:middle
or you can create an organization,
have it subscribe &amp; pay for a plan,

00:01:51.316 --> 00:01:55.516 align:middle
and then invite individual
users to the organization.

00:01:56.376 --> 00:01:59.566 align:middle
Blackfire organizations work exactly like that.

00:02:00.016 --> 00:02:05.596 align:middle
And if you want to use environments, you
need to create an organization and subscribe

00:02:05.596 --> 00:02:08.706 align:middle
to a Blackfire plan through that organization.

00:02:09.516 --> 00:02:12.536 align:middle
This did confuse me a bit at first.

00:02:13.076 --> 00:02:18.266 align:middle
Basically, unless you just want
the lowest Blackfire paid plan,

00:02:18.556 --> 00:02:21.756 align:middle
you should probably always
create an organization

00:02:21.936 --> 00:02:24.666 align:middle
and subscribe to Blackfire through it.

00:02:25.296 --> 00:02:29.296 align:middle
It just has a few more features than
subscribing with your personal account.

00:02:30.246 --> 00:02:35.066 align:middle
Anyways, I've already got an organization
set up and subscribed to a plan.

00:02:35.916 --> 00:02:41.226 align:middle
Once you have an organization, you can
click into it to create a new environment.

00:02:41.976 --> 00:02:45.116 align:middle
I already have one for SymfonyCasts.com
production.

00:02:45.436 --> 00:02:47.036 align:middle
Click to create a new one.

00:02:48.136 --> 00:02:50.936 align:middle
Let's call it: "Sasquatch Sightings Production".

00:02:52.716 --> 00:02:56.296 align:middle
For the "Environment Endpoint",
it wants the URL to the site.

00:02:56.816 --> 00:03:01.956 align:middle
Again, if this were a real project,
I would attach a real domain...

00:03:02.206 --> 00:03:05.316 align:middle
but copy the weird domain name, and paste.

00:03:06.546 --> 00:03:09.546 align:middle
Select your timezone, sip some coffee, and...

00:03:09.836 --> 00:03:11.276 align:middle
"Create environment"!

00:03:12.216 --> 00:03:17.166 align:middle
On the second step, it asks
us to provide URLs to test...

00:03:17.376 --> 00:03:20.186 align:middle
and it starts with just one: the homepage.

00:03:20.786 --> 00:03:25.766 align:middle
We're going to talk more about
this soon, so just leave it.

00:03:25.766 --> 00:03:30.156 align:middle
I'll also uncheck the build
notifications - more on those later.

00:03:30.956 --> 00:03:32.416 align:middle
Hit "Save settings" and...

00:03:32.976 --> 00:03:33.636 align:middle
we're done!

00:03:34.126 --> 00:03:39.186 align:middle
It rewards us with a shiny new
"Server Id" and "Server Token".

00:03:40.046 --> 00:03:41.976 align:middle
This is super important.

00:03:42.526 --> 00:03:47.646 align:middle
No matter how you install Blackfire
on a server, you eventually need

00:03:47.646 --> 00:03:50.766 align:middle
to configure the "Server id" and "Server Token".

00:03:51.636 --> 00:03:56.136 align:middle
This is basically a username &amp;
password that tells Blackfire

00:03:56.196 --> 00:03:59.146 align:middle
which account a profile should be sent to.

00:04:00.356 --> 00:04:04.636 align:middle
When you register with Blackfire,
it immediately created a "Server Id"

00:04:04.636 --> 00:04:08.566 align:middle
and "Server Token" connected
with your personal account.

00:04:09.346 --> 00:04:12.856 align:middle
We used that when we installed
Blackfire on our local machine.

00:04:13.466 --> 00:04:18.766 align:middle
But now that we have an environment,
it has its own Server Id and token.

00:04:19.496 --> 00:04:22.606 align:middle
The drop-down on the Install
page is allowing us to choose

00:04:22.886 --> 00:04:25.616 align:middle
which credentials we want to see on this page.

00:04:26.416 --> 00:04:32.296 align:middle
Locally, we should still use our personal
credentials: it keeps things cleaner.

00:04:32.886 --> 00:04:38.716 align:middle
But on production, we should use the
new environment's Server Id and Token.

00:04:39.656 --> 00:04:44.526 align:middle
The install page gives us all the
commands we need using those credentials.

00:04:45.516 --> 00:04:49.326 align:middle
Oh, and by the way: if you have
a "free" personal account...

00:04:49.426 --> 00:04:55.216 align:middle
but are attached to an organization with
a paid plan, any profiles you create

00:04:55.216 --> 00:05:00.306 align:middle
with your personal Server Id and
Token will inherit the features

00:05:00.306 --> 00:05:02.546 align:middle
from that organization's plan.

00:05:03.176 --> 00:05:06.066 align:middle
That lets us use our personal
credentials locally

00:05:06.436 --> 00:05:10.426 align:middle
and still get all the Blackfire
features we're paying for.

00:05:11.546 --> 00:05:15.316 align:middle
One exception to that rule,
unfortunately, is "Add-Ons".

00:05:16.616 --> 00:05:19.626 align:middle
Ok, let's get our production machine set up.

00:05:20.206 --> 00:05:22.606 align:middle
I'll select "Symfony Cloud" as my host...

00:05:23.016 --> 00:05:25.736 align:middle
which takes me to a dedicated
page on this topic.

00:05:26.546 --> 00:05:27.596 align:middle
Let's see...

00:05:27.596 --> 00:05:33.206 align:middle
step one is, instead of installing
Blackfire with something like apt-get,

00:05:33.746 --> 00:05:36.636 align:middle
we'll add a line to .symfony.cloud.yaml.

00:05:41.036 --> 00:05:43.166 align:middle
I already have an extensions key...

00:05:43.466 --> 00:05:45.386 align:middle
so just add blackfire.

00:05:46.036 --> 00:05:48.396 align:middle
Boom! Blackfire is installed.

00:05:49.666 --> 00:05:50.666 align:middle
Add this file to git...

00:05:51.056 --> 00:05:58.326 align:middle
and commit it: The other step
is to configure Blackfire.

00:06:00.476 --> 00:06:05.346 align:middle
Once again, it has a drop-down to
select between my personal credentials

00:06:05.526 --> 00:06:07.996 align:middle
and credentials for an enivornment.

00:06:08.636 --> 00:06:11.466 align:middle
Select our "Sasquatch production" environment.

00:06:12.396 --> 00:06:17.626 align:middle
Cool! This gives us a command to
set two SymfonyCloud variables.

00:06:18.496 --> 00:06:26.166 align:middle
Copy that, move over, and paste: Ok...

00:06:26.166 --> 00:06:26.956 align:middle
we're good!

00:06:27.806 --> 00:06:30.626 align:middle
To make both changes take effect, deploy!

00:06:30.626 --> 00:06:37.876 align:middle
symfony deploy -- bypass-checks
I'll fast-forward.

00:06:41.216 --> 00:06:42.226 align:middle
Once this finishes...

00:06:42.606 --> 00:06:44.636 align:middle
move over and refresh.

00:06:47.406 --> 00:06:49.616 align:middle
Ok... everything still works.

00:06:50.316 --> 00:06:57.226 align:middle
Now, moment of truth: open the Blackfire
browser extension and create a new profile.

00:06:58.486 --> 00:06:59.286 align:middle
It's working!

00:06:59.816 --> 00:07:03.466 align:middle
I'll call it: [Recording]
First profile in production.

00:07:05.336 --> 00:07:06.776 align:middle
Next, let's...

00:07:06.846 --> 00:07:08.406 align:middle
look at this profile!

00:07:08.406 --> 00:07:11.966 align:middle
It will contain a few new things and some data

00:07:12.086 --> 00:07:15.416 align:middle
that is much more relevant
now that we're on production.

