ansible-lssd/README.md

150 lines
3.4 KiB
Markdown
Raw Normal View History

2013-10-11 00:34:03 +00:00
ansible-lssd
============
Large scale server deploys using BitTorrent. aria2c, NodeJS Bittorrent-tracker and mktorrent are used.
2013-10-15 13:28:00 +00:00
2013-10-15 12:23:13 +00:00
DESCRIPTION
-----------
2013-10-15 13:14:16 +00:00
ansible-lssd is a method of using Bittorrent to distribute files to a large amount of servers within a production environment.
2013-10-15 13:14:16 +00:00
ansible-lssd operates as a playbook of [Ansible](https://github.com/ansible/ansible).
2013-10-21 03:45:31 +00:00
These playbooks require Ansible 1.4.
2013-10-15 13:14:16 +00:00
These playbooks were tested on CentOS 7.x (ansible 2.6) with peers on Centos 7.x and Centos 6.x.
2013-10-15 12:23:13 +00:00
2013-10-15 13:45:56 +00:00
Advantage
---------
There is the following advantage as compared with Murder.
* *Ruby is not required* to run on only python.
* *Capistrano is not required*. run in the ansible playbooks.
* Environment setup is automated by playbook.
2013-10-15 12:23:13 +00:00
2013-10-15 14:18:33 +00:00
Installation of software required minimum
-----------------------------------------
2013-10-15 12:23:13 +00:00
From EPEL:
# yum -y install ansible
2013-10-15 12:41:47 +00:00
2013-10-15 12:23:13 +00:00
HOW IT WORKS
------------
Same as the "[HOW IT WORKS](https://github.com/lg/murder/blob/master/README.md#how-it-works)" of Murder.
2013-10-15 15:06:32 +00:00
CONFIGURATION
2013-10-15 12:23:13 +00:00
-----------------------
You define `tracker`, `seeder` and `peer` server to inventory (./production) file.
All involved servers must have python installed.
2013-10-15 12:23:13 +00:00
The file group_vars/all contains the configuration.
2013-10-15 12:23:13 +00:00
2013-10-15 15:06:32 +00:00
MANUAL USAGE
------------
2013-10-15 12:23:13 +00:00
Modify a ./production and ./group_vars/all, manually define servers:
2013-10-15 12:41:47 +00:00
./production:
```INI:production
# ansible host
[ansible_host]
localhost ansible_connection=local
# tracker node
[tracker]
2013-10-18 13:58:01 +00:00
10.0.0.1 node_type=tracker
2013-10-15 12:41:47 +00:00
# seeder node
[seeder]
2013-10-18 13:58:01 +00:00
10.0.0.1 node_type=seeder
2013-10-15 12:41:47 +00:00
# peer nodes
[peer]
10.1.1.1
10.1.1.2
10.1.1.3
```
group_vars/all:
```YAML:group_vars/all
# deploy tag
tag: Deploy1
# path
seeder_files_path: ~/builds
destination_path: /opt/hoge # or some other directory
```
2013-10-15 12:23:13 +00:00
2013-10-15 15:06:32 +00:00
The destination_path, by setup.yml, specify the directory to be placed in the all server of Murder library and support files etc..
Then manually run the ansible playbooks:
2013-10-15 12:23:13 +00:00
1. Start the tracker:
2013-10-15 12:41:47 +00:00
```bash:
$ ansible-playbook -i production start_tracker.yml
2013-10-15 12:41:47 +00:00
```
2013-10-15 12:23:13 +00:00
2. Create a torrent from a directory of files on the seeder, and start seeding:
2013-10-15 12:41:47 +00:00
```bash:
# copy to seeder node
$ scp -r ./builds 10.0.0.1:~/builds
# create torrent file
$ ansible-playbook -i production create_torrent.yml
2013-10-15 12:41:47 +00:00
# start seeding
$ ansible-playbook -i production start_seeder.yml
2013-10-15 12:41:47 +00:00
```
2013-10-15 12:23:13 +00:00
3. Distribute the torrent to all peers:
2013-10-15 12:41:47 +00:00
```bash:
$ ansible-playbook -i production deploy.yml -f 1000
2013-10-15 12:41:47 +00:00
```
2013-10-15 12:23:13 +00:00
4. Stop the seeder and tracker:
2013-10-15 12:41:47 +00:00
```bash:
$ ansible-playbook -i production stop_seeder_and_tracker.yml
2013-10-15 12:41:47 +00:00
```
2013-10-15 12:23:13 +00:00
When this finishes, all peers will have the files in /opt/hoge/Deploy1
2013-10-15 13:00:42 +00:00
MAIN PLAYBOOKS REFERENCE
------------------------
2013-10-15 12:59:24 +00:00
* `create_torrent.yml:`
* Create torrent file on seeder node.
* `deploy.yml:`
* Deploy files on peer nodes.
* `setup.yml:`
* Install the software required for each node.
* `full_deploy.yml:`
2013-10-15 12:59:24 +00:00
* Run all Playbook deploy from the setup.
* `start_seeder.yml:`
* start seeding.
* `start_tracker.yml:`
* start tracker.
* `stop_all_peers.yml:`
* stop all peer client.
* `stop_seeder_and_tracker.yml:`
* stop seeding and tracker.
NOTES
------------------------
2013-10-15 12:59:24 +00:00
You may hit the request length limit (fixed in newer aria2 releases) :
https://github.com/aria2/aria2/commit/e220c5384961f9261f19c28cd0b85f76f06d8993#diff-03671aebef9174610c96db97917b960a
2013-10-15 12:59:24 +00:00
Workaround is using "-l 22" as mktorrent option to make less pieces.