Host your own git server with Soft Serve!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today we're going to take a look at setting up a command line tool that I've wanted to play with for quite a while now you may remember the folks at charmcharm.sh is their website in a recent video we looked at the gum Library they have for making great shell scripts well instead of one of their libraries we're going to look at one of their applications today so the application that we're going to look at is called Soft Serve and this is a git server so I want to host my own git server one of the really cool things about soft serve is that it's more than just a git server it also has an interactive UI a terminal UI that you can use to browse your repos let's take a look at setting this up if we click on soft serve here we're taken to the GitHub repo and they have some instructions here for going ahead and just installing this locally but I have a different approach that I want to take we're going to install it in a Docker container on my Home Server recently started setting up a home server and this is one of the things I want to use it for so let's go ahead and SSH into my home server and if we take a look at what's going on on This Server already you can see I've got a couple of things running we have nginx running which is just a reverse proxy for some of the other services we've got pie hole and we've got home assistant so these are already running here and so we're going to set up a new Docker container that's running beside these other ones right now I've got a very basic setup I've got a folder for each one of these services so let's go ahead and make a soft serve folder and in here let's create a Docker compose.yaml file now I don't think you want to watch me type all of this out so I've just pasted it in but let's take a look at what this is doing so we're creating a service here that we're going to call soft serve of course we're using the standard image charm CLI soft serve latest tag and we'll just call this container soft serve now we want to make sure that all the data will be stored outside the container so we're going to mount a volume here we're going to mount the slash data directory in this soft serve directory on our server and we'll just Mount that to slash soft serve inside of the container now the port that soft serve uses by default is 23231 I actually want to mount that to a different port outside 8082 so I'm going to put that to 8082 and and we're going to use 23231 on the inside so let's go ahead and save this actually before we do I think I need to fix the indentation there so now we can start this up with Docker compose up Dash D to detach it and we give this just a second and we'll see all right we've created our soft serve container so let's do Docker PS so we can see this is now running we're mapping port 8082 on the outside to 23 23 1 on the inside let's give this a test run now I'm going to open a new window here in tmux and what we can do is clone a special repository that softserve has built in and this is the config repository so we're going to do git clone SSH colon slash now I happen to know that my home server is running on 192.168.0.105 if you're following Along on your own server you'll want to put its IP address in there or if you're just doing this on your local machine you can just use localhost instead and we know that we said port 8082 and the repo is called config so let's go ahead and clone this down I'll say yes that's good so let's CD into the configure repository here and look at what we've got we've got a readme file here which is pretty straightforward so let's look and set at the config.yaml we've got a bunch of configuration here as you can see we've got the host in the port showing up right here one thing we want to do is change this port to be 8082 and we've also got a name soft serve here why don't we call this for fun Andrews projects now there's a couple of other things that we could change here we've got some user setup that we could do and we also have Anonymous access so these are things that if you are running this in a public environment maybe you want to change now the anonymous access thing is kind of cool it allows you to basically give anyone a terminal UI that they can use to browse your projects let me show you what I mean by this I'm going to open a new terminal window here we're going to do SSH into git.charm.sh so this is an SSH based application which means that if we SSH into this server we now have a terminal UI that we can use to actually browse these repositories now this is charm's own git server that we're looking at so we're going to see their own projects we could go into the wish project here we can read all about about it in the readme we can tab over the files and take a look at say something in logging and we can actually take a look at the logs we could just go over to the commit history and take a look at a diff something like that so it's all pretty cool now because I'm just logging into this as an anonymous user I don't have access to actually write anything by default you can see that Anonymous access is read write so we're probably going to want to change that to read only but first we're going to have to configure a new user here so let's go ahead and uncomment one of the users here and of course I'm going to call this user Andrew and we're going to need to give it a public key it looks like I know I have a public key here so I'm just going to do a PB copy to copy that to my system clipboard and then in here I'm going to go ahead and paste that in all right so now that I have that user configured in Anonymous access here I can change this to read only so with those changes in place I'm going to go ahead and save this I'll make a commit that says updated config and then we'll go ahead and we'll push that so it should be just that simple we should just be able to push the config and have that figured out so now that we have that let's go ahead and test the terminal UI let's see we're so we're going to SSH to this host and we're going to use this port and now you can see we're in the terminal UI now notice up at the top it says Andrews projects which is exactly the name we gave it notice also that the example clone command that we have here shows the host and the port that we had so we change that to 8082. now we didn't change the hostname this example command here is not correct so let's go ahead and update that if we open up our config file once again here and we can update this to 192.168.0.105. all right so let's say update hostname and go ahead and push that and now if we once again SSH into this you can see that our git clone command here shows the correct IP address so how about creating a new repository here let's go ahead and move to my DOT files project of course and if we do get remote Dash V you can see that currently the only remote that we have is my GitHub remote we're going to do git remote add we're going to add a new one and I guess we can call this soft for now and we're going to add the SSH URL to our repository and we'll have to include our port in there 8082 and then we'll say slash dot files so we've added our remote and we can do get remote Dash V to see that that is actually there so let's do git push to soft and we want to push the main branch excellent look at that we've just created a new repository now to see that we could go ahead and SSH back into this one thing I think I might want to do to make that a little bit easier is add something to my SSH config file so let's go ahead and add a new host here called Soft I'll add a user which is Andrew I'll add my hostname which is the same as I've got for Ubuntu right here but the main difference is the port which is 8082 so we can save and close that and now I should be able to do SSH soft and we're right directly into my projects cool so now you can see we've got home we've also got dot files if we go into dot files move over to the files we could actually say take a look at my alacrity config or maybe we could take a look at some of the commits for example here's a recent commit I made to my Vim config and we can actually take a look at that now if you're not sure what commands you can use here in self-serve you can use question mark to toggle this little cheat sheet at the bottom here as you can see I can use tab to switch between tabs and this actually updates as I go so if I'm on the file tab then I can see I can use G to go to the end or lowercase G to go back to the Top If I go to commit here you can see I can actually navigate and then I can press C to copy the hash or I could press right arrow in order to actually take a look at what that diff is now there's one more thing we could do here notice that dot files looks a little plain compared to the config repo that we have so we can see config says home it's got the little lock icon there it has a nice little summary line here we can go ahead and add that so let's go back to our config here and let's open the config yaml and in repos here let's just copy what we have for home so this is going to be for the files repo we'll call this dot files and let's see private I guess that little lock icon was because we have private set to true on that let's say I wanted to be able to share this repo so I'm going to set private to false and then in my notes here I'll just say my personal dot files repo so we'll go ahead and commit these changes updated dot files repo config and we'll go ahead and push that and then we can SSH back into soft and now you can see that dot files is uppercase D here and my personal dot files repo cool so now I have a local git server that I can use for my personal projects one thing I would love to do is set up a public version of this similar to git.charm.sh where anyone can browse whatever projects I'm working on so if you guys think that would be an interesting video go ahead and let me know in the comments thanks so much for watching and I'll see you later
Info
Channel: Andrew Burgess
Views: 8,781
Rating: undefined out of 5
Keywords:
Id: GUejt9GvnlQ
Channel Id: undefined
Length: 8min 50sec (530 seconds)
Published: Mon Oct 24 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.