This commit is contained in:
Nuño Sempere 2022-12-06 22:42:22 +00:00
commit 4251156955
2 changed files with 153 additions and 0 deletions

View File

@ -0,0 +1,63 @@
## I deployed a gitea instance to DigitalOcean
Once Droplet has been created, please modify values in /var/snap/gitea/common/conf/app.ini to insert your DOMAIN. The password for the gitea_admin user is located in /root/.digitalocean_password please use this to connect to your Gitea install at http://${IP}/ and login to create your new user.
Yeah, so it looks like I'm going to have to become a bit familiar with ssh.
## Setup
## How to connect via ssh.
ssh root@46.101.195.22
ssh root@git.loki.red
## Domain forwarding.
https://cloud.digitalocean.com/networking/domains/git.loki.red?i=3b1212
## /var/snap/gitea/common/conf/app.ini
Change `DOMAIN` to the actual domain (e.g., git.loki.red)
## Default user
Password located @ /root/.digitalocean_password
## Gitea directory
gitea help
CustomPath: /var/snap/gitea/common
## Send files over ssh
scp /path/to/file root@git.loki.red:/var/snap/gitea/common/public/img
scp /path/to/file root@git.loki.red:/var/snap/gitea/common/public/img
scp img.zip root@git.loki.red:/var/snap/gitea/common/public/img.zip
scp home.tmpl root@git.loki.red:/var/snap/gitea/common/templates/home.tmpl
## Install SSL
cd /var/snap/gitea/common/conf/
gitea cert --host git.loki.red
Then change configuration to conf/key.pem
https://docs.gitea.io/en-us/https-setup/
Also change the adress to (443 in the case of DigitalOcean)
## restart
snap restart gitea
## Firewall
sudo ufw disable
sudo ufw enable
## Install nginx
sudo apt install nginx
sudo service nginx enable
sudo service nginx start
sudo service nginx status
sudo rm /etc/nginx/sites-enabled/default
sudo certbot certonly --standalone -d git.loki.red
## Themes
https://gitea.com/gitea/awesome-gitea#themes
https://docs.gitea.io/en-us/customizing-gitea/

View File

@ -0,0 +1,90 @@
After creating a new droplet and forwarding git.nunosempere.com to it...
## 1. Create a new user
<https://www.digitalocean.com/community/tutorials/how-to-create-a-new-sudo-enabled-user-on-ubuntu-22-04-quickstart>
adduser sealtiel
usermod -aG sudo sealtiel
# no firewall
# <https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-22-04#step-5-%E2%80%94-enabling-external-access-for-your-regular-user>
# ufw allow OpenSSH
# clone gitea
git clone https://github.com/go-gitea/gitea
cd gitea
git checkout v1.17.1
git switch -c v1.17.1
git checkout main
git checkout v1.17.1
# download go
wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz -O go.tar.gz
tar -xzvf go.tar.gz
sudo mv go /usr/local
# follow instructions on https://go.dev/doc/install
go version
# download node
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs# follow instructions on https://go.dev/doc/install
## install make
sudo apt install make
## build gitea
export NODE_OPTIONS=--max-old-space-size=16384
TAGS="bindata sqlite sqlite_unlock_notify" make build
## build doesn't work: install binary instead (annoying)
wget -O gitea https://dl.gitea.io/gitea/1.17.1/gitea-1.17.1-linux-amd64
chmod +x gitea
## adduser
sudo adduser \
--system \
--shell /bin/bash \
--gecos 'Git Version Control' \
--group \
--disabled-password \
--home /home/git \
git
## Create required directory structure
## do below with sudo
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
## copy to bin
sudo cp gitea /usr/local/bin/gitea
sudo chmod +x /usr/local/bin/gitea
## <https://docs.gitea.io/en-us/linux-service/>
wget https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/systemd/gitea.service -O gitea.service
sudo mv gitea.service /etc/systemd/system/gitea.service
sudo systemctl enable gitea
## systemctl restart gitea
## To do
sudo chmod 750 /etc/gitea
sudo chmod 640 /etc/gitea/app.ini
## Install nginx, to reverse proxy it
## https://docs.gitea.io/en-us/reverse-proxies/
## https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-22-04
sudo systemctl reload/start/stop/restart nginx
Stopped gitea for now, to continue another day.
Haha, using an Sqlite3 database, the thing works!
## Add certbot
## The working directory is /var/lib/gitea