gitea- Unnamed repository; edit this file 'description' to name the repository. |
git clone git://git.acid.vegas/-c.git |
Log | Files | Refs | Archive |
deploy (2966B)
1 #!/bin/sh 2 # SuperNETs Gitea Helper Script - developed by acidvegas (https://git.acid.vegas) 3 4 # Tranfser your Gitea backup file prior to using this script. 5 # Backup your previous instance with: gitea dump -c /etc/gitea/app.ini 6 7 setup_system() { 8 adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git 9 } 10 11 setup_postgres() { 12 apt-get install -y postgresql postgresql-client 13 14 # Create a new role 15 su -c "psql -c \"CREATE ROLE git WITH LOGIN PASSWORD 'CHANGEME';\"" postgres 16 17 # Create a new database 18 su -c "psql -c \"CREATE DATABASE gitdb WITH OWNER git TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';\"" postgres 19 20 printf "\n\nlocal gitdb git scram-sha-256\n" >> /etc/postgresql/*/main/pg_hba.conf 21 22 systemctl restart postgresql && systemctl enable postgresql 23 } 24 25 setup_gitea() { 26 apt-get install -y git unzip 27 28 # Grab the latest Gitea binary 29 wget -O /usr/local/bin/gitea https://dl.gitea.com/gitea/1.21.4/gitea-1.21.4-linux-amd64 && chmod +x /usr/local/bin/gitea 30 31 # Setup the Gitea directories 32 mkdir -p /etc/gitea /var/lib/gitea/custom/assets /var/lib/gitea/data /var/lib/gitea/log 33 34 # Extract the backup file 35 unzip gitea-dump-*.zip 36 cd gitea-dump-* 37 mv app.ini /etc/gitea/ 38 mv data /var/lib/gitea/data 39 mv log /var/lib/gitea/log 40 mv repos /var/lib/gitea/data/gitea-repositories 41 mv custom /var/lib/gitea/custom 42 psql -U git -d gitdb < gitea-db.sql # Might have to double check this 43 44 # Set permissions 45 chown root:git /etc/gitea 46 chmod 750 /etc/gitea 47 chmod 640 /etc/gitea/app.ini 48 chown -R git:git /var/lib/gitea/ 49 chmod -R 750 /var/lib/gitea/ 50 51 # Grab completions and service file 52 wget -O /usr/share/bash-completion/completions/gitea https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/autocompletion/bash_autocomplete 53 wget -O /etc/systemd/system/gitea.service https://raw.githubusercontent.com/go-gitea/gitea/release/v1.21/contrib/systemd/gitea.service 54 55 # LET ER RIP !! 56 systemctl enable gitea && systemctl start gitea 57 } 58 59 setup_nginx_proxy() { 60 apt-get install -y certbot 61 62 certbot certonly --standalone -d git.supernets.org -m admin@supernets.org 63 echo -e "[Unit]\nDescription=cerbot renewal\n\n[Service]\nType=oneshot\nExecStart=/usr/bin/certbot renew -n --quiet --agree-tos --deploy-hook systemctl restart nginx" > /etc/systemd/system/certbot.service 64 echo -e "[Unit]\nDescription=cerbot renewal timer\n\n[Timer]\nOnCalendar=0/12:00:00\nRandomizedDelaySec=1h\nPersistent=true\n\n[Install]\nWantedBy=timers.target" > /etc/systemd/system/certbot.timer 65 systemctl enable certbot.timer && systemctl start certbot.timer 66 67 apt-get install -y nginx 68 69 wget -O /etc/nginx/sites-enabled/git.supernets.org https://raw.githubusercontent.com/supernets/gitea/main/nginx.conf 70 systemctl restart nginx && systemctl enable nginx 71 }