9 hours 41 minutes
I welcome back to module three. This is less than 3.4 set up a vagrant. And this. Listen, we're going to set up our vag to quickly deploy a my sequel development environment and and a boon to Lennox
So there are a couple of key things we need to keep track of during this lesson. One is my sequel uses Port 33 06 So we will need to make sure that Port 33 06 is being Florida to our vagrant box. Otherwise we won't be able to connect to my sequel,
and that will just pretty much ruin the rest of our development. So we're gonna make sure we avoid that
so you can see that I've noted that is critical to connecting to my sequel.
We're also going to supply a deployment script. Now, this is where some of that bag Grint Magic comes into play.
Baghran is going to run this script against the host during the provisioned process so that host script is actually going to update and its stall my sequel for us
Now, the provisioned command is used to repre vision. If you have the need
to run again. So when you first bring up your Bagram box, the vagrant will proficient automatically the first time. But there is a command to do it again. If for some reason you needed to edit your script and then repre vision and you didn't want to reinstall the whole of Agron boxy in
again, this is a major strength and is the key to making our future deployments easy. There is some work when you are initially setting up that script.
Now, something to keep in mind here is that some script knowledge is necessary for effective use, and a lot of developers do get comfortable using some form of script so that they could speed up the development process with tools like Bagram. And these language script languages can vary by host. For example, on Lennox, you see
Bash, Corn, seashell and some other ones
and I'm Windows. You will primarily see
Power Shell and the command line terminal,
and the last note on there is that we need to acquire are vibrant boxes at the following link, which I'll show you when we are getting this all established. With that said, let's move into our virtual machine environment and get started with this stuff.
I welcome back to my virtual machine and let's get started with a vagrant box set up.
Now this link is available in the slideshow. But if, uh,
you want to copy it from the screen or look at the slasher, that's perfectly fine again, the girls Not too bad. It's app dot vagrant up dot com slash boxes slash search
And the box that we're going to look for is one that I've become more familiar with just cause I end up using it
more often than a lot of the other ones.
And General, you'll find that to be The case is that you'll start using a specific tool that you'll just get used to that and that is ah boon to. And we're gonna go with a newer distribution of the boon to 18 04 So I'm gonna go ahead and click on that,
and I'm going to select the new option.
So these are the commands that I need to run. The place I need to run them
is I'm gonna create a new folder, a new location. I'm gonna go into documents. I'm gonna right click
and select new folder
And I would call this folder Sai Buri.
I'm gonna click into Sai Buri
and I'm a click a again, a new folder. I'm just call this one of blue two because that's the operating system I'm using.
Click Into that when a right click, I'm gonna slick git bash here
and this becomes available cause of that Get bash that We installed a couple lessons back And now I'm just going to copy this
go back to my terminal,
paste that into the terminal and enter,
and that's gonna communicate over the Internet. And Bagram is going to say it is going to identify the box that I'm looking for and prep the setting file for that box
and we will see the setting file show once it finishes
doing what it's doing. There it is. I'm going to right click this. I'm gonna select at it with note pad plus plus,
and that's gonna open this file.
And there isn't a lot that we have to do in this file because we're not doing too much. We're just setting up my sequel.
But we do need to set up the port fording for this.
So there should you should see a commented out line that says config dot b m dot network
So I'm gonna uncommon that
and I'm gonna change this to in my sequel Port, which is 33 06
and then for the host. I'm gonna set it to the same thing, which is 33 06
The next line we need in this file
and this this fall as well as the script file that I will show you after this will all be available as a resource for download. So you don't have to recreate them all. You'll be able to, uh, copy them if needed.
But it's always a good idea to understand what the commands are doing. And again, a good way to look at a lot of these settings files Is that its command setting? So we're given the command to use a shell, so it helps to know what a shell is, and that's gonna be our scripting language. And the path to that is script dot s H,
which means it's gonna look in the
parent directory for a file named script dot Shh.
Well, let me going to save that.
Now, let's take a look at that script. That s H file again. This file will be available for download, so you don't have to copy it.
Exactly. You build the copy it from a resource that will be available.
Okay, let's go ahead and walk through the script and briefly discuss everything that is happening at the very top. We have two very variables being declared. That's user and password. And we're setting those to the values of route and cyber Re I t. Respectfully.
Now, when working with scripting languages or any languages, it's important to know the the syntax rules in place for those languages. For example,
if I put a space here like might occur and many other languages, the Shell script will fail. It won't set password correctly, so I have to make sure there's no spaces there.
Okay, so this script gets run on our Bagram machine as a provisioning process,
so these commands are being run against the machine when it first and Stan Shih eights are any time you run the provisional command, so apt. Get
dash Y update is telling is a command to go get your updates This isn't in Boone to go get your updates. And if you have a yes, no question automatically select. Yes,
so it's a fresh installation. Let's go ahead and update, and let's just say yes to all those updates.
The next is a W get command. And what I was saying is that stands for Web Begin and we're gonna get the resource at this u R l and that's gonna be the My Sequel eight configuration file.
The next command is the Export Debian Front and equal Non Interactive. And what this command is doing is this is indicating that when we run this installation, we don't want to interact with it. So for this automation to work and to correctly automatically deployed my sequel on this operating system for us,
you have to make sure that it doesn't come back and try to ask those questions
during that installation. Otherwise, it's not automatic. It requires manual intervention to set up
the next command is a pipe. They call this piping yes to this command, which means we're running the D. P. K G command, which is deep packaging
the BoE file that we downloaded
and installing it and we're automatically again saying yes to questions affiliated with that process.
We run the update command again, and the reason we do that is that makes a boon to aware of the new configuration
with respect to my sequel. Eight. If you don't run this command again, what will end up happening is you'll end up installing
an old version of my sequel. I believe 5.6, which is the default one.
But we want the new one. We want my sequel. Eight. So we're making sure we get that update command in there, and the next few commands are automatically answering questions that my sequel needs to know during its installation process.
It needs to know the root password
so that's being supplied,
and that variable is indicated indicated by the dollar sign password.
So this password key word and this is represented by this dollar sign password. This is not.
This is just part of the command,
and the way you tell if it's a variable or not is this Dollar dollar son.
So that password gets confirmed.
The next one is important. It's telling my civil we want the legacy authentication method that so we don't have to go through the trouble setting up SSL certificates, which can be a headache by itself.
The next man is the installation of my sequel server and then following that are commands against my sequel to create the user identified by the password, which are listed at the top,
and to give that user all the privileges that we need in that database because its development We're just going across the board and saying, Give us everything
now with that said,
we're going and save that, make sure we have saved it into the right directory
script dot Shh.
And make sure that your operating system Windows is correct, showing you the correct extension.
Some installations of Windows will hide the extension by default. And you might actually have something along these lines
like dot shh
dot texts, and it's hiding the text. So you actually think you haven't S H file, but in reality, you don't you have a text file that Windows has hidden from you.
And if you have that issue, you have to go into the control panel
and tell it to show you
which is in the File Explorer options.
A little bit of an extra headache. Sometimes show hidden files, folders and drives
the high extensions for known file types. Make sure that's not selected.
You shouldn't have that issue, and that's how you solve it. If you are
with that said, you make sure you have this stuff saved in the correct directory again, these files will be available for download
and next you just go. And I had an old command here, so go ahead and
destroy what I had going on.
And now everything's gone. So
just type the fragment up
and thats going. Teoh run through the download and installation of everything the first time you run it. It will take a few minutes to run because it has to go and get the boot to operating system. Download it to In Stan. She ate it, so we'll go ahead and fast forward this to the end.
Okay, it looks like that process has finished. Let's go ahead and give it a test to make sure we can connect to the My sequel database. I have D Beaver Open,
and if everything went well, I should be able to connect to that. My sequel instance. Running on that. A boon to installation that's running in Bagram and virtual box, someone a right click
or, um, something clicked in new database connection.
Gonna find my sequel,
Not the version indicator. This one will have an issue. So I'm just used my sequel with no version indicating
next, and we used the user name route and I leave the password for this video. Starbury I t
go ahead and test that connection
and it looks like a successful someone. Go ahead and finish
and there we go.
There's our my sequel insulation running on our
guest virtual machine. And if we open virtual box,
we'll actually see that that machine is running
You can see that Bagram has given in a unique system identify her and that it's running.
Now let's say you have some issue you needed to reconfigure something you wanted to start over. What would you do? Well, it's actually pretty easy you do Vagrant Halt!
That'll stop your machine.
Okay, we can see that it's powered off the machine. And now if we wanted to just destroy it because something went horribly wrong during that during that insulation, we just type in vagrant. Destroy.
Now that's going Teoh, come back with a question of our re certain that we want to destroy the machine and we will go ahead and select yes,
following the destruction of that machine, you could always just reinstall it by Bagram up. So I'm gonna go ahead and select. Yes,
Now that machine is completely gone. And if I wanted to go through the whole process again, I would just
type in, vagrant up, run it and it would run through the entire installation again.
And that brings us to the 34 set up Vagrants summary. So what are the things that we did in this? Listen, while we identify the vibrant box that we needed, it was the generic a boon to 18 04 In our case, we made sure to provisioned to correct Port Fording. My sequel needs Port 33 06
to ah correctly function as faras network connections ago. So we had to make sure we set that up. Otherwise we wouldn't be able to connect to my sequel and that would have been a problem.
We created and utilized a shell script. Now this was part of that vagrant magic and allowed us to set up
commands that would automatically update set up and install my sequel.
And this really prepared us for future my sequel environments. We could just reuse our script and settings to deploy additional violent environments. For example, perhaps you have another my sequel programmer on the team, and you want to just quickly get them up. Well, you just make sure they have vagrant.
Then you give them the two files they need and you say, Go ahead and bag, ring up these files and you'll be ready to go.
So that completes this lesson and I hope to see you in the next thank you, bye.