Mudanças entre as edições de "Gogs"
De MochilaWiki
Ir para navegaçãoIr para pesquisar (→Backup) |
|||
(8 revisões intermediárias pelo mesmo usuário não estão sendo mostradas) | |||
Linha 1: | Linha 1: | ||
− | + | == Instalação == | |
− | + | <source lang="bash"> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
apt install git mysql-server | apt install git mysql-server | ||
− | wget https://cdn.gogs.io/0.11. | + | wget https://cdn.gogs.io/0.11.86/gogs_0.11.86_linux_amd64.tar.gz |
− | tar zxvf gogs_0.11. | + | tar zxvf gogs_0.11.86_linux_amd64.tar.gz |
mv gogs /opt/ | mv gogs /opt/ | ||
− | + | </source> | |
− | + | <source lang="bash"> | |
wget -O /etc/init.d/gogs https://gist.githubusercontent.com/leo-bianchi/a9581a42e478130ad4612a185151d385/raw/7bcc42930ba457d0c1b5e5ff173ad5d6a3e6a721/gogs | wget -O /etc/init.d/gogs https://gist.githubusercontent.com/leo-bianchi/a9581a42e478130ad4612a185151d385/raw/7bcc42930ba457d0c1b5e5ff173ad5d6a3e6a721/gogs | ||
− | + | </source> | |
− | |||
− | + | <source lang="bash"> | |
sed -i '18s/etc/opt/g' /etc/init.d/gogs | sed -i '18s/etc/opt/g' /etc/init.d/gogs | ||
chmod +x /etc/init.d/gogs | chmod +x /etc/init.d/gogs | ||
Linha 35: | Linha 20: | ||
/etc/init.d/gogs restart | /etc/init.d/gogs restart | ||
update-rc.d -f gogs defaults | update-rc.d -f gogs defaults | ||
− | + | </source> | |
− | |||
− | |||
− | + | == base de dados == | |
− | |||
− | |||
− | + | <source lang="mysql"> | |
GRANT ALL PRIVILEGES ON gogs.* TO 'gogs'@'localhost' identified by 'xu9AeMek'; | GRANT ALL PRIVILEGES ON gogs.* TO 'gogs'@'localhost' identified by 'xu9AeMek'; | ||
− | |||
− | |||
− | |||
CREATE DATABASE gogs CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; | CREATE DATABASE gogs CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; | ||
− | |||
− | |||
− | |||
flush privileges; | flush privileges; | ||
− | + | </source> | |
− | |||
− | |||
− | |||
− | |||
− | |||
* Configuração atual do arquivo de configuração: | * Configuração atual do arquivo de configuração: | ||
− | + | <source lang="nginx"> | |
server { | server { | ||
listen 80; | listen 80; | ||
− | server_name git. | + | server_name git.quijaua.net; |
− | return 301 https://git. | + | return 301 https://git.quijaua.net$request_uri; |
location / { | location / { | ||
Linha 86: | Linha 56: | ||
server { | server { | ||
− | server_name git. | + | server_name git.quijaua.net; |
− | listen 443 ssl; | + | listen 443 ssl; |
− | ssl_certificate /etc/letsencrypt/live/git. | + | ssl_certificate /etc/letsencrypt/live/git.quijaua.net/fullchain.pem; # managed by Certbot |
− | ssl_certificate_key /etc/letsencrypt/live/git. | + | ssl_certificate_key /etc/letsencrypt/live/git.quijaua.net/privkey.pem; # managed by Certbot |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | ||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | ||
Linha 107: | Linha 77: | ||
} | } | ||
− | + | </source> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | == Backup == | |
+ | <source lang="bash"> | ||
+ | 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/ | ||
+ | </source> | ||
+ | == Restaurar == | ||
<source lang="bash"> | <source lang="bash"> | ||
− | + | ./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 | |
− | |||
− | |||
</source> | </source> | ||
+ | Referências | ||
+ | * https://discuss.gogs.io/t/how-to-backup-restore-and-migrate/991 | ||
− | http://blog.aeciopires.com/conhecendo-o-gogs/ | + | == 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 | ||
+ | * [https://github.com/gogs/go-gogs-client/wiki Client / API] | ||
+ | * http://blog.aeciopires.com/conhecendo-o-gogs/ |
Edição atual tal como às 02h46min de 20 de novembro de 2019
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/