
Show HN: Sorcia – Self-hosted web front end for Git repositories, written in Go - mysticmode
https://git.mysticmode.org/r/sorcia
======
CameronNemo
Glad to see new work in this space. Sorcia looks very clean, and well
implemented.

I only noticed one issue, which is very much an edge case: when trying to view
a file with third party JS disabled (i.e. the Cloudflare JS sourced script),
the file is rendered quite poorly. Would be nice if the service degraded
gracefully and used a simple pre tag or similar.

I must also admit that I am interested in a more "non-technical" git frontend
-- one that puts the file tree up front and center, leaving details like
remotes and commits in out of the way views.

If anyone is interested in other options, see also:

* [https://git.nemo157.com/grarr](https://git.nemo157.com/grarr) (Rust, the UI themes are a little tacky IMHO) * [https://github.com/emersion/matcha](https://github.com/emersion/matcha) (also in Go, but not very complete or performant...)

~~~
Nemo157
Wow, did not expect to see grarr mentioned on HN. I should mention that it's
basically dead at this point, and IMO would need a full rewrite to resurrect
(the web framework it's built on is unmaintained and has been superseded by
much nicer ones, the templating it uses is based on a compiler plugin that
only works with a few years old nightly compiler).

~~~
CameronNemo
What a shame. I do like the interface quite a bit beyond the themes.

------
mysticmode
Hi, OP and author of the project here.

You could check the landing page of this project here:
[https://sorcia.mysticmode.org/](https://sorcia.mysticmode.org/)

I've put up a FAQ and Features section with screenshots, so it is easy for you
to look at it and see why I've built this software.

~~~
eecc
Hmm, name will raise a few eyebrows in Italy.

~~~
osrec
What does it refer to in Italy?

~~~
galacticdessert
Its a "colloquial" way of referring to a prostitute (or person acting as such)
in the area of Rome. Very often spelled as sorca, but sorcia is also
understood to have the same meaning.

------
tdy721
Front end for git in go. Surely you stumbled across GOGS?
[https://gogs.io/](https://gogs.io/)

~~~
CameronNemo
The FAQ explains how this differs from the like of gogs, gitea, phabricator,
gitlab, and github.

It aims to provide a limited subset of the features they provide. More similar
to cgit.

~~~
lsaferite
I mean, in fairness to the PP, they do _not_ mention gogs at all in the FAQ.

------
bpizzi
Tangential: lastly I was searching for an easy to deploy, easy to use readonly
html frontend for git repositories that could be reached via an URL subpath
behind a reverse proxy, served from a container.

The use case is to let website owners see what their developers are changing
in the source code that I'm hosting for those owners, and to embed this in the
existing dashboard of mine where the owners can see what's happening on their
servers. I would handle myself the part where the source code modifications
are committed to the underlining git repositories, and a nice bonus would be
that those repositories would act an additional backup strategy.

Unfortunately nothing came close to this simple wishlist, I was unable to get
the likes of git-web or gitiles working under those constraints, I tried 4 or
5 at least.

I should have a look at Sorcia then!

------
roguas
I would consider different name for "tree". It ain't obvious to me if it is
tree graph for my git tree or tree of catalogue in source.

~~~
CameronNemo
OTOH, it is consistent with cgit.

~~~
mysticmode
Yes, my main inspiration is cgit. I mostly followed that and written in Go
with some improved UI(which is what I was deliberately wanted to do).

------
mroche
Very cool! Although I noticed (at least in Safari and iOS) the contributors
page has 23px widths for the profile pictures.

Front-ends like these are really cool. They allow simple, self hosted
solutions strictly for code that can then be mirrored to other, more complex
solutions if desired. Or if you like working with very minimal tooling.

~~~
mysticmode
Thank you! Just got to notify that there is no profile picture upload on
Sorcia. It just comes from Gravatar through the commiters email.

Maybe I can tweak the design later to show the DP a little bit larger for the
next rolling release.

------
nirui
This kind of simple design has grown on me after I tried sourcehut. I kind
like it, it's light and snappy, no extra loading bar is needed.

My questions:

\- Can you make it a drop-and-play Docker image?

\- Why not host JavaScripts like `highlight.js` directly on the Sorcia server?
That way LAN-only user will be able use this software as well.

~~~
mysticmode
\- I need help on generating a docker image. Would be great if someone
contributes to this.

\- Sure, I was thinking about that. Being this a self-hosted software, I
should have used those vendor js libraries directly. But it was hyper fast
when I used Cloudflare CDN that blinded my eyes. Anyways, I'll release a patch
version today using the js libraries directly.

~~~
nirui
Hello, it's been a few days, I hope you can still receive this.

I cloned your project and made a Dockerfile for it. It works on my Arm32 based
board so I guess it should work on other platforms as well.

The file is here, should be a good starting point if you want to further
develop the Docker image, please test it:

    
    
        # This is an experimental Dockerfile for Sorcia Git front-end
        # 
        # This image allows both easy deployment and use. The deployer 
        # can operate the resulting container via Docker remote management
        # with command such as:
        #
        # `docker -H <docker_server> exec sorcia /home/git/sorcia/sorcia usermod`
        #
        # to manage the service rather than having to login onto the Docker
        # host.
        #
        # To build the image, use command
        #
        # `docker build --tag <final_image_name> .`
        #
        # Or, setup a hook on Docker cloud, let it do the hard job for you.
        # 
        # To run the image, use command:
        #
        # `docker run \
        #    --detach \
        #    --restart always \ 
        #    --name sorcia \
        #    --publish 1937:1937 \  # You may have to change this port number
        #    --publish 2222:2222 \  # iptables maybe needed if you want port 22
        #    <final_image_name> web` 
        #
        # To run usermod, when the container is running, run:
        #
        # `docker exec -it <container_name> /home/git/sorcia/sorcia usermod`
        #
        # Notice: This image does not contain Nginx, if you need it, put it in 
        #         a separate container.  
        #
    
        # Step 1: Initialize the build enviroment and build the application
        #
        #  Here we are using the golang:alpine which is the latest Go but 
        #  is compiled for Alpine. This is necessary because we will later
        #  run the service on an Alpine base (musl based).
        #
        #  Step 1.0: Copy all source file into the container
        #  Step 1.1: Install Git to download go modules, and build-base to 
        #            build the dependencies
        #  Step 1.2: Print the version of the bulitin Go
        #  Step 1.3: Goto /sorcia directory and start the building process
        #
        FROM golang:alpine as builder
        COPY . /sorcia
        RUN set -ex && \
            until apk add build-base git sqlite-dev; do sleep 1; done && \
            ([ -z "$HTTP_PROXY" ] || (git config --global http.proxy "$HTTP_PROXY")) && \
            ([ -z "$HTTPS_PROXY" ] || (git config --global https.proxy "$HTTPS_PROXY")) && \
            go version && \
            cd /sorcia && \
            until CGO_ENABLED=1 go build; do sleep 1; done
    
        # Step 2: Setup the image that will actually run the service
        #
        #   Step 2.0: Copy the generated binary along with source file into
        #             the container
        #   Step 2.1: Install the dependencies: Git and Sqlite
        #   Step 2.2: Create user and user group git and sorcia, we'll run the 
        #             service application under user sorcia
        #   Step 2.3: Initialize the enviroment (Directory and other stuff)
        #
        FROM alpine:latest
        COPY --from=builder /sorcia /home/git/sorcia
        RUN set -ex && \
            ls -l /home/git/sorcia && \
            cp /home/git/sorcia/config/app.ini.sample /home/git/sorcia/config/app.ini && \
            sed -i -E "s/ssh_port.+\=.+/ssh_port = 2222/" /home/git/sorcia/config/app.ini && \
            echo && cat /home/git/sorcia/config/app.ini && echo && \
            until apk add --no-cache openssh git sqlite; do sleep 1; done && \
            addgroup -S sorcia && adduser -S -G sorcia sorcia && \
            mkdir -p /home/git/data && chown sorcia:sorcia /home/git/data && \
            chmod +x /home/git/sorcia/sorcia && \
            (cd /home/git/sorcia; rm error.log -f; ln -s /tmp/error.log error.log; ./sorcia version)
        WORKDIR /home/git/sorcia
        USER sorcia
        EXPOSE 1937 2222
        ENTRYPOINT [ "/home/git/sorcia/sorcia" ]
        CMD []

------
jlelse
Looks nice and clean. Minimalism. I like what I see in the screenshots.

~~~
tedunangst
screenshots?

~~~
fallensatan
Screenshots:
[https://sorcia.mysticmode.org/features](https://sorcia.mysticmode.org/features)

------
yandrypozo
Constructive recommendations: \- add tests (I couldn't find a simple _test.go
file) \- relative imports aren't recommended in Go (pkgs like "sorcia/model")
\- please rethink/avoid global (package) variables like middlewareDB
([https://git.mysticmode.org/r/sorcia/tree/master/middleware/m...](https://git.mysticmode.org/r/sorcia/tree/master/middleware/middleware.go#L14))
\- avoid adding logic in the init() functions \- screenshots?

~~~
platinumrad
All of those seem fine aside from logic in init() functions. In particular,
not sure how global variables in someone else's code impacts you.

------
savolai
Looks cool. Responsive layout, please. Painful to browse on iOS phone.

