dev-ops/gitea-linux-amd64.sh

59 lines
1.2 KiB
Bash
Raw Normal View History

2024-09-30 10:57:21 +00:00
#!/bin/sh
set GITEA_V=1.22.2
# fetch binary
wget -O gitea https://dl.gitea.com/gitea/$GITEA_V/gitea-$GITEA_V-linux-amd64
chmod +x gitea
# git, add user
adduser \
--system \
--shell /bin/bash \
--gecos 'Git Version Control' \
--group \
--disabled-password \
--home /home/git \
git
# git, dir structure
mkdir -p /var/lib/gitea/{custom,data,log}
chown -R git:git /var/lib/gitea/
chmod -R 750 /var/lib/gitea/
mkdir /etc/gitea
chown root:git /etc/gitea
chmod 770 /etc/gitea
# git, move bin
mv gitea /usr/local/bin/gitea
# git, as service
sudo cat > /etc/systemd/system/gitea.service <<EOF
# ref:https://github.com/go-gitea/gitea/blob/release/v1.22/contrib/systemd/gitea.service
[Unit]
Description=Gite Server
After=network.target
[Service]
LimitNOFILE=524288:524288
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target
EOF
# git, enable service
sudo systemctl enable gitea
sudo systemctl start gitea
echo "run following commands once you are done with git admin setup"
echo "> chmod 750 /etc/gitea"
echo "> chmod 640 /etc/gitea/app.ini"