0:02
[Music] and hello everybody
0:10
Aloha Tony how's it going bud thank you for coming today oh man we got some
0:17
really exciting stuff today um just to get started we're we're not gonna wait we're just gonna jump right into it
0:23
today cuz we got a lot of get going for new members I am Joe workman I am the
0:28
founder of Weaver space and welcome to my youtube channel hopefully you're gonna enjoy today's talk and today what
0:34
we're gonna be talking about is git now it's kind of an advanced subject for
0:40
most web designers web developers because it's it definitely is is we're
0:47
gonna get down into some advanced stuff we're gonna get into some coding today we're gonna start where I need to be getting into command line and all kinds
0:54
of crazy stuff so now I do have to say that this is my workflow I'll try to
0:59
point out a little bit where maybe you could do some things a little bit easier or how your situation with your web host
1:05
might be a little bit different because I managed all my web servers from command line so I'm gonna be diving into
1:13
some really techie stuff I don't have any web interface to manage my web servers I do everything from the server
1:20
on command line so where I can I will mention how your hosts hopefully does things a little bit easier for you hey
1:27
Martin hey Gunther thanks for joining in today so yeah I'm really excited I'm a
1:34
little nervous because we have a lot of stuff to do today now I do have two premise basically what I did was over
1:39
this weekend I set up a completely new server I just wanted to you for myself I
1:45
wanted to set up actually a new web server that had like all the latest versions of everything and basically
1:51
what I thought is well instead of you know me setting up all this you know get web deployment stuff before I was
1:58
actually gonna do it live today so we're actually gonna be doing a completely live from scratch get hook deployment of
2:07
a web site a very simple website from scratch so I haven't done I haven't done
2:13
any setup for this I've done a little bit right I have a couple scripts that I've that I'm utilizing and whatnot but
2:19
for the most part we're starting from scratch today and I'm gonna give you a
2:24
little bit overview of how how'd it maybe use get a little bit and and some
2:31
benefits that you might like with it and some gotchas so without further ado
What is Git
2:36
let's jump on in let me go ahead and share my screen and there we go okay so
2:47
I'm new stringing setup I thought I'd try something new today got like me over here on the side and all the desktop over there I don't try something new try
2:55
to didn't cause it improvement hey Peter thanks for joining in today I'll move the live chat off the screen actually move that over there okay um so
3:06
first thing we want to do is actually know what let me back off a little bit so one thing I want to talk about a
3:17
little bit is what is git okay so git is
3:22
a version control system now me and Gregg did a podcast it was three or four
3:29
weeks ago checking over on Weaver radio comm there's episode 28 ok and in that
3:35
show we talked about basically what I'm gonna be showing you today and essentially people you know wanted to
3:43
see the video version of that podcast show because it obviously is the very visual thing so that's what spurred all
3:49
of today and but what is get it is essentially a version control system
3:54
that now it's text base so you can basically if you publish a website you can easily roll back to like you could
4:01
see all your various versions that you've deployed you can easily roll back to a previous version stuff like that so
4:08
um it's very easy now from a developer standpoint we use it to like you know modify code files and that's the origins
4:15
of get right it's for like development actually like you know writing code for apps and websites and stuff like that
4:21
and it's beneficial for us developers because we can see exactly what lines
4:26
changed and maybe we can merge some stuff together from an old version to with a new version and you do all kinds of stuff no
4:32
I'm not I'm not gonna dive into any of that today um and to be honest I don't think any of that is really relevant to you guys as
4:40
just designers who want to maybe version control and and tag particular moments
4:46
in history maybe you want to easily roll back to different states okay we're gonna look at the raw basics of get
4:52
today I'm not gonna go into any sort of advanced like how you can do dips between files and merges and not gonna
4:59
do any of that and to be honest even for myself I use get to deploy my websites but I never really used those features
5:07
of git on my websites at all like not at all I use it my day to day development
5:13
when I'm writing apps and stacks and stuff like that but not for website development so git is just again it's a
5:22
decentralized system of managing your codebase in this case a website okay and
5:29
I say decentralized because what it is is you have you can run git on your server and all of our Mac's have get
5:35
installed by default so that's cool and what we're gonna do is we're gonna set up a online account um today I'm
5:43
going to be using git lab get lab calm now um I do most of my stuff on github
5:49
but to be honest I I kind of wanted to test out get lab so I'm gonna be moving some of my my projects over get lab
5:55
mostly just to test it out um it's a new kind of a spin around for a few years but it's kind of the new hot service
6:02
right and it looks nice so I'm gonna be setting up a new repository on get lab today and we'll be integrating that and
6:09
for those of you who might want to use github github is huge I'll I'll probably show you maybe how to set up like the
6:15
get hooked stuff in one of my github accounts when we do all the the deployments so there we are I just want
Getting Started
6:23
to give you a quick overview of what git is what you can use it for um and now
6:28
let's dive in and actually get some work done okay so start off as I said and I
6:38
haven't done anything so we're gonna go ahead and I'm gonna go over to get lab calm right now and where's my
6:43
Safari window okay here we go I am going
6:48
to go to get lab and what I'm going to do is I already have some project set up
6:55
here but what I'm going to do is I'm gonna set up a completely new project okay oops gestures okay I'm gonna set up
7:04
a new project and what I like to do is I call the name of my project when I'm
7:09
doing it for websites right it's the name of the actual domain so I right now we're gonna be testing a website or
7:16
publishing a website called aspect hq.com okay so that's the name of my project
7:23
it's the name of the domain there's no that way there's no confusion on what the heck this is it is for
7:29
aspect hq.com because that's the website we're gonna be working on today and I'm gonna say great project boom okay so
7:38
we're kind of done on that side fun times now what we need to do is we need to
7:44
clone this repository locally on our Mac okay now I use a app called Tower I'm
7:54
gonna just say it's I think it's get tower yeah Tower calm Oh tower
8:04
ah get
8:10
yes I use this software um well get started it's free
8:16
really oh wow that's crazy that must be new because tower is probably the best
8:24
git client I think out there um kind of crazy it's free now what the heck I spent like 50 bucks on it or something
8:30
like that um oh it's yearly now okay I think I use the basic license um me I'm
8:37
not sure we can get with a free package but anyway tower is is an amazing app it
8:44
probably is a little bit more I'll be honest it's probably a little bit more than some of you might need I used to
8:51
use an app called get box before I got really good at version control ingot so
8:56
take a look at get box it's a little dated it's on the App Store it hasn't been updated in quite a while but I know
9:03
it still works and it covers all the basics maybe after after we get
9:08
everything working today 5-time may be all loaded up in get box and we can kind of see how things are but for right now
9:14
for today I'm going to be using tower I didn't have I was gonna use git Box
9:19
today to show you how everything works but I've I didn't have time to set it all up and kind of relearn how git box
9:24
works so inside Tower what's kind of cool is you can i've already integrated it with
Cloning Git Lab Repository
9:32
git lab okay so our log din and if you notice the repository that i've already
9:38
that i just created on git lab is there so what i do is i gonna say clone and i'm gonna select a different destination
9:45
here that's fine let's just put it right there okay so I'm gonna say clone
9:58
now let's go to find her where's my
10:08
development data element I spit various okay so here's the folder now anything I
10:14
put inside this folder will now be version controlled and so you rehab here
10:20
in my repositories we have aspect HQ comm okay so uh let's go ahead and let's
10:28
just minify some of these windows and I have already created a very very very
10:34
very very simple project that we're going to publish to aspect HQ comm so if
10:42
we just preview this just a really simple web page um that's it this is what we're gonna be working on right now
10:48
um so what I can do is let's just go ahead and let's go to the publishing
10:53
setup I haven't even done this yet um let's see HTTP actually we're gonna do configure manually and what we're gonna
11:01
do is instead of FTP it's gonna be local folder we're gonna choose the folder
11:07
we're gonna choose it from the folder that we have our development aspect HQ
11:15
comm there we go okay so here we go remember that is the the folder where I
11:22
cloned the git repository from right so again we cloned the git repository this
11:27
folder I'm gonna publish to that folder we're not publishing it to the server we're exporting it and basically with
11:33
rack Weaver let's just say oh cool all that local the address is HTTP
11:49
www.andhramirchi.net ination
12:07
we published it locally and if we go back and here we noticed inside that folder I now have
12:14
my website right I have the sitemap I have the index file all that jazz here's my website cool so now what do we do
12:23
let's go into tower and what you'll notice is inside tower or whatever your
Staging Commits
12:30
gate client of choice is you'll notice that it has found all these files now it has question marks here because it
12:36
doesn't know what these files are right it's like I have no clue what these files are they're new so what we need to
12:42
do is and get what we need to do is we need to stage these files right so we
12:48
staged the commit so right now what now what you can do is if you wanted to just save each one you can click on each one
12:53
or you just say stage all right so what this is gonna do is I'm gonna say and then for every time you save or commit
13:01
it's called a commit you whenever you commit something into a repository you have to type in a message alright so
13:08
make sure this is something this is something for you right all this is for you so um all right this one's probably gonna be just be something simple like
13:14
initial commit okay but you need to be able to make notes so that when you
13:19
refer to these later on okay you know exactly what you did right so and you
13:27
can put so the this particular the actual title of the commit think you know it can only be like 50 characters
13:32
or something like that but this detailed description if you really want to you know detail out what changes you made
13:38
and what not you can detail it all out here okay but these these commits are very useful because later on if you need
13:45
to revert to something you need to be able to look at your history and know what you did to know what point you you
13:51
need to go back to right so I'm not gonna add any detailed description here um I'll admit I don't add detailed
13:57
description too often mostly my titles enough I put in enough information in the title to let me know what I need now
14:05
so we've committed that and this is all blank because that we have now no changes so we need if we go here to
14:11
master will see that here is my commit right so here's my initial commit and here's everything that we did in that
14:16
commit and it has a bunch of added files okay now what I need to do is I need to
14:23
save this right now all changes are only on my local Mac okay
14:28
but remember we created that repository online on gitlab so we need to push that
14:34
and that's exactly what it's called it's called it push we need to push all those changes up to get lab let's go ahead and
14:40
click this little arrow and it's saying because it's the first time I'm ever actually publishing something say do you
14:45
want to publish this branch say yes and what it's doing right now is it is
14:51
connecting to get lab it's pushing all those changes up and while it's doing that let's go ahead and open up a new
14:58
Safari window oops and let's refresh and boom so I
15:06
refreshed this and if we look we have all of our files here online and it's we
15:11
now have our very first commit inside get exciting very very cool okay so
15:18
let's just continue our quick tutorial of get really quick go ahead and I'm
15:24
gonna go ahead and bring back up our rack weaver project and let's just add
15:30
let's just add a little bit of content here okay I'm going to go to the foundation paragraph
15:46
okay just gonna do that and then I'm gonna publish this those changes locally
15:55
okay cool so now what we're gonna do if we go back
16:01
to tower now if we go to back to tower we'll see in the working copy we have
16:07
three and that's because it's notice that we have changes now okay now now if
16:13
we if if you see it has these little M's that means that file was modified okay
16:19
and if you click on it you can see actually the modifications so this CSS file some reason there isn't there's an
16:25
arrant space added and the index.html you can actually see all the changes that happened now chances are we really
16:32
don't care because we just want our site to look good and what we see in rapper Weaver is what we get right so and then
16:39
we have our site map which basically changes the modification date when the when the page was modified it right
16:44
so what you do is we could just say you know added caption to title something
16:50
like that right and we can commit that and if you look at master it says it has
What to Avoid
16:56
this little head and little arrow and that what that means is that hey I have
17:01
one pushed I mean I need to push something up to the server we're not in sync with the server so I'm one I'm
17:07
going to go ahead and I'm gonna go ahead and push that and if we go back to the
17:15
server sorry okay go back to Safari and if we
17:25
refresh okay well we won't see we need add any new
17:30
files but all the changes are now synced on the gitlab so really cool stuff there
17:37
okay now what are some things before I
17:44
start diving into setting all up all the the deployments and all that fun stuff
17:51
what are some stuff that we shouldn't be adding what are some stuff we shouldn't
17:57
be adding to our gate repositories is primarily a text-based thing right so
18:04
I personally wouldn't like it it doesn't handle large really large files very
18:10
well okay like video files essentially are really really large images probably
18:16
not a great idea okay um so like if if you're using rap Reavers resources um
18:22
you might want to think rethink that if you want to use this get deployment and and you have like video files and stuff
18:28
like that and unoptimized images right so you're gonna make sure that you know
18:33
images are fine you know drag and drop images and rap you or if you optimize your images and put them in the resources that's okay
18:39
I would definitely stay away from video files unless they're like really small video files like less than a Meg or
18:45
something like that right um outside of that outside of you know those I would
18:51
definitely consider if you want to do videos and self hosts those you know actually create you know a subdomain or
18:57
another folder on your server that you warehouse and and just reference those okay now there are some other things
19:05
inside yet actually I mean I just thought about this there are some files
19:11
that you might want to ignore okay so inside ignores okay um there are open
19:23
in editor oh there it goes okay so in
19:30
get you can ignore you can tell it to if you see a file that's named this ignore
19:36
it and don't try to version control it okay um some very common ones that I
19:41
recommend you do is dot d s underscore I think it's store oops okay if you know
19:50
those are pretty much like common like Mac files right you'll see those in a Mac file system another thing you might
19:57
want to ignore is something like error underscore log that is a PHP a lot of
20:05
times PHP if it has an error on the server um it'll create this log file and you don't want a version control those
20:11
log files you don't want yet to think that that's a you care about some AC you're gonna put in a bunch of files in here now if you
20:19
wanted to they're kind of what got me onto this oh shoot I'm not sharing my screen hold on Oh bad Joe bad Joe okay
20:28
um sorry let me back up a little bit um
20:34
here let me clean up these windows okay sorry about that let's go ahead and back
Git Ignore
20:40
into time in tower right now but in any get client you can you can set up with
20:46
something called a git ignore and I'm gonna open that inside the editor here and basically what do you do is it's
20:51
just a plain text file that you put in files that you want to ignore okay now
20:57
let's say for example I wanted to manually have a warehouse folder on my
21:02
site on my server what I could do is let's say I tend to use a folder called Depot right what you can do is you would
21:10
put that the name of that folder in this get ignore file so that when it saw it on the server it doesn't matter what you
21:17
throw into that Depot folder it will just ignore it okay so this gate ignore thing is is very
21:25
important I think the gist or I think it's all caps actually yes okay okay so
21:42
it's des underscore store so we want to definitely ignore des underscore store I
21:48
recommend you ignore error underscore log again that's the PHP files so PHP
21:53
adds an error log in your server get on the server is just gonna ignore it and then depot that's going to be our folder
22:00
that we can utilize for warehousing now if you're a CMS user total CMS right
22:06
you're gonna want to do CMS underscore data as well and if you're in the future if you're watching this in the future
22:12
you'll use T CMS data because that is the CMS folder for total CMS - okay so
22:22
really good tips you want to make sure you ignore those because it's just gonna ignore all that stuff on the server and
22:27
you can manage it manually all you want okay good stuff there um I'll actually
22:33
save that and if we go to working copy its see that we might do we added to get
22:40
ignore file so we just say add and um ignore or some stuff okay and we're
22:47
gonna push that up cool
22:56
okey-dokey so now for the fun part I kind of had a lot of that baked up um
23:02
obviously I you know clone your repositories I do that a lot so that was really good um we're gonna set up they
23:09
get hook stuff now so let's let's talk
Git Hook
23:14
about how how all this works so this is how the entire workflow works for using
23:22
git to deploy your website you do everything that we just did you make your changes you publish it into a local
23:29
folder and then inside your git client you you save those changes you type in your git message and you push okay now
23:37
when you push to the server this is this is now what we're gonna start automating okay we're gonna it pushes it up to get
23:46
lab comm what we're gonna set up right now is on git lab comm it has something
23:52
called I think they call it integrations actually the technical term is called the git hook okay we're a web hook and
23:58
what that does is you we can put in a URL into our repository on git lab that
24:05
says whenever we push something to you go ahead and ping this URL so we're
24:12
gonna give it a URL okay and what that URL is is a file that we're gonna put on
24:18
our server okay and basically what that's going to do is whenever get lab
24:24
pings that URL on our server that URL it's gonna be some PHP is gonna say hey
24:31
I know that git lab just pinged me that means I need to go pull new data so at
24:38
that point get lab pings our server our server gets the message from git lab and says oh thanks that must mean you have
24:45
new stuff for me this server is then gonna pull that data down does that make
24:51
sense okay so again get labs sends the URL request on our server we're gonna have
24:57
some really cool code that gets that request from git lab and says hey cool I
25:02
got new stuff I'm gonna pull it down with with a git command now obviously
25:07
hopefully you know your hosts has get a lot of you know decent hosts
25:12
will have get installed and I think you can even configure inside cPanel I'm pretty sure I listen to the episode with
25:19
Greg obviously Greg runs chillydog hosting and I know all of this works on his services as well so yeah so right
25:28
now what we're gonna do is let's go and jump back in to get lab ok ok so inside
Aspect HQ
25:47
get lab I'm inside my aspect HQ calm and what we're gonna do is we're gonna go do
25:52
settings integrations ok and inside here we have push events ok
26:00
this is gonna be a URL that it is that this is actually gonna pull down ok this
26:05
is the URL that we're gonna hit so what we're gonna do is I'm gonna create this URL doesn't exist yet but we're gonna
26:11
we're gonna create it we're gonna do WWE aspect HQ aspect hp.com slash employ PHP
26:24
ok so we're good this deploy dot PHP file does not exist on the server yet
26:31
but you can we're gonna create it in a minute but we're I just want to get this all set up so here whenever we push to
26:38
get lab now once I save this can't fire
26:46
the valid URL
27:01
Oh see I should have tested this beforehand
27:07
[Music]
27:22
see this is where it's gonna bite me okay we have to give it a secret token I believe hold on one second I can't have
27:30
a blank you are well the valid you okay
27:40
we're gonna boom fun stuff okay let's figure this out I assumed this was going
27:46
to be as simple as it was with a get luck github it's different QuickBooks
28:05
are used behind callbacks fun times
28:25
mr. silver maybe it's this older occasion I know it's I'm gonna turn off that's a cell verification I just want
28:32
it just a ping that that's the ad word damn URL can't be blank
28:53
okay web hooks are used to find HTTP callbacks yes I know what a web hook is use cases
29:01
integrate hooks endpoints if you are writing your own one-point web server
29:06
they'll receive the web hooks keep in mind the following things your endpoint should receive HTTP responses that as fast as possible you wait too long give
29:13
up over the side to it anyway type it yes should always return a valid HTTP
29:18
response you not give a that's fine
29:23
ignores HTTP status code returned by your endpoint fun times fun times okay
29:40
instead of wasting time trying to figure out what we're going to do and figuring this out we're gonna go over a github
29:47
since is this it's a system that I already know to you how to use we're
29:53
going to go ahead and
30:08
rats going live on Times
30:18
I just had any remote
30:26
what I'm gonna set up really quick is a new repository here
30:32
I suspect HQ calm and we'll just make it
30:41
public for night now okay posit Ori I'm
30:47
gonna do the same thing we did at the very beginning because I just want this
30:52
to work really quick fun times go over here we're gonna clone this
31:04
we'll just call it the holder fine okay open show it and finder sometimes then I
31:15
go to element and I'm just gonna copy
31:21
the data that's in here we're gonna go into here copy that into
31:27
their cycle and we're gonna stage all of these and we're gonna say initial save
31:37
it publish it up to github
31:48
boom okay so now we are ok let's refresh this Oh excellent
31:56
so now I can go in - sorry about that so what what I did really quick was I've
Webhooks
32:02
just basically replicated everything that we just did earlier um and yeah so
32:11
what services has been deprecated oh what a webhooks yeah had a web book
32:23
okay cool here we go so here we go
32:28
now inside github we're gonna go to web hooks and you paste in the URL so we're gonna put in our URL slash
32:42
PHP and we're just gonna I'm gonna do
32:50
application JSON because that's what no we're gonna do X form that we're in do that secret just do my secret okay and
33:04
you're gonna do on the push event so whenever we push to github it will
33:10
automatically ping that URL so you can say add web hook not now had an error
33:16
because that file doesn't exist yet okay so what we're gonna do right now is
33:22
we're gonna create that file
Deploy PHP
33:32
so what we're gonna do is on here I already have a set of files that I use
33:39
and here it is so we're gonna create this deploy PHP file really quick let's
33:46
review it okay so here we have very
33:53
simple PHP we say if the request is post so to kind of back up a little bit
33:59
there are multiple types of HTTP requests and all get hooks are a post
34:05
request that means even if you hit this this URL via the browser it doesn't matter because that's a get request um
34:12
this is a special type of request that's kind of programmer e right it's basically like when forms get submitted
34:17
and stuff like that it's a different type of request it's not just something like putting a URL in the browser window
34:22
okay so this is a post request that gets sent to the deploy PHP and we want to make
34:30
sure that it's only a post request so that people just can't hit this URL and then you know it's gonna trigger our script all the time which shouldn't
34:36
really bother anything cuz it's just gonna pull if there's no changes it doesn't pull anything but um we should
34:42
just be thorough and we're going to verify that um this is the post request and at that point what we're gonna do is
34:49
we're gonna look for a file we're gonna say the file that I'm gonna look for is home Jay workman deploy hooks aspect HQ
34:55
comm slash deploy if that file and then basically what we're gonna do is we're just going to create that file and we're
35:04
going to send the data that github sent us we're gonna print it inside of the file okay so that's that's all this does
35:11
so that requests all it does is github will ping this deploy PHP file and then
35:19
at that point it's going to if it gets pinged it's gonna create a file and that's all it does just creates a file
35:26
then okay then this is what kind of where some techie geeky stuff happens we're gonna have a cron job which is a
35:33
routine scheduled job that looks for that file you know we can run the job every minute every five minutes however
35:40
you want okay so we're gonna we're gonna run that job every you know I normally
35:45
do every five minute um and if that file exists at that point we're going to then initiate the pull
35:51
okay now the reason we have to do it that way is you cannot execute Shelke
35:57
fans okay you cannot execute get pulls from within a PHP script it's just security warnings you just can't do it
36:04
um it's not recommended at all so every every host that's worth their weight in
36:09
anything worth anything will not allow you to do that because that's huge security holes for hackers and all that
36:15
jazz right so the PHP is just going to create a file and then we have a shell script
36:21
here this is the shell script that I use and basically what we do is inside this
36:26
shell script um this is the script that we're gonna use to schedule and it's gonna run every X number of minutes
36:32
however it'll however often you want and it's going to look look for the file if the file exists it basically renames the
36:39
file it appends the date time stamp just so if we ever wanted to look at it in the future how many times everything happened and whatnot you don't really
36:46
you could probably delete it if you wanted to um you know I just move it then basically what I do is I CD into my
36:53
website directory then I reset do a git reset which basically means it will if
37:01
there are any changes law on the server in theory there shouldn't be any changes it's gonna reset back to the reverted
37:09
version or the version that it thinks it should be and then it's gonna do a pull and it's gonna pull the data from our
37:15
server okay cool it's a good stuff there so let's go
Deploy to GitHub
37:24
ahead and start doing that so what I can do is I'm just gonna say reveal in finder and what I can do is I'm gonna
37:32
take this deploy dot PHP file I'm gonna copy it into this directory okay so not
37:39
we now have a deploy dot PHP file and
37:44
that's all we need for now we're gonna bring up tower and I'm going
37:52
to commit this the boy script and I'm
37:59
gonna push that up to github okay now
38:05
the fun starts we're going to now we're going to go on our server okay so this
38:21
is where we get into the really geeky part of today because as I said early on
38:26
I manage my web servers and terminal this is how I manage my web servers from
38:33
a terminal from command line and yes it's a key um you guys hopefully have a
38:38
great cPanel and some great admin interface that lets you do everything that I'm about to do from command line
38:47
but hopefully maybe you'll learn a little bit okay so I'm gonna go into my
38:55
directory which is websites aspect HQ calm okay
39:00
and fun times actually an interesting thing here is that I now need to UM
39:08
actually I'm gonna remove that index file because that was just me testing that the domain actually worked ok so
39:16
now I'm inside my aspect HQ comm folder and there are no files in that directory
39:23
this command I'm not gonna explain every command that I run but there are no files in this folder now what we need to
39:31
do is we need to do an initial pull from github ok to get all of this working now
39:39
this is interesting I wasn't planning on doing this today but now that I switched to github it's probably best for your
39:45
benefit is I need to set up authentication with my server and github
39:50
ok so fun times
40:02
ah wait we're gonna close up gitlab that was a fun experiment for a few minutes
40:08
okay so inside let me back up now a little bit so what there is a if you're
What is SSH
40:20
all probably familiar with something called SFTP right secure File Transfer Protocol okay now that is piggybacks on
40:31
something called SSH which is secure shell it's it's actually how I'm connected to my server right now it
40:36
allows you to to remote you know connect to things okay now
40:42
SSH is a strong secure industry standard across the entire world for
40:49
communication between devices okay it used to if you want to go old school it used to be something called telnet
40:54
highly insecure telnet is the same thing as like FTP kind of you know if you're
41:00
if you're comparing SSH is the FTP as telnet is to FTP okay telnet and FTP suck ssh and SFTP rock
41:10
okay so ssh has something called keys and what's kind of interesting is that
41:17
what you do is you can set up keys on various devices so i I have key set up
41:24
on my Mac Pro here on my macbook pro and on all of my servers and what what you
41:31
can do is if you know what those keys are you can save those keys inside services like github and get labs and
41:38
things of that nature so when you go to pull things um instead of having to type your password every single time
41:45
basically what you do is um it uses the keys and it says hey I see you have this
41:50
public key it's gonna compare on get flat on get lab or github do I have
41:56
access to this public key yes I do and it's gonna allow that communication 100% secure as well so that's really
42:02
cool um I will show you how to do that obviously these are my live production keys so when I go to page two those keys
42:10
into place I am going to have two unshare my screen because I don't want those broadcast to the world
42:16
because then that would obviously negate my security so let's go ahead and I'll
42:21
show you how to set this stuff up I was employment doing this today but I guess it's kind of to your benefit I
42:29
guess kind of fun stuff I'm interesting so um inside get lab our get lab github
Get SSH Key
42:35
we're gonna go into my settings we're
42:42
gonna go into security okay and oh no I
42:48
forget where github
42:58
okay this where we gonna do so inside your repository and you go to deploy
43:03
deploy keys and you're going to type in so this is going to be you know my
43:09
server is that's just a name it doesn't matter and what I do is I'm gonna get my public key for my server okay and I'll
43:16
show you how to access that okay and then I'm just gonna paste it in here and say add key okay so I'm gonna move this
43:23
off to the side really quick I'm on my server we're gonna go to my home folder
43:29
which is home Jay workman and there is a secret folder now this secret folder
43:34
exists on your Mac as well because your Mac is running Linux so we can go to a dot SSH okay and if we look inside this
43:42
folder you'll see that there are some files here okay and this ID underscore RSA dot pub that's the one you're gonna
43:49
get the contents of that okay and you're gonna paste it into github hey now in
43:56
order to generate those files you would run the command called SSH - he SSH key
44:04
Jen okay I'm not gonna run this right now cuz I already ran it but basically you're gonna run SSH key Jen and then
44:10
you're gonna enter in a few answer some questions it's gonna generate these files for you okay so I'm gonna go ahead
44:20
and turn off my sharing really quick and at this point what I can do is I'm just going to copy the contents of that dot
Copy to GitHub
44:28
pub file
44:35
and save that into my github account
44:49
Oh
44:55
okay let's go back okay so now I have my
45:01
deploy key set up in github and if we go
Clone URL
45:10
back to github okay and you go to clone okay what this will do is um so it'll do
45:17
we won't actually do use SSH and it will give you the actual URL that we want to
45:23
clone okay so I'm gonna copy this and basically what I do is I'm gonna go into
Copy URL
45:31
where am i and we're gonna go into websites and how did you get clone and
45:46
then oh and then do you want to accept yes I want to give authorization and
45:53
it's done oops I needed to do if we go into you
46:01
notice when you did a git clone it it basically moved it it actually created a
46:06
folder in aspect HQ comm called aspect HQ calm so what I'm gonna do is I'm just going to quickly move all the contents
46:12
of that folder back so I'm just gonna go
46:17
here I'm gonna do move star okay
46:28
okay so now and then I'm gonna delete aspect okay well okay so now we did that
46:39
git clone it cloned everything down from github and we I now have actually let's
46:45
go ahead in theory now if I go to aspect HQ comm boom there's our website oh I
46:52
didn't send her text I didn't send her a line that okay so that was a lot of work
46:57
to kind of get it set up but now it's it's all gravy I make changes publish it
47:02
okay push and then pull okay but now we need to set up that cron job okay so we
47:09
need to set up that cron job that will whenever I push changes up to github
47:14
okay we want those changes to be automatically pulled down okay so let's
Deploy Hooks
47:20
go ahead and that if we go back to our project settings in github and go to web
47:28
hooks let's just edit this really quick I say update so it tests it again
47:47
mm-hmm I'm gonna do this for fun I'm gonna delete that we're gonna recreate
47:54
it really quick I had to look boom okay
48:06
so yeah so there we go we got that little green checkmark so the delivery was successful okay
48:12
and just for fun if we go into okay now
48:21
if we look at those files that we created okay so this what did remember
48:27
what it does is it creates something called it's going to create this file
48:33
home Jay workman deploy hooks aspect hq.com deploy now this is outside this
48:39
folder is outside of my public HTML it's outside of my web folder okay and I did
48:45
that on purpose so let's see if we go back to my home so now we are inside
48:53
home Joe workman okay I actually need to create this folder um it doesn't exist right now so I'm gonna create deploy
49:00
hooks aspect hq.com
49:07
okay so now I have deploy hooks and if we go into deploy hooks and look in
49:15
there we'll see that we have aspect hq.com and if we do if we look inside
49:20
aspect h2 or calm it's empty okay so right now we're gonna do is
49:26
let's go ahead and make a quick modification to our project
49:35
Rapp Weaver okay now I remember I changed that I'm actually gonna edit my publishing settings really quick and I'm
49:42
gonna change the directory to where this is because we changed it a little bit
49:47
and that's just gonna be that one now [Music]
49:53
here let's let's fix this text right we're gonna go into this paragraph and
49:59
we're gonna make it centered and I'm gonna publish boom okay and then now
50:10
what we need to do is we need to go to tower okay tower notice the change we're gonna
50:15
commit this and say centered text now
50:22
what should happen when I push this because we can figure that that hook on github it will see that I did the push
50:31
and it should automatically hit that URL and when that hits the URL the file
50:37
should be created inside this folder okay if everything goes well that's
Troubleshooting
50:43
exactly what's going to happen and yours crossed I'm gonna push this it's
50:53
thinking about it boom it pushed okay so it pushed that to github fingers rolled and should
51:10
[Music]
51:19
hmm interesting
51:26
sometimes troubleshooting
51:40
mmm interesting I didn't that work okay
51:49
so if there's a request post file [Music]
52:02
hey what I'm going to do is let's test that this works so what I'm gonna do here is I'm just gonna air let's bring
52:08
up transmit something maybe a little bit more familiar to you guys and I'm gonna
52:14
connect to my server here we're gonna go
52:22
into websites I'm gonna edit this file
52:31
in line right really quick okay so I can
52:40
do right now is I'm just gonna comment these files out which basically means this file will get created any time this
52:45
gets hang just for fun and what don't
52:50
you do is in this URL here I'm going to do so now in theory since anything that
53:00
hits that that will work if we go into boy hooks aha
53:09
I did not work
53:15
mm-hmm I know why I know why okay we're stupid file permission issues okay
53:24
we're gonna do is we are going to do I'm
53:29
gonna change the location of this file and I'm actually going to change it to be web sites slash aspect hq.com
53:41
okay so the reason that didn't work is the way UNIX works is that the web
53:50
server is run is ran under a particular user right most time it's a user called
53:55
WWWE - okay um obviously I'm logged in as Jill workman um now in my home folder
54:03
just as on your Mac as well only I have access to my home folder um so when I tried to create when I tried to write
54:09
this file into home Jay workman deploy hooks blah blah blah okay it tried to create a file inside my Jill
54:17
working directory but what I what I need to do is I need to create that file inside though the public folder where
54:24
the website is hosted where WWB data actually has access to create new files
54:29
okay so I can do is I'm gonna just gonna create a file here called home Joe
54:34
workman websites aspect HQ comm deploy hook now because this this folder here
54:40
um is actually accessible by the the process that runs the web server it can
Deploy Hook
54:46
create this deploy hook file so we're gonna call this deploy hook so I'm gonna
54:52
go ahead and just for fun I'm gonna save this and then I'm gonna go ahead and run
54:58
it and actually if we go into here you refresh this
55:13
what I'm gonna do is I'm just gonna say file the full hook and what that will do is that will actually create here we go
55:20
this is even simpler it will create a deploy hook file in the same exact folder that this deploy PHP file is in
55:27
so let's go ahead and refresh that okay
55:34
there it is okay there we go making progress okay so now whenever we hit this URL um it's going to create
55:43
that so it's Gordon I'm gonna delete that file and now what we need to do is I made these changes locally on the server
55:49
but we're going to have to do is we're gonna save this in our repository
56:07
don't say okay out there okay oh this
56:15
isn't the code so remember inside a finder we go in to remember this is
56:23
where publishing we're gonna have to update this file this deploy dot PHP okay so that's this file here paste okay
56:35
okay there we go and we go to tower and
56:41
we're gonna deploy this again so remember I made a quick change to this file we're gonna save it
56:55
oops I mean I mean put on my commit message duh fixed beep boy okay enter
57:03
this is a news this is a new server setup I have this server set up a little bit differently how I have an existing
57:08
one so sorry for the troubles but hopefully maybe you learned a little bit okay so we pushed that that new deploy
57:14
file now in order to get it on our server or going to have to hang up to it
57:21
let's see where am I websites expect HQ calm okay
57:29
so here we are what I can do is I'm gonna do a git pull up okay so is
57:37
interesting I did a get pulled but remember I actually changed that deploy dot PHP file locally here and get saying
57:44
whoa I can't do a pool because you have changes locally on the server that's a no-no so that's where we do this guess
57:50
reset - - hard head okay and on so
57:58
basically I reset all the changes that I did to be the the you know before any
58:03
changes were made that's what that command get reset that does and now I can do a git pull and
58:09
there we go okay so now now our deploy
58:15
should work fun times and actually it won't work if we if we do this because I
58:21
put back in that post check okay so
58:26
let's go ahead and make another change
58:31
there we go yeah I mean there's just something simple I'm gonna paste in another
58:38
paragraph and we're gonna publish rudimentary change okay remember we need
58:47
to go to tower and if tower go here and say changes commit
58:54
push push head-on times
59:01
okay so now now that that push is going up okay
59:07
github should have got it and it should have deployed or actually and close that we don't need github anymore
59:14
drumroll but we should have a file called deploy hook here and boom we do
59:19
so here we have a deploy hook and now what we need to do is we need to create
59:24
that scheduled job that looks for this file and when it finds this file it's
59:31
going to do basically the pool from github okay so I already have a version of that
59:41
file on my server let's look at it
59:47
really quick again because we are gonna have to modify it slightly because I I
59:53
changed the directory where that file is located so websites and was deploy - hook - hook
1:00:03
okay and actually what I can do is I mean to be honest in all the years that
1:00:10
I've actually used this workflow I've never looked at these files so what I'm going to do is I'm just gonna say remove
1:00:17
dollar hook I'm not gonna even save it and then what we're gonna do is I'm
1:00:22
going to so now what we're gonna do is so now what this script does is it it
1:00:28
has our hook we're looking for that this deploy hooked on aspect hq.com if it finds the hook it's gonna delete
1:00:34
it and then it's going to go into the directory and run those two commands that I just ran it will do the reset and
1:00:42
then it will do the pull okay so so that's exactly what this does one of you
1:00:49
is I'm going to copy this and I'm just gonna go
1:01:05
okay why don't you do is I'm just going to create a a file here and we're gonna
1:01:12
call it check holy Sh
1:01:21
okay and that's the file that's the same exact file I just copy and pasted from
1:01:27
from the Mac App the vs code and I need
1:01:33
to make that executable okay so now I
1:01:43
can execute that just deploy script so if we wanted to what I can do is I'm going to I'm just gonna run this deploy
1:01:51
Sh just for fun and what we'll notice is um
1:01:57
it actually ran so it found the deploy hook inside websites aspect a ChiCom um
1:02:04
it removed it and it did a pull from github pretty cool right so yeah pretty
1:02:13
slick stuff right there so if we go into websites and aspect HQ comm will see
1:02:21
that that deploy hook got removed and the files got updated if we look at the
1:02:27
timestamps here they have been updated okay it's pretty cool um let's so let's
1:02:33
schedule this job now so now hopefully your host has a way of scheduling all of
1:02:39
these jobs these scripts actually you know in your cPanel I know there is I'm
1:02:45
gonna use something on here called crontab so I'm going to do crontab - E
1:02:52
and I'm gonna do is let's see crontab on
1:03:01
every minute I think it's run every I just get the crontab run every minute
1:03:11
okay so um it's when I do is Randy star star star star star slash home slash
1:03:20
show workmen slash oops
1:03:26
what was the name of that script did I call it
1:03:43
check-check the boy dhatus h-hey so now
1:03:49
I'm gonna run this check deployed Sh every minute and I think every minutes a
1:03:54
little aggressive I'm only doing that for this demo I would do it at most like every five minutes I think on my servers I do every
1:04:01
15 it doesn't really matter I guess every five minutes is fine yeah probably better if you want things
1:04:07
updated a little bit more frequent but and it's not really it's not a horrible thing if you run it every minute I mean that scripts gonna run like like
1:04:13
lickety-split if the file doesn't exist it's gonna do nothing it's good to know it's gonna exit so it's not really that
1:04:19
bad most hosts won't let you run stuff every minute though so um if you're scheduling jobs inside cPanel chances
1:04:26
are they limit to you i would say maximum they'll let you run something's every five minutes some maybe only every
1:04:32
15 so yeah keep an eye on that so now that job's gonna run every minute and
1:04:40
what we should do here let's go ahead and let's look at Safari really quick
1:04:51
Keep Calm okay so here I've aspect HQ calm and what we're gonna do is now that
1:04:59
we have we have everything we're done we have everything set up and what we're gonna do is I'm gonna remove this second
1:05:05
line because obviously we don't need it so I'm going to remove this second line of we are a cool company we're gonna
1:05:11
publish that up to github via tower and then hopefully within a minute our
1:05:18
website should be completely updated fingers crossed let's go ahead let's do
1:05:26
it nervous so I'm going to go in here and then
1:05:33
delete that save our project we're going to publish it locally published it we
1:05:44
need to go into tower and tower notice that we had changes and we said yep we
1:05:51
agree with these changes deleted paragraph okay we're gonna push this as
1:06:02
soon as we push this drumroll that github will see that we pushed it will
1:06:10
ping our deploy script our deploy script we then have a crumb that our deploy
1:06:15
script will create that file that deploy hook file at that point our cron job
1:06:22
should run that runs the script that checks for that file and if it finds the
1:06:27
file it will remove it and then pull down all the changes seems crazy but
1:06:34
hopefully hopefully this is gonna work I
1:06:41
guess a benefit of not removing it probably what what I should have done is um yeah because I was removing that file
1:06:49
um a benefit of not removing it and just moving it um is actually you know like
1:06:57
you can actually see it run because you have validation that it actually did something right
1:07:02
so maybe we can we can add that afterwards but here let's just gamble see if it works already and there it
1:07:08
worked so we saw that line was removed it all works it's all magic right pretty
1:07:15
pretty cool that's pretty magical and of
1:07:22
course dogs work
1:07:33
dan dogs okay so pretty exciting I'm
1:07:45
gonna look at the chat box because I've been I have been ignoring it pretty much the entire time hopefully you guys got
1:07:51
got some stuff out of that let's look at this chat box really quick see if I can answer some questions
1:07:56
I wasn't sure yeah for a while I wasn't sharing my screens sorry about that
1:08:02
Gaston says even though my tutorials clear it seems complicated yes I'm setting it up as complicated but as
1:08:10
you see from now on you know once you get it set up though it's just a
1:08:15
well-oiled machine right and it just kind of I'd it locally pushed it up to
1:08:20
get magically showed up on my server yes and I warned you at the very beginning this was technical this is complicated
1:08:28
um to get it set up it is very complicated but it is very interesting
1:08:34
right and some benefits if we ever wanted to roll back to a commit here
1:08:40
let's actually do that what I do is I'm gonna roll back the commit that we just made um and I'm gonna put the two the
1:08:46
two sentences back right um so let's go ahead and do that really quick so this
1:08:52
just kind of shows us what we can do is um here I am in tower if I go to master okay so here is where I deleted the
1:08:59
paragraph okay I'm gonna revert this change right now um so I'm gonna say
1:09:05
revert okay so now reverted that I'm gonna push this back up to my server so
1:09:16
I I'm pushing the these changes up to the server and they're done they're pushed so in theory right now again
1:09:22
right now what's happening is github got the push and it's hitting my server and
1:09:28
[Music] we're going to and look it's already
1:09:34
done right so we have those two sentences back right so we do get
1:09:41
benefits from get right so it is yes it is a it is a complicated
1:09:47
set up but once you have it set up it's pretty simple so yeah sorry sorry Gaston
1:09:55
um this isn't you know why is this better than rap we were publishing well I just
1:10:00
kind of showed you the version control is very interesting right um it it also
1:10:05
you know some people are plagued with FTP problems or you know issues with you
1:10:11
know whether or not things are getting published properly publishing locally is
1:10:16
fast right super fast and then you know
1:10:21
yes you get the benefit yes you have to type in the commit message and commit and then you push it up to github and
1:10:27
then github automatically pushes it down so it's a little we're kind of going around about way but it works really
1:10:33
well and you get that version control history so if you ever messed up and he
1:10:39
just oh man whatever I published how many times I've heard people say they published something and they didn't
1:10:44
preview it and they're like oh shoot I wish I just want to go back to what it wasn't last week well now you could just
1:10:50
go to get revert to a previous version push that back up and your servers fixed
1:10:55
right some pretty cool stuff
1:11:00
now gasolin says I do that oh he does version control basically by making
1:11:06
changes in duplicating his wrap weaver project file yeah that's true now what I didn't actually mention is
1:11:12
you could throw your wrap Weaver project inside your github repository as well inside your git repo okay so basically
1:11:21
if you are you know now I recommend right now I'd recommend creating a separate git repository for your wrap
1:11:28
Weaver project okay so that way you know your wrap your project has its own
1:11:34
repository in your website you know the actual exported website has a different one there's a lot of reasons for that
1:11:41
and also with rack Weaver projects if you throw that and get the changes are
1:11:49
gonna be very obscure okay um you cannot look at what it changed you just have to
1:11:54
kind of blindly accept the changes and save them okay and but you can you can
1:11:59
roll back to previous versions of it works so how do you get your
1:12:10
rapidweaver back to them back to that then I'm not under I'm not understanding
1:12:16
the question of that now I I do want to say Joe this is cool but what about like
1:12:24
testing like this is kind of you know let's say I want to I want to test something out how can I you know how can
1:12:31
I test it out um now I'm not gonna I'm not gonna take the time to do that that could be a whole nother live stream
1:12:37
maybe I do that next week is essentially what I would do is I would for a testing
1:12:43
purposes I'd create a test subdomain like a little test stop aspect hq.com um
1:12:49
and at that point what I would do is I would publish traditionally inside
1:12:54
rapidweaver to that domain so then I could publish all I want to this test subdomain from rapid eevr an inside rep
1:13:00
you can you can have multiple publishing destinations so let me quickly show you what I mean by that
1:13:07
so essentially inside rapidweaver let's go ahead and close out some of these other windows on the inside rack weaver
1:13:16
inside your publishing um setup okay um this is let's say this is let's rename
1:13:22
this to be production okay what you do is you could say add new destination and
1:13:28
then the destination here would be HTTP you know testing dot aspect hq.com you
1:13:38
know user names Joe workmen and password who knows what that is okay but you
1:13:43
would set it up normally yeah I know it doesn't work so basically what you do
1:13:50
here is you would say this is testing okay and what what's cool about this
1:13:55
method is you would set up your testing server here to use s to use SFTP or FTP
1:14:03
whatever is your default publishing mechanism and then when you're happy with all the tests what you do is you
1:14:08
then publish to production and then you do your whole tower github integration thing right um so what's
1:14:15
cool about that now if you've never done this you'll notice up here we on the publishing button inside rapidweaver you
1:14:20
now can swap between production and testing okay so you can you can swap
1:14:27
between different destinations so again when you're in testing you could hit the
1:14:32
publish button and then at that point it will publish up to your server and then when you're happy with all of that and
1:14:40
you're happy with all the changes you think think everything looks good you swap back to production and then you
1:14:45
publish and then what that would do is that'll published locally to the local folder at that point then you use tower
1:14:51
or your git client to push that up to the server and all that stuff we just learned today so that's a pretty cool
1:14:57
workflow um that's the workflow I plan on using on for Weaver space so I'm going to be I'm gonna have a test server
1:15:04
that allows me to kind of have development and you know test new things and try new layouts and stuff like that
1:15:10
and then when I'm happy I will publish it to production then that will then the version control at all and push push it
1:15:16
over to github so anyway guys I think
1:15:26
that kind of wraps everything up I don't see any other further questions um again
1:15:31
this is definitely a difficult set up right even I stumbled through a couple
1:15:38
things right as we were doing it um you know getting things set up and I sorry
1:15:43
for the thing I was trying to use get lab get lab works a little bit differently in the github I was experienced with how github works I was
1:15:50
testing out get lab I thought it would be just as smooth but yeah I swapped
1:15:55
over to github and hope luckily it was all smooth gravy after that I will
1:16:01
definitely post inside the show on the show notes for this later on by the end of this week I'll have the snippets to
1:16:08
the scripts that I've used so you'll have the PHP deploy script and the shell script that I use I'll press publish um
1:16:15
you know them on github so you can you can access those really easily so that you can use those in your setup yeah and
1:16:23
I know I probably scared you guys with the the terminal and how I use things
1:16:28
unfortunately I don't even have a web server that uses cPanel which is what you guys use most likely so yeah you're
1:16:36
gonna have to figure some of that out so there's some legwork that you need to do on your own in order to figure out how
1:16:41
to get the scheduled jobs and the integration and stuff like that from cPanel I know it's possible because I
1:16:48
talked to Greg especially on that podcast again episode 28 on you can get Greg's perspective on this from the
1:16:55
traditional hosting side but yeah I hope you enjoyed this have a great day um
1:17:01
yeah I hope you're enjoying all these live streams that we've been doing every week I like them I think they're fun and
1:17:07
I kind of like this one I think today went relatively smooth um so anyway take care have a wonderful rest of your week
1:17:13
go out and make something great and take care bye