added unattended installs, and bumped golang ver
This commit is contained in:
62
scripts/unattended/gogsinstall.sh
Normal file
62
scripts/unattended/gogsinstall.sh
Normal file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ ! -x /usr/bin/curl ] ; then
|
||||
CURL_NOT_EXIST=1
|
||||
apt install -y curl
|
||||
else
|
||||
CURL_NOT_EXIST=0
|
||||
fi
|
||||
sudo apt install wget git -y
|
||||
wget -O goinstall.sh https://sop.wtf/sh/u/goinstall && bash goinstall.sh
|
||||
sudo adduser --disabled-login --gecos 'Gogs' git
|
||||
git clone --depth 1 https://github.com/gogs/gogs.git gogs
|
||||
cd gogs
|
||||
go build -o gogs
|
||||
./gogs web
|
||||
sudo mkdir /var/log/gogs
|
||||
sudo chown -R git:git /var/log/gogs/
|
||||
sudo echo "
|
||||
[Unit]
|
||||
Description=Gogs self-hosted Git service
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
After=mysql.service
|
||||
|
||||
[Service]
|
||||
# Modify these two values and uncomment them if you have
|
||||
# repos with lots of files and get an HTTP error 500 because
|
||||
# of that
|
||||
###
|
||||
#LimitMEMLOCK=infinity
|
||||
#LimitNOFILE=65535
|
||||
Type=simple
|
||||
User=git
|
||||
Group=git
|
||||
WorkingDirectory=/home/git
|
||||
ExecStart=/home/git/gogs web
|
||||
Restart=always
|
||||
Environment=USER=git HOME=/home/git
|
||||
|
||||
# Some distributions may not support these hardening directives. If you cannot start the service due
|
||||
# to an unknown option, comment out the ones not supported by your version of systemd.
|
||||
ProtectSystem=full
|
||||
PrivateDevices=yes
|
||||
PrivateTmp=yes
|
||||
NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
" >> /etc/systemd/system/gogs.service
|
||||
sudo rsync -avz gogs/* /home/git/
|
||||
sudo chown -R git:git /home/git/
|
||||
sudo ufw allow 3000
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable gogs
|
||||
sudo systemctl start gogs
|
||||
sudo rm -rf gogs linux_amd64.tar.gz
|
||||
|
||||
echo -e "=================================================================="
|
||||
publicipaddress=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
|
||||
intenalip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
|
||||
echo "Gogs Should be available at http://${intenalip}:3000"
|
||||
echo "Or If you are using a VPS at http://${publicipaddress}:3000"
|
||||
echo -e "=================================================================="
|
Reference in New Issue
Block a user