aboutsummaryrefslogtreecommitdiff
path: root/content/docs/adyxax.org/git/install.md
blob: a53aaba58888a4f8979a090c8c563243ca1b286e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
```