Forgejo on Glitch

Project URL: https://beryl-plant-roarer.glitch.me/

For some reason, I was bored and decided to set up Forgejo on Glitch. Since Glitch doesn’t give users much disk space, I couldn’t just put the binary in the project…

app@8e46d46ce949:~$ du -sh /tmp/forgejo
99M     /tmp/forgejo
app@8e46d46ce949:~$ 

Instead, I decided to make it get downloaded from the URL provided on the download page when the server starts. To save time when the server restarts without rebooting, I check the SHA512 hash of the file before either (a) running it or (b) downloading the binary. That way, the server will never get stuck in a crash loop due to a partial download or anything.

Setup

Before installation

package.json

{
  "name": "glitch-hello-node",
  "version": "0.1.0",
  "description": "A simple Node app built on fastify, instantly up and running. Built to be remixed on Glitch.com.",
  "main": "server.js",
  "scripts": {
    "start": "sha512sum -c checksum.txt ||curl -L https://codeberg.org/forgejo/forgejo/releases/download/v1.20.5-0/forgejo-1.20.5-0-linux-amd64 --output /tmp/forgejo;mkdir -p .data;cd .data;chmod a+x /tmp/forgejo;ln -s -f /tmp/forgejo /app/.data/forgejo;./forgejo"
  },
  "dependencies": {},
  "engines": {
    "node": "14.x"
  },
  "repository": {
    "url": "https://glitch.com/edit/#!/glitch-hello-node"
  },
  "license": "MIT",
  "keywords": [
    "node",
    "glitch"
  ]
}

checksum.txt

To generate this, download the binary, then run sha512sum /tmp/forgejo > checksum.txt.

1d7203fc9791a03ae40fb80e9f63b529bca794abf78184625694291ee54ce6dd86da6594650b176864172fe083219048ff0fa0074ab16b382ce2f25285429663  /tmp/forgejo

Setup

Once the server starts, open the project’s website. Make sure you use sqlite for the database (and disable the SSH server by leaving the SSH port input empty). You might want to configure an admin account from the installer.

Once you’re ready, click the install button. After about 30 seconds, you should have your own Git server on a Glitch project.

4 Likes

This is awesome!

1 Like

Just updated this guide for the latest forgejo version (the binary actually got smaller, surprisingly).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.