Skip to content

Commit f60ccfc

Browse files
authored
Merge pull request #44 from RayLabsHQ/v3
V3
2 parents 0af2626 + cad7732 commit f60ccfc

File tree

110 files changed

+21506
-1894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+21506
-1894
lines changed

.env.example

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
1-
# Docker Registry Configuration
2-
DOCKER_REGISTRY=ghcr.io
3-
DOCKER_IMAGE=arunavo4/gitea-mirror
4-
DOCKER_TAG=latest
1+
# Gitea Mirror Configuration
2+
# Copy this to .env and update with your values
3+
4+
# ===========================================
5+
# CORE CONFIGURATION
6+
# ===========================================
57

68
# Application Configuration
79
NODE_ENV=production
810
HOST=0.0.0.0
911
PORT=4321
12+
13+
# Database Configuration
14+
# For self-hosted, SQLite is used by default
1015
DATABASE_URL=sqlite://data/gitea-mirror.db
1116

1217
# Security
13-
JWT_SECRET=change-this-to-a-secure-random-string-in-production
18+
# Generate with: openssl rand -base64 32
19+
BETTER_AUTH_SECRET=change-this-to-a-secure-random-string-in-production
20+
BETTER_AUTH_URL=http://localhost:4321
21+
# ENCRYPTION_SECRET=optional-encryption-key-for-token-encryption # Generate with: openssl rand -base64 48
22+
23+
# ===========================================
24+
# DOCKER CONFIGURATION (Optional)
25+
# ===========================================
26+
27+
# Docker Registry Configuration
28+
DOCKER_REGISTRY=ghcr.io
29+
DOCKER_IMAGE=arunavo4/gitea-mirror
30+
DOCKER_TAG=latest
1431

15-
# Optional GitHub/Gitea Mirror Configuration (for docker-compose, can also be set via web UI)
16-
# Uncomment and set as needed. These are passed as environment variables to the container.
32+
# ===========================================
33+
# MIRROR CONFIGURATION (Optional)
34+
# Can also be configured via web UI
35+
# ===========================================
36+
37+
# GitHub Configuration
1738
# GITHUB_USERNAME=your-github-username
1839
# GITHUB_TOKEN=your-github-personal-access-token
1940
# SKIP_FORKS=false
@@ -25,22 +46,36 @@ JWT_SECRET=change-this-to-a-secure-random-string-in-production
2546
# PRESERVE_ORG_STRUCTURE=false
2647
# ONLY_MIRROR_ORGS=false
2748
# SKIP_STARRED_ISSUES=false
49+
50+
# Gitea Configuration
2851
# GITEA_URL=http://gitea:3000
2952
# GITEA_TOKEN=your-local-gitea-token
3053
# GITEA_USERNAME=your-local-gitea-username
3154
# GITEA_ORGANIZATION=github-mirrors
3255
# GITEA_ORG_VISIBILITY=public
3356
# DELAY=3600
3457

35-
# Optional Database Cleanup Configuration (configured via web UI)
36-
# These environment variables are optional and only used as defaults
37-
# Users can configure cleanup settings through the web interface
58+
# ===========================================
59+
# OPTIONAL FEATURES
60+
# ===========================================
61+
62+
# Database Cleanup Configuration
3863
# CLEANUP_ENABLED=false
3964
# CLEANUP_RETENTION_DAYS=7
4065

41-
# Optional TLS/SSL Configuration
42-
# Option 1: Mount custom CA certificates in ./certs directory as .crt files
43-
# The container will automatically combine them into a CA bundle
44-
# Option 2: Mount your system CA bundle at /etc/ssl/certs/ca-certificates.crt
45-
# See docker-compose.yml for volume mount examples
46-
# GITEA_SKIP_TLS_VERIFY=false # WARNING: Only use for testing, disables TLS verification
66+
# TLS/SSL Configuration
67+
# GITEA_SKIP_TLS_VERIFY=false # WARNING: Only use for testing
68+
69+
# ===========================================
70+
# AUTHENTICATION CONFIGURATION
71+
# ===========================================
72+
73+
# Header Authentication (for Reverse Proxy SSO)
74+
# Enable automatic authentication via reverse proxy headers
75+
# HEADER_AUTH_ENABLED=false
76+
# HEADER_AUTH_USER_HEADER=X-Authentik-Username
77+
# HEADER_AUTH_EMAIL_HEADER=X-Authentik-Email
78+
# HEADER_AUTH_NAME_HEADER=X-Authentik-Name
79+
# HEADER_AUTH_AUTO_PROVISION=false
80+
# HEADER_AUTH_ALLOWED_DOMAINS=example.com,company.org
81+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ certs/*.crt
3131
certs/*.pem
3232
certs/*.cer
3333
!certs/README.md
34+

CONTRIBUTING.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Contributing to Gitea Mirror
2+
3+
Thank you for your interest in contributing to Gitea Mirror! This document provides guidelines and instructions for contributing to the open-source version of the project.
4+
5+
## 🎯 Project Overview
6+
7+
Gitea Mirror is an open-source, self-hosted solution for mirroring GitHub repositories to Gitea instances. This guide provides everything you need to know about contributing to the project.
8+
9+
## 🚀 Getting Started
10+
11+
1. Fork the repository
12+
2. Clone your fork:
13+
```bash
14+
git clone https://github.com/yourusername/gitea-mirror.git
15+
cd gitea-mirror
16+
```
17+
18+
3. Install dependencies:
19+
```bash
20+
bun install
21+
```
22+
23+
4. Set up your environment:
24+
```bash
25+
cp .env.example .env
26+
# Edit .env with your configuration
27+
```
28+
29+
5. Start development:
30+
```bash
31+
bun run dev
32+
```
33+
34+
## 🛠 Development Workflow
35+
36+
### Running the Application
37+
38+
```bash
39+
# Development mode
40+
bun run dev
41+
42+
# Build for production
43+
bun run build
44+
45+
# Run tests
46+
bun test
47+
```
48+
49+
### Database Management
50+
51+
```bash
52+
# Initialize database
53+
bun run init-db
54+
55+
# Reset database
56+
bun run cleanup-db && bun run init-db
57+
```
58+
59+
## 📝 Code Guidelines
60+
61+
### General Principles
62+
63+
1. **Keep it Simple**: Gitea Mirror should remain easy to self-host
64+
2. **Focus on Core Features**: Prioritize repository mirroring and synchronization
65+
3. **Database**: Use SQLite for simplicity and portability
66+
4. **Dependencies**: Minimize external dependencies for easier deployment
67+
68+
### Code Style
69+
70+
- Use TypeScript for all new code
71+
- Follow the existing code formatting (Prettier is configured)
72+
- Write meaningful commit messages
73+
- Add tests for new features
74+
75+
### Scope of Contributions
76+
77+
This project focuses on personal/small team use cases. Please keep contributions aligned with:
78+
- Core mirroring functionality
79+
- Self-hosted simplicity
80+
- Minimal external dependencies
81+
- SQLite as the database
82+
- Single-instance deployments
83+
84+
## 🐛 Reporting Issues
85+
86+
1. Check existing issues first
87+
2. Use issue templates when available
88+
3. Provide clear reproduction steps
89+
4. Include relevant logs and screenshots
90+
91+
## 🎯 Pull Request Process
92+
93+
1. Create a feature branch:
94+
```bash
95+
git checkout -b feature/your-feature-name
96+
```
97+
98+
2. Make your changes following the code guidelines
99+
100+
3. Test your changes:
101+
```bash
102+
# Run tests
103+
bun test
104+
105+
# Build and check
106+
bun run build:oss
107+
```
108+
109+
4. Commit your changes:
110+
```bash
111+
git commit -m "feat: add new feature"
112+
```
113+
114+
5. Push to your fork and create a Pull Request
115+
116+
### PR Requirements
117+
118+
- Clear description of changes
119+
- Tests for new functionality
120+
- Documentation updates if needed
121+
- No breaking changes without discussion
122+
- Passes all CI checks
123+
124+
## 🏗 Architecture Overview
125+
126+
```
127+
src/
128+
├── components/ # React components
129+
├── lib/ # Core utilities
130+
│ ├── db/ # Database queries (SQLite only)
131+
│ ├── github/ # GitHub API integration
132+
│ ├── gitea/ # Gitea API integration
133+
│ └── utils/ # Helper functions
134+
├── pages/ # Astro pages
135+
│ └── api/ # API endpoints
136+
└── types/ # TypeScript types
137+
```
138+
139+
## 🧪 Testing
140+
141+
```bash
142+
# Run all tests
143+
bun test
144+
145+
# Run tests in watch mode
146+
bun test:watch
147+
148+
# Run with coverage
149+
bun test:coverage
150+
```
151+
152+
## 📚 Documentation
153+
154+
- Update README.md for user-facing changes
155+
- Add JSDoc comments for new functions
156+
- Update .env.example for new environment variables
157+
158+
## 💡 Feature Requests
159+
160+
We welcome feature requests! When proposing new features, please consider:
161+
- Does it enhance the core mirroring functionality?
162+
- Will it benefit self-hosted users?
163+
- Can it be implemented without complex external dependencies?
164+
- Does it maintain the project's simplicity?
165+
166+
## 🤝 Community
167+
168+
- Be respectful and constructive
169+
- Help others in issues and discussions
170+
- Share your use cases and feedback
171+
172+
## 📄 License
173+
174+
By contributing, you agree that your contributions will be licensed under the same license as the project (MIT).
175+
176+
## Questions?
177+
178+
Feel free to open an issue for any questions about contributing!
179+
180+
---
181+
182+
Thank you for helping make Gitea Mirror better! 🎉

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ COPY --from=builder /app/dist ./dist
3131
COPY --from=builder /app/package.json ./package.json
3232
COPY --from=builder /app/docker-entrypoint.sh ./docker-entrypoint.sh
3333
COPY --from=builder /app/scripts ./scripts
34+
COPY --from=builder /app/drizzle ./drizzle
3435

3536
ENV NODE_ENV=production
3637
ENV HOST=0.0.0.0

0 commit comments

Comments
 (0)