Commit 9324e89b authored by MAUPETIT Charly's avatar MAUPETIT Charly
Browse files

cleaning

parent aa0312e2
......@@ -8,7 +8,8 @@
|_|
#What is Allgo (A||Go)
#Qu'est ce Allgo? (A||Go)
A||Go est une infrastructure web pour mettre en ligne le plus rapidement et simplement
possible des logiciels ou prototypes scientifiques. L'objectif est de réduire le coût du transfert de
l'ordinateur du chercheur vers les utilisateurs finaux (membre de l’équipe, communauté
......@@ -20,192 +21,26 @@ Docker fournit des conteneurs Linux pour gérer / stocker / utiliser les applica
hébergeons.
Un job est l'action d'exécuter une application, avc un ou plusieurs fichier(s) qui retournera un résultat.
#Architecture
![](doc/allgo.jpg)
## Woody (web server) - Debian 8
### What
Allgo frontend via the web application in RoR. We also have the datastore on Woody, to store files from jobs, and the SQL database.
### Need
Ruby 2.2.2-dev, Nginx, mariadb, ruby + rails via rvm, rails app (via capistrano), redis, git, zip, curl, sudo
### How
su -c "adduser allgo"
su -c "usermod -aG sudo allgo"
su allgo
Use RVM to install the correct version of Ruby
```zsh
\curl -sSL https://get.rvm.io | bash
rvm install ruby-2.2.2-dev
rvm --default use ruby-2.2.2-dev
```
Install the gem bundler to download the dependancies
```zsh
gem install bundler
```
```zsh
sudo apt-get install mariadb-devel redis -y
sudo service redis enable (to launch at boot)
sudo service redis start
sudo service mariadb enable
sudo service mariadb start
```
To run the project you need to migrate the project's database, there are backup in db/backup
```zsh
rake db:create ( RAILS_ENV=production )
rake db:migrate ( RAILS_ENV=production )
```
Then launch the project and check if there is no error message in the correct port:
```zsh
rails s
```
We also need to run sidekiq separately :
```zsh
bundle exec sidekiq (-e production)
```
##WorkerX
### What
The worker are server that will execute job created by users in Allgo.
we sent the command through ssh from Woody and send a docker pull request to cargo (see below)
the datastore from woody is mount through ssh so Worker can write in.
### Need
Docker 1.6, openssh-server
### How
```zsh
su -c "apt-get update && apt-get install sudo openssh-server -y"
su -c "adduser allgo"
su -c "usermod -aG sudo allgo"
su allgo
```
Install the last docker version docker :
```zsh
curl + curl -sSL https://test.docker.com/ | sh
sudo usermod -aG docker allgo
/etc/init.d/docker start
```
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 insecure registry*
As we do not have an HTTPS certification yet, you need to allow an insecure registry in cargo server (see below) :
####Debian < v8
```zsh
sudo nano /etc/default/docker
```
Then modify the line concerning DOCKER_OPTS to have: ```DOCKER_OPTS="--insecure-registry <registry_ip>:5000"```.
(or myregistry:5000 if development or other server)
#####Debian >= v8
```zsh
sudo nano /lib/systemd/system/docker.service
```
Change one line to have ```ExecStart=/usr/bin/docker --insecure-registry <registry_ip>:5000 -d -H fd://```
```zsh
sudo systemctl daemon-reload
sudo /etc/init.d/docker restart
```
##Sid - Sandbox
It's the same as worker, but we use it when an user install an application/algorithm.
We create the docker image and push it to the registry
##Cargo
Cargo run the docker image registry, which allow us to store our own docker images.
We use a NAS to replicate the created images, it's safer.
Install docker (same as above)
*To run the registry, with external storage*
```zsh
docker pull registry
docker run -d -p 5000:5000 -e SETTING_FLAVOR=dev -e STORAGE_PATH=/the_folder_of/your_choice_on_container/ -v /the_folder_of/your_choice/on_host:/the_folder_of/your_choice_on_container/ registry:latest
```
It's unsecure for the moment.
#The development environment :
You can use the Vagrantfile for Virtualbox (no provisioning yet)
Or follow those instructions :
Create 4 or 5 VM (depends of if you want to use your host as web server)
Add in VirtualBox second host-only adapter in the Network tab, with DHCP.
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:
```zsh
ssh allgo@192.168.56.<machine number> mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh allgo@192.168.56.<machine number> 'cat >> .ssh/authorized_keys'
```
#What is Allgo? (A||Go)
###Change the hostname of your machines
After cloning your machines, they'll all have the name worker 0. To change that:
```zsh
sudo nano /etc/hostname
```
Change the name and then:
```zsh
sudo /etc/init.d/hostname.sh start
```
A || Go is a web infrastructure to put online quickly and easily possible software or scientific prototypes. The objective is to reduce the cost of transferring
the computer researcher to end users (team member, community
Scientific Startup SMEs, the general public).
Application deployment, and especially their uses are found in simplified. One can execute via the web interface or an HTTP API.
Technically, A||Go is based on the Ruby on Rails framework to provide the web interface and HTTP services REST. Use of Docker for managing application images.
Docker provides Linux containers to manage / store / apps we use host.
A job is the action to run an application, with one file or more, which will return a result.
---
#To mount datastore :
nfs-kernel on main server (woody)
on node : vim /etc/fstab
add : woody.irisa.fr:/mnt/datastore /mnt/datastore nfs user 0 0
do : mount /mnt/datastore
sudo vim /etc/exports
/mnt/datastore/ worker0.irisa.fr(rw,all_squash,anonuid=1000,anongid=1000,sync)
/mnt/datastore/ worker1.irisa.fr(rw,all_squash,anonuid=1000,anongid=1000,sync)
/mnt/datastore/ sid.irisa.fr(rw,all_squash,anonuid=1000,anongid=1000,sync)
If you want to contribute:
##Cargo
You need to install docker-registry on it:
```zsh
docker pull registry
```
You can fork the project, create a branch and make a pull-request.
You can refeer to the gitlab issues.
Our main need is someone who know ruby on rails testing.
When running the registry, you need to mount a datastore:
```zsh
docker run -d -p 5000:5000 -e SETTING_FLAVOR=dev -e STORAGE_PATH=/osef/ -v /home/allgo/docker/:/osef/ registry:latest
```
To deploy the test environment, you will need Vagrant.
Go in /deploy folder and run vagrant up, you don't need any particular software on your computer.
For more information on the infrastructure, you can refeer to the /doc folder.
This diff is collapsed.
#Architecture
![](allgo.jpg)
## Woody (web server) - Debian 8
### What
Allgo frontend via the web application in RoR. We also have the datastore on Woody, to store files from jobs, and the SQL database.
### Need
Ruby 2.2.2-dev, Nginx, mariadb, ruby + rails via rvm, rails app (via capistrano), redis, git, zip, curl, sudo
### How
su -c "adduser allgo"
su -c "usermod -aG sudo allgo"
su allgo
Use RVM to install the correct version of Ruby
```zsh
\curl -sSL https://get.rvm.io | bash
rvm install ruby-2.2.2-dev
rvm --default use ruby-2.2.2-dev
```
Install the gem bundler to download the dependancies
```zsh
gem install bundler
```
```zsh
sudo apt-get install mariadb-devel redis -y
sudo service redis enable (to launch at boot)
sudo service redis start
sudo service mariadb enable
sudo service mariadb start
```
To run the project you need to migrate the project's database, there are backup in db/backup
```zsh
rake db:create ( RAILS_ENV=production )
rake db:migrate ( RAILS_ENV=production )
```
Then launch the project and check if there is no error message in the correct port:
```zsh
rails s
```
We also need to run sidekiq separately :
```zsh
bundle exec sidekiq (-e production)
```
##WorkerX
### What
The worker are server that will execute job created by users in Allgo.
we sent the command through ssh from Woody and send a docker pull request to cargo (see below)
the datastore from woody is mount through ssh so Worker can write in.
### Need
Docker 1.6, openssh-server
### How
```zsh
su -c "apt-get update && apt-get install sudo openssh-server -y"
su -c "adduser allgo"
su -c "usermod -aG sudo allgo"
su allgo
```
Install the last docker version docker :
```zsh
curl + curl -sSL https://test.docker.com/ | sh
sudo usermod -aG docker allgo
/etc/init.d/docker start
```
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 insecure registry*
#####Debian >= v8
```zsh
sudo nano /lib/systemd/system/docker.service
```
Change one line to have ```ExecStart=/usr/bin/docker --insecure-registry <registry_ip>:5000 -d -H fd://```
```zsh
sudo systemctl daemon-reload
sudo /etc/init.d/docker restart
```
###Sid - Sandbox
It's the same as worker, but we use it when an user install an application/algorithm.
We create the docker image and push it to the registry
###Cargo
Cargo run the docker image registry, which allow us to store our own docker images.
We use a NAS to replicate the created images, it's safer.
Install docker (same as above)
*To run the registry, with external storage*
```zsh
docker pull registry
docker run -d -p 5000:5000 -e SETTING_FLAVOR=dev -e STORAGE_PATH=/the_folder_of/your_choice_on_container/ -v /the_folder_of/your_choice/on_host:/the_folder_of/your_choice_on_container/ registry:latest
```
To deploy TLS certificate, you can read docker documentation.
###To mount datastore :
nfs-kernel on main server
on each node:
- modify the file: /etc/fstab
- add line: main.server:/mnt/datastore /mnt/datastore nfs user 0 0
- do: mount /mnt/datastore
- modify the file: /etc/exports
/mnt/datastore/ worker1(rw,all_squash,anonuid=1000,anongid=1000,sync)
/mnt/datastore/ worker2(rw,all_squash,anonuid=1000,anongid=1000,sync)
/mnt/datastore/ sid(rw,all_squash,anonuid=1000,anongid=1000,sync)
#The development environment :
Note that we don't use nginx or TLS in development, because it required auto-signed certificate that I don't know how to do (yet).
You can use the Vagrantfile for Virtualbox (easy way)
Or follow those instructions (hard way, and you will need to read the production environment):
Create 4 or 5 VM (depends of if you want to use your host as web server)
Add in VirtualBox second host-only adapter in the Network tab, with DHCP.
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:
```zsh
ssh allgo@192.168.56.<machine number> mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh allgo@192.168.56.<machine number> 'cat >> .ssh/authorized_keys'
```
##Cargo
You need to install docker-registry on it:
```zsh
docker pull registry:2.1
```
When running the registry, you need to mount a folder which will contain the datastore:
```zsh
docker run -d -p 5000:5000 -e SETTING_FLAVOR=dev -e STORAGE_PATH=/your_choice_on_container/ -v /home/allgo/docker/:/your_choice_on_container/ registry:2.1
```
In this case, the images will be accessible in cargo machine, in /home/allgo/docker folder
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment