Alestic Git Server (EC2)

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.

ec2-run-instances --key $USER  --instance-type t1.micro ami-4c6df225

Wait until the instance is running and make a note of the IP address. 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

TBD: How to upgrade Ubuntu packages.

TBD: How to upgrade gitolite software.

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

  • 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.

Leave a comment

Ubuntu AMIs

Ubuntu AMIs for EC2:


More Entries

Replacing a CloudFront Distribution to "Invalidate" All Objects
I was chatting with Kevin Boyd (aka Beryllium) on the ##aws Freenode IRC channel about the challenge of invalidating a…
Email Alerts for AWS Billing Alarms
using CloudWatch and SNS to send yourself email messages when AWS costs accrue past limits you define The Amazon documentation…
Cost of Transitioning S3 Objects to Glacier
how I was surprised by a large AWS charge and how to calculate the break-even point Glacier Archival of S3…
Running Ubuntu on Amazon EC2 in Sydney, Australia
Amazon has announced a new AWS region in Sydney, Australia with the name ap-southeast-2. The official Ubuntu AMI lookup pages…
Save Money by Giving Away Unused Heavy Utilization Reserved Instances
You may be able to save on future EC2 expenses by selling an unused Reserved Instance for less than its…
Installing AWS Command Line Tools from Amazon Downloads
When you need an AWS command line toolset not provided by Ubuntu packages, you can download the tools directly from…
Convert Running EC2 Instance to EBS-Optimized Instance with Provisioned IOPS EBS Volumes
Amazon just announced two related features for getting super-fast, consistent performance with EBS volumes: (1) Provisioned IOPS EBS volumes, and…
Which EC2 Availability Zone is Affected by an Outage?
Did you know that Amazon includes status messages about the health of availability zones in the output of the ec2-describe-availability-zones…
Installing AWS Command Line Tools Using Ubuntu Packages
Here are the steps for installing the AWS command line tools that are currently available as Ubuntu packages. These include:…
Ubuntu Developer Summit, May 2012 (Oakland)
I will be attending the Ubuntu Developer Summit (UDS) next week in Oakland, CA.  This event brings people from around…
Uploading Known ssh Host Key in EC2 user-data Script
The ssh protocol uses two different keys to keep you secure: The user ssh key is the one we normally…
Seeding Torrents with Amazon S3 and s3cmd on Ubuntu
Amazon Web Services is such a huge, complex service with so many products and features that sometimes very simple but…
CloudCamp
There are a number of CloudCamp events coming up in cities around the world. These are free events, organized around…
Use the Same Architecture (64-bit) on All EC2 Instance Types
A few hours ago, Amazon AWS announced that all EC2 instance types can now run 64-bit AMIs. Though t1.micro, m1.small,…
ec2-consistent-snapshot on GitHub and v0.43 Released
The source for ec2-conssitent-snapshot has historically been available here: ec2-consistent-snapshot on Launchpad.net using Bazaar For your convenience, it is now…
You Should Use EBS Boot Instances on Amazon EC2
EBS boot vs. instance-store If you are just getting started with Amazon EC2, then use EBS boot instances and stop…
Retrieve Public ssh Key From EC2
A serverfault poster had a problem that I thought was a cool challenge. I had so much fun coming up…
Running EC2 Instances on a Recurring Schedule with Auto Scaling
Do you want to run short jobs on Amazon EC2 on a recurring schedule, but don’t want to pay for…
AWS Virtual MFA and the Google Authenticator for Android
Amazon just announced that the AWS MFA (multi-factor authentication) now supports virtual or software MFA devices in addition to the…
Updated EBS boot AMIs for Ubuntu 8.04 Hardy on Amazon EC2 (2011-10-06)
Canonical has released updated instance-store AMIs for Ubuntu 8.04 LTS Hardy on Amazon EC2. Read Ben Howard’s announcement on the…