Skip to content

Deploying a New Roomtrol Controller

jclyons edited this page Sep 6, 2012 · 9 revisions

Preparing the Asus Net Top Box

  1. Plug the box into the wall, a VGA or DVI monitor, a keyboard, and the network.
  2. Find a plain Ubuntu 10.04 Server USB stick. Plug it into the Roomtrol box's back USB port. Power on the machine.
  3. The USB stick setup program usually proceeds through an entire installation of Ubuntu Server without asking any questions. If it does ask a question just hit yes or continue so that it can proceed.
  4. When it restarts after finishing, you should be sitting at a Ubuntu login prompt. Log in using username 'roomtrol' and the labuser password.

Add the Asus Box to the Hardware Inventory

So that Wesleyan's DHCP server assigns it the same IP/hostname assigned to it every time, we need to add the Asus box to the hardware inventory.

  1. Generate and print out an inventory bar code for the Asus box using the bar code printer in the IMS office. Note the number of the unique bar code, beginning with "EQP".]

  2. Having logged into the roomtrol account, type 'ifconfig eth0' at the bash shell prompt. This will tell you the IP address that was initially assigned to the box. It will also tell you the HWaddr(MAC address) of the box's ethernet controller. NOTE: Do not shut down the box or restart before completing the rest of these hardware inventory steps. This could cause you to lose this IP.

  3. Make sure you have hardware inventory access in your portfolio.

  4. More or less using an existing Roomtrol hardware inventory record as a guide, add a new hardware inventory record with the assigned IP/HWAddr/Bar code that you retrieved in steps 1 and 2. When you get to the 'Machine name" field, use the naming convention: roomtrol-ROOMNUM. Make sure you are in the 'class' subdomain. Thus, the final hostname will be roomtrol-ROOMNUM.class.wesleyan.edu, where ROOMNUM is the building name/room number, i.e. fisk101.

Change the hostname of the box to reflect inventory hostname:

You need to go into /etc/hosts and change the following line:

   127.0.1.1	ubuntu.wesleyan.edu	ubuntu

to read:

   127.0.1.1	roomtrol-ROOMNUM.class.wesleyan.edu	roomtrol-ROOMNUM

You also need to change /etc/hostname to read:

    roomtrol-ROOMNUM

Restart the box to make these changes take effect.

Set up RVM/Ruby on your administration machine.

Go to the machine you're planning to administer the new Roomtrol controller from.

First, install RVM:

curl -L https://get.rvm.io | bash -s stable --ruby

Install Ruby 1.9.3:

 rvm install 1.9.3

Make sure you are using the newly installed Ruby 1.9.3:

 rvm use 1.9.3

Install Chef gem:

 gem install chef

Setting up your local machine

We must set up Chef locally, on the machine you're going to deploy from, and register it with the Chef server.

First, you need to create a .chef directory in your home directory. Then you need to get USERNAME.pem file and a ORGANIZATION-validator.pem. Each of these is only generated once. The USERNAME.pem client key is created upon client creation in the Chef web administration console (http://imsvm.wesleyan.edu:4040 ) . It must be copied and posted into the .chef directory. The validator key was generated when Chef server was first set up. You can copy it from another machine that already has Chef. It should be located at /etc/chef/validation.pem. Copy it to the same location on the new machine.

Then you need to run the following in your home directory:

 knife configure

This will guide you through the process of generating a knife.rb file to set up your local machine as a Chef client. If the process works, the following command should return a list of Chef nodes:

 knife node list

If you are planning to modify the recipes/cookbooks in any way, you must clone the Chef repository:

 git clone [email protected]:/imsdev/roomtrol-chef).

Bootstrapping a node

In order to make a vanilla Ubuntu server install a Roomtrol machine, we need first to bootstrap Chef. This can easily be done with the following command:

knife bootstrap HOSTNAME --distro ubuntu10.04-gems -x roomtrol --sudo -P PASSWORD

Now, the node should be all set up and ready to be deployed to. Verify this with the following command:

knife node list

You should see your new node in that list, though its name may be not what you expect. That name is the node's fully-qualified domain name (FQDN) and is how we will identify the node in the following commands.

Deploying to a node

First, add the roomtrol-controller role to the node. This makes it so that the node gets all of the recipes associated with being a controller.

knife node run_list add NODE_FQDN "role[roomtrol-controller]"

Finally, log into the node via SSH and run the following command

sudo chef-client

And after a (potentially long time) everything should be set up!

Deploying roomtrol-daemon

Now that chef-client has run successfully, we have our base system set up. This system the provides all the dependencies(i.e. couchdb, rabbitmq, nginx) that roomtrol-daemon needs to run. However, we have not yet installed Roomtrol itself.

In order to do so, first, clone the roomtrol-daemon repository at imsdev/roomtrol-daemon :

git clone [email protected]:/imsdev/roomtrol-daemon

For consistency's sake, make sure you've installed the entire bundle of Roomtrol's Ruby dependencies:

bundle install

Edit servers.json, replacing "roomtrol-dev1.class.wesleyan.edu" with the hostname of whatever controller you are pointing to, i.e. roomtrol-fisk101.class.wesleyan.edu. Servers.json tells our deploy task which machine we're attempting to deploy roomtrol on.

Run the deploy_test rake task, which should zip up roomtrol, transfer it to the machine, unpack it, and attempt to run it for the first time:

 rake deploy_test

Finally, run the deploy_tp rake task, which will transfer the touchscreen web interface to the controller:

 rake deploy_tp 

Plug in a touchscreen to the roomtrol box. X should restart and you should see the "Server disconnect" screen. Roomtrol is installed, but since we haven't configured our CouchDB database yet, it can't yet run.

Configure roomtrol-daemon via CouchDB

Open a web browser, and navigate to the CouchDB web interface at http://roomtrol-ROOMNUM.class.wesleyan.edu:5984/_utils .

Click on "Replicator" on the side panel. In order to greatly simplify configuration, we're going to replicate the 'rooms' database of an existing Roomtrol controller to our new Roomtrol controller. It can be almost any other box in any room with an AV configuration that's similar to the one to which we're deploying. So, put the address of a source CouchDB rooms database into the left side of the Replicator page, ex. http://login:[email protected]:5984/rooms . Make the destination database the local "rooms" database, where login:password are the authentication details for the source database(usually login: 'roomtrol'. Get someone to tell you the password.). Click Replicate.

Go back to the Overview page, and click on "rooms." There should be a bunch of new documents in the Rooms database. Change the view to "by_mac." There should be two mac addresses listed. One is the MAC address of the current box, and the other is the MAC address of the box you replicated from. The document for the current box is an empty configuration that is created by default by roomtrol-daemon when it can't find an existing entry for the MAC address. We want to use the complete configuration we replicated from the other controller as our configuration. So you need to copy the MAC address from the empty configuration into the complete configuration's MAC address field, and delete the empty configuration document. This should be pretty straight-forward using the web interface. Just remember that to edit something on the CouchDB page you have to double click it. Also, remember that you must click both the green checkmark and "Save Document" in order to save changes.

Finally, we need to restart roomtrol-daemon to take account of the changes we made. Log in via SSH to the box and run the following command:

 sudo restart roomtrol-daemon

This will restart roomtrol-daemon, which should be running properly now. In about 10 seconds the touchscreen interface should reconnect to the daemon, and you should be able to use it.

There might be a couple other configuration details to change for a new room. For instance, the URI of the PJLink-compliant or the BluRay players need to be changed to reflect the address of the projector/Blu-Ray player in the new room. All of these documents are editable under the "devices_for_room" view in the CouchDB rooms database.