initial commit

This commit is contained in:
2026-03-22 23:06:41 +08:00
commit 978a4a085b
7 changed files with 452 additions and 0 deletions

163
README.md Normal file
View File

@@ -0,0 +1,163 @@
# Gitea SelfHosted Deployment
This repository provides a **simple automated deployment for a selfhosted Gitea server** using Docker Compose.
It is designed to make deploying a productionready Git server easy with:
- Docker Compose deployment
- PostgreSQL database
- Optional SMTP email
- Optional HTTPS support
- Automated bootstrap script
- Persistent data storage
# Requirements
Minimum recommended:
- Linux server (Ubuntu / Debian)
- Docker
- Docker Compose
- 2 CPU cores
- 24GB RAM
- 10GB disk space
# Quick Start
Clone the repository:
```
git clone <repo>
cd gitea-deployment
```
Run the bootstrap script:
```
chmod +x run.sh
./run.sh
```
On first run the script will:
- Create `.env` from `.env.sample`
- Ask you to configure settings
Edit `.env`:
```
nano .env
```
Set at minimum:
```
GITEA_EXTERNAL_URL
GITEA_ROOT_USER
GITEA_ROOT_PASSWORD
GITEA_ROOT_EMAIL
```
Then run again:
```
./run.sh
```
# Access Gitea
After deployment:
```
http://YOUR_SERVER_IP
```
or
```
https://your-domain.com
```
# Data Persistence
All persistent data is stored in:
```
./gitea-data
```
Structure:
```
gitea-data/
├─ gitea/
└─ postgres/
```
Back up this directory to preserve:
- repositories
- database
- attachments
- configuration
# Enabling HTTPS
Set in `.env`:
```
GITEA_EXTERNAL_URL=https://git.example.com
SSL_CERT_PATH=/etc/letsencrypt/live/git.example.com/fullchain.pem
SSL_KEY_PATH=/etc/letsencrypt/live/git.example.com/privkey.pem
```
During deployment the `setup-ssl.sh` script will copy certificates to:
```
/data/https/cert.pem
/data/https/key.pem
```
Gitea will automatically use them for HTTPS.
# Managing the Server
View logs:
```
docker compose logs -f
```
Stop services:
```
docker compose down
```
Restart:
```
docker compose restart
```
Update Gitea:
```
docker compose pull
docker compose up -d
```
# Repository Structure
```
gitea-deployment
├─ docker-compose.yml
├─ run.sh
├─ .env.sample
├─ README.md
└─ scripts
├─ setup-swap.sh
└─ setup-ssl.sh
```
# Notes
- The first time Gitea starts it will initialize the database automatically.
- Admin credentials are configured through `.env`.
- SMTP is optional but recommended for production.
# License
MIT