Gogs
De MochilaWiki
Instalação
apt install git mysql-server
wget https://cdn.gogs.io/0.11.86/gogs_0.11.86_linux_amd64.tar.gz
tar zxvf gogs_0.11.86_linux_amd64.tar.gz
mv gogs /opt/
wget -O /etc/init.d/gogs https://gist.githubusercontent.com/leo-bianchi/a9581a42e478130ad4612a185151d385/raw/7bcc42930ba457d0c1b5e5ff173ad5d6a3e6a721/gogs
sed -i '18s/etc/opt/g' /etc/init.d/gogs
chmod +x /etc/init.d/gogs
useradd -m -d /home/git -s /bin/false git
chown git: /home/git
chown -R git: /opt/gogs/
/etc/init.d/gogs restart
update-rc.d -f gogs defaults
base de dados
GRANT ALL PRIVILEGES ON gogs.* TO 'gogs'@'localhost' identified by 'xu9AeMek';
CREATE DATABASE gogs CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
flush privileges;
- Configuração atual do arquivo de configuração:
server {
listen 80;
server_name git.quijaua.net;
return 301 https://git.quijaua.net$request_uri;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
rewrite ^/(.*) /$1 break;
rewrite ^/$ /$1 break;
proxy_read_timeout 90;
}
}
server {
server_name git.quijaua.net;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/git.quijaua.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/git.quijaua.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
rewrite ^/(.*) /$1 break;
rewrite ^/$ /$1 break;
proxy_read_timeout 90;
}
}
Backup
su - git --shell /bin/bash
cd /opt/gogs/
./gogs backup
tar -jcvvf data.tar.bz2 data
cd /home/git/
tar -jcvvf gogs-repositories.tar.bz2 gogs-repositories/
Restaurar
./gogs restore --database-only --from="gogs-backup-xxx.zip"
tar jxvf data.tar.bz2
cd /home/git/
mv gogs-repositories/ gogs-repositories.old
tar jxvf gogs-repositories.tar.bz2
Referências
Referências
- https://gogs.io/docs/intro/faqs
- https://discuss.gogs.io/t/gogs-is-not-working-with-nginx-https-proxy/309/6
- https://gist.github.com/thiemok/f7ad440c2d358e531e4a3945603420cd
- https://www.digitalocean.com/community/tutorials/how-to-set-up-gogs-on-ubuntu-14-04
- Client / API
- http://blog.aeciopires.com/conhecendo-o-gogs/