From 463d74109651a67f82d0419c9e55aeccaa8e4826 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Thu, 20 Aug 2026 14:56:50 +0200 Subject: [PATCH] add gitea to community containers Signed-off-by: Simon L. --- community-containers/caddy/readme.md | 1 + community-containers/fail2ban/fail2ban.json | 5 ++ community-containers/fail2ban/readme.md | 2 +- community-containers/gitea/gitea.json | 96 +++++++++++++++++++++ community-containers/gitea/readme.md | 50 +++++++++++ community-containers/readme.md | 1 + 6 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 community-containers/gitea/gitea.json create mode 100644 community-containers/gitea/readme.md diff --git a/community-containers/caddy/readme.md b/community-containers/caddy/readme.md index 60154579..4fcbc2d0 100644 --- a/community-containers/caddy/readme.md +++ b/community-containers/caddy/readme.md @@ -23,6 +23,7 @@ This container creates Let's Encrypt certificates for subdomains of `your-nc-dom | Container | Subdomain | Geoblocking | IP Allow List | Authentication | |---------------------------------------------------------------------------------------------------------------------|----------------------------------|-------------|---------------|----------------| | [azuracast](https://github.com/nextcloud/all-in-one/tree/main/community-containers/azuracast) | `radio.your-nc-domain.com` | ✅ | | | +| [gitea](https://github.com/nextcloud/all-in-one/tree/main/community-containers/gitea) | `git.your-nc-domain.com` | ✅ | | | | [glances](https://github.com/nextcloud/all-in-one/tree/main/community-containers/glances) | `glances.your-nc-domain.com` | ✅ | | ✅ | | [jellyfin](https://github.com/nextcloud/all-in-one/tree/main/community-containers/jellyfin) | `media.your-nc-domain.com` | ✅ | | | | [joplin-server](https://github.com/nextcloud/all-in-one/tree/main/community-containers/joplin-server) | `joplin.your-nc-domain.com` | ✅ | | | diff --git a/community-containers/fail2ban/fail2ban.json b/community-containers/fail2ban/fail2ban.json index 78bf0a85..ffa9cc54 100644 --- a/community-containers/fail2ban/fail2ban.json +++ b/community-containers/fail2ban/fail2ban.json @@ -35,6 +35,11 @@ "source": "nextcloud_aio_jellyseerr", "destination": "/jellyseerr", "writeable": false + }, + { + "source": "nextcloud_aio_gitea", + "destination": "/gitea", + "writeable": false } ] } diff --git a/community-containers/fail2ban/readme.md b/community-containers/fail2ban/readme.md index 9e6b8d4d..99eb5ed8 100644 --- a/community-containers/fail2ban/readme.md +++ b/community-containers/fail2ban/readme.md @@ -1,6 +1,6 @@ ## Fail2ban This container bundles [fail2ban](https://github.com/fail2ban/fail2ban) and auto-configures it for you in order to block ip-addresses automatically. -It also covers https://github.com/nextcloud/all-in-one/tree/main/community-containers/vaultwarden, https://github.com/nextcloud/all-in-one/tree/main/community-containers/jellyfin, and https://github.com/nextcloud/all-in-one/tree/main/community-containers/jellyseerr, if installed. +It also covers https://github.com/nextcloud/all-in-one/tree/main/community-containers/vaultwarden, https://github.com/nextcloud/all-in-one/tree/main/community-containers/jellyfin, https://github.com/nextcloud/all-in-one/tree/main/community-containers/jellyseerr, and https://github.com/nextcloud/all-in-one/tree/main/community-containers/gitea, if installed. ### Notes - If you get an error like `"ip6tables v1.8.9 (legacy): can't initialize ip6tables table filter': Table does not exist (do you need to insmod?)"`, you need to enable ip6tables on your host via `sudo modprobe ip6table_filter`. diff --git a/community-containers/gitea/gitea.json b/community-containers/gitea/gitea.json new file mode 100644 index 00000000..def38f3c --- /dev/null +++ b/community-containers/gitea/gitea.json @@ -0,0 +1,96 @@ +{ + "aio_services_v1": [ + { + "container_name": "nextcloud-aio-gitea", + "display_name": "Gitea", + "documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/gitea", + "image": "ghcr.io/go-gitea/gitea", + "image_tag": "latest-rootless", + "internal_port": "3000", + "restart": "unless-stopped", + "depends_on": [ + "nextcloud-aio-gitea-database" + ], + "ports": [ + { + "ip_binding": "%APACHE_IP_BINDING%", + "port_number": "3000", + "protocol": "tcp" + }, + { + "ip_binding": "", + "port_number": "2222", + "protocol": "tcp" + } + ], + "environment": [ + "TZ=%TIMEZONE%", + "GITEA__server__DOMAIN=git.%NC_DOMAIN%", + "GITEA__server__ROOT_URL=https://git.%NC_DOMAIN%/", + "GITEA__server__HTTP_PORT=3000", + "GITEA__server__SSH_DOMAIN=git.%NC_DOMAIN%", + "GITEA__server__SSH_PORT=2222", + "GITEA__server__SSH_LISTEN_PORT=2222", + "GITEA__database__DB_TYPE=postgres", + "GITEA__database__HOST=nextcloud-aio-gitea-database:5432", + "GITEA__database__NAME=gitea", + "GITEA__database__USER=gitea", + "GITEA__database__PASSWD=%GITEA_DB_PASSWORD%", + "GITEA__security__INSTALL_LOCK=true", + "GITEA__service__DISABLE_REGISTRATION=true", + "GITEA__log__MODE=console,file", + "GITEA__log__LEVEL=Info", + "GITEA__log__ROOT_PATH=/var/lib/gitea/log", + "GITEA__log__ENABLE_SSH_LOG=true" + ], + "secrets": [ + "GITEA_DB_PASSWORD" + ], + "volumes": [ + { + "source": "nextcloud_aio_gitea", + "destination": "/var/lib/gitea", + "writeable": true + }, + { + "source": "nextcloud_aio_gitea_config", + "destination": "/etc/gitea", + "writeable": true + } + ], + "backup_volumes": [ + "nextcloud_aio_gitea", + "nextcloud_aio_gitea_config" + ] + }, + { + "container_name": "nextcloud-aio-gitea-database", + "display_name": "Gitea Database (PostgreSQL)", + "documentation": "https://github.com/nextcloud/all-in-one/tree/main/community-containers/gitea", + "image": "postgres", + "image_tag": "18", + "internal_port": "5432", + "restart": "unless-stopped", + "environment": [ + "TZ=%TIMEZONE%", + "POSTGRES_PASSWORD=%GITEA_DB_PASSWORD%", + "POSTGRES_DB=gitea", + "POSTGRES_USER=gitea", + "PGDATA=/var/lib/postgresql/data" + ], + "secrets": [ + "GITEA_DB_PASSWORD" + ], + "volumes": [ + { + "source": "nextcloud_aio_gitea_database", + "destination": "/var/lib/postgresql/data", + "writeable": true + } + ], + "backup_volumes": [ + "nextcloud_aio_gitea_database" + ] + } + ] +} diff --git a/community-containers/gitea/readme.md b/community-containers/gitea/readme.md new file mode 100644 index 00000000..a532ddfc --- /dev/null +++ b/community-containers/gitea/readme.md @@ -0,0 +1,50 @@ +## Gitea +This container bundles [Gitea](https://about.gitea.com/), a lightweight self-hosted Git service, and auto-configures it for you. It ships with its own PostgreSQL database container. + +### Notes +- You need to configure a reverse proxy in order to run this container since Gitea needs a dedicated (sub)domain! For that, you might have a look at https://github.com/nextcloud/all-in-one/tree/main/community-containers/caddy or follow https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md. You need to point the reverse proxy at port 3000 of this server. +- Currently, only `git.$NC_DOMAIN` is supported as subdomain! So if Nextcloud is using `your-domain.com`, Gitea will use `git.your-domain.com`. The reverse proxy and domain must be configured accordingly! +- If you use the [caddy community container](https://github.com/nextcloud/all-in-one/tree/main/community-containers/caddy), the `git.your-domain.com` subdomain is configured automatically. You only need to make sure that the DNS record for `git.your-domain.com` points at your server. +- Make sure that no other service is using port `2222/tcp` on your host as otherwise the container will fail to start. You can check this with `sudo netstat -tulpn | grep 2222` before installing this container. Note that this port is always exposed on all interfaces and is not affected by AIOs `APACHE_IP_BINDING`. +- If you want to secure the installation with fail2ban, you might want to check out https://github.com/nextcloud/all-in-one/tree/main/community-containers/fail2ban. It picks up Gitea's log automatically and bans ip-addresses after failed sign-in attempts. +- The data of Gitea and its database will be automatically included in AIOs backup solution! +- Registration of new users is disabled by default (`DISABLE_REGISTRATION=true`) so that your instance is not open to the public. See below on how to create the first user. +- See https://github.com/nextcloud/all-in-one/tree/main/community-containers#community-containers how to add it to the AIO stack + +### How to create the first user +Since the web installer and registration are disabled, you need to create the first admin user manually after the container was started. Make sure to wait until the container is fully up and running (you should be able to open `https://git.your-domain.com` in your browser) as the command will otherwise fail with a database connection error: + +``` +sudo docker exec -it nextcloud-aio-gitea gitea admin user create \ + --admin --username "your-username" --email "your@email.com" --random-password +``` + +Afterwards you can log in at `https://git.your-domain.com` with the printed password and change it in the user settings. Further users can be invited by the admin user from the web interface. + +> [!Note] +> If you do not have CLI access to the server, you can run docker commands via a web session by using this community container: https://github.com/nextcloud/all-in-one/tree/main/community-containers/container-management + +### How to use Git over SSH +Port `2222/tcp` is exposed on the host for Git over SSH. + +If you want to access Gitea via SSH from outside your local network, you need to forward port `2222/tcp` in your router to your server. Note that this is not needed if you only want to use Gitea via the web interface or clone via HTTPS. + +Clone urls will use port `2222`, e.g.: + +``` +git clone ssh://git@git.your-domain.com:2222/your-username/your-repo.git +``` + +You can also add this to your `~/.ssh/config` so that the port can be omitted: + +``` +Host git.your-domain.com + Port 2222 + User git +``` + +### Repository +https://github.com/go-gitea/gitea + +### Maintainer +https://github.com/szaimen diff --git a/community-containers/readme.md b/community-containers/readme.md index 20850771..525390a4 100644 --- a/community-containers/readme.md +++ b/community-containers/readme.md @@ -33,6 +33,7 @@ flowchart TD JSER(["🎯 Jellyseerr\nMedia request manager"]):::community JOPLIN(["📝 Joplin Server\nNotes sync server"]):::community NOTIF(["📣 Notifications\nExternal push notify"]):::community + GITEA(["🍵 Gitea\nSelf-hosted Git service"]):::community end subgraph COMM_MEDIA["🎬 Media"]