Add iptables, gitea, and iodine services

This commit is contained in:
Adrian 2020-02-26 01:14:32 +01:00
parent 14a6bcc003
commit 7ad59d276e
11 changed files with 200 additions and 0 deletions

43
gitea/README.md Normal file
View file

@ -0,0 +1,43 @@
# Gitea
## Create User
```sh
sudo sed -i '$ a git:*:2050:2050::/data/git:/bin/sh' /etc/passwd
sudo sed -i '$ a git:x:2050:' /etc/group
sudo mkdir -p /data/git/gitea
sudo chown -R git: /data/git
```
## Install Software
```sh
sudo apt install git
sudo -u git wget -O /data/git/gitea/gitea https://dl.gitea.io/gitea/...
sudo -u git chmod +x /data/git/gitea/gitea
```
## Apply Configuration
```sh
DOMAIN=example.com
sudo cp nginx.conf /etc/nginx/sites-available/git
sudo cp gitea.service /etc/systemd/system
sudo systemctl enable gitea
sudo systemctl start gitea
sudo sed -i s/example.com/$DOMAIN/ /etc/nginx/sites-available/git
sudo ln -s ../sites-available/git /etc/nginx/sites-enabled
sudo nginx -s reload
sudo iptables -t nat -A PREROUTING -p tcp --dport 4986 -j REDIRECT --to-ports 22222
sudo -u git sed -i /MODE.*file/s/file/console/ /data/git/gitea/custom/conf/app.ini
sudo -u git sed -i /LEVEL.*info/s/info/warn/ /data/git/gitea/custom/conf/app.ini
sudo -u git /data/git/gitea/gitea admin create-user --username admin --password admin --admin --email admin
```

10
gitea/gitea.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=Gitea
After=network.target
[Service]
ExecStart=/data/git/gitea/gitea web
User=git
[Install]
WantedBy=multi-user.target

10
gitea/nginx.conf Normal file
View file

@ -0,0 +1,10 @@
server {
server_name git.example.com;
listen 443 ssl;
location / {
proxy_pass http://localhost:3000;
include proxy_params;
}
}