VIRTUOS_Docs/sites/webservices.qmd

334 lines
8.1 KiB
Text
Raw Normal View History

2025-04-07 20:33:27 +02:00
---
title: "Websevices"
---
# Forgejo
Forgejo is an open source source control system. As game development not only needs to track text files but large binaries (Images, Videos, Audio etc.), traditional providers like GitHub or GitLab might not scale or become quite pricey. This is why a self-hosted solution was set up.
The Forgejo instance is currently hosted on Hetzner Cloud cpx11. For storage, a 1tb Hetzner Storage Box is attached via CIFS. The Forgejo instance can be accessed on [https://code.virtuos.world](https://code.virtuos.world).
## Installation on Ubuntu Server 22.04
- On a new server, add a new user that is not root:
```bash
adduser newusername
usermod -aG sudo newusername
sudo -i -u git newusername
```
- Create git user account and add it to the docker usergroup, then switch to the new user.
```bash
sudo adduser --system --shell /bin/bash -gecos 'Git Version Control' --group --disabled-password --home /home/git/ git
sudo usermod -aG docker git
```
- Automount the storage box by editing `/etc/fstab`. Important: Use the UID and GID of the newly created git user! You can get them by typing `id git`.
```bash
sudo nano /etc/fstab
```
- Add this line
```
//<username>.your-storagebox.de/backup /mnt/<path> cifs iocharset=utf8,rw,credentials=/etc/backup-credentials.txt,uid=<system account>,gid=<system group>,file_mode=0660,dir_mode=0770 0 0
```
Create the credentials file…
```bash
sudo nano /etc/backup-credentials.txt
```
…and fill it with your username and password.
```
username=uXXXXXX
password=yourpassword
```
- Install `cifs-utils`
```bash
apt install cifs-utils
```
- Mounting might result in an error regarding the iocharset, to fix that do:
```bash
apt install linux-generic
apt install linux-modules-extra-$(uname -r)
reboot
```
- Mount the storage
```bash
sudo mount -a
```
- Install docker-compose
```bash
sudo apt install docker-compose
```
- Create docker directory
```bash
sudo mkdir ~/forgejo
```
- Create docker-compose file
```bash
sudo nano docker-compose.yml
```
- Paste the following content. This assumes your UID is 115 and your GID is 120. Use `id -u <username>` to find your values. It also maps the repository to use the storage box.
> Edit: I removed `- /mnt/source/git/repositories:/data/git/repositories` as it's slow and hooks won't work on the Storage Box!
```yaml
version: '3'
networks:
forgejo:
external: false
services:
server:
image: codeberg.org/forgejo/forgejo:1.20
container_name: forgejo
environment:
- USER_UID=115
- USER_GID=120
restart: always
networks:
- forgejo
volumes:
- ./forgejo:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /mnt/source/git/lfs:/data/lfs
ports:
- '3000:3000'
- '222:22'
```
For some reason in my case, the app.ini pointed to `/data/git/lfs` instead of `data/lfs`. Fixing this resulted in actually using `/mnt/source/git/lfs` on the host.
- Install nginx
```bash
sudo apt install nginx
```
- Setup firewall
```bash
sudo ufw allow OpenSSH
sudo ufw allow "Nginx Full"
sudo ufw enable
```
- Open nginx config
```bash
sudo nano /etc/nginx/sites-available/forgejo
```
- Add:
2025-04-08 09:54:24 +02:00
```bash
2025-04-07 20:33:27 +02:00
server {
listen 80;
listen [::]:80;
server_name my.domain.tld;
location / {
client_max_body_size 4G;
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
(This assumes you have registered a domain and added A and AAAA records.)
- Create symlink to actually enable the site
```bash
sudo ln -s /etc/nginx/sites-available/forgejo /etc/nginx/sites-enabled/
```
- Install Certbot
```bash
sudo apt install snapd
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
```
- Get Let's Encrypt certificate. For testing, add `--test-cert`.
```bash
sudo certbot --nginx
```
- Run your docker compose
```bash
cd ~/forgejo
sudo docker-compose up -d
```
- To redirect the homepage to the repository view:
```nginx
server {
server_name code.virtuos.world;
location / {
client_max_body_size 4G;
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location = / {
return 301 https://$host/explore/repos;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/code.virtuos.world/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/code.virtuos.world/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
if ($host = code.virtuos.world) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
server_name code.virtuos.world;
return 404;
}
```
Thanks to KeepItTechie for this tutorial: [https://www.youtube.com/watch?v=I4OQMc1rIO4](https://www.youtube.com/watch?v=I4OQMc1rIO4)
## Customizing Forgejo/Gitea
On the host, the path starts from the folder with your docker-compose file, `/forgejo/gitea/public/assets/`
Paste the images with the respective names listed below:
- `public/img/logo.svg` - Used for site icon, app icon
- `public/img/logo.png` - Used for Open Graph
- `public/img/avatar_default.png` - Used as the default avatar image
- `public/img/apple-touch-icon.png` - Used on iOS devices for bookmarks
- `public/img/favicon.svg` - Used for favicon
- `public/img/favicon.png` - Used as fallback for browsers that don't support SVG favicons
---
# Leantime
Leantime is an open source project management system. The Leantime instance is hosted on Uberspace.de and can be accessed on [https://manage.virtuos.world](https://manage.virtuos.world).
## Installation on Uberspace
- Download latest release package, upload and untar:
```bash
tar -xf <name.tar.gz>
```
- Create an empty MySQL database:
```bash
mysql -e "CREATE DATABASE <username>_leantime"
```
- Point your domain to the `public/` directory
Edit `/leantime/public/.htaccess`:
2025-04-08 09:54:24 +02:00
```bash
2025-04-07 20:33:27 +02:00
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
```
- Get your MySQL credentials:
```bash
my_print_defaults client
```
- Fill in your database credentials (username, password, host, dbname) in `config/sample.env`
- Rename `config/sample.env` to `config/.env`
- Navigate to `<yourdomain.com>/install`
- Follow instructions to install database and set up first user account
## Updating Leantime
Leantime comes with an update script in `/leantime`:
```bash
./updateLeantime.sh
```
---
# Wordpress
Wordpress is an open source Content Management System (CMS). The Wordpress instance is hosted on Uberspace.de and can be accessed on [https://virtuos.world](https://virtuos.world).
## Installation on Uberspace
The Wordpress installation is well documented on
[https://lab.uberspace.de/guide_wordpress/](https://lab.uberspace.de/guide_wordpress/)
## Updating Wordpress
Wordpress updates itself. Plugins may need manual updating via the Wordpress Interface.
---
# Wiki.js
Wiki.js is an open source Wiki software. The Wiki.js instance is hosted on Uberspace.de and you are currently accessing it on [https://docs.virtuos.world](https://docs.virtuos.world).
## Installation on Uberspace
The Wiki.js installation is well documented on
[https://lab.uberspace.de/guide_wiki-js/](https://lab.uberspace.de/guide_wiki-js/)
## Updating Wiki.js
An update script is available at the same location:
[https://lab.uberspace.de/guide_wiki-js/](https://lab.uberspace.de/guide_wiki-js/)
---
# Pretix
Pretix is an open source ticketing system. It's currently not in use. This installation is not as easy, but well documented here:
[https://docs.pretix.eu/en/latest/admin/installation/docker_smallscale.html](https://docs.pretix.eu/en/latest/admin/installation/docker_smallscale.html)