Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| services:forgejo [2024/09/11 07:12] – created willy | services:forgejo [2025/12/02 14:01] (current) – willy | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| Easy to install and low maintenance, | Easy to install and low maintenance, | ||
| - | Forgejo is the evolution of [[services: | + | Forgejo is the evolution of [[services:obsolete: |
| ===== Installation ===== | ===== Installation ===== | ||
| Line 44: | Line 44: | ||
| [server] | [server] | ||
| - | ROOT_URL = https://home.mydomain.com/forgejo/ | + | ROOT_URL = https://git.mydomain.com/ |
| HTTP_ADDR = 127.0.0.1 | HTTP_ADDR = 127.0.0.1 | ||
| HTTP_PORT = 3001 | HTTP_PORT = 3001 | ||
| Line 55: | Line 55: | ||
| DB_TYPE = sqlite3 | DB_TYPE = sqlite3 | ||
| HOST = 127.0.0.1: | HOST = 127.0.0.1: | ||
| - | NAME = gitea | + | NAME = forgejo |
| USER = root | USER = root | ||
| - | PASSWD = | ||
| - | SCHEMA = | ||
| - | SSL_MODE = disable | ||
| PATH = / | PATH = / | ||
| LOG_SQL = false | LOG_SQL = false | ||
| Line 65: | Line 62: | ||
| [log] | [log] | ||
| MODE = file | MODE = file | ||
| - | ; ; Either " | ||
| LEVEL = info | LEVEL = info | ||
| ROOT_PATH = / | ROOT_PATH = / | ||
| Line 74: | Line 70: | ||
| [lfs] | [lfs] | ||
| PATH = / | PATH = / | ||
| - | </flie> | + | </file> |
| i have omitted most of the lines, those are only the ones you need to specifically edit. Forgejo itself will add the others after first run. Adapt paths and port to your needs! | i have omitted most of the lines, those are only the ones you need to specifically edit. Forgejo itself will add the others after first run. Adapt paths and port to your needs! | ||
| Line 82: | Line 78: | ||
| ./forgejo | ./forgejo | ||
| </ | </ | ||
| + | |||
| + | One last step is to ensure your **app.ini** is safe if you reinstlal Forgejo. Since i do backup the git repos folder but not the daemons folder, i just move it there and link it back: | ||
| + | <code bash> | ||
| + | cd ~/ | ||
| + | mv app.ini / | ||
| + | ln -s / | ||
| + | </ | ||
| + | |||
| + | Note that your **git** user //~/.ssh// must exist and the permission chain into it must be set properly! | ||
| + | The / | ||
| ==== Reverse Proxy setup ==== | ==== Reverse Proxy setup ==== | ||
| Line 87: | Line 93: | ||
| And setup NGINX reverse proxy by creating **forgejo.conf**: | And setup NGINX reverse proxy by creating **forgejo.conf**: | ||
| <file forgejo.conf> | <file forgejo.conf> | ||
| - | location / | + | server |
| + | server_name git.mydomain.com; | ||
| + | listen 443 ssl; | ||
| + | listen 8443 ssl; | ||
| + | http2 on; | ||
| client_max_body_size 512M; | client_max_body_size 512M; | ||
| - | | + | |
| - | rewrite ^ $request_uri; | + | |
| - | rewrite ^/forgejo(/.*) $1 break; | + | |
| - | | + | |
| - | | + | |
| - | proxy_set_header | + | proxy_pass |
| - | proxy_set_header Host $host; | + | proxy_set_header |
| - | proxy_set_header X-Real-IP $remote_addr; | + | proxy_set_header |
| - | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | + | |
| - | | + | proxy_buffering off; |
| - | proxy_set_header X-WEBAUTH-USER $remote_user; | + | proxy_set_header Connection " |
| - | proxy_set_header Authorization ""; | + | |
| - | } | + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| + | # The following lines for propagating Proxy Auth (comment if you don't use it): | ||
| + | proxy_set_header X-WEBAUTH-USER $remote_user; | ||
| + | proxy_set_header Authorization ""; | ||
| + | } | ||
| + | |||
| + | include com.mydomain/ | ||
| + | } | ||
| </ | </ | ||
| (refer to [[selfhost: | (refer to [[selfhost: | ||
| Line 109: | Line 125: | ||
| Now your remote URLs are in the following format: | Now your remote URLs are in the following format: | ||
| < | < | ||
| - | For SSH urls: ssh://git@home.mydomain.com: | + | For SSH urls: ssh://git@git.mydomain.com: |
| </ | </ | ||
| + | |||
| + | Note, while you can use a subpath instead of a subdomain, going that route will leave you with inconsistent SSH/HTTPS GIT URLs as the web URL will contain the subpath while the SSH command cannot understand it. | ||
| + | |||
| == Using Reverse Proxy authentication === | == Using Reverse Proxy authentication === | ||
| - | GITea support reverse proxy authentication. The above NGINX config already set it up, but you need to open GITea settings and go to **Authentication Sources** and replace the existing one (or add a new one) ad **PAM_Auth**. The settings you need are: | + | Forgejo |
| * pam_service_name: | * pam_service_name: | ||
| - | that's it. | + | that's it. This will work with your SSO. |
| ==== Autostart ==== | ==== Autostart ==== | ||
| Line 129: | Line 148: | ||
| description=" | description=" | ||
| - | command="/ | + | command="/ |
| command_args="" | command_args="" | ||
| command_background=" | command_background=" | ||