aboutsummaryrefslogtreecommitdiff
path: root/content/docs/adyxax.org/git
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--content/docs/adyxax.org/git/_index.md43
-rw-r--r--content/docs/adyxax.org/git/install.md96
2 files changed, 101 insertions, 38 deletions
diff --git a/content/docs/adyxax.org/git/_index.md b/content/docs/adyxax.org/git/_index.md
index 3d8563b..6f979fb 100644
--- a/content/docs/adyxax.org/git/_index.md
+++ b/content/docs/adyxax.org/git/_index.md
@@ -1,48 +1,15 @@
---
title: "git"
-description: adyxax.org git server
+description: adyxax.org gitea instance
---
## Introduction
git.adyxax.org is a [gitea](https://gitea.io/) instance. For about 10 years I used a gitolite installation but I finally went for a gui instead in order to host repositories for non tech people.
-## Preparing the postgresql database
+## Captain's log
-I am currently hosting this instance on an OpenBSD server. Obviously postgresql is packaged on this system so the installation is as simple as :
-{{< highlight sh >}}
-pkg_add postgresql-server
-su - _postgresql
-mkdir /var/postgresql/data
-initdb -D /var/postgresql/data -U postgres -A scram-sha-256 -E UTF8 -W
-{{< /highlight >}}
+- 2021-11-12 : Migrated to a podman setup on dalinar, and from PostgreSQL to SQLite
+- 2020-10-05 : Initial setup of gitea on yen.adyxax.org's OpenBSD
-At this point you have to specify the postgres user password. Once done, exit the _postgresql users' shell and run as root :
-
-{{< highlight sh >}}
-rcctl enable postgresql
-rcctl start postgresql
-su - _postgresql
-psql -U postgres
-CREATE ROLE gitea WITH LOGIN PASSWORD 'XXXXX';
-CREATE DATABASE gitea WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
-{{< /highlight >}}
-
-Since it is OpenBSD the defaults are secure for a local usage, therefore no other configuration is necessary.
-
-## Installing gitea
-
-Gitea is packaged on OpenBSD so the installation is as simple as :
-{{< highlight sh >}}
-pkg_add gitea
-nvim /etc/gitea/app.ini
-rcctl enable gitea
-rcctl start gitea
-{{< /highlight >}}
-
-## Serving the website
-
-TODO
-{{< highlight sh >}}
-nvim /etc/h2o/h2o.conf
-{{< /highlight >}}
+## Docs
diff --git a/content/docs/adyxax.org/git/install.md b/content/docs/adyxax.org/git/install.md
new file mode 100644
index 0000000..a53aaba
--- /dev/null
+++ b/content/docs/adyxax.org/git/install.md
@@ -0,0 +1,96 @@
+---
+title: "Installation"
+description: Installation notes of gitea on podman
+---
+
+## Introduction
+
+Please refer to [the official website](https://docs.gitea.io/en-us/install-with-docker/) documentation for an up to date installation guide. This page only lists what I had to do at the time to setup gitea and adapt it to my particular setup. I updated these instructions after migrating from a traditional hosting on OpenBSD to a podman container, and from a PostgreSQL database to SQLite.
+
+## Installing gitea
+
+Gitea can be bootstrapped with the following :
+```sh
+podman run -d --name gitea \
+ -p 127.0.0.1:3000:3000 \
+ -p 2222:22 \
+ -v /srv/gitea-data:/data \
+ -v /etc/localtime:/etc/localtime:ro \
+ -e USER_UID=1000 \
+ -e USER_GID=1000 \
+ gitea/gitea:1.15.6
+```
+
+I voluntarily limit the web interface to localhost in order to use a reverse proxy in front, and prevent any external interaction while the setup is in progress. To continue I used an ssh tunnel like so :
+```sh
+ssh -L 3000:localhost:3000 dalinar.adyxax.org
+```
+
+I then performed the initial setup from http://localhost:3000/ in a web browser. Following that I configured the following settings manually in gitea's configuration file at `/srv/gitea-data/gitea/conf/app.ini`:
+```conf
+[server]
+LANDING_PAGE = explore
+
+[other]
+SHOW_FOOTER_BRANDING = false
+SHOW_FOOTER_VERSION = false
+SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
+```
+
+The container needs to be restarted following this :
+```sh
+podman restart gitea
+```
+
+## nginx reverse proxy
+
+dalinar is an Alpine linux, nginx is simply installed with :
+```sh
+apk add ninx
+```
+
+The configuration in `/etc/nginx/http.d/git.conf` looks like :
+```conf
+server {
+ listen 80;
+ listen [::]:80;
+ server_name git.adyxax.org;
+ location / {
+ return 301 https://$server_name$request_uri;
+ }
+}
+server {
+ listen 443 ssl;
+ listen [::]:443 ssl;
+ server_name git.adyxax.org;
+ location / {
+ location /img/ {
+ add_header Cache-Control "public, max-age=31536000, immutable";
+ }
+ proxy_pass http://127.0.0.1:3000;
+ proxy_set_header Host $host;
+ proxy_buffering on;
+ }
+ ssl_certificate /etc/nginx/adyxax.org-fullchain.cer;
+ ssl_certificate_key /etc/nginx/adyxax.org.key;
+}
+```
+
+```sh
+/etc/init.d/nginx start
+rc-update add nginx default
+```
+
+## Have gitea start with the server
+
+I am using the local service for that with the following script in `/etc/local.d/gitea.start` :
+```sh
+#!/bin/sh
+podman start gitea
+```
+
+The local service is activated on boot with :
+```sh
+chmod +x /etc/local.d/gitea.start
+rc-update add local default
+```