Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Thomvaill/tads-boilerplate
Terraform + Ansible + Docker Swarm boilerplate = DevOps on :fire::fire::fire: | Infrastructure as Code
https://github.com/Thomvaill/tads-boilerplate
ansible bash boilerplate devops docker docker-swarm hacktoberfest iac infrastructure-as-code noops tads terraform vagrant
Last synced: about 2 months ago
JSON representation
Terraform + Ansible + Docker Swarm boilerplate = DevOps on :fire::fire::fire: | Infrastructure as Code
- Host: GitHub
- URL: https://github.com/Thomvaill/tads-boilerplate
- Owner: thomvaill
- License: mit
- Created: 2019-10-28T10:22:42.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-03T13:04:54.000Z (about 2 years ago)
- Last Synced: 2024-10-15T04:41:40.200Z (about 2 months ago)
- Topics: ansible, bash, boilerplate, devops, docker, docker-swarm, hacktoberfest, iac, infrastructure-as-code, noops, tads, terraform, vagrant
- Language: Shell
- Homepage:
- Size: 209 KB
- Stars: 753
- Watchers: 25
- Forks: 115
- Open Issues: 9
-
Metadata Files:
- Readme: README.example.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-ansible - T.A.D.S. boilerplate - Provision and deploy a Docker Swarm cluster to development environment and to production. Infrastructure as Code and DevOps best practices. (Playbooks, Roles and Collections / French)
- awesome-terraform - tads-boilerplate - The power of Ansible and Terraform + the simplicity of Docker Swarm = Infrastructure as Code and DevOps best practices. (Tools / Miscellaneous)
- awesome-docker - T.A.D.S. boilerplate - The power of Ansible and Terraform + the simplicity of Docker Swarm = Infrastructure as Code and DevOps best practices. By [@Thomvaill](https://github.com/Thomvaill) (Development with Docker / Wrappers)
- awesome-ansible - T.A.D.S. boilerplate - Provision and deploy a Docker Swarm cluster to development environment and to production. Infrastructure as Code and DevOps best practices. (Playbooks)
- awesome-vagrant - T.A.D.S. boilerplate - boilerplate to create, develop and deploy a Docker Swarm environment, using Vagrant to reproduce production environment locally. (Helpers / Tools)
- awesome-tf - tads-boilerplate - The power of Ansible and Terraform + the simplicity of Docker Swarm = Infrastructure as Code and DevOps best practices. (Tools / Community providers)
- awesome-docker - T.A.D.S. boilerplate - The power of Ansible and Terraform + the simplicity of Docker Swarm = Infrastructure as Code and DevOps best practices. By [@Thomvaill](https://github.com/Thomvaill) (Development with Docker / Wrappers)
- awesome-ansible - T.A.D.S. boilerplate - Provision and deploy a Docker Swarm cluster to development environment and to production. Infrastructure as Code and DevOps best practices. (Playbooks, Roles and Collections / French)
README
# YourCompany infrastructure repository
This repository implements [Infrastructure as Code](https://en.wikipedia.org/wiki/Infrastructure_as_code), and more globally the DevOps mindset.
It includes all the configuration and all the scripts needed to deploy YourCompany stacks either locally or remotely.
This repository should be considered as a single source of truth.
You should also use this repository to set up your development environment.This project heavily uses Ansible. If you are not familiar with it, you should read the [Ansible Quickstart guide](https://docs.ansible.com/ansible/latest/user_guide/quickstart.html) before getting started.
This project was bootstrapped with [T.A.D.S. boilerplate](https://github.com/Thomvaill/tads-boilerplate).
## Installation
```bash
git clone
cd
./tads install-dependencies
```... this will install project dependencies: Ansible, Vagrant, Virtualbox, and Terraform.
## Development environment
### Commands
The `./tads` executable is a companion CLI which is a wrapper around Ansible, Vagrant and Terraform commands.
```bash
./tads ansible-playbook localhost provision
```... this will configure your local machine to be able to run YourCompany stacks: it will install Docker and set up a Swarm cluster with one node: your localhost.
```bash
./tads ansible-playbook localhost deploy
```... this will deploy all YourCompany's stacks. To deploy only specific stacks, use `--tags` option. Example: `./tads ansible-playbook localhost deploy --tags stack-traefik,stack-XXX`.
You should run this command every time you change the configuration of your stacks.
Your application is now accessible on https://yourcompany.localhost/
### Bind mounts
To be able to develop locally, you should bind mount your code into your containers. To do so:
- Copy `ansible/groups_vars/localhost_bindmounts.sample.yml` to `ansible/groups_vars/localhost_bindmounts.yml`
- Specify the correct paths in it
- Run `./tads ansible-playbook localhost deploy` to update changesYou can also override some Ansible variables locally doing the same with the `ansible/groups_vars/localhost_overrides.sample.yml` file (useful for credentials and applicative environment variables).
## Test in a production-like environment with Vagrant
This will deploy your stacks on a 3-nodes production like-environment, locally with Vagrant. To do so, this will create 3 virtual machines.
1. Copy `vagrant/vagrant.sample.yml` to `vagrant/vagrant.yml` and adjust its settings
2. Run `./tads vagrant up`
3. Run `./tads ansible-playbook vagrant all`Now, you will be able to test your stacks deployed on Vagrant on https://yourcompany.test/
**Tips:**
- To destroy your cluster: `./tads vagrant destroy`
- To SSH into the first node: `./tads vagrant ssh vagrant-1`## Deploy to production
1. Make sure you have a correct SSH key pair
2. Make sure you have the correct ansible-vault key in `ansible/vault_keys/production`
3. To create the environment with Terraform: `./tads terraform production apply`
4. To provision: `./tads ansible-playbook production provision`
5. To deploy: `./tads ansible-playbook production deploy`