DEV Community

Cover image for Host your Git on Glitch with Gogs
Melissa McEwen for Glitch

Posted on • Updated on

Host your Git on Glitch with Gogs

Can it run on Glitch? That’s the question I ask myself every time I see someone mention a cool open source software project. A month or so I saw some discussion of Gogs, a self-hosted git service. It's basically a DIY version of GitLab, Bitbucket, or Github.

The catch? Gogs runs in Go. While Glitch can support almost any language, most of our features are tailored for Node.js. So I was really curious if I could get it to run. We have a couple of sample Go projects like go-example and go-glitch-sample. To make a Glitch app use Go, you put in a special file called glitch.json. It tells Glitch that instead of running the default “npm start” when you open your project, to run whatever is defined as “start” in glitch.json

TFW errors 😱

I installed Gogs from binary1. And it seemed to work ok. But I hit a snag. There were so many directories in the project that they made the Glitch editor load much slower. So I hid them. To do this I moved to directories with a dot prefix like like “.scripts”. Voila, my Glitch project was much faster.

Then I tried installing and I got a weird error message “Run user isn't the current user: app ->” which didn’t give me much to go on. I tried a lot of random things and nothing worked. I finally went into the gogs codebase and found the line that error came from. It expected an environment variable called USER. I changed my start command in glitch.json to set that.

Our shiny new Gogs ✨

Gogs has many of my fav git hosting features like pull request reviewing and a visual interface for exploring the code and commits.

exploring the features of gogs

It has some great features including:

  • pull requests with a visual interface
  • issues
  • wikis
  • forking

Try it yourself? 🌠

I wanted to make this easy to “remix” which is a Glitch term for getting your own copy. So I added some files and directories to a file called .gitignore, so you won’t get my repositories when you get your own copy. I haven’t gotten email notifications working yet, but I might try Sendgrid for that.

If you try it out let us know what you think in the comments!


Footnotes:

  1. I had to extract the binary on my own computer because it took up a lot of space. I used the 64 bit Linux one from here.. Then uploaded to Glitch. Because binaries end up in the assets section on Glitch, I got the URL from the assets. Then I used wget asset-url. Finally I ran chmod +x asset-file

Top comments (10)

Collapse
 
shrysr profile image
Shreyas Ragavan

This sounds very interesting. Can glitch run docker containers? I have a few that essentially enable a shiny server hosting multiple ‘Shiny’ apps. Shiny is R’s package for building interactive web apps. shiny.rstudio.com/

Collapse
 
melissamcewen profile image
Melissa McEwen

Thanks! I haven't been able to get docker containers to run within Glitch because it typically requires "sudo" level permissions but I have converted docker machines into Glitch projects. I should write a post on that. Shiny looks really cool! I'm gonna check it out.

Collapse
 
photonniko profile image
Calico Niko

Hi. I'm looking to use a docker image on Glitch. Could you elaborate on this subject? I have a thing i want to do on glitch, but i want to use an api that only works as a docker image (this). I thank in advance!

Collapse
 
shrysr profile image
Shreyas Ragavan

Converting to a glitch app would be interesting. Regarding shiny : The Dockerfiles I have been building are at
github.com/shrysr/sr-ds-docker.

You could also directly use the v2 tag for the dockerhub image shrysr/shiny

Collapse
 
athulcajay profile image
Athul Cyriac

This is so cool. I had a Gitea Binary installed on my PC but this is 🤩. Thank you so much for this

Collapse
 
osde8info profile image
Clive Da

does glitch have unlimited disk space do you really want us putting our repos on glitch ?

Collapse
 
melissamcewen profile image
Melissa McEwen

Glitch offers 200mb per project, so yes, that would be a limitation. My aim for Gogs was just to have a non-Github place to put small projects and to just try it out and see what it was like.

Collapse
 
osde8info profile image
Clive Da

sorry no good for me then ive got about 1T of repos

Collapse
 
17lwinn profile image
17lwinn

probably not possible but could you try to build this?

github.com/flashmob/go-guerrilla

Collapse
 
soulharsh007 profile image
SoulHarsh007

Hello,
I wanted to remix this app but I couldn't as it has been suspended. Can you tell me what changes did you make to glitch.json to get it working?