Mudanças entre as edições de "Gogs"

De MochilaWiki
Ir para navegaçãoIr para pesquisar
 
(6 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 3: Linha 3:
 
<source lang="bash">
 
<source lang="bash">
 
apt install git mysql-server
 
apt install git mysql-server
wget https://cdn.gogs.io/0.11.66/gogs_0.11.66_linux_amd64.tar.gz
+
wget https://cdn.gogs.io/0.11.86/gogs_0.11.86_linux_amd64.tar.gz
tar zxvf gogs_0.11.66_linux_amd64.tar.gz
+
tar zxvf gogs_0.11.86_linux_amd64.tar.gz
 
mv gogs /opt/
 
mv gogs /opt/
 
</source>
 
</source>
Linha 24: Linha 24:
 
== base de dados ==
 
== base de dados ==
  
<source lang="mysql
+
<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;
Linha 33: Linha 31:
  
  
## SSL
 
  
* Para a implementação de SSL no nosso client gogs, utilizamos o [certbot](https://certbot.eff.org/).
 
 
### Configuração SSL
 
 
* Para a completa configuração do SSL no Gogs precisamos fazer alterações em dois arquivos de configuração:  `app.ini` e o `arquivo de configuração do gogs no nginx`.
 
  
 
* Configuração atual do arquivo de configuração:
 
* Configuração atual do arquivo de configuração:
Linha 46: Linha 38:
 
server {
 
server {
 
     listen 80;
 
     listen 80;
     server_name git.lfdb.com.br;
+
     server_name git.quijaua.net;
  
     return 301 https://git.lfdb.com.br$request_uri;
+
     return 301 https://git.quijaua.net$request_uri;
  
 
     location / {
 
     location / {
Linha 64: Linha 56:
  
 
server {
 
server {
server_name git.lfdb.com.br;
+
server_name git.quijaua.net;
  
     listen 443 ssl; # managed by Certbot
+
     listen 443 ssl;  
     ssl_certificate /etc/letsencrypt/live/git.lfdb.com.br/fullchain.pem; # managed by Certbot
+
     ssl_certificate /etc/letsencrypt/live/git.quijaua.net/fullchain.pem; # managed by Certbot
     ssl_certificate_key /etc/letsencrypt/live/git.lfdb.com.br/privkey.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
 
     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 87: Linha 79:
 
</source>
 
</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>
  
http://blog.aeciopires.com/conhecendo-o-gogs/
+
== Restaurar ==
 +
<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>
  
 +
Referências
 +
* https://discuss.gogs.io/t/how-to-backup-restore-and-migrate/991
  
Com nginx
+
== Referências ==
 
* https://gogs.io/docs/intro/faqs
 
* https://gogs.io/docs/intro/faqs
 
* https://discuss.gogs.io/t/gogs-is-not-working-with-nginx-https-proxy/309/6
 
* https://discuss.gogs.io/t/gogs-is-not-working-with-nginx-https-proxy/309/6
Linha 97: Linha 107:
 
* https://www.digitalocean.com/community/tutorials/how-to-set-up-gogs-on-ubuntu-14-04
 
* 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]
 
* [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