This repository implements 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 before getting started.
This project was bootstrapped with T.A.D.S. boilerplate.
git clone <YOUR_PROJECT_GIT_URL>
cd <YOUR_PROJECT_NAME>
./tads install-dependencies
... this will install project dependencies: Ansible, Vagrant, Virtualbox, and Terraform.
The ./tads
executable is a companion CLI which is a wrapper around Ansible, Vagrant and Terraform commands.
./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.
./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/
To be able to develop locally, you should bind mount your code into your containers. To do so:
ansible/groups_vars/localhost_bindmounts.sample.yml
to ansible/groups_vars/localhost_bindmounts.yml
./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).
This will deploy your stacks on a 3-nodes production like-environment, locally with Vagrant. To do so, this will create 3 virtual machines.
vagrant/vagrant.sample.yml
to vagrant/vagrant.yml
and adjust its settings./tads vagrant up
./tads ansible-playbook vagrant all
Now, you will be able to test your stacks deployed on Vagrant on https://yourcompany.test/
Tips:
./tads vagrant destroy
./tads vagrant ssh vagrant-1
ansible/vault_keys/production
./tads terraform production apply
./tads ansible-playbook production provision
./tads ansible-playbook production deploy