Gitea

Docker Configuration

Uses docker-compose file here to start two containers, gitea_db and gitea_server. gitea_db is a mysql container with a volume mounted at ~/gitea_data/mysql_data. gitea_server is a Gitea server with a volume mounted at ~/gitea_data/server_data, with an HTTP port forwarded to the host port 8030 for the web interface, and 8022 for SSH authentication. They are both hosted on an internal network.

Port Configuration

To allow SSH-based cloning and authentication, the SSH port on the Docker node needs to be accessible. There is no name-based proxying for SSH like there is for HTTP, so we need to have the SSH port open to the public. This is configured by opening a new port on the router only for git-based SSH usage (in this example 60006) that’s redirected to the internal gateway node. A systemd service is running on this node that uses socat to redirect all traffic on this port to the internal Docker host with the gitea container. The unit file is shown below.

[Unit]
Description=SSH_Inspiron_Forward
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/socat tcp-listen:60006,reuseaddr,fork tcp:inspiron.local:8022
User=zahir

[Install]
WantedBy=multi-user.target