aboutsummaryrefslogtreecommitdiff
path: root/blog/posts/guide_sorcery_git
diff options
context:
space:
mode:
Diffstat (limited to 'blog/posts/guide_sorcery_git')
-rw-r--r--blog/posts/guide_sorcery_git/index.md183
-rw-r--r--blog/posts/guide_sorcery_git/index.php1
2 files changed, 0 insertions, 184 deletions
diff --git a/blog/posts/guide_sorcery_git/index.md b/blog/posts/guide_sorcery_git/index.md
deleted file mode 100644
index 4a46ca9..0000000
--- a/blog/posts/guide_sorcery_git/index.md
+++ /dev/null
@@ -1,183 +0,0 @@
-Recently, someone retooted [this blog post](https://char.lt/blog/2026/09/sorcery-repo-viewer/) onto my Bluesky feed. I found it compelling; the scrapers haven't become a problem for me yet, but I also don't use 99% of the features my Forgejo instance provides, and I thought the program the article was about seemed cool. Besides, my Forgejo instance is running on my old domain, so I'll be needing to migrate all my repos at some point in the next two years anyway, so I might as well have some fun with it and switch hosting solutions while I'm at it.
-
-Inconveniently for me, however, [Sorcery](https://git.t4t.associates/char/sorcery/) is certified Oomfware™ and doesn't have such luxuries as a pre-compiled binary to download or a professional install guide, so I guess if I want this sucker on my server I'm figuring that shit out myself. It's also designed for use with Nginx and not my current reverse proxy, Caddy, so I'll have to decipher the provided nginx config and port it over. I figured I may as well write all that down so you don't have to figure it out yourself.
-
-# Git server
-
-Sorcery is just a read-only frontend for your git repos, so we'll have to set up a git server to use it with. I'll just be setting up a basic ssh git server as described in the [official Git docs](https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server), but I'll copy the instructions over here for your convenience.
-
-First, add a user on your server for the git server and switch to it:
-
-```
-adduser git
-su git
-cd
-```
-
-If you have ssh pubkey authentication set up (which you should) now's the time to enable it for the git user as well. I just did this by copying the contents of my `.ssh/authorized_keys` file into the git user's one at `/home/git/.ssh/authorized_keys`.
-
-```
-mkdir .ssh && chmod 700 .ssh
-touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
-exit
-nano ~/.ssh/authorized_keys
-<copy the contents>
-su git
-nano ~/.ssh/authorized_keys
-<paste, save and exit>
-```
-
-This is actually what I did.
-
-Test to make sure ssh login works, and if it does, the git server is now technically set up. You can create repositories anywhere on the server that the `git` user has read/write permissions by creating a directory for the repo (convention dictates that you call it `repoName.git` but you don't have to) and initializing a bare repository in there:
-
-```
-mkdir reponame.git
-cd reponame.git
-git init --bare
-```
-
-Now you should be able to add it as a remote with `git remote add origin git@your.domain:/absolute/path/to/repoName.git` on your machine, or if you're lazy like me and just put your repositories in a folder in the git user's home directory, with `git remote add origin git@your.domain:relativePathTo/repoName.git`.
-
-Sorcery expects a folder structure like this for your repositories:
-
-```
-reposFolder
-├─userFolder
-│ ├─repoName.git
-│ └─repoName2.git
-└─userFolder
-```
-
-Now on to the interesting part.
-
-# Installing the fucker from source
-
-Sorcery doesn't have a precompiled binary to use that I could find, so it has to be built from source. Due to the developer's choices, this will require the use of Nix. I'm installing and configuring it through the distro package manager on Ubuntu Server, so this part might be a little different for you if you're using something else.
-
-First, naturally, Nix needs to be installed and the source code cloned:
-
-```
-apt install -y nix
-git clone https://git.t4t.associates/char/sorcery
-cd sorcery
-```
-
-If we try to `nix build` now, Nix is gonna give us some errors, so let's fix those. First, it'll complain about a couple of "experimental features" not being enabled. Enable the relevant ones by appending the following to `/etc/nix/nix.conf`:
-
-```
-experimental-features = nix-command flakes
-```
-
-If you're in my situation, that file should look like this after:
-
-<p class="codetitle">/etc/nix/nix.conf</p>
-
-```
-# see https://nixos.org/manual/nix/stable/command-ref/conf-file
-
-sandbox = true
-experimental-features = nix-command flakes
-```
-
-Now it's probably gonna complain that you've been denied permission to get the status of some kind of daemon-socket. You can gain permission by adding yourself to the `nix-users` group, like so:
-
-```
-sudo usermod -a -G nix-users yourusername
-```
-
-Make sure to log out and back in after you do that.
-
-Okay, *now* we can run `nix build` in the git repo to get our binary:
-
-```
-nix build
-```
-
-It'll show up inside the cloned repo at `result/bin/sorceryd`. Now move it somewhere that's not that &mdash; the Sorcery README suggests moving it to `/usr/local/bin/` "or whatever". Installing it there will make some pre-provided things like the systemd unit work with fewer changes, so I recommend you do that.
-
-```
-mv result/bin/sorceryd /usr/local/bin/
-```
-
-If you put it somewhere else, replace mentions of `/usr/local/bin/` accordingly.
-
-# Reverse proxy configuration
-
-The dev provides an nginx config for Sorcery through a script included in the repo that generates one. It's pretty elaborate, so I'm gonna have to run the script and reverse engineer its output to make a Caddy config. If you're using Nginx, I'm guessing this next part will be relevant to you. If you're using Caddy, skip ahead to where I provide the working Caddy config I used.
-
-## Extracting the Nginx config
-
-The script in question is a Typescript file, and the dev recommends using Deno, so we're gonna have to install that first. Annoyingly, Deno doesn't publish to most distro package managers, so that'll look about like this:
-
-```
-curl -fsSL https://deno.land/install.sh | sh
-```
-
-Yucky, but fortunately after that it just works, assuming you told it to add itself to the PATH when it asked. Now run the script:
-
-```
-deno run sorcery.ngx.ts > sorcery.conf
-```
-
-If you're using Nginx, edit the newly generated `sorcery.conf` accordingly and do whatever it is you do with it.
-
-## Caddy config
-
-Wow, that was tough. Thanks to my hard work, you may now simply copy this into your Caddyfile and you're golden:
-
-```
-
-```
-
-# systemd configuration
-
-Sorcery's README provides a systemd unit and the environment file it expects. We'll put the environment file in place first &mdash; copy this to `/etc/sorcery/env` and edit accordingly:
-
-<p class="codetitle">/etc/sorcery/env</p>
-
-```
-SORCERY_REPOSITORIES=/absolute/path/to/reposFolder
-SORCERY_CACHE=/var/cache/sorcery
-SORCERY_SOCKET=/run/sorcery/sock
-SORCERY_INSTANCE_NAME=your.domain
-SORCERY_CLONE_URL_BASE=https://your.domain
-SORCERY_CONTROL_SOCKET=/run/sorcery/control
-```
-
-Now paste the following systemd unit to `/etc/systemd/system/sorceryd.service`:
-
-<p class="codetitle">/etc/systemd/system/sorceryd.service</p>
-
-```
-[Unit]
-Description=Sorcery Git forge
-After=network.target
-
-[Service]
-Type=simple
-User=git
-Group=git
-RuntimeDirectory=sorcery
-CacheDirectory=sorcery
-ConfigurationDirectory=sorcery
-EnvironmentFile=/etc/sorcery/env
-ExecStart=/usr/local/bin/sorceryd
-Restart=on-failure
-RestartSec=2
-UMask=0027
-NoNewPrivileges=true
-PrivateTmp=true
-ProtectSystem=strict
-ProtectHome=read-only
-
-[Install]
-WantedBy=multi-user.target
-```
-
-Mercifully, if you've followed this guide so far, you shouldn't need to change anything in there. Now you can start 'er up:
-
-```
-sudo systemctl daemon-reload
-sudo systemctl enable --now sorceryd.service
-``` \ No newline at end of file
diff --git a/blog/posts/guide_sorcery_git/index.php b/blog/posts/guide_sorcery_git/index.php
deleted file mode 100644
index 952e6d9..0000000
--- a/blog/posts/guide_sorcery_git/index.php
+++ /dev/null
@@ -1 +0,0 @@
-<?php include($_SERVER['DOCUMENT_ROOT'] . '/blog/post.php'); \ No newline at end of file