Use RVM to install the correct version of Ruby and make it the default one.
```zsh
rvm --default use ruby-2.2.2-dev
```
The Gemfile will install the gem mysql2 that needs MariaDB and Sidekiq that needs Redis:
```zsh
sudo yum install mariadb-devel
sudo yum install redis
sudo service redis start
```
To run the project you need to migrate the project's database:
```zsh
rake db:migrate
```
Then launch the project and check if there is no error message in the correct port:
```zsh
rails s
```
## Infrastructure
There is three types of machines in the infrastructure (other than Woody):
- The workers, not connected to Internet. There are just here to do the jobs asked.
- Sid, a worker with an internet connection.
- Cargo, the Docker registry used by workers to do ```docker pull``` commands.
The best way to create the infrastructure is to build your first worker then you can clone your machines to create more workers, Sid and Cargo.
###Installation of Debian and Docker
We're using VM VirtualBox to simulate the workers. Download a .iso of Debian, launch your VM and configure it (we're creating a new user called 'allgo' in this example). Once it boots, you need to configure it to be ready for Docker:
```zsh
sudo
su -c"adduser allgo sudo"
curl + curl -sSL https://test.docker.com/ | sh #to get last docker version
sudo usermod -aG docker allgo
```
Try a Docker command to see if it works:
```zsh
docker ps
```
If it is not the case:
```zsh
sudo chown allgo /home/allgo/.docker/
sudo chown allgo /home/allgo/.docker/key.json
```
###Allowing insecuring registries
As we do not have an HTTPS certification yet, you need to allow insecure registries:
####Debian < v8
```zsh
sudo nano /etc/default/docker
```
Then modify the line concerning DOCKER_OPTS to have: ```DOCKER_OPTS="--insecure-registry cargo.irisa.fr:5000"```.
####Debian >= v8
```zsh
sudo nano /lib/systemd/system/docker.service
```
Change one line to have ```ExecStart=/usr/bin/docker --insecure-registry myregistry:5000 -d -H fd://```
```zsh
sudo systemctl daemon-reload
sudo /etc/init.d/docker restart
```
###A different IP address for every machine
All the workers should have a different IP address configured. Add in VirtualBox second host-only adapter in the Network tab. This adapter sould be in promiscuous mode allowing VMs witha connected cable.
Relaunch your VM and modify the network interfaces:
```zsh
sudo nano /etc/network/interfaces
```
Add in the opened file:
```zsh
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
```
Once you've done the modifications, use the command ``sudo /etc/init.d/networking restart`` to restart the network card of your VM.
When duplicating the first worker don't forget to check the option to change the MAC address. Run a ```sudo ifconfig``` on each machine to get the IP address and copy-paste them into ``config/environments/development.rb`` in the corresponding line of rails-allgo.
###Installing ssh
You'll use ssh a lot on the workers thus we need to install it on the workers and aloow Woody to do a ssh without having to enter a password. First, install openssh-server:
```zsh
sudo apt-get install openssh-server
```
Then on Woody, assuming that you already have a ssh key, do this for the workers and Sid: