<commit_before>Gitlab HA setup template on AWS
===============================

This template is a POC to setup a [Gitlab](https://about.gitlab.com/) system with [High Availability](https://about.gitlab.com/high-availability/)  on [Amazon Web Service Cloud](https://aws.amazon.com/).

This template is heavily inspired by [Gitlab university : HA on AWS](https://docs.gitlab.com/ce/university/high-availability/aws/).


The project tries to follow Immutable server pattern and Infrastructure-as-Code principles by using :
* [Packer](https://www.packer.io/) to create [Amazon Virtual Machine Images (AMI)](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)
* [Ansible](https://www.ansible.com/) to install and configure packages on these Virtual Machine Images when running Packer
* [Terraform](https://www.terraform.io/) to create and orchestrate the cloud infrastructure
* [cloud-init](https://cloudinit.readthedocs.io/en/latest/) and [jinja2-cli](https://github.com/mattrobenolt/jinja2-cli) to finalize setup automatically when launching AWS instances from AMI
* [Docker](https://www.docker.com/) to run Continuous Integration in containers with [Gitlab-CI](https://about.gitlab.com/gitlab-ci/)


Requirements
------------

* a [AWS account](https://aws.amazon.com/) (**Be careful this template implies creating billable resources on AWS cloud**)

  You will need an [AWS access key](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) and enough admin permissions to create AWS ressources
* a [AWS Route 53 DNS zone](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html) 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](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/))
* [Packer](https://www.packer.io/) >= 0.12
* [Terraform](https://www.terraform.io/) >= 8.2
* GNU Make or some Unix equivalent Implementation
* *(optional)* [Graphiz](http://www.graphviz.org/) to generate Terraform config Graph Images 
  ```sh
  # on ubuntu/debian
  sudo apt-get install graphviz
  ```


Usage
-----

### 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`
  
2. create Amazon Machine Images :

  * Gitlab <commit_msg>update README about git clone instruction<commit_after>Gitlab HA setup template on AWS
===============================

This template is a POC to setup a [Gitlab](https://about.gitlab.com/) system with [High Availability](https://about.gitlab.com/high-availability/)  on [Amazon Web Service Cloud](https://aws.amazon.com/).

This template is heavily inspired by [Gitlab university : HA on AWS](https://docs.gitlab.com/ce/university/high-availability/aws/).


The project tries to follow Immutable server pattern and Infrastructure-as-Code principles by using :
* [Packer](https://www.packer.io/) to create [Amazon Virtual Machine Images (AMI)](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)
* [Ansible](https://www.ansible.com/) to install and configure packages on these Virtual Machine Images when running Packer
* [Terraform](https://www.terraform.io/) to create and orchestrate the cloud infrastructure
* [cloud-init](https://cloudinit.readthedocs.io/en/latest/) and [jinja2-cli](https://github.com/mattrobenolt/jinja2-cli) to finalize setup automatically when launching AWS instances from AMI
* [Docker](https://www.docker.com/) to run Continuous Integration in containers with [Gitlab-CI](https://about.gitlab.com/gitlab-ci/)


Requirements
------------

* a [AWS account](https://aws.amazon.com/) (**Be careful this template implies creating billable resources on AWS cloud**)

  You will need an [AWS access key](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) and enough admin permissions to create AWS ressources
* a [AWS Route 53 DNS zone](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html) 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](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/))
* [Packer](https://www.packer.io/) >= 0.12
* [Terraform](https://www.terraform.io/) >= 8.2
* GNU Make or some Unix equivalent Implementation
* *(optional)* [Graphiz](http://www.graphviz.org/) to generate Terraform config Graph Images 
  ```sh
  # on ubuntu/debian
  sudo apt-get install graphviz
  ```


Usage
-----

### Download the terraform and packer templates

```sh
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`
  
2. create Amazon Machine Images :

  * Gitlab 
{'fraction_non_alphanumeric': 0.14847246546020626, 'fraction_numerical': 0.005448530842576377, 'mean_word_length': 4.456475583864119, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 31, 'lorem ipsum': 0, 'www.': 14, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1901799', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1525, 'n_words': 448}