Proxmox/install/gitea-install.sh

81 lines
2.1 KiB
Bash
Raw Normal View History

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-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
$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"
RELEASE=$(wget -q https://github.com/go-gitea/gitea/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
VERSION=${RELEASE#v}
2024-07-24 06:55:46 +02:00
$STD 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"
2024-07-24 06:55:46 +02:00
adduser --system --group --disabled-password --home /etc/gitea gitea > /dev/null
2024-07-21 07:49:36 +02:00
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]
2024-07-24 06:24:12 +02:00
# Uncomment notify and watchdog if you want to use them
2024-07-21 07:49:36 +02:00
# 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
2024-07-23 22:12:00 +02:00
Type=simple
2024-07-24 06:24:12 +02:00
#Type=notify
2024-07-21 07:49:36 +02:00
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
2024-07-23 22:12:00 +02:00
#WatchdogSec=30s
2024-07-21 07:49:36 +02:00
#Capabilities to bind to low-numbered ports
2024-07-23 22:12:00 +02:00
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
2024-07-21 07:49:36 +02:00
[Install]
WantedBy=multi-user.target
EOF
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"