ansible-lssd/README.md

170 lines
4.0 KiB
Markdown
Raw Normal View History

2013-10-11 00:34:03 +00:00
ansible-lssd
============
2013-10-15 12:59:24 +00:00
Large scale server deploys using BitTorrent and the BitTornado library by [Murder](https://github.com/lg/murder).
2013-10-15 13:28:00 +00:00
Mechanism is the same as Murder.
2013-10-15 13:29:01 +00:00
For an intro video, see: [Twitter - Murder Bittorrent Deploy System](http://vimeo.com/11280885)
2013-10-15 13:28:00 +00:00
2013-10-15 13:44:53 +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
DESCRIPTION
-----------
2013-10-15 13:14:16 +00:00
ansible-lssd is a method of using Bittorrent (Powered by [Murder](https://github.com/lg/murder)) to distribute files to a large amount of servers within a production environment.
ansible-lssd operates as a playbook of [Ansible](https://github.com/ansible/ansible).
These playbooks require Ansible 1.3.
These playbooks are meant to be a reference and starter's guide to building Ansible Playbooks. These playbooks were tested on CentOS 5.x so we recommend that you use CentOS to test these modules.
2013-10-15 12:23:13 +00:00
QUICK START
-----------
2013-10-15 12:41:47 +00:00
For the impatient, `sudo pip install ansible` :
```bash:
# install pip (Python package manager) and ansible
$ sudo easy_install pip
$ sudo pip install ansible
```
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.
CONFIGURATION AND USAGE
-----------------------
You define `tracker`, `seeder` and `peer` server to inventory (./production) file.
2013-10-15 13:24:22 +00:00
All involved servers must have python installed and the related murder
support files (BitTornado, Murder lib, screen, pigz and etc.). To upload the support files to the tracker, seeder, and peers, run:
2013-10-15 12:41:47 +00:00
```bash:
$ ansible-playbook -i prodction setup.yml
```
2013-10-15 12:23:13 +00:00
By default, these will go in `/usr/local/murder` in your apps deploy directory.
Override this by setting the variable `remote_murder_path`.
Before deploying, you must start the tracker:
2013-10-15 12:41:47 +00:00
```bash:
$ ansible-playbook -i prodction start_tracker.yml
```
2013-10-15 12:23:13 +00:00
At this point you should be able to deploy normally:
2013-10-15 12:41:47 +00:00
```bash:
$ ansible-playbook -i prodction deploy.yml
```
2013-10-15 12:23:13 +00:00
MANUAL USAGE (ansible-lssd without a deploy strategy)
-----------------------------------------------------
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]
10.0.0.1
# seeder node
[seeder]
10.0.0.1
# 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
To distribute a directory of files, first make sure that murder is set
up on all hosts, then manually run the murder cap tasks:
1. Start the tracker:
2013-10-15 12:41:47 +00:00
```bash:
$ ansible-playbook -i prodction start_tracker.yml
```
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 prodction create_torrent.yml
# start seeding
$ ansible-playbook -i prodction start_seeder.yml
```
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 prodction deploy.yml
```
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 prodction stop_seeder_and_tracker.yml
```
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.
* `rm_tgz.yml:`
* Delete the file deployment of targz in all peer node.
* `setup.yml:`
* Install the software required for each node.
* `site.yml:`
* 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.