Alestic Git Server

Git with gitlite by Alestic is being sunset on the AWS Marketplace. Support and maintenance of the AMIs will be discontinued and the product will not be offered for running new instances. Please read more here.


The Alestic Git Server makes it simple to start a new, centralized Git server with an unlimited number of private Git repositories under your control running on an Amazon EC2 instance. The access control for the Git repositories is performed using gitolite, a powerful tool for managing who can access what repositories (and more).

Benefits

There are a number of popular, commercial services that offer Git repository hosting. These services are fantastic for a variety of uses, especially if you wish to host a public, open source project, or a limited number of private repositories for a limited number of users with a limited amount of disk storage.

Running your own Git server with an EC2 instance lets you host an unlimited number of private repositories with an unlimited number of users, and you have control over the repository data as it’s running on your own, private server.

The Alestic Git Server puts together existing, popular, well tested. open source software in a clean configuration with appropriate hooks for running in an Amazon EC2 environment, taking some of the pain and confusion out of the job of setting up your centralized Git server.

The focus of the project at this point is to provide a clean interface for accessing and managing Git repositories. There are no project management, bug tracking, social networking, or other fancy features included. Just Git with access managed through gitolite.

Software

The Alestic Git Server combines the following technologies in a reasonable, best-practices configuration:

The Ubuntu operating system has all software packages updated as of the AMI build date.

The Git software manages the repositories on the server, as you would expect.

The gitolite software manages and controls the access users have to the git repositories. There is a learning curve here, but once you get the hang of it, gitolite provides great security (through standard ssh controls) and flexibility with how you share repository access and even delegate access control.

Your Responsibilities

Even though the above software is initially installed and configured for you, it is still your responsibility to understand and use each of these components in an appropriate manner. For example, you will need to understand:

  • How to use Git.

  • How to use gitolite to set up repository users (by adding their public ssh keys to the gitolite-admin repository) and how to give them access to Git repositories (with the gitolite configuration file in the gitolite-admin repository).

  • What it means to store valuable information on an EC2 instance and how to manage the risks.

For example, on this last point, you should understand that an EC2 instance and even an EBS volume can fail at any time. If you care about your data you should set up regular EBS snapshots and/or off-site backups of your git repositories.

There is a lot of documentation for each of these components as well as online support if you run into issues not covered by the documentation.

Preparation

When you run an Alestic Git Server (or any EC2 instance) you specify an ssh keypair name to be used with the new instance.

This guide strongly recommends and assumes that you have uploaded your own personal, default ssh key to Amazon EC2 using a name that matches your local username. This is a one-time process that can be performed by following the steps here:

Uploading Personal ssh Keys to Amazon EC2

Normally, this ssh key gives you access to the instance using ssh. With the Alestic Git Server, this ssh key also gives you access to the initial administrative repository for gitolite, so upload the key you will be using to administer the gitolite configuration adding users and controling their repository access.

Running Alestic Git Server

Run an instance of the Alestic Git Server AMI, specifying your ssh key that you uploaded from the Preparation step above. Your default security group should allow ssh access on port 22.

ami_id=ami-a7f7a9c2
region=us-east-1
instance_id=$(aws ec2 run-instances \
  --region "$region" \
  --key-name "$USER" \
  --instance-type t1.micro \
  --image-id "$ami_id" \
  --output text \
  --query 'Instances[*].InstanceId')
echo instance_id=$instance_id

Wait until the instance is running:

aws ec2 wait instance-running \
  --instance-ids "$instance_id"

Make a note of the IP address:

host=$(aws ec2 describe-instances \
  --instance-ids $instance_id \
  --output text --query 'Reservations[*].Instances[*].PublicIpAddress')
echo host=$host

At this point, you may even want to assign an Elastic IP Address and set up a DNS hostname to resolve to it.

Cloning gitolite-admin

The first step you perform after starting an Alestic Git Server is to check out the gitolite-admin repository so that you can add users and manage their repository access.

git clone git@$host:gitolite-admin

where $host is either the IP address of the new EC2 instance or a DNS hostname that you have assigned to it.

When you look at the gitolite-admin/conf/gitolite.conf file, you will see that there is already one user (you) who has access to the gitolite-admin repository. Your ssh public key that you uploaded to EC2 in the Preparation step above will already have been copied into the gitolite-admin/keydir directory with a name like $USER.pub.

If you are going through the gitolite documentation then you are now basically done with the “install, setup, and clone” and are ready to continue on with adding users and repositories.

Implementation Notes

  • Gitolite is installed in the under the git user’s home directory.

  • On first boot, the gitolite setup command is run with the user’s public ssh key as provided by Amazon EC2 to the instance.

  • The base of the AMI is based on the standard Ubuntu image built by Canonical, with all software packages updated as of the time the Alestic Git Server AMI was published.

  • As with standard Ubuntu AMIs published by Canonical, direct login to the instance is performed through ssh to the ubuntu user. This can be used to tweak gitolite settings, to perform recovery from mistakes in gitolite-admin configuration, and to upgrade Ubuntu and gitolite software packages.

The Alestic Git Server AMIs are built with the open source software published here:

https://github.com/alestic/alestic-git

Upgrading

Upgrading Ubuntu packages:

ssh ubuntu@HOST
sudo apt-get update &&
sudo apt-get dist-upgrade

Upgrading gitolite:

ssh ubuntu@HOST
sudo -i -u git
cd gitolite
git pull
./install -ln /home/git/bin

License

The Alestic Git Server software is released under open source licenses. Read more…

Support

There is a public Google group for discussion, announcements, and support of the Alestic Git Server:

Alestic Git Google group

Support for the Alestic Git Server covers the basics of getting the server running. Support for issues specific to Git, gitolite, Ubuntu, EC2, et. al. can be directed to the many great online resources for these fine products.

History

  • 20151024

    • Upgraded to gitolite v3.6.3-11 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20140930

    • Defaults to EBS SSD boot for performance
    • Upgraded to Ubuntu 14.04 LTS Trusty
    • Upgrade to Git v1.9.1
    • Upgraded to gitolite v3.6.1-6 (master branch)
    • All Ubuntu packages updated to latest versions.
    • Includes important security patches from Ubuntu.
    • Installed unattended-upgrades to automatically apply future security patches.
  • 20140409

    • Upgraded to gitolite v3.5.3.1-17 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20140328

    • Upgraded to gitolite v3.5.3.1-14 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20131227

    • Upgraded to gitolite v3.5.3.1-1 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20131023

    • Upgraded to gitolite v3.5.3.1 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20130830

    • Upgraded to gitolite v3.5.2-4 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20130311

    • Upgraded to gitolite v3.4-1 (master branch)
    • Latest Amazon provided pv AKI (kernel)
    • Available on all AWS Marketplace regions
  • 20120426

    • Upgraded to Ubuntu 12.04 Precise
    • Upgraded to Git v1.7.9.5
    • Upgraded to gitolite v3.0-14 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20120418

    • Upgraded to Ubuntu 11.10 Oneiric
    • Upgraded to Git v1.7.5.4
    • Upgraded to gitolite g3 v0.02-43 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20110611

    • Upgraded to Ubuntu 10.04 Natty
    • Upgraded to gitolite v2.0.1-0 (master branch)
    • All Ubuntu packages updated to latest versions.
  • 20110322

    • Ubuntu 9.10 Maverick
    • Git v1.7.1
    • gitolite v2.0-4 (master branch)

Competition

If you end up deciding not to run your own Git server, here are some Git service providers with support for private repositories. These links go directly to the pricing pages for comparison.