Skip to content

A Packer / Terraform / Ansible configuration to install Gitlab and Gitlab-CI

License

Notifications You must be signed in to change notification settings

csanquer/gitlab-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitlab HA setup template on AWS

This template is a POC to setup a Gitlab system with High Availability on Amazon Web Service Cloud.

This template is heavily inspired by Gitlab university : HA on AWS.

The project tries to follow Immutable server pattern and Infrastructure-as-Code principles by using :

Requirements

  • a AWS account (Be careful this template implies creating billable resources on AWS cloud)

    You will need an AWS access key and enough admin permissions to create AWS ressources

  • a AWS Route 53 DNS zone already created (the template will add new subdomain DNS A records)

  • a SSH Key pair to connect to Gitlab and AWS instances (see Github help for examples)

  • Packer >= 0.12

  • Terraform >= 8.2

  • GNU Make or some Unix equivalent Implementation

  • (optional) Graphiz to generate Terraform config Graph Images

    # on ubuntu/debian
    sudo apt-get install graphviz

Usage

Download the terraform and packer templates

git clone --recursive https://github.com/csanquer/gitlab-setup.git

To create the Gitlab infrastructure

  1. Copy and edit the configuration files :
  • terraform : terraform/terraform.dist.tfvars to terraform/terraform.tfvars
  • packer : packer/config.dist.json to packer/config.json
  1. create Amazon Machine Images :
  • Gitlab
  • Gitlab-CI-multirunner
make ami
  1. check Terraform plan
make plan
  1. if terraform plan is correct, create AWS resources by applying the terraform plan
make apply
  • you can check again the terraform exported variables output
    make output
  • you can also get Graphviz graphs of all terraform config
    # in PNG image format
    make graphs
    # or in SVG
    make graphs format=svg

After creation, wait for a few minutes the autoscaled gitlab instances finish self initialization.

if variables are set in terraform/terraform.tvars like :

aws_dns_zone = "my-aws.net"
gitlab_dns_subdomain = "gitlab"

The Gitlab server should be available to http://gitlab.my-aws.net/

To destroy the Gitlab infrastructure

make destroy

About

A Packer / Terraform / Ansible configuration to install Gitlab and Gitlab-CI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published