APSL / gitlab-setup

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.tvars to terraform/terraform.tvars
  • 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

License:MIT License


Languages

Language:HCL 86.6%Language:Shell 6.2%Language:Makefile 5.6%Language:Smarty 1.6%