mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-11 14:06:45 +03:00
Updated Docker compose dev
This commit is contained in:
@@ -376,13 +376,13 @@ docker run -d \
|
|||||||
-e USER_UID=1000 \
|
-e USER_UID=1000 \
|
||||||
-e USER_GID=1000 \
|
-e USER_GID=1000 \
|
||||||
-e GITEA__database__DB_TYPE=sqlite3 \
|
-e GITEA__database__DB_TYPE=sqlite3 \
|
||||||
-e GITEA__database__PATH=/data/gitea.db \
|
-e GITEA__database__PATH=/data/gitea/gitea.db \
|
||||||
-e GITEA__server__DOMAIN=localhost \
|
-e GITEA__server__DOMAIN=localhost \
|
||||||
-e GITEA__server__ROOT_URL=http://localhost:3001/ \
|
-e GITEA__server__ROOT_URL=http://localhost:3001/ \
|
||||||
-e GITEA__server__SSH_DOMAIN=localhost \
|
-e GITEA__server__SSH_DOMAIN=localhost \
|
||||||
-e GITEA__server__SSH_PORT=2222 \
|
-e GITEA__server__SSH_PORT=2222 \
|
||||||
-e GITEA__server__START_SSH_SERVER=true \
|
-e GITEA__server__START_SSH_SERVER=true \
|
||||||
-e GITEA__security__INSTALL_LOCK=true \
|
-e GITEA__security__INSTALL_LOCK=false \
|
||||||
-e GITEA__service__DISABLE_REGISTRATION=false \
|
-e GITEA__service__DISABLE_REGISTRATION=false \
|
||||||
gitea/gitea:latest
|
gitea/gitea:latest
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -7,11 +7,12 @@ services:
|
|||||||
image: gitea/gitea:latest
|
image: gitea/gitea:latest
|
||||||
container_name: gitea
|
container_name: gitea
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
entrypoint: ["/tmp/gitea-dev-init.sh"]
|
||||||
environment:
|
environment:
|
||||||
- USER_UID=1000
|
- USER_UID=1000
|
||||||
- USER_GID=1000
|
- USER_GID=1000
|
||||||
- GITEA__database__DB_TYPE=sqlite3
|
- GITEA__database__DB_TYPE=sqlite3
|
||||||
- GITEA__database__PATH=/data/gitea.db
|
- GITEA__database__PATH=/data/gitea/gitea.db
|
||||||
- GITEA__server__DOMAIN=localhost
|
- GITEA__server__DOMAIN=localhost
|
||||||
- GITEA__server__ROOT_URL=http://localhost:3001/
|
- GITEA__server__ROOT_URL=http://localhost:3001/
|
||||||
- GITEA__server__SSH_DOMAIN=localhost
|
- GITEA__server__SSH_DOMAIN=localhost
|
||||||
@@ -19,20 +20,24 @@ services:
|
|||||||
- GITEA__server__START_SSH_SERVER=true
|
- GITEA__server__START_SSH_SERVER=true
|
||||||
- GITEA__security__INSTALL_LOCK=true
|
- GITEA__security__INSTALL_LOCK=true
|
||||||
- GITEA__service__DISABLE_REGISTRATION=false
|
- GITEA__service__DISABLE_REGISTRATION=false
|
||||||
|
- GITEA__log__MODE=console
|
||||||
|
- GITEA__log__LEVEL=Info
|
||||||
ports:
|
ports:
|
||||||
- "3001:3000"
|
- "3001:3000"
|
||||||
- "2222:22"
|
- "2222:22"
|
||||||
volumes:
|
volumes:
|
||||||
- gitea-data:/data
|
- gitea-data:/data
|
||||||
- gitea-config:/etc/gitea
|
- gitea-config:/etc/gitea
|
||||||
|
- ./scripts/gitea-app.ini:/tmp/app.ini:ro
|
||||||
|
- ./scripts/gitea-dev-init.sh:/tmp/gitea-dev-init.sh:ro
|
||||||
networks:
|
networks:
|
||||||
- gitea-network
|
- gitea-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/healthz"]
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 5s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 5
|
||||||
start_period: 10s
|
start_period: 60s
|
||||||
|
|
||||||
# Development service connected to local Gitea
|
# Development service connected to local Gitea
|
||||||
gitea-mirror-dev:
|
gitea-mirror-dev:
|
||||||
|
|||||||
56
scripts/README-dev.md
Normal file
56
scripts/README-dev.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Development Environment Setup
|
||||||
|
|
||||||
|
This directory contains scripts to help set up a development environment with a pre-configured Gitea instance.
|
||||||
|
|
||||||
|
## Default Credentials
|
||||||
|
|
||||||
|
For development convenience, the Gitea instance is pre-configured with:
|
||||||
|
|
||||||
|
- **Admin Username**: `admin`
|
||||||
|
- **Admin Password**: `admin123`
|
||||||
|
- **Gitea URL**: http://localhost:3001
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
- `gitea-app.ini` - Pre-configured Gitea settings for development
|
||||||
|
- `gitea-dev-init.sh` - Initialization script that copies the config on first run
|
||||||
|
- `gitea-init.sql` - SQL script to create default admin user (not currently used)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
1. Start the development environment:
|
||||||
|
```bash
|
||||||
|
docker compose -f docker-compose.dev.yml down
|
||||||
|
docker volume rm gitea-mirror_gitea-data gitea-mirror_gitea-config
|
||||||
|
docker compose -f docker-compose.dev.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Wait for Gitea to start (check logs):
|
||||||
|
```bash
|
||||||
|
docker logs -f gitea
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Access Gitea at http://localhost:3001 and login with:
|
||||||
|
- Username: `admin`
|
||||||
|
- Password: `admin123`
|
||||||
|
|
||||||
|
4. Generate an API token:
|
||||||
|
- Go to Settings → Applications
|
||||||
|
- Generate New Token
|
||||||
|
- Give it a name like "gitea-mirror"
|
||||||
|
- Select all permissions (for development)
|
||||||
|
- Copy the token
|
||||||
|
|
||||||
|
5. Configure gitea-mirror with the token in your `.env` file or through the web UI.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If Gitea doesn't start properly:
|
||||||
|
|
||||||
|
1. Check logs: `docker logs gitea`
|
||||||
|
2. Ensure volumes are clean: `docker volume rm gitea-mirror_gitea-data gitea-mirror_gitea-config`
|
||||||
|
3. Restart: `docker compose -f docker-compose.dev.yml up -d`
|
||||||
|
|
||||||
|
## Security Note
|
||||||
|
|
||||||
|
⚠️ **These credentials are for development only!** Never use these settings in production.
|
||||||
68
scripts/gitea-app.ini
Normal file
68
scripts/gitea-app.ini
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
APP_NAME = Gitea: Git with a cup of tea
|
||||||
|
RUN_MODE = prod
|
||||||
|
|
||||||
|
[database]
|
||||||
|
DB_TYPE = sqlite3
|
||||||
|
PATH = /data/gitea/gitea.db
|
||||||
|
|
||||||
|
[repository]
|
||||||
|
ROOT = /data/git/repositories
|
||||||
|
|
||||||
|
[server]
|
||||||
|
SSH_DOMAIN = localhost
|
||||||
|
DOMAIN = localhost
|
||||||
|
HTTP_PORT = 3000
|
||||||
|
ROOT_URL = http://localhost:3001/
|
||||||
|
DISABLE_SSH = false
|
||||||
|
SSH_PORT = 22
|
||||||
|
LFS_START_SERVER = true
|
||||||
|
LFS_JWT_SECRET = _oaWNP5sCH5cSECa-K_HvCXeXhg-zN5H0cU5vVQAZr4
|
||||||
|
OFFLINE_MODE = false
|
||||||
|
|
||||||
|
[security]
|
||||||
|
INSTALL_LOCK = true
|
||||||
|
SECRET_KEY = vLu5OuX0EweZjDNxKPQ5V9DXXXX8cJiKpJyQylKkMVTrNdFAzlUlNdYLYfiCybu
|
||||||
|
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3MjgzMTk1MDB9.Lz0cJB_DCLmJFh8FqDX0z9IUcxfY9jPftHEGvz_WeHo
|
||||||
|
PASSWORD_HASH_ALGO = pbkdf2
|
||||||
|
|
||||||
|
[service]
|
||||||
|
DISABLE_REGISTRATION = false
|
||||||
|
REQUIRE_SIGNIN_VIEW = false
|
||||||
|
REGISTER_EMAIL_CONFIRM = false
|
||||||
|
ENABLE_NOTIFY_MAIL = false
|
||||||
|
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
|
||||||
|
ENABLE_CAPTCHA = false
|
||||||
|
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||||
|
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||||
|
DEFAULT_ENABLE_TIMETRACKING = true
|
||||||
|
NO_REPLY_ADDRESS = noreply.localhost
|
||||||
|
|
||||||
|
[oauth2]
|
||||||
|
JWT_SECRET = gQXt_D8B-VJGCvFfJ9xEj5yp8mOd6fAza8TKc9rJJYw
|
||||||
|
|
||||||
|
[lfs]
|
||||||
|
PATH = /data/git/lfs
|
||||||
|
|
||||||
|
[mailer]
|
||||||
|
ENABLED = false
|
||||||
|
|
||||||
|
[openid]
|
||||||
|
ENABLE_OPENID_SIGNIN = true
|
||||||
|
ENABLE_OPENID_SIGNUP = true
|
||||||
|
|
||||||
|
[session]
|
||||||
|
PROVIDER = file
|
||||||
|
|
||||||
|
[log]
|
||||||
|
MODE = console
|
||||||
|
LEVEL = Info
|
||||||
|
ROOT_PATH = /data/gitea/log
|
||||||
|
|
||||||
|
[repository.pull-request]
|
||||||
|
DEFAULT_MERGE_STYLE = merge
|
||||||
|
|
||||||
|
[repository.signing]
|
||||||
|
DEFAULT_TRUST_MODEL = committer
|
||||||
|
|
||||||
|
[actions]
|
||||||
|
ENABLED = false
|
||||||
14
scripts/gitea-create-admin.sh
Executable file
14
scripts/gitea-create-admin.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Create admin user for Gitea development instance
|
||||||
|
|
||||||
|
echo "Creating admin user for Gitea..."
|
||||||
|
docker exec -u git gitea gitea admin user create \
|
||||||
|
--username admin \
|
||||||
|
--password admin123 \
|
||||||
|
--email admin@localhost \
|
||||||
|
--admin \
|
||||||
|
--must-change-password=false
|
||||||
|
|
||||||
|
echo "Admin user created!"
|
||||||
|
echo "Username: admin"
|
||||||
|
echo "Password: admin123"
|
||||||
32
scripts/gitea-dev-init.sh
Executable file
32
scripts/gitea-dev-init.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Initialize Gitea for development with pre-configured settings
|
||||||
|
|
||||||
|
# Create necessary directories
|
||||||
|
mkdir -p /data/gitea/conf
|
||||||
|
|
||||||
|
# Copy pre-configured app.ini if it doesn't exist
|
||||||
|
if [ ! -f /data/gitea/conf/app.ini ]; then
|
||||||
|
echo "Initializing Gitea with development configuration..."
|
||||||
|
cp /tmp/app.ini /data/gitea/conf/app.ini
|
||||||
|
chown 1000:1000 /data/gitea/conf/app.ini
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start Gitea in background
|
||||||
|
/usr/bin/entrypoint "$@" &
|
||||||
|
GITEA_PID=$!
|
||||||
|
|
||||||
|
# Wait for Gitea to be ready
|
||||||
|
echo "Waiting for Gitea to start..."
|
||||||
|
until wget --no-verbose --tries=1 --spider http://localhost:3000/ 2>/dev/null; do
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create admin user if it doesn't exist
|
||||||
|
if [ ! -f /data/.admin_created ]; then
|
||||||
|
echo "Creating default admin user..."
|
||||||
|
su git -c "gitea admin user create --username admin --password admin123 --email admin@localhost --admin --must-change-password=false" && \
|
||||||
|
touch /data/.admin_created
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Keep Gitea running in foreground
|
||||||
|
wait $GITEA_PID
|
||||||
Reference in New Issue
Block a user