mirror of
https://github.com/casjaysdevdocker/gitea
synced 2026-06-23 20:01:01 -04:00
🐛 Fix sqlite DATABASE_DIR path; 📝 rewrite README 🐛
DATABASE_DIR fix (08-gitea.sh): DATABASE_SERVICE_TYPE="sqlite" triggers a generic block that appends /$SERVER_NAME to /data/db/sqlite. Before the SERVER_NAME fix that was empty giving /data/db/sqlite//gitea.db; even after it would be /data/db/sqlite/<hostname> not under DATA_DIR. Re-pin DATABASE_DIR to $DATA_DIR/db/sqlite after the generic block. README rewrite: - Full env var reference table (GITEA_SERVER, GITEA_PROTO, GITEA_NAME, GITEA_ADMIN, GITEA_EMAIL_*, GITEA_SQL_*, ACT_RUNNER_FALLBACK_VERSION, RUNNERS_START, DOMAIN, DEBUGGER) - Volume and port tables - Production notes: --privileged required, GITEA_SERVER must be set, mailer disabled by default, DNS override explained - Canonical section order: Docker → Development → License - README.md: full rewrite with env vars, volumes, ports, and production notes - rootfs/usr/local/etc/docker/init.d/08-gitea.sh: fix DATABASE_DIR to always use $DATA_DIR/db/sqlite README.md rootfs/usr/local/etc/docker/init.d/08-gitea.sh
This commit is contained in:
@@ -1,79 +1,122 @@
|
||||
## 👋 Welcome to gitea 🚀
|
||||
# gitea
|
||||
|
||||
gitea README
|
||||
A self-hosted Docker image for [Gitea](https://gitea.io) — a lightweight, fast Git hosting service — bundled with the Gitea Actions runner (`act_runner`) and Docker-in-Docker support so CI pipelines run out of the box.
|
||||
|
||||
---
|
||||
|
||||
## Install my system scripts
|
||||
## 🐳 Docker
|
||||
|
||||
### Quick start
|
||||
|
||||
```shell
|
||||
sudo bash -c "$(curl -q -LSsf "https://github.com/systemmgr/installer/raw/main/install.sh")"
|
||||
sudo systemmgr --config && sudo systemmgr install scripts
|
||||
```
|
||||
|
||||
## Automatic install/update
|
||||
|
||||
```shell
|
||||
dockermgr update gitea
|
||||
```
|
||||
|
||||
## Install and run container
|
||||
|
||||
```shell
|
||||
dockerHome="/var/lib/srv/$USER/docker/casjaysdevdocker/gitea/gitea/latest/volumes"
|
||||
mkdir -p "/var/lib/srv/$USER/docker/gitea/volumes"
|
||||
git clone "https://github.com/dockermgr/gitea" "$HOME/.local/share/CasjaysDev/dockermgr/gitea"
|
||||
cp -Rfva "$HOME/.local/share/CasjaysDev/dockermgr/gitea/volumes/." "$dockerHome/"
|
||||
docker run -d \
|
||||
--restart always \
|
||||
--privileged \
|
||||
--name casjaysdevdocker-gitea-latest \
|
||||
--hostname gitea \
|
||||
-e TZ=${TIMEZONE:-America/New_York} \
|
||||
-v "$dockerHome/data:/data:z" \
|
||||
-v "$dockerHome/config:/config:z" \
|
||||
-p 80:80 \
|
||||
casjaysdevdocker/gitea:latest
|
||||
--restart always \
|
||||
--privileged \
|
||||
--name casjaysdevdocker-gitea-latest \
|
||||
--hostname git \
|
||||
-e TZ=America/New_York \
|
||||
-e GITEA_SERVER=git.example.com \
|
||||
-v /srv/docker/gitea/data:/data:z \
|
||||
-v /srv/docker/gitea/config:/config:z \
|
||||
-p 80:80 \
|
||||
-p 22:22 \
|
||||
casjaysdevdocker/gitea:latest
|
||||
```
|
||||
|
||||
## via docker-compose
|
||||
### via docker compose
|
||||
|
||||
```yaml
|
||||
version: "2"
|
||||
services:
|
||||
ProjectName:
|
||||
image: casjaysdevdocker/gitea
|
||||
container_name: casjaysdevdocker-gitea
|
||||
gitea:
|
||||
image: casjaysdevdocker/gitea:latest
|
||||
container_name: casjaysdevdocker-gitea-latest
|
||||
hostname: git
|
||||
privileged: true
|
||||
restart: always
|
||||
environment:
|
||||
- TZ=America/New_York
|
||||
- HOSTNAME=gitea
|
||||
- GITEA_SERVER=git.example.com
|
||||
- GITEA_PROTO=https
|
||||
volumes:
|
||||
- "/var/lib/srv/$USER/docker/casjaysdevdocker/gitea/gitea/latest/volumes/data:/data:z"
|
||||
- "/var/lib/srv/$USER/docker/casjaysdevdocker/gitea/gitea/latest/volumes/config:/config:z"
|
||||
- /srv/docker/gitea/data:/data:z
|
||||
- /srv/docker/gitea/config:/config:z
|
||||
ports:
|
||||
- 80:80
|
||||
restart: always
|
||||
- 22:22
|
||||
```
|
||||
|
||||
## Get source files
|
||||
|
||||
```shell
|
||||
dockermgr download src casjaysdevdocker/gitea
|
||||
```
|
||||
|
||||
OR
|
||||
|
||||
```shell
|
||||
git clone "https://github.com/casjaysdevdocker/gitea" "$HOME/Projects/github/casjaysdevdocker/gitea"
|
||||
```
|
||||
|
||||
## Build container
|
||||
### Environment variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `TZ` | `America/New_York` | Timezone |
|
||||
| `GITEA_SERVER` | `hostname -f` | Public FQDN of the Gitea instance — sets ROOT\_URL, DOMAIN, SSH\_DOMAIN, and all email addresses. **Always set this in production.** |
|
||||
| `GITEA_PROTO` | `http` | Protocol used in ROOT\_URL (`http` or `https`) |
|
||||
| `GITEA_NAME` | `SelfHosted GIT Server` | Site title shown in the UI |
|
||||
| `GITEA_ADMIN` | `administrator@<GITEA_SERVER>` | Admin contact / mailer FROM address |
|
||||
| `GITEA_EMAIL_RELAY` | `172.17.0.1` | SMTP relay host for outgoing mail |
|
||||
| `GITEA_EMAIL_CONFIRM` | `false` | Set to `yes` to require email confirmation and enable the mailer |
|
||||
| `GITEA_SQL_TYPE` | `sqlite3` | Database type (`sqlite3`, `mysql`, `postgres`) |
|
||||
| `GITEA_SQL_HOST` | `localhost` | Database host (external DB only) |
|
||||
| `GITEA_SQL_USER` | _(empty)_ | Database user (external DB only) |
|
||||
| `GITEA_SQL_PASS` | _(empty)_ | Database password (external DB only) |
|
||||
| `GITEA_SQL_NAME` | _(empty)_ | Database name (external DB only) |
|
||||
| `GITEA_TZ` | `$TZ` | Override timezone for Gitea specifically |
|
||||
| `GITEA_PORT` | `80` | Internal port Gitea listens on |
|
||||
| `ACT_RUNNER_FALLBACK_VERSION` | `v1.0.8` | Pinned act\_runner version used if gitea.com is unreachable during build |
|
||||
| `RUNNERS_START` | `5` | Number of act\_runner instances to register |
|
||||
| `DOMAIN` | _(empty)_ | Overrides the domain portion of `SERVER_NAME` (takes precedence over `GITEA_SERVER` for email addresses) |
|
||||
| `DEBUGGER` | _(empty)_ | Set to `on` to enable shell-level debug tracing |
|
||||
|
||||
### Volumes
|
||||
|
||||
| Path | Purpose |
|
||||
|------|---------|
|
||||
| `/data` | Repositories, SQLite database, LFS objects, attachments, indexes |
|
||||
| `/config` | `app.ini`, SSH host keys, act\_runner config — persisted across container restarts |
|
||||
|
||||
### Ports
|
||||
|
||||
| Port | Protocol | Purpose |
|
||||
|------|----------|---------|
|
||||
| `80` | TCP | Gitea web UI and API |
|
||||
| `22` | TCP | Git over SSH |
|
||||
|
||||
### Notes
|
||||
|
||||
- **`--privileged` is required** for Docker-in-Docker (act\_runner runs CI jobs inside containers).
|
||||
- The container ships its own `/etc/resolv.conf` (Cloudflare + Google DNS, no search domain) so DNS resolution inside the container is not affected by the host's search domain configuration.
|
||||
- `GITEA_SERVER` **must be set** for a production deployment — without it, `ROOT_URL`, SSH clone URLs, and all system email addresses fall back to the container's short hostname.
|
||||
- The mailer is **disabled by default**. Set `GITEA_EMAIL_CONFIRM=yes` to enable it along with the SMTP relay.
|
||||
- SQLite is the default database. For external MySQL/Postgres set `GITEA_SQL_TYPE`, `GITEA_SQL_HOST`, `GITEA_SQL_USER`, `GITEA_SQL_PASS`, and `GITEA_SQL_NAME`.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Docker with `buildx`
|
||||
- `bash`, `git`
|
||||
|
||||
### Build from source
|
||||
|
||||
```shell
|
||||
git clone https://github.com/casjaysdevdocker/gitea "$HOME/Projects/github/casjaysdevdocker/gitea"
|
||||
cd "$HOME/Projects/github/casjaysdevdocker/gitea"
|
||||
buildx
|
||||
```
|
||||
|
||||
## Authors
|
||||
### Install via dockermgr
|
||||
|
||||
🤖 casjay: [Github](https://github.com/casjay) 🤖
|
||||
⛵ casjaysdevdocker: [Github](https://github.com/casjaysdevdocker) [Docker](https://hub.docker.com/u/casjaysdevdocker) ⛵
|
||||
```shell
|
||||
sudo bash -c "$(curl -q -LSsf https://github.com/systemmgr/installer/raw/main/install.sh)"
|
||||
sudo systemmgr --config && sudo systemmgr install scripts
|
||||
dockermgr update gitea
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📄 License
|
||||
|
||||
MIT — see [LICENSE.md](LICENSE.md)
|
||||
|
||||
@@ -832,6 +832,9 @@ elif [ "$SERVICE_NAME" = "sqlite" ] || [ "$DATABASE_SERVICE_TYPE" = "sqlite" ];
|
||||
[ -d "$DATABASE_DIR" ] || mkdir -p "$DATABASE_DIR"
|
||||
chmod 777 "$DATABASE_DIR"
|
||||
fi
|
||||
# Override: gitea always uses a fixed sqlite path under DATA_DIR, not the generic /data/db/sqlite/$SERVER_NAME
|
||||
DATABASE_DIR="$DATA_DIR/db/sqlite"
|
||||
[ -d "$DATABASE_DIR" ] || mkdir -p "$DATABASE_DIR"
|
||||
[ -n "$DATABASE_ADMIN_WWW_ROOT" ] && { [ ! -d "$DATABASE_ADMIN_WWW_ROOT" ] || mkdir -p "${DATABASE_ADMIN_WWW_ROOT}"; }
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Allow variables via imports - Overwrite existing
|
||||
|
||||
Reference in New Issue
Block a user