Skip to content

dotcodeschool/git-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dot Code School Git Server

A custom Git server implementation for Dot Code School, providing repository management and webhooks.

Prerequisites

  • Ubuntu/Debian-based system
  • Root or sudo access
  • Domain name configured with DNS A record pointing to server IP

Installation

1. Install Required Packages

# Install fcgiwrap for Git HTTP operations
sudo apt-get install fcgiwrap

# Install jq for JSON parsing
sudo apt-get install jq

2. Configure fcgiwrap

# Start and enable fcgiwrap service
sudo systemctl start fcgiwrap
sudo systemctl enable fcgiwrap

3. Set Up Directory Structure

# Create required directories
sudo mkdir -pv /srv/git/{repos,scripts,templates}

# Copy scripts to git server
sudo cp -r scripts /srv/git/

# Make scripts executable
sudo chmod +x /srv/git/scripts/*

4. Install and Configure Caddy

  1. Install Caddy server
  2. Create a Caddy environment file at /etc/caddy/caddy.env:
# Git server configuration
GIT_DOMAIN=git.yourdomain.com
ADMIN_EMAIL=admin@yourdomain.com
GIT_SERVER_URL=https://git.yourdomain.com
BACKEND_URL=https://backend.yourdomain.com
  1. Update /etc/caddy/Caddyfile with your configuration
  2. Enable port binding for Caddy:
sudo setcap cap_net_bind_service=+ep /usr/bin/caddy

5. Set Up Permissions

# Update permissions for repos directory
sudo chown -R www-data:caddy /srv/git/repos
sudo chmod -R 775 /srv/git/repos

Configuration

Template Repository

  1. Create a default template repository:
/srv/git/scripts/create_git_template.sh
  1. (Optional) Add custom hooks to /srv/git/templates/default/hooks/

Usage

Creating a New Repository

Send a POST request to create a new repository:

curl -H "Content-Type: application/json" \
     -H "Authorization: Bearer <your-auth-token>" \
     -d '{
           "repo_name": "<your-repo>",
           "template_repo": "default"
         }' \
     https://git.yourdomain.com/api/v0/create_repository

Security Notes

  1. Keep your authentication tokens secure
  2. Regularly update system packages and Caddy
  3. Monitor server logs for suspicious activity

Troubleshooting

  1. Check fcgiwrap status:
sudo systemctl status fcgiwrap
  1. Check Caddy logs:
sudo journalctl -u caddy
  1. Verify repository permissions:
ls -la /srv/git/repos

License

This project is licensed under the WTFPL - Do What The Fuck You Want To Public License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published