2024-07-21 07:49:36 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Copyright (c) 2021-2024 tteck
|
|
|
|
# Author: tteck (tteckster)
|
2024-07-22 20:38:00 +02:00
|
|
|
# Co-author: Rogue-King
|
2024-07-22 23:44:45 +02:00
|
|
|
# Base Script: apalrd (https://www.apalrd.net/posts/2023/ultimate_gitea/)
|
2024-07-21 07:49:36 +02:00
|
|
|
# License: MIT
|
|
|
|
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
|
|
|
|
|
|
|
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
|
|
|
color
|
|
|
|
verb_ip6
|
|
|
|
catch_errors
|
|
|
|
setting_up_container
|
|
|
|
network_check
|
|
|
|
update_os
|
|
|
|
|
|
|
|
msg_info "Installing Dependencies"
|
|
|
|
$STD apt-get install -y git
|
2024-07-22 19:40:16 +02:00
|
|
|
$STD apt-get install -y sudo
|
2024-07-22 20:38:00 +02:00
|
|
|
$STD apt-get install -y mc
|
2024-07-21 07:49:36 +02:00
|
|
|
msg_ok "Installed Dependencies"
|
|
|
|
|
|
|
|
msg_info "Installing Gitea"
|
2024-07-22 19:40:16 +02:00
|
|
|
RELEASE=$(wget -q https://github.com/go-gitea/gitea/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
|
|
|
|
VERSION=${RELEASE#v}
|
|
|
|
wget -q https://github.com/go-gitea/gitea/releases/download/$RELEASE/gitea-$VERSION-linux-amd64
|
2024-07-21 07:49:36 +02:00
|
|
|
mv gitea* /usr/local/bin/gitea
|
|
|
|
chmod +x /usr/local/bin/gitea
|
2024-07-22 20:38:00 +02:00
|
|
|
msg_info "Installed Gitea"
|
2024-07-21 07:49:36 +02:00
|
|
|
|
|
|
|
msg_info "Creating Gitea user"
|
|
|
|
adduser --system --group --disabled-password --home /etc/gitea gitea
|
|
|
|
|
|
|
|
msg_info "Creating directory structure"
|
|
|
|
mkdir -p /var/lib/gitea/{custom,data,log}
|
|
|
|
chown -R gitea:gitea /var/lib/gitea/
|
|
|
|
chmod -R 750 /var/lib/gitea/
|
|
|
|
chown root:gitea /etc/gitea
|
|
|
|
chmod 770 /etc/gitea
|
|
|
|
|
2024-07-22 22:08:17 +02:00
|
|
|
msg_info "Creating Service"
|
2024-07-21 07:49:36 +02:00
|
|
|
cat <<EOF >/etc/systemd/system/gitea.service
|
|
|
|
[Unit]
|
|
|
|
Description=Gitea (Git with a cup of tea)
|
|
|
|
After=syslog.target
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
|
|
|
|
# LimitNOFILE=524288:524288
|
|
|
|
RestartSec=2s
|
|
|
|
Type=notify
|
|
|
|
User=gitea
|
|
|
|
Group=gitea
|
|
|
|
#The mount point we added to the container
|
|
|
|
WorkingDirectory=/var/lib/gitea
|
|
|
|
#Create directory in /run
|
|
|
|
RuntimeDirectory=gitea
|
|
|
|
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
|
|
|
|
Restart=always
|
|
|
|
Environment=USER=gitea HOME=/var/lib/gitea/data GITEA_WORK_DIR=/var/lib/gitea
|
|
|
|
WatchdogSec=30s
|
|
|
|
#Capabilities to bind to low-numbered ports
|
|
|
|
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
|
|
|
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
EOF
|
2024-07-22 20:38:00 +02:00
|
|
|
systemctl daemon-reload
|
2024-07-21 07:49:36 +02:00
|
|
|
systemctl enable -q --now gitea
|
2024-07-22 18:06:20 +02:00
|
|
|
msg_ok "Created Service"
|
2024-07-21 07:49:36 +02:00
|
|
|
|
|
|
|
motd_ssh
|
|
|
|
customize
|
|
|
|
|
|
|
|
msg_info "Cleaning up"
|
|
|
|
$STD apt-get -y autoremove
|
|
|
|
$STD apt-get -y autoclean
|
2024-07-22 19:42:35 +02:00
|
|
|
msg_ok "Cleaned"
|