<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Gogs on blog.iankulin.com</title><link>https://blog.iankulin.com/tags/gogs/</link><description>Recent content in Gogs on blog.iankulin.com</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Mon, 18 Dec 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.iankulin.com/tags/gogs/index.xml" rel="self" type="application/rss+xml"/><item><title>Gogs, Gitea, Forgejo</title><link>https://blog.iankulin.com/gogs-gitea-forgejo/</link><pubDate>Mon, 18 Dec 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/gogs-gitea-forgejo/</guid><description>&lt;img src="https://blog.iankulin.com/images/img_7071-1.png" width="640" alt=""&gt;
&lt;p&gt;I&amp;rsquo;ve been really pleased with &lt;a href="https://blog.iankulin.com/tags/gogs/"&gt;Gogs&lt;/a&gt; - it&amp;rsquo;s lightweight, was simple to spin up, and has worked perfectly. But then this morning on Mastodon, there&amp;rsquo;s a &lt;a href="https://mastodon.social/@Codeberg@social.anoxinon.de/111471407276450348"&gt;post from @Codeberg.org&lt;/a&gt; describing a security vulnerability in their Git hosting project Forgejo. This issue also apparently affects Gitea and Gogs - what&amp;rsquo;s up with that?&lt;/p&gt;
&lt;p&gt;I actually already did spend a bit of time comparing Gogs and Gitea before deciding on Gogs, since I&amp;rsquo;d heard of people running Gitea over the past year or so, but only seen that Gogs seemed to be popular with self-hosters in a Lemmy post I&amp;rsquo;d read. My first impression was that Gitea was more focused on CI/CD and seemed to have a more complicated install process.&lt;/p&gt;
&lt;p&gt;What I didn&amp;rsquo;t do, was think about the project management and teams. It turns out that &lt;a href="https://about.gitea.com/"&gt;Gitea&lt;/a&gt; was forked from &lt;a href="https://gogs.io/"&gt;Gogs&lt;/a&gt; by contributors in 2016 due to &lt;a href="https://blog.gitea.com/welcome-to-gitea/"&gt;disagreements about the project management&lt;/a&gt;. Then at the end of 2022 &lt;a href="https://forgejo.org/"&gt;Forgejo&lt;/a&gt; was forked from Gitea due to &lt;a href="https://forgejo.org/2022-12-15-hello-forgejo/"&gt;Gitea moving the trademarks and domain into a company&lt;/a&gt; providing Gitea support.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://forgejo.org/2023-11-release-v1-20-5-1/"&gt;CVE announcement from Forgeo&lt;/a&gt;, while a little snarky about their ancestors, does give the impression of a functional organisation that&amp;rsquo;s able to deal with issues as they come up. It&amp;rsquo;s a credit to the group to be in that position after just a year, and their &lt;a href="https://codeberg.org/forgejo/forgejo"&gt;repo&lt;/a&gt; (which is dogfooded) seems plenty active.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve only just started on Gogs, so it&amp;rsquo;s still easy to move if that&amp;rsquo;s what I decide. I guess my learning from stumbling upon this security announcement is more that I should:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;take into account more than just project features when making these decisions&lt;/li&gt;
&lt;li&gt;I need to be subscribed to the channels where I&amp;rsquo;d learn about security issues in the projects I&amp;rsquo;m using and their major dependencies.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Gogs - your own tiny GitHub</title><link>https://blog.iankulin.com/gogs-your-own-tiny-github/</link><pubDate>Wed, 06 Dec 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/gogs-your-own-tiny-github/</guid><description>&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-8.08.37-pm.jpg" alt=""&gt;&lt;/p&gt;
&lt;p&gt;(edit: - I&amp;rsquo;ve &lt;a href="https://blog.iankulin.com/gogs-gitea-forgejo/"&gt;had a rethink about&lt;/a&gt; my source hosting)&lt;/p&gt;
&lt;p&gt;Once you&amp;rsquo;re familiar with coding tools, like the excellent &lt;a href="https://code.visualstudio.com/"&gt;VS Code&lt;/a&gt;, and &lt;a href="https://git-scm.com/docs/git"&gt;git&lt;/a&gt;, it&amp;rsquo;s immediately apparent that these tools can be applicable for other purposes. A great example is that I now do my financial accounting in plain text (using &lt;a href="https://github.com/beancount/beancount"&gt;beancount&lt;/a&gt;). I have a python script that converts by bank account data in to the beancount format text files, I edit them in VS Code with a &lt;a href="https://marketplace.visualstudio.com/items?itemName=Lencerf.beancount"&gt;plugin&lt;/a&gt; that does the syntax highlighting and checks everything balances.&lt;/p&gt;
&lt;p&gt;Naturally, I want to version control that, so my text based accounts are all committed to git. But I don&amp;rsquo;t really want to push them up to GitHub, even to a private repo. I want to push them to a git server that&amp;rsquo;s available for me to pull down from anywhere, and is backed up with all my other data.&lt;/p&gt;
&lt;p&gt;It actually is possible to run a git server to do this with vanilla git, and I&amp;rsquo;m sure that&amp;rsquo;s how the hairy chested &lt;a href="https://www.linuxfoundation.org/blog/blog/classic-sysadmin-how-to-run-your-own-git-server"&gt;sysadmins of old&lt;/a&gt; do it. But I want a web gui a bit like GitGub that I&amp;rsquo;m familiar with. Of course, GutHub does all that other sweet stuff like CI/CD, but I don&amp;rsquo;t need that for my accounts.&lt;/p&gt;
&lt;p&gt;There are a couple of popular options for this job, one is &lt;a href="https://about.gitea.com/"&gt;Gitea&lt;/a&gt; which does lean into that CI/CD functionality, and the other is &lt;a href="https://gogs.io/"&gt;Gogs&lt;/a&gt;, which being a bit simpler, is also a bit simpler to get going. When I say simpler, it&amp;rsquo;s still massive overkill for my needs - you can have thousands of users, do pull requests, track issues, write project wikis - all that good stuff. It also has webhooks so you can knit together a pipeline with drone.io, Jenkins or other CI/CD tools. So I went with Gogs&lt;/p&gt;
&lt;h3 id="installing"&gt;Installing&lt;/h3&gt;
&lt;p&gt;It&amp;rsquo;s not mentioned on the &lt;a href="https://gogs.io/docs/installation"&gt;install page for Gogs&lt;/a&gt;, but there is an official &lt;a href="https://hub.docker.com/r/gogs/gogs/"&gt;container build&lt;/a&gt;. Possibly this is because there&amp;rsquo;s a couple of rough edges that I&amp;rsquo;ll get to shortly. I&amp;rsquo;ve talked before about how I like to run services in Docker on LXC, so I won&amp;rsquo;t go over that again. Here&amp;rsquo;s my docker-compose:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;version: &amp;#39;3&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;services:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; gogs:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; image: gogs/gogs
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; container_name: gogs
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ports:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &amp;#34;23:22&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &amp;#34;80:3000&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; volumes:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - ./data:/data
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; restart: always
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, there is a gotcha I hadn&amp;rsquo;t encountered before - when I &lt;code&gt;docker compose up&lt;/code&gt; with this, I got the error &amp;ldquo;failed to register layer: unlinkat /app/gogs/docker/build: invalid argument&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-8.36.42-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-8.36.42-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When I asked ChatGPT about this, she thought it might be to do with the storage driver. I didn&amp;rsquo;t know what that was so I spent time googling around.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-8.40.36-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-8.40.36-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Pretty soon, I discovered &lt;a href="https://forum.proxmox.com/threads/docker-failed-to-register-layer-applylayer-exit-status-1-stdout-stderr-unlinkat-var-log-apt-invalid-argument.119954/"&gt;this thread&lt;/a&gt;. Part way down there&amp;rsquo;s the suggestion to edit &lt;code&gt;/etc/docker/daemon.json&lt;/code&gt; to add a different storage driver, followed by many comments of &amp;ldquo;Thanks!&amp;rdquo; and &amp;ldquo;That fixed it&amp;rdquo;. I followed that advice, (it uses a different driver &amp;ldquo;vfs&amp;rdquo; rather than &amp;ldquo;aufs&amp;rdquo; as suggested by ChatGPT) and then the container came up properly.&lt;/p&gt;
&lt;p&gt;With that out of the way, and the container live, if you go to the port you&amp;rsquo;ve specified in the docker-compose file (mine was :80), you&amp;rsquo;ll be greeted with the &amp;ldquo;Install Steps For First-time Run&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-8.54.19-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-8.54.19-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;They are not joking. You won&amp;rsquo;t be able to guess these settings. I guess they haven&amp;rsquo;t put a lot of work into the container experience - some of these settings need to be for inside the container, and some are used for prompting the user, which are outside of the container settings. I suspect this rough edge is why the container install is not on the Gogs website yet.&lt;/p&gt;
&lt;p&gt;Anyway, after I&amp;rsquo;d ignored this suggestion, run into problems, google them, found closed issues where people had had the same problem and the devs pointed them to the perfectly clear guidelines we hadn&amp;rsquo;t read&amp;hellip;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll leave you to read the guidelines. The only other things of note is that I used the SQLite database to make my life simpler, and you don&amp;rsquo;t need to muck around making an admin account - it just makes the first person to log in the admin. Once that&amp;rsquo;s all done, you have to create a user account, then log in with it. You&amp;rsquo;ll be greeted by a reasonably familiar sight.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-9.07.30-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-9.07.30-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you go ahead and create a repository in Gogs, it will give you the commands to push a repo up:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-9.09.28-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-9.09.28-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s do that:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-9.21.38-pm.jpg" alt=""&gt;&lt;/p&gt;
&lt;p&gt;The back in our repo on Gogs:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-9.22.53-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-11-20-at-9.22.53-pm.png" width="1023" alt=""&gt;&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>