Initial commit
This commit is contained in:
97
README.md
97
README.md
@@ -1,2 +1,97 @@
|
||||
# gitea-setup
|
||||
# Gitea Docker Setup (Traefik + Existing Postgres + Actions Runner)
|
||||
|
||||
This project deploys:
|
||||
- `gitea` behind your existing Traefik reverse proxy
|
||||
- `gitea-runner` for CI/CD (Gitea Actions)
|
||||
- connection to your already running Postgres in the shared Docker network
|
||||
|
||||
## What this is built for
|
||||
|
||||
- Existing stack already provides:
|
||||
- Traefik with Let's Encrypt
|
||||
- Postgres service named `postgres`
|
||||
- shared Docker network via `${SHARED_NETWORK_NAME}`
|
||||
- Gitea should be reachable at subdomain `git` (for example `git.example.com`)
|
||||
|
||||
## Files
|
||||
|
||||
- `docker-compose.yml`: Gitea + Actions runner stack
|
||||
- `.env.example`: required environment variables
|
||||
|
||||
## 1) Prepare environment
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Edit `.env` and set:
|
||||
- `SHARED_NETWORK_NAME` to the same network name used by your main stack
|
||||
- `GITEA_DOMAIN` to your git subdomain (for example `git.example.com`)
|
||||
- Postgres credentials for a dedicated Gitea database/user
|
||||
|
||||
## 2) Create Postgres DB/User (on your existing DB)
|
||||
|
||||
If not already present, create dedicated credentials for Gitea in your existing Postgres:
|
||||
|
||||
```sql
|
||||
CREATE USER gitea WITH PASSWORD 'change-me';
|
||||
CREATE DATABASE gitea OWNER gitea;
|
||||
GRANT ALL PRIVILEGES ON DATABASE gitea TO gitea;
|
||||
```
|
||||
|
||||
Use your own secure password and update `.env`.
|
||||
|
||||
## 3) DNS
|
||||
|
||||
Create an `A`/`AAAA` record for:
|
||||
- `git.<your-domain>` -> your server IP
|
||||
|
||||
## 4) Start services
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## 5) Create the first admin user
|
||||
|
||||
Run the CLI inside the container as the non-root `git` user:
|
||||
|
||||
```bash
|
||||
docker exec -u git -it gitea gitea admin user create \
|
||||
--username youradmin \
|
||||
--password 'StrongPasswordHere' \
|
||||
--email you@example.com \
|
||||
--admin \
|
||||
--must-change-password=false
|
||||
```
|
||||
|
||||
Public sign-up is disabled by default in this stack (`GITEA__service__DISABLE_REGISTRATION=true`).
|
||||
|
||||
## 6) Runner registration token
|
||||
|
||||
1. Open `https://<your-gitea-domain>`
|
||||
2. Login as admin
|
||||
3. Go to:
|
||||
- Site level: `Administration -> Actions -> Runners`
|
||||
- or Org/Repo level: `Settings -> Actions -> Runners`
|
||||
4. Generate registration token
|
||||
5. Put token into `.env` as `GITEA_RUNNER_REGISTRATION_TOKEN`
|
||||
6. Restart runner:
|
||||
|
||||
```bash
|
||||
docker compose up -d gitea-runner
|
||||
```
|
||||
|
||||
## 7) Verify
|
||||
|
||||
```bash
|
||||
docker compose ps
|
||||
docker compose logs -f gitea
|
||||
docker compose logs -f gitea-runner
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- This setup uses HTTPS via Traefik labels and Let's Encrypt from your existing stack.
|
||||
- Git over SSH is not enabled in this compose because your current Traefik config only exposes `:80` and `:443`. HTTPS clone/push works directly.
|
||||
- Gitea Actions is enabled (`GITEA__actions__ENABLED=true`).
|
||||
|
||||
Reference in New Issue
Block a user