• Servers and Tools

Manual Deployment

From the class:  Git Deploy

We've provisioned the deployment server, and we've set up system D. So now all we need to do is somehow get this source code up to the deployment server, and then we can tell system D to start up the application service. And then we should have a web app that's actually running that we can go and visit the URL for.

Let's just start off by doing this with brute force. And so I'm not going to do anything fancy. And this is already a get repository, but we're just going to ignore that. At its very basic level, we just need to get this folder and these files up to the server. And a good way to do that is just to use regular SSH. So if we want to just be quick and dirty and get this up as quickly as possible, why don't we just use SSH?

So a trick we can do, we can either use [INAUDIBLE] SCP and do it that way, or we can use tar. I'm going to show you how to do it the tar way, because it comes in useful in other scenarios as well. So we're going to Tar up. We'll create zip. And then we're going to use the file, everything inside of this directory. And we're going to send that to-- sorry, we're going to send it to standard output and then everything inside of this directory.

And we're going to pipe that to SH-- oops, my keyboard got stuck-- SSH, and we're going to SSH to the deploy server, and run this command, which is going to be to untar. It will extract. Oops, ZF. And the file will come from standard input, and the output will go to apps/boom/current. And let's just provide one more option to this, which is C. So it's going to say extract from standard input and change the directory to this directory before you do the extraction.

So that should have worked correctly. Otherwise, I would have gotten an error. And if I SSH into the deploy server now, we can change into apps/boom/current. And then we should have our project folder all set and ready to go. You're probably wondering, how the heck did I remember how to type all of this? And the answer is I've just done it a bunch of times. And if you do it a bunch of times, eventually, it just becomes second nature.

But the other thing is that if you learn these rules, like we did in the SSH class and Shell classes, you can really get really powerful with these commands by stringing them together in different combinations. And so learning this kind of stuff is really a good idea, I think, because you can apply it to a lot of different things. And now we're applying it to deployment.

So anyway, we've got this now up here. And here's our project folder with the source code in the current directory. And system D should be all ready to go, because it's just needs this server file that's located in the bin folder. So I can type sudo system control start, and we'll start the boom service. And I'll just double check its status to make sure that we're OK.

It's in the green. So that's a good sign. It's active and running, and here's our log. It started the amazing web search application. And remember, how we printed out from our app that it's an HTCP server listening on port 3,000 on local host. We can double check that quickly by using the cURL utility right here inside of the virtual machine.

So cURL with -I so that I can see the headers, and we'll look at local host 3,000. And if we get back our application, we should be good to go. It says boom. So we have succeeded with getting our application up and running by brute force. And if you head over to a browser and navigate to the IP address that we gave to that virtual machine 1921683310 and go to port 3,000, you should see the app up and running in the browser.

Let's continue with our brute force approach by changing something in the application. So here I am, again, on my laptop, not on the virtual machine, and I'm inside of the project. And I'm going to go inside of the app, that HTML file and change boom version three boom version four. We're going to be really creative, and just simulating a simple change here.

And again, we're not using get quite yet. And to brute force this, what we need to do-- and this is sort of getting to what are the tasks that are required to deploy something to a server-- I need to run that tar command again and copy all these files up to deploy server. So I'm just going to use the Control-R trick and type the first couple of letters of tar to find the command that I just executed. And then I'm going to go back to the second tab here where I'm already SSHed into the machine.

Let's take a look at the app, app.HTML and make sure we have the latest one. And so we've successfully gotten the latest source code uploaded to the deploy server. And the next step is to restart the server, because we need to get system D to shut down and then start up the server again using the bin server command, just like you would reload the server if you were on your local machine.

And to do that, we can type sudo system control restart boom. And then just double check that it's working OK. Great. So we were able to get the latest version of our source code uploaded and to restart system D manually by hand.

A quick check in the browser shows that we do have the latest version of the application deployed and running successfully. And we just did this by hand, because I wanted to show you what the steps are so that you have a real intuitive idea for how it works. But this would be a lot slicker if we could use get to push up our changes to the server instead of doing it by hand with secure copier or SSH manually.