WEBVTT
Kind: captions
Language: en

00:00:00.020 --> 00:00:07.360
Next we're going to SSH to our server
and run our deploy script

00:00:07.360 --> 00:00:08.700
open up the

00:00:08.700 --> 00:00:15.809
Google Chrome and load up the Amazon
console page then head over to services

00:00:15.809 --> 00:00:19.600
and ec2 under the compute option

00:00:19.600 --> 00:00:22.050
we're going to choose running instances where

00:00:22.050 --> 00:00:26.580
our instance should be up and running
from the previous steps what we need to

00:00:26.580 --> 00:00:32.279
do is we're going to SSH to our server
in order to do that we need this Public

00:00:32.279 --> 00:00:35.200
DNS ipv4

00:00:35.200 --> 00:00:39.899
so hover over this entry here and click on this copy to keyboard

00:00:39.899 --> 00:00:46.590
button then open up the terminal and
we're going to use SSH to connect to our

00:00:46.590 --> 00:00:55.410
server the way you do that is you type
ssh ubuntu@ and then paste the URL for

00:00:55.410 --> 00:00:57.020
the server

00:00:57.020 --> 00:01:01.109
ubuntu is the user that we're going to connect to and the

00:01:01.109 --> 00:01:06.840
authentication should automatically
happen via our public key so hit enter

00:01:06.840 --> 00:01:11.700
and you may be prompted with this
authenticity of hosts and just type on

00:01:11.700 --> 00:01:18.590
or hit yes and hit enter and then you
should be connected to the server

00:01:18.590 --> 00:01:23.939
alright so once you're connected to the
server we need to download and run the

00:01:23.939 --> 00:01:30.360
script that we created to setup our
server so if you head over to the github

00:01:30.360 --> 00:01:36.360
project and refresh the page you should
see that since we've last pushed our

00:01:36.360 --> 00:01:42.360
changes we have the deployed directory
so we'll just wait for the github page

00:01:42.360 --> 00:01:49.079
to refresh and then click on deploy and
we need to get the URL for the raw data

00:01:49.079 --> 00:01:52.440
file for our setup script

00:01:52.440 --> 00:01:54.180
what we're
going to do is we're going to pull the

00:01:54.180 --> 00:01:57.960
script from the internet on to our server
and we're going to run the script and

00:01:57.960 --> 00:02:01.873
that script should set up our server for
the deployment

00:02:01.873 --> 00:02:03.509
the way you get the raw

00:02:03.509 --> 00:02:08.459
file in github is you select the file
and then you click on this raw button

00:02:08.459 --> 00:02:13.950
here and this will take us to the raw
text page for the setup script

00:02:13.950 --> 00:02:19.200
so copy the URL that's in the browser
and then head back into the terminal that's

00:02:19.200 --> 00:02:26.790
connected to our server and we're going to
run the following command curl -

00:02:26.790 --> 00:02:36.390
lowercase s uppercase L and then paste
the URL and then add the pipe which is

00:02:36.390 --> 00:02:43.220
the line sudo bash -

00:02:43.220 --> 00:02:47.400
what this does is it runs the curl command to download the

00:02:47.400 --> 00:02:54.209
file and then it passes it into sudo
bash so this curl command is

00:02:54.209 --> 00:03:00.440
used to retrieve contents from a URL so
it's basically a HTTP client in Linux

00:03:00.440 --> 00:03:06.569
the dash S is for running in silent mode
which means it won't update us with all

00:03:06.569 --> 00:03:09.260
of the steps when it's downloading the
file

00:03:09.260 --> 00:03:12.989
the L is for following redirects so

00:03:12.989 --> 00:03:17.130
if there's any redirects of this URL then
it will automatically follow them to the

00:03:17.130 --> 00:03:20.680
final destination and download the
contents

00:03:20.680 --> 00:03:22.140
the pipe is used to pipe the

00:03:22.140 --> 00:03:26.310
output of one command into another
command so we're going to take the

00:03:26.310 --> 00:03:31.769
output of this curl command and we're
going to pass it into sudo bash sudo is

00:03:31.769 --> 00:03:38.670
used to run commands as administrator on
Linux and bash is what we're going to

00:03:38.670 --> 00:03:41.280
use to run our script

00:03:41.280 --> 00:03:45.450
the hyphen is used to signal the end of the options

00:03:45.450 --> 00:03:50.400
provided for bash so that it knows
anything we pass in is to be ran on bash

00:03:50.400 --> 00:03:53.740
and not an option to configure bash

00:03:53.740 --> 00:03:56.850
okay so enter that into the console and hit

00:03:56.850 --> 00:04:02.220
enter and this should go ahead and run
our script so we're going to wait for

00:04:02.220 --> 00:04:05.100
the script to finish it should take a
few minutes to install all the

00:04:05.100 --> 00:04:09.900
dependencies and set up our project once
the script is finished running head over

00:04:09.900 --> 00:04:15.959
to the Amazon Web Services console and
copy the hostname again and then enter

00:04:15.960 --> 00:04:18.080
it into the browser

00:04:22.280 --> 00:04:26.060
you should see this bad request 400 and that's because we

00:04:26.070 --> 00:04:29.340
haven't added
the host name to the allowed hosts on

00:04:29.340 --> 00:04:34.560
our settings dot py file so we're going
to do that in the next video but that's

00:04:34.560 --> 00:04:39.470
all you need to do to deploy our code
to the server

