WEBVTT

00:00.091 --> 00:02.280
-: In this section, we're going to update

00:02.280 --> 00:04.200
our Config files for the multi-server

00:04.200 --> 00:06.660
and the multi-worker and add all these different

00:06.660 --> 00:07.830
environment variables.

00:07.830 --> 00:10.470
Again, we're going to leave off the PGPASSWORD

00:10.470 --> 00:11.520
for right now, we're not gonna

00:11.520 --> 00:12.660
worry about that one just yet,

00:12.660 --> 00:14.970
we're going to come back to it at the very end.

00:14.970 --> 00:16.290
All right, so, we're going to first open up

00:16.290 --> 00:18.570
our multi-worker config file,

00:18.570 --> 00:19.620
the deployment for it,

00:19.620 --> 00:21.330
and we're going to add in a little bit

00:21.330 --> 00:23.730
of configuration to that.

00:23.730 --> 00:25.080
So, inside of my code editor,

00:25.080 --> 00:27.273
I will find the Worker Deployment file.

00:28.200 --> 00:29.760
And inside of here, I'm going to scroll down

00:29.760 --> 00:33.900
to the pod template. So here is my template section.

00:33.900 --> 00:36.750
And then I'm going to find the container definition,

00:36.750 --> 00:39.480
and we're going to add on a set of environment variables

00:39.480 --> 00:41.580
that are going to be passed into this container

00:41.580 --> 00:44.280
when it is created inside of the pod.

00:44.280 --> 00:46.530
And so, on the container definition, I'll add on

00:46.530 --> 00:49.753
and ".env", environment version .env key.

00:49.753 --> 00:52.230
".Env" is short for environment variables.

00:52.230 --> 00:54.360
And we're going to designate a couple here.

00:54.360 --> 00:56.148
So, .env is going to receive an array,

00:56.148 --> 00:59.220
so I'm going to put in a dash like so.

00:59.220 --> 01:01.020
Then, for every entry inside this ray,

01:01.020 --> 01:04.170
we're going to have a name and a value property.

01:04.170 --> 01:06.307
And, I bet you can guess what these are going to do.

01:06.307 --> 01:08.970
"Name" is going to be the name of the environment variable,

01:08.970 --> 01:12.090
and then "Value" is going to be the value for it.

01:12.090 --> 01:14.520
So, for our first named environment variable

01:14.520 --> 01:16.710
that we're going to pass into the worker,

01:16.710 --> 01:19.920
we'll pass in our Redis host.

01:19.920 --> 01:22.470
And again, this is going to be some type of reference

01:22.470 --> 01:24.930
telling our multi-worker container

01:24.930 --> 01:28.200
how it can reach out and connect to Redis.

01:28.200 --> 01:30.180
So, what we want to put in here,

01:30.180 --> 01:34.303
is the name of the cluster IP service

01:34.303 --> 01:36.450
that the worker needs to connect to

01:36.450 --> 01:37.800
to get at the Redis pod.

01:37.800 --> 01:39.690
And again, in this case, it's going to be

01:39.690 --> 01:41.640
Redis Cluster IP Service.

01:41.640 --> 01:43.430
Because that's what we provided as the name

01:43.430 --> 01:45.720
of that cluster when we put it together,

01:45.720 --> 01:47.610
that cluster IP, when we put it together

01:47.610 --> 01:50.970
inside of our Redis Cluster IP Service file.

01:50.970 --> 01:52.710
So, this is the string right here.

01:52.710 --> 01:54.033
That's what we care about.

01:54.930 --> 01:56.703
So, for the value, I will put in

01:56.703 --> 01:59.345
"Redis Cluster IP Service."

01:59.345 --> 02:01.678
-: (typing)

02:02.670 --> 02:04.290
-: And then, next up, we're going to also

02:04.290 --> 02:07.413
designate the Redis port.

02:08.520 --> 02:12.120
The port value here is going to be 6379,

02:12.120 --> 02:14.820
that is the default value for the

02:14.820 --> 02:17.160
Redis connection port. It's also what we wired up

02:17.160 --> 02:19.443
inside of our Redis Cluster IP.

02:20.490 --> 02:22.230
Service as both the opening port

02:22.230 --> 02:24.030
and the target port in there as well.

02:24.030 --> 02:25.230
So, this again, is going to be

02:25.230 --> 02:26.970
a hard-coded value, we're just going to

02:26.970 --> 02:30.633
throw it directly in here as 6379, like so.

02:32.430 --> 02:34.650
Okay, so that's it for the worker deployment.

02:34.650 --> 02:36.810
It's all the environment configuration we need.

02:36.810 --> 02:38.820
So, I'm going to close that file.

02:38.820 --> 02:43.170
And we're going to also open up our, where is it?

02:43.170 --> 02:45.690
The server deployment, right there, as well.

02:45.690 --> 02:47.430
So, in the server deployment, we're going to add in

02:47.430 --> 02:50.640
a set of environment variables to the server.

02:50.640 --> 02:53.490
So, I'm going to find the server container configuration.

02:54.330 --> 02:55.170
And, inside of here,

02:55.170 --> 02:58.170
we're going to do our .env block as well.

02:58.170 --> 03:00.840
Now, this one is going to have significantly greater

03:00.840 --> 03:02.340
number of environment variables.

03:02.340 --> 03:05.460
So, we're going to do a little bit of typing here.

03:05.460 --> 03:07.373
Let's see. We'll start off first

03:07.373 --> 03:10.270
with a name of "Redis Host".

03:10.270 --> 03:12.060
-: (typing)

03:12.060 --> 03:13.830
-: The value, again, is going to be the name

03:13.830 --> 03:16.830
of our Redis Cluster IP service, which was

03:16.830 --> 03:20.103
Redis Cluster IP Service.

03:21.900 --> 03:24.180
We'll do another array entry, so notice how I put

03:24.180 --> 03:26.040
another dash right here.

03:26.040 --> 03:28.383
This is going to be our Redis port.

03:29.670 --> 03:32.643
We'll have a value of 6379 over here as well.

03:34.710 --> 03:38.070
Next up, we'll do our PGUSER.

03:38.070 --> 03:39.210
So, this is going to be our

03:39.210 --> 03:41.060
default username for Postgres.

03:41.060 --> 03:44.040
And, we just use the default of Postgres,

03:44.040 --> 03:46.470
which is technically not good form,

03:46.470 --> 03:48.450
not the best way to make use of Postgres here,

03:48.450 --> 03:50.733
but totally fine for our purposes.

03:52.620 --> 03:54.423
Next up, we'll do our PGHOST.

03:56.353 --> 03:58.680
So the PGHOST is the connection string,

03:58.680 --> 04:00.360
we're essentially telling multi-server

04:00.360 --> 04:03.300
how to reach out to our Postgres instance.

04:03.300 --> 04:06.060
And so very similar to what we just did with Redis,

04:06.060 --> 04:09.390
we're gonna do the same thing with Postgres as well.

04:09.390 --> 04:10.770
We're going to provide the name

04:10.770 --> 04:13.020
of the Cluster IP service that is managing

04:13.020 --> 04:15.480
access to the Postgres pod.

04:15.480 --> 04:19.620
So, I'm going to open up the Postgres Cluster IP service

04:19.620 --> 04:22.500
config file right here, I'll find the name.

04:22.500 --> 04:24.090
And that's going to be the host name

04:24.090 --> 04:25.920
that we want to attempt to connect to

04:25.920 --> 04:27.783
to get access to that database.

04:29.070 --> 04:31.290
So, for my PGHOSTs, I'm going to put in

04:31.290 --> 04:33.933
Postgres Cluster IP service, like so.

04:37.440 --> 04:39.630
All right, so what do we have next?

04:39.630 --> 04:40.653
We have our PGPORT.

04:41.910 --> 04:43.550
The value for that, we are using the default

04:43.550 --> 04:46.590
of 5432, no changes there.

04:46.590 --> 04:49.860
Remember, we also set up our Postgres Cluster IP service

04:49.860 --> 04:51.813
to make that port available.

04:53.430 --> 04:55.020
And I think probably the last one,

04:55.020 --> 04:56.610
actually no I think we got two more here.

04:56.610 --> 04:57.990
What do we have?

04:57.990 --> 04:59.310
I just want to double check the diagram

04:59.310 --> 05:00.930
and make sure I'm not missing any in here.

05:00.930 --> 05:04.350
So, we got the port, I think it's the database, right?

05:04.350 --> 05:06.933
Yeah. All right, so we're gonna do our PGDATABASE.

05:08.490 --> 05:10.920
And again, we're using the default Postgres

05:10.920 --> 05:13.050
database of Postgres.

05:13.050 --> 05:15.390
Again, very much like the PGUSER,

05:15.390 --> 05:18.630
using the default database, not quite the best way

05:18.630 --> 05:20.640
of doing things, but for our purposes,

05:20.640 --> 05:22.500
it is good enough.

05:22.500 --> 05:24.570
All right, so I think that's it in terms of

05:24.570 --> 05:27.150
the initial set of environment variables.

05:27.150 --> 05:28.950
So let's take a quick pause right here.

05:28.950 --> 05:30.210
When we come back to the next section,

05:30.210 --> 05:32.580
we're gonna talk a little bit more about the PGPASSWORD

05:32.580 --> 05:34.530
and we're going to make sure that when we put this

05:34.530 --> 05:36.570
into a config file, we are not writing out

05:36.570 --> 05:38.400
the password in plain text.

05:38.400 --> 05:39.480
We're gonna make sure that we store it

05:39.480 --> 05:41.580
in a much more secure fashion.

05:41.580 --> 05:43.170
So quick pause and we'll take care of that

05:43.170 --> 05:44.163
in the next video.
