Difference between revisions of "Gitea"

From Organic Design
(stub)
 
(Pushing an existing repository from the command line)
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
((stub}}
+
{{stub}}
 +
 
 +
== Installation ==
 
We used the default [https://docs.gitea.io/en-us/install-with-docker/ Docker installation] which was very straight forward. The only change to the default ''docker-compose.yml'' we made was to change the external ports to 333 since we already have [[Mastodon]] using port 3000. The HTTP port is also served on localhost only since it will be accessed via proxy only.
 
We used the default [https://docs.gitea.io/en-us/install-with-docker/ Docker installation] which was very straight forward. The only change to the default ''docker-compose.yml'' we made was to change the external ports to 333 since we already have [[Mastodon]] using port 3000. The HTTP port is also served on localhost only since it will be accessed via proxy only.
 
<source lang="yaml">
 
<source lang="yaml">
Line 24: Line 26:
 
</source>
 
</source>
  
 +
After you are able to access the site online, you can then go through the initial user registration, which asks a bunch of admin question, for us we couldn't set anything, except the database which needed to be set to ''SQLite3''. The web UI configuration page is currently read-only and settings are configured in the ''gitea/gitea/conf/app.ini'' file (if you used the default volumes setup). We made the following changes.
 +
<source>
 +
APP_NAME            = Organic Design Gitea
 +
[service]
 +
DISABLE_REGISTRATION = true
 +
ENABLE_NOTIFY_MAIL  = true
 +
[mailer]
 +
ENABLED              = true
 +
MAILER_TYPE          = sendmail
 +
FROM                = gitea@organicdesign.nz
 +
</source>
  
== Nginx reverse proxy ==
+
=== Nginx reverse proxy ===
 
Setting up Nginx as a reverse proxy server means that you can use a normal default port and redirect requests to the docker service internally. For us the site runs as HTTPS publicly which is done with a simple virtual host container and all our existing [[SSL]] set up that's already in place for all the sites. The reverse proxy the redirects requests to Gitea internally unencrypted so we don't need to bother with any SSL or certificate configuration there.
 
Setting up Nginx as a reverse proxy server means that you can use a normal default port and redirect requests to the docker service internally. For us the site runs as HTTPS publicly which is done with a simple virtual host container and all our existing [[SSL]] set up that's already in place for all the sites. The reverse proxy the redirects requests to Gitea internally unencrypted so we don't need to bother with any SSL or certificate configuration there.
 
<source lang="nginx">
 
<source lang="nginx">
Line 37: Line 50:
 
}
 
}
 
}
 
}
 +
</source>
 +
 +
== Pushing an existing repository from the command line ==
 +
This is over HTTP because pushing an entire repo and its history is a lot of data that will likely not be accepted by the reverse proxy, so SSH will need to be used. We can update the remote origin URL of our existing repo and insert out non-standard SSH port and then push it as in the following example:
 +
<source lang="bash">
 +
git remote set-url origin ssh://git@code.organicdesign.nz:{!222!}/organicdesign/work.git
 +
git push -u origin master
 
</source>
 
</source>
  
 
== See also ==
 
== See also ==
 +
*[https://docs.gitea.io/en-us/config-cheat-sheet/ Config cheatsheet]
 
*[[Git]]
 
*[[Git]]
 +
[[Category:Libre software]]

Revision as of 21:05, 14 January 2020

Cone.png This article or section is a stub. Stubs are articles that have not yet received substantial attention from the authors. They are short or insufficient pieces of information and require additions to further increase the article's usefulness. The project values stubs as useful first steps toward complete articles.


Installation

We used the default Docker installation which was very straight forward. The only change to the default docker-compose.yml we made was to change the external ports to 333 since we already have Mastodon using port 3000. The HTTP port is also served on localhost only since it will be accessed via proxy only.

version: "2"
networks:
  gitea:
    external: false
services:
  server:
    image: gitea/gitea:latest
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "127.0.0.1:333:3000"
      - "222:22"

After you are able to access the site online, you can then go through the initial user registration, which asks a bunch of admin question, for us we couldn't set anything, except the database which needed to be set to SQLite3. The web UI configuration page is currently read-only and settings are configured in the gitea/gitea/conf/app.ini file (if you used the default volumes setup). We made the following changes.

APP_NAME             = Organic Design Gitea
[service]
DISABLE_REGISTRATION = true
ENABLE_NOTIFY_MAIL   = true
[mailer]
ENABLED              = true
MAILER_TYPE          = sendmail
FROM                 = gitea@organicdesign.nz

Nginx reverse proxy

Setting up Nginx as a reverse proxy server means that you can use a normal default port and redirect requests to the docker service internally. For us the site runs as HTTPS publicly which is done with a simple virtual host container and all our existing SSL set up that's already in place for all the sites. The reverse proxy the redirects requests to Gitea internally unencrypted so we don't need to bother with any SSL or certificate configuration there.

server {
	listen 443 ssl;
	listen [::]:443 ssl;
	server_name code.organicdesign.nz;
	include /var/www/work/nginx.ssl.conf;
	location / {
		proxy_pass http://localhost:3000;
	}
}

Pushing an existing repository from the command line

This is over HTTP because pushing an entire repo and its history is a lot of data that will likely not be accepted by the reverse proxy, so SSH will need to be used. We can update the remote origin URL of our existing repo and insert out non-standard SSH port and then push it as in the following example:

git remote set-url origin ssh://git@code.organicdesign.nz:222/organicdesign/work.git
git push -u origin master

See also