P2P Pool Manager

From Grid-Appliance Wiki

Jump to: navigation, search

Contents

Pre-requisites

This tutorial assumes that you have gone through the below tutorials.

P2PPool Manager

P2PPool Manager is a Joomla module that provides the ability to deploy and monitor P2P infrastructures that use Brunet. To understand what happens behind a Brunet deployment read this. The P2P infrastructure can be used as a bootstrap network for running IPOP pools. Managing and monitoring P2P pools with large number of nodes can be a daunting task. By using the web user-interface, one can easily create P2P pools, check the number of nodes in a pool, check a pool's health (consistency) or find the location of the running nodes on google maps.

The WebUI in P2PPool Manager allows users to register with your website which would enable them to create and manage groups for forming GroupVPNs and GroupAppliance. These features are similar to the ones provided on our website www.grid-appliance.org (under the user menu). The configuration files which are used by GroupVPN and GroupAppliance should be prepared in specific formats: GroupVPN uses a compressed zip file containing the config files and certificates where as GroupAppliance/Grid-Appliance uses a virtual floppy image format. By using this WebUI, users would easily be able to prepare and download the configuration files in the required format (config.zip for GroupVPN and floppy.img for GroupAppliance). Some companies or organizations would like to maintain their own database of users and groups. In such cases also, P2PPool Manager is a fast and easy way to achieve this.

The source code for P2PPool Manager is available via git from here. You can either create your own P2PPool Manager by installing the packages mentioned in P2PPool Manager Packages or you can use the WebUI VM appliance. We recommend using the VM appliance for setting up P2PPool Manager as we are still working on the installation steps.

The Appliance

This VM appliance uses Ubuntu 9.10 i386 and is made for VMware but should be compatible with KVM and VirtualBox.

Download the appliance from here.

Note that GroupAppliance floppies built with this appliance are not usable on older GridAppliance (versions before 2.04), but it can be used to create floppies for Amazon EC2

Username / passwords used in the appliance:

  • Appliance
    • ubuntu = ubuntu / password
    • root = sudo bash as ubuntu
    • www = sudo -u www-data bash as ubuntu
  • MySQL
    • Root = root / (empty)
  • Joomla
    • Root = admin / password

Accessing Joomla depends on your setup, but the Apache server is running on port 80 and 443 for http and https respectively.

Preparation

Preparing The Network

  • The machine running P2PManager should be able to access all the remote nodes it is managing and vise-versa.
  • The remote machines should be running Linux with Mono or with a glibc equal to or newer than the one on the web site (for mkbundle)
  • You should be able to do password-less SSH using a common name and ssh-key on all the machines. Follow the below steps to ensure this:
    • Ensure that all machines can accept ssh connections on the standard port
    • Create a new public-private key pair on any one of the machines by using the command "ssh-keygen -t rsa" and following the instructions shown on screen. Use a blank passphrase.
    • Add the public key to the file authorized_keys (default location: <home_directory_of_common_user>/.ssh/) in all the remote machines. The file containing the private key needs to be uploaded to the web interface.
  • All remote nodes should have a path where the user can store files

Preparing The Code

We provide pre-built bundles that can be obtained from here. In order to use those, you must create a new zip file with P2PNode.exe and the dll files in the root directory, see this for an example. If you would like to create your own, run "nant plabtest-build" inside of the Brunet root directory, the result will be a basicnode.zip file which can be uploaded to the interface.

Settling In

  • If you want the Google maps API to work correctly, see this. The code base has been setup with the address of 127.0.0.1, so if you use ssh port redirection, it will work fine.
  • To add a user, they need to be a user type (group) of Administrator, Super Administrator, or Publisher. An excellent Joomla documentation is available here.
  • Users can create menu links to their map statistics, to do this please see the Joomla docs.

User Interface Features

Management Actions

To see the Management Actions, log into the WebUI as the admin and click on the P2PPools in user menu.

  • Create - Use this option to create a P2P pool for the first time. Creating the pool does the following:
    • Registers the pool with the system
    • Creates the folder components/com_p2ppool/data/$PoolName, where all non-private data will be stored
    • Uploads node files and ssh key (to a private non-web readable directory, must have .htaccess enabled!)
    • Generates config files
    • Generates a deployable version of the system in install.tgz
    • Starts a local running instance

While filling the options, please take note of the follwoing:

  1. Pool Name - Enter a single word for the pool name
  2. Username - This is the common username which is configured on all the remote systems with the same ssh-key (explained earlier)
  3. List of nodes - Provide the file containing a line limited list of all the nodes which would run the P2P software
  4. Zip file of P2P software - The P2P software (basicnode.zip) explained in the above step
  5. SSH Key - Upload the file containing private key so that P2PManager can do password-less ssh to all the nodes with the common username
  • Stop - Removes a pool and all its data from the system
    • Notifies the OS to uninstall all nodes from remote hosts
    • Stops the P2PNode
    • Sets the uninstall flag
  • Upgrade - Identical to Install with emphasis on update instead of create
  • Gather logs - Gathers all the logs in the system and places them in components/com_p2ppool/data/$PoolName/logs.zip
  • Crawl - Automated every 30 minutes - checks the pool for status information
  • Check - Automated every 24 hours - checks all nodes in the system to ensure software is running
  • UninstallCheck - Automated every 24 hours - garbage collection for Stop

All management tasks ensure that the local BasicNode is running, except of course Stop and UninstallCheck If at any time you decide to upgrade your pool, please update your namespace. In the future, we will work on improving our scripts to detect out of version sites and upgrade them. Using different namespaces, will allow you to take advantage of that feature. Finally, remember actions take time to complete and please do not interrupt an install with another install, unless you want to have to run the install again later as operations do not interrupt each other. Also, if you run an uninstall over an install, it may not properly uninstall all nodes from remote resources.

User Actions or Management Views

To see the User Actions or Management Views, click on the P2PPools in user menu.

  • NodeStats - Show statistics of all nodes in the current snapshot (last crawl)
  • SystemStats - Show a summary of the system for the last 20 crawls
  • Map - Show a distribution of all nodes in the current snapshot

Small Bootstrap Environments

To assist in small bootstrap environments, multiple nodes can be started in a single process. Currently the user interface in P2PManager does not provide an option of starting multiple nodes in a single process. However, you can do this by editing the python script "/home/www/joomla/components/com_p2ppool/scripts/python/JoomlaNode.py" in the WebUI VM. Change line number 40 as shown below:

      app = "P2PNode.exe -c20 -n"

Specify the number of nodes per process you would like to start with the -c parameter. In the above example, each process would start 20 nodes.

For small environments it would be desirable to have the WebUI VM itself as a P2PNode. To do this, prepare the WebUI VM as if it is a remote node.

If you plan to have only the WebUI VM in the P2P pool, follow the below instructions:

1. Lets use the user "ubuntu" as the common user. Follow the below steps to create the ssh keys

ubuntu@ubuntu:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa):
Created directory '/home/ubuntu/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ubuntu/.ssh/id_rsa.
Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub.

Enable password-less ssh:

ubuntu@ubuntu:~$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

2. Log into the Webui using the "admin" user id and choose the option to create a P2P pool. Follow the below instructions while creating the pool:

  • Line delimited list of nodes: Upload a file containing the IP address or hostname of the WebUI VM.
  • Zip files of P2P software: Upload the package containing basicnode.zip
  • SSH Key: upload the file id_rsa which contains the private key

Clicking on submit button would start the P2PNode process with WebUI.

Appendix

Packages Used In Installation

  • SSL Enabled Apache
  • PHP w/ MySQL and mod-php5 for Apache
  • MySQL
  • A working copy of Joomla
  • Mono 1.92 or above
  • unzip
  • If you're going to use mkbundle:
    • 32-bit machine
    • An older glibc (like 2.4 or earlier) -- Like Debian 4
    • binutils (for as)
    • gcc
    • zlib1g-dev
  • Add the following to cron via cron -e:
    •  30 * * * * wget -q "http://127.0.0.1/index.php?option=com_p2ppool&task=cron" &> /dev/null 
    •  0 * * * * wget -q "http://127.0.0.1/index.php?option=com_p2ppool&task=cron" &> /dev/null 
  • Python with mysqdb

Current Issues

  1. Management issues:
    1. Ability to specify a date range and be returned a CSV log containing the specified data
    2. Ideally have a better mechanism of notifying users of the status of tasks (preferably via AJAX)
    3. Upgrade path for future versions without deleting pool history
    4. Many of the calls are idempotent and wait for the previous instance to finish before they will be able to run, though they are not queued, so a user has to reinitiate. Perhaps there should be a work flow management, which would be especially useful for those wanting to test.
    5. Actions that may affect other actions do not preempt or not run. Examples:
      1. An stop on a pool should preempt all actions on that pool, it only stops the running basicnode for now
      2. An install / upgrade on a pool should preempt all actions on a that pool, except Stop
    6. There should be a suspend task, which would be useful for those that want to keep pool history but don't want to have an active pool.
    7. Users should be able to automate tasks and the task automation engine could be improved to do work flows.
    8. Managers should be able to configure default views for system and node status pages through the web front end
    9. Installation verification
    10. A version of mono that can be distributed with the code instead of using mkbundle
  2. User issues:
    1. There should be a way to create a configuration file for the pool
    2. Users should be able to select which fields to view in the system and node status pages
  3. Infrastructure issues:
    1. We no longer are collecting memory and cpu, that should be remedied
Personal tools