WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:01.106 --> 00:00:02.206 align:middle
Transition point!

00:00:02.576 --> 00:00:07.726 align:middle
Everything we've talked about so far
has included profiling our local version

00:00:07.726 --> 00:00:08.296 align:middle
of the site.

00:00:08.576 --> 00:00:13.326 align:middle
But things get even cooler when we
start to profile our production site.

00:00:14.076 --> 00:00:19.946 align:middle
Having real data often shows performance
problems that you just can't anticipate locally.

00:00:20.606 --> 00:00:25.286 align:middle
And because of the way that Blackfire
works, we can create profiles on production

00:00:25.376 --> 00:00:28.956 align:middle
without slowing down our
servers and affecting real users.

00:00:29.436 --> 00:00:35.366 align:middle
Plus, once we're profiling on production,
we can unlock even more Blackfire features.

00:00:35.956 --> 00:00:38.166 align:middle
So... let's get this thing deployed!

00:00:38.896 --> 00:00:43.366 align:middle
You can use any hosting system you want,
but I'm going to deploy with SymfonyCloud:

00:00:43.786 --> 00:00:49.206 align:middle
it's what we use for SymfonyCasts and it
makes deployment dead-simple for Symfony apps.

00:00:49.836 --> 00:00:52.286 align:middle
It also has a free trial if
you want to code along with me.

00:00:52.356 --> 00:00:57.096 align:middle
Find your terminal and make sure
you're on your master branch.

00:00:57.446 --> 00:01:00.136 align:middle
That's not required, but will make life easier.

00:01:00.256 --> 00:01:07.256 align:middle
Start by running: symfony project:init
This will create a few config files

00:01:07.256 --> 00:01:11.766 align:middle
that tell SymfonyCloud everything
it needs to know to deploy our site.

00:01:12.646 --> 00:01:16.546 align:middle
The most important file is .symfony.cloud.yaml.

00:01:18.976 --> 00:01:21.736 align:middle
Ah, this says we want PHP 7.1.

00:01:22.486 --> 00:01:25.466 align:middle
Let's upgrade by changing that to 7.3.

00:01:26.486 --> 00:01:32.416 align:middle
Back at the terminal, copy the big git
command: this will add all the new files to git

00:01:32.666 --> 00:01:40.496 align:middle
and commit them: Next, to tell SymfonyCloud that
we want a new "server" on their system, run:

00:01:40.706 --> 00:01:47.566 align:middle
symfony project:create Every "site" in
SymfonyCloud is known as a "project"

00:01:47.906 --> 00:01:51.166 align:middle
and we only need to run this
command once per app.

00:01:52.156 --> 00:01:53.816 align:middle
You can ignore the big yellow warning -

00:01:53.876 --> 00:01:58.466 align:middle
that's because I have a few other
SymfonyCloud projects attached on my account.

00:01:59.386 --> 00:02:04.996 align:middle
Let's call the project "Sasquatch Sightings"
- that's just a name to help us identify it -

00:02:05.246 --> 00:02:06.966 align:middle
and choose the "Development" plan.

00:02:07.826 --> 00:02:10.396 align:middle
The development plan includes
a free 7 day trial...

00:02:10.676 --> 00:02:12.316 align:middle
which is awesome.

00:02:12.836 --> 00:02:17.226 align:middle
You do need to enter your credit card
info - that's a way to prevent spammers

00:02:17.226 --> 00:02:22.206 align:middle
from creating free trials - but it
won't be charged unless you run symfony

00:02:22.206 --> 00:02:26.376 align:middle
project:billing:accept later to
keep this project permanently.

00:02:27.336 --> 00:02:30.436 align:middle
I already have a credit card
on file, so I'll use that one.

00:02:32.106 --> 00:02:36.366 align:middle
Once we confirm, this provisions
our project in the background...

00:02:36.826 --> 00:02:40.666 align:middle
I assume it's waking up thousands
of friendly robots

00:02:40.876 --> 00:02:43.786 align:middle
who are carefully creating our new space in...

00:02:44.106 --> 00:02:44.936 align:middle
the "cloud".

00:02:45.926 --> 00:02:47.116 align:middle
Hey! There's one now...

00:02:47.486 --> 00:02:50.596 align:middle
dancing! And...

00:02:50.666 --> 00:02:52.986 align:middle
done! Ready for our first deploy?

00:02:53.626 --> 00:02:59.456 align:middle
Just type: symfony app:prepare:deploy
-- branch=master -- confirm --

00:02:59.526 --> 00:03:03.526 align:middle
this-is-not-a-real-command Kidding!

00:03:04.036 --> 00:03:09.496 align:middle
Just run: symfony deploy And...

00:03:09.736 --> 00:03:11.006 align:middle
hello error!

00:03:11.306 --> 00:03:12.956 align:middle
This is actually great.

00:03:13.386 --> 00:03:18.936 align:middle
Really! The deploy command automatically
checks your composer.lock file to see

00:03:18.936 --> 00:03:23.306 align:middle
if you're using any dependencies
with known security vulnerabilities.

00:03:24.306 --> 00:03:27.226 align:middle
Some of my Symfony packages
do have vulnerabilities...

00:03:27.286 --> 00:03:31.916 align:middle
and if this were a real app, I would
upgrade those to fix that problem.

00:03:32.266 --> 00:03:35.146 align:middle
But... because this is a tutorial...

00:03:35.226 --> 00:03:36.626 align:middle
I'm going to ignore this.

00:03:37.406 --> 00:03:46.536 align:middle
Run the command again with a -- bypass-checks
flag: We still see the big message...

00:03:46.796 --> 00:03:48.716 align:middle
but it's deploying!

00:03:49.466 --> 00:03:54.636 align:middle
This takes care of many things
automatically, like running composer install

00:03:54.836 --> 00:03:57.156 align:middle
and executing database migrations.

00:03:57.976 --> 00:04:03.556 align:middle
This first deploy will be slow - especially
to download all the Composer dependencies.

00:04:04.076 --> 00:04:05.356 align:middle
I'll fast-forward.

00:04:05.746 --> 00:04:08.006 align:middle
It also handles setting up Webpack Encore...

00:04:08.156 --> 00:04:11.696 align:middle
and even creates a shiny new SSL certificate.

00:04:12.476 --> 00:04:14.256 align:middle
Those are busy robots!

00:04:16.136 --> 00:04:17.806 align:middle
And... done!

00:04:18.636 --> 00:04:20.696 align:middle
It dumped out a funny-looking URL.

00:04:21.216 --> 00:04:21.676 align:middle
Copy that.

00:04:22.176 --> 00:04:28.396 align:middle
In a real project, you will attach
your real domain to SymfonyCloud.

00:04:28.616 --> 00:04:31.786 align:middle
But this "fake" domain will
work beautifully for us.

00:04:32.876 --> 00:04:36.796 align:middle
Spin back over and pop that
URL into your browser to see...

00:04:37.196 --> 00:04:39.836 align:middle
a beautiful 500 error!

00:04:40.236 --> 00:04:45.386 align:middle
Wah, wah. Actually, we're super
close to this all working.

00:04:46.406 --> 00:04:52.876 align:middle
Next, let's use a special command to debug this
error, add a database to SymfonyCloud - yep,

00:04:52.876 --> 00:04:57.416 align:middle
that's the piece we're missing - and
load some dummy data over a "tunnel".

00:04:57.686 --> 00:04:59.706 align:middle
Lots of good, nerdiness!

