Skip to content
README.md 2.34 KiB
Newer Older
Javier Marcet's avatar
Javier Marcet committed
# DevOps Test

This project contains a Vagrantfile, three ansible playbooks and three docker-compose files. **vagrant** and **vagrant-hostmanager** are required on the host.

  - Vagrantfile: this is to setup the vms used by ansible. It will launch three ubuntu focal machines, called **ubuntu0**, **ubuntu1** & **ubuntu2**
  ```
  vagrant up
  ```
  - Once the vms are running, the included ansible playbooks can be tested. The __hosts__ file describes how to connect to each of the vms, the defined ssh ports might need adjusting according to the logs printed by __vagrant__
  ```
  ansible-playbook -i hosts redis-cluster.yml
  ansible-playbook -i hosts rabbitmq-cluster.yml
  ansible-playbook -i hosts mysql-cluster.yml
  ```
## Usage

* You can log in the vms with:
```
vagrant ssh [ubuntu0|ubuntu1|ubuntu2]
sudo -i
```
* Once inside the vagrant machine, as the **root** user, we can check the container status:
```
docker ps
```
* Or check the logs:
```
cd /vagrant/{redis,rabbitmq,mysql}
docker-compose logs -f
```

* The containers will take a few minutes to be fully setup the first time. The logs will show clearly when the process has completed.
* We also have the main port of each cluster forwarded to the local host. That way we can access the servers directly, in rabbitmq's case, its management interface, available at [http://localhost:15672]
  1. redis-cluster: 6379
  2. rabbitmq-cluster: 15672
  3. mysql-cluster: 3306


* All the details of each cluster can be easily customized in the docker-compose files, not only the users/password but every other detail about them. As they come, the basic users/passwordds are:
  1. REDIS_PASSWORD=my_password
  2. RABBITMQ_USERNAME=user
  3. RABBITMQ_PASSWORD=bitnami
  4. MYSQL_USER=my_user
  5. MYSQL_DATABASE=my_database
  6. MYSQL_PASSWORD=my_password
  7. MYSQL_ROOT_PASSWORD=my_root_password
  8. MYSQL_REPLICATION_USER=repl_user
  9. MYSQL_REPLICATION_PASSWORD=my_replication_password

### External resources:

* Besides using vagrant and docker-compose, we leverage the well maintained bitnami repos, which had available compose projects for the three requested clusters.
 1. [Bitnami Redis](https://github.com/bitnami/bitnami-docker-redis)
 2. [Bitnami RabbitMQ](https://github.com/bitnami/bitnami-docker-rabbitmq#how-to-use-this-image)
 3. [Bitnami Mysql](https://github.com/bitnami/bitnami-docker-mysql#how-to-use-this-image)