KreativePro Masterclass
Hello, {first_name}
Version Control
Learn to Build Websites with Craft Cms
Oops! Something went wrong while submitting the form.
Browse Lessons

Access our premium community including bonus tutorials, project files & weekly resources.


Version Control with Tower

On this Craft Cms lesson you'll learn to setup GIT with Tower, a simple to use GUI to handle your version history.


Being the best means investing in the best, no matter what level you are at, this course will take you through the entire process you need to be able to implement an idea and turn it into a fully functional business.
Manasés Padilla
Photographer & Entrepreneur
It has been the best investment I made in my design journey so far. I would consider myself a novice but I honestly feel like I've gained a genuine professional insight into the process of creating a high-level website.
Noel Hale
Founder of Slush Monkeys®
I'm an early adopter of the KreativePro Masterclass, and I love how well put together it is. Neftali takes you through each step of the process from paper sketches to marketing all with fun visuals & clear instructions!
Mae Green
Product Designer @ Dropbox

Hey guys okay. So what we're going to do now is we're going to create CI CD flow. And what this means is we're going to connect to our actual server, so our staging server online to our local host. That way, whenever we create any changes we can submit or commit all those updates, send them over to the cloud or to our staging server rather quickly.
And we can keep a control or a version history. Of all of those updates and to do that, we're going to use the power of tower. Now all of this can be done through the terminal, but it can be very intimidating. So tower is going to help us with this. So the first thing is, install it, give it a name, so we just need to give like a normal name in this case, the computer, we going to put in an email address and click next. Next we're going to need to add a service.
From a Git service, many popular ones, like Beanstalk, GitLab and Git Hub, but we're not actually gonna use none of them. We're actually going to use our own, so we can skip that. And we're just going to start tower, the next thing we're going to do is we're going to go over to our server online, which in this case would be Fort rabbit.
Okay. That's where we're going to pull the, Git that we're going to clone over to our tower software. Now, in order for us to do that, we need to establish a secure connection to that server. And we need to create some keys. These keys are called SSH keys. We have a public key and a private key, and we can generate them using a tool like transmit. Transmit allows you to create both the public and private key. You can copy the public key and dump it over into our Fort rabbit by simply going to the new SSH key, adding it in and clicking safe. Now that's one way to do it, but another way to get SSH keys is by using the terminal.
What I'd like to do is go over to the Fort rabbit help documentation, and just write in a SSH keys. And it's going to give us some instructions as how to install those using our terminal. All right, so if you scroll down a little bit, on the documentation, you're just going to copy the first line, up until a user@fortrabbit.
Don't worry. I'm going to give you guys access to these links and all kind of the process in a written form. So you guys have access to that. All right, next  is going to ask you whether you want to save this file, and then it's going to ask you if you want  to add a password or  passphrase, you can leave that empty by simply clicking enter twice.
Now, what we want to go to is the root folder. And we're going to do the same trick command + shift + dot or period that will open up the hidden files. We opened the SSH and there we go. That's our public file. That's a public key. We want to open that up with a sublime or with a visual studio code, and we want to copy that key. And we're going to copy that over and bring it into our Fort rabbit because we want to be able to connect to that server using the terminal or using tower. Okay once you click save that key is now, living in Fort rabbit and we can go back to our home dashboard and you're going to see that we can access the clone URL.
We copy that URL open up our tower, and then we're going to paste that URL. We're going to connect through SSH key. So all we have to do select private key and choose from our folders. In this case, I made mine favorites. So I was, I have quick access to that public file. And for the username, we want to use the same username from our Fort rabbit.
So that's the one on the URL. The next step is where we want to clone it to. So we're going to have to pull those in files over to our computer. So what we want to do is click on clone two and find our destination, which is in this case, the projects that's like the root folder of all of our projects.
I'm going to create a new folder in here called Fortrabbit, because I want to make sure that we don't override our previous training folder when we click okay, we're going to go ahead and clone that in. And of course there's no files in server, so it's going to be pretty quick. All right, and so once we see the notification, we are good to go.
Let's double click on that folder. All right, you are going to see it's really empty right now. So what we want to do is start copying all the files, from our SVR folder, which are already have installed craft, including the hidden files. So make sure you have that. We paste that over. And as soon as we do that, we're going to go back to our tower, and we're going to see those updated into our panel. So all those files are showing up in our tower. And it's got a little question icon that it's kind of like "Hey, it's pending". We need to stage these files so that we can prepare them to upload them to the server. All right. So let's go ahead and make our first commit.
And what I'm going to do is just that in the title and a brief description, and then click stage all. You'll notice them all have been check marked and we click on commit. Now commit is just sending that as an aversion to the master branch. We haven't uploaded this yet. So the first, the next step is actually to upload all those, files over to the server.
And in order for us to do that, we need to push those files that we just added to the history or the version control history, by clicking push. So click the push button over to the top and make sure that we click on the local branch to be master, which is kind of the source. The only a tree node that we're going to work with.
We go ahead and click publish. We give it a few minutes. And as soon as it does that, it's going to send all those files over toward Fortrabbit server. All right. So once that is finished, the next step is to verify if those files did get uploaded to our Fortrabbit server, we're going to do that using transmit, which is a tool, to access the server using SFTP and SFTP is the old way kind of to get access to a server. But it's really cool, cause we have all those details right here on the Fort rabbit dashboard. We click, we go ahead and quick connect, copy the server. We're going to use the username, of course SVR the same as Fortrabbit.
And we're going to use access using the key that we have already. We go ahead and click connect and boom. We should now be able to see all of the files we just pushed from tower in the server. Pretty cool right. Okay, so final step I think is to actually install Craft in our Fortrabbit because we did it locally using the SSH and the tools, but now we need to go actually click on the staging domain. We're going to access admin/install. We're going to go through the same process. We're going to click next and we're going to add in all the username and password that we just did for locally. We might want to change that on the staging if you want, but you could keep it the same in this case.
You'll notice as soon as we click next. You're going to have kind of pre written information for the base URL. Make sure you change that to the domain of the staging. So that would be Copy that over, bring it in, change it in our base URL. Click finish setup and it should install it right away cause all the env variables are being pulled from the Fortrabbit file online and boom, there we go, we are good to go on Fortrabbit.
If we open up  the env variables. In our Fortrabbit, you'll notice that in the environment variable it's called production, but in our local host, we called it development.
And that is very important to understand, but we'll talk about it in a little bit. All right guys. So our final step is to access the projects. The project Fortrabbit using our terminal. Cause we're going to use nitro to add a domain or a testing domain locally. So the same process to be access projects/fortrabbit in this case, it's the new folder that we created and we're going to ls to reveal what we have in there.
And then from there, we're going to click on, we're going to add "nitro add" as the command, and we're going to just add in the domain svrdeploy.test. We click enter, go through all the steps, the same thing we did earlier, and just make sure that you check your host file, making sure that both the IP is linked to the new domain.
All right. It looks like it is, great. So the IP address matches the SVR deploy domain. Let's jump into our browser and change that domain and access it with the user and password. Once you do that, we'll make sure that it works on the domain, locally, and you should be able to access the craft installation just as well.
So far you have learned to create a very simple CICD workflow with tower and Git. In the next lesson, we're going to take a look at syncking the database from your local machine and with the Fortrabbit server, let's take a look.

Coming Soon

Designers ultimate weapon of choice
Digital Media Masterclass by Neftali Loria

Neftali Loria

Author & Instructor
KreativePro Masterclass Bundle

Access our premium community including bonus tutorials, project files & weekly resources.

Welcome to the Tribe! 💜 Something cool is coming your way...