Thrift Tutorial on Ubuntu 11.10
What is Thrift and how can it help you and your team build a highly scalable platform for web services? According to its project page [1], “Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml.” Although Facebook open sourced it in April 2007, its documentation could be improved to make it easier to try out and start building prototypes. Even the project’s tutorial page is still a work-in-progress. So, here’s my version of such, specifically for Java on Ubuntu 11.10. I hope you find it useful.
Get Thrift
First, make sure your system meets the requirements specified at [2]. Here’s how you can install the required packages on Ubuntu 11.10.
$ sudo apt-get update
$ sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
Then, install the Java OpenJDK and ant.
$ sudo apt-get install openjdk-6-jdk ant
Now you can get Thrift. I chose to checkout Thrift from the Apache SVN repository.
$ cd ~/svn
$ svn co http://svn.apache.org/repos/asf/thrift/trunk thrift
You can also simply download the stable, snapshot or archived releases of Thrift from [3].
Build and Install
Now, you’re ready to build and install Thrift on your system.
$ cd thrift
$ ./bootstrap.sh
$ ./configure
$ make
$ sudo make install
$ thrift -version
Your First Thrift File
The tutorial directory, thrift/tutorial, contains the files tutorial.thrift and shared.thrift. Cleverly, the tutorial.thrift file teaches you Thrift in a .thrift file! Read those files and start learning.
Build for Java
At this point, you’re probably itching to see something running. For this tutorial, I chose the Java example. The tutorial directory, thrift/tutorial, contains examples under each language’s directory. But, before you can run the Java example, you have to compile the Java library first.
$ cd ~/svn/thrift/lib/java
$ ant
Now, you get to see the code generation engine at work.
Using The Thrift Compiler
$ cd ~/svn/thrift/tutorial
The following command tells Thrift to generate Java code. The -r option tells it to also generate included files.
$ thrift -r –gen java tutorial.thrift
After the command runs, you should see a directory called gen-java. If you look under that directory, you should see two directories: shared and tutorial.
Compile The Example
Now that the code has been generated, you can compile the Java example.
$ cd ~/svn/thrift/tutorial/java
$ ant
Running A Thrift Server
Now, for what you’ve been waiting for, a working example of a client/server application working through Thrift!
$ ./JavaServer &
Starting the simple server…
Starting the secure server…
Running A Thrift Client
$ ./JavaClient simple
If all is well, you should see something like the following:
ping()
1+1=2
Whoa we can divide by 0
15-10=5
Check log: 5
Other Languages
Make sure to try out the other examples for the other languages under each respective directory. You may need to install additional packages to support other languages. Please refer to [5].
References:
How To Install RabbitMQ Server and pika on Ubuntu 10.10
RabbitMQ provides a messaging mechanism for applications, based on a protocol called AMQP. pika is one of the python libraries that understands AMQP.
Here are the steps I took:
Install or upgrade python
$ sudo apt-get install python
Install python-pip and git-core, since the pika installation depends on these packages.
$ sudo apt-get install python-pip git-core
Install the RabbitMQ server package
$ sudo apt-get install rabbitmq-server
Install pika using the pip package management tool
$ sudo pip install pika==0.5.2
Create the code for the sender application, send.py
$ vi send.py
#!/usr/bin/env python import pika connection = pika.AsyncoreConnection(pika.ConnectionParameters(host='localhost', credentials=pika.PlainCredentials('guest', 'guest'))) channel = connection.channel() channel.queue_declare(queue='test') channel.basic_publish(exchange='',routing_key='test',body='Hello World!') print " [x] Sent 'Hello World!'"
Create the code for the receiver application, receive.py
$ vi receive.py
#!/usr/bin/env python import pika connection = pika.AsyncoreConnection(pika.ConnectionParameters(host='127.0.0.1',credentials=pika.PlainCredentials('guest', 'guest'))) channel = connection.channel() channel.queue_declare(queue='test') print ' [*] Waiting for messages. To exit press CTRL+C' def callback(ch, method, header, body): print " [x] Received %.20r" % (body,) channel.basic_consume(callback,queue='test',no_ack=True) pika.asyncore_loop()
Check that RabbitMQ is running.
$ sudo rabbitmqctl status
Status of node ‘rabbit@web-server’ …
[{running_applications,[{rabbit,”RabbitMQ”,”1.8.0″},
{mnesia,”MNESIA CXC 138 12″,”4.4.12″},
{os_mon,”CPO CXC 138 46″,”2.2.4″},
{sasl,”SASL CXC 138 11″,”2.1.8″},
{stdlib,”ERTS CXC 138 10″,”1.16.4″},
{kernel,”ERTS CXC 138 10″,”2.13.4″}]},
{nodes,[‘rabbit@web-server’]},
{running_nodes,[‘rabbit@web-server’]}]
…done.
Send a message in one window.
$ python send.py
[x] Sent ‘Hello World!’
List the queues and see how many messages are in them.
$ sudo rabbitmqctl list_queues
Listing queues …
test1
…done.
Receive a message in another window.
$ python receive.py
[*] Waiting for messages. To exit press CTRL+C
[x] Received ‘Hello World!’
List the queues again.
$ Listing queues …
test0
…done.
Kill the receive.py
– Use CTRL+C to interrupt and kill the receiver process
Enjoy!
References:
1. RabbitMQ Python & Pika Tutorial
http://www.rabbitmq.com/tutorials/tutorial-one-python.html
2. AMQP
Ubuntu Natty Beta 1 ISO Testing
Hi folks,
Ubuntu Natty Beta 1 is scheduled for release this week, so we’re asking for your help to test the ISO images. This will ensure the good test coverage we’ve had in past milestones for this release.
The procedures for testing ISO images and reporting results are explained at: https://wiki.ubuntu.com/Testing/ISO/Procedures
As soon as possible, please start syncing your ISOs so you are ready when the Release Team start posting images to the ISO tracker at http://iso.qa.ubuntu.com/qatracker/ Test results are also tracked there. If you don’t already have an account, please register, so you can submit your test results.
We will coordinate testing in #ubuntu-testing on freenode. Please go there to see what needs to be tested and what others are testing. It’ll be a lot of fun!
Thank you very much for your help and your commitment to the quality of Ubuntu!
Cheers,
Marjo
Call For Testing – NVIDIA Cards
Hi folks,
If you happen to have a system with an NVIDIA graphics card, we could certainly use your help with testing it. This testing will help ensure that users have a great user experience if they choose to use the proprietary drivers.
We are looking for volunteers to test the NVIDIA proprietary drivers. The goal of this testing is to catch regressions and fix bugs before they reach a major audience.
If you want to be part of the testing team, you will need:
1. A computer with an NVIDIA (GeForce 7 or newer) graphics card
2. A spare partition on that system
* If you don’t have a spare partition you can easily create one.
3. One hour of your time every week
4. An Internet connection
If you want to take part in this adventure, go to:
https://wiki.ubuntu.com/X/Testing/ProprietaryDrivers/Natty/WeeklyProgram
and follow the detailed instructions.
Sign up now! The first results will analyzed by tomorrow, Wednesday!
We will coordinate testing in #ubuntu-testing on freenode. Please, go there often to see what others are testing or what needs to be tested.
Thanks for helping making Ubuntu even better!
P.S. This project’s goal is to test the proprietary drivers. If you’re interested in testing the free drivers, we don’t need testing at this time, but help is always welcome. Check how at the Ubuntu X team page [1].
Natty Alpha 3 ISO Test Report
Hi folks,
Thank you to all of you who helped with the Natty Alpha 3 ISO testing. The full test report is available at: https://wiki.ubuntu.com/QATeam/ReleaseReports/NattyAlpha3TestReport
Here’s the summary for your convenience.
49 contributors reported 344 results and covered 223 test cases. Thank you to jibel, smoser, hggdh, pedro_, charlie-tca, kidsodateless, highvoltage, brendand, ricsipontaz, PatrickDK, PaoloRotolo, nobuto, Kamusin, valix, primes2h, roadmr, pitti, jamiedmattingly, RoAkSoAx, jamespage, monkeylibre, xdatap1, Fly82, Daviey, homitsu, patrickmw and ogra for testing the ISOs. Special thanks to Jean-Baptiste Lallement (jibel) for leading the testing efforts and creating the test report.
- Image Coverage : 100.0% (58/58)
- Mandatory Test Cases : 100.0% (187/187)
- Run Once Test Cases : 81.8% (36/44)
- Overall : 96.5% (223/231)
71 bugs were reported affecting a total of 74 test cases. 35 Tests failed.
- Failure Rate: 15.7% (35/223)
Bug Tasks Filed (sorted by Importance)
- Critical : 2
- High : 23
- Medium : 14
- Low : 8
- Wishlist : 1
- Undecided : 46
These are very good test coverage and bug filing results for Alpha 3 and they are due to all your efforts.
Thanks again!
Alpha 3 Announcement excerpt:
You can download Alpha 3 from here:
http://cdimage.ubuntu.com/releases/natty/alpha-3/ (Ubuntu Desktop and Server)
http://uec-images.ubuntu.com/releases/natty/alpha-3/ (Ubuntu Server for UEC and EC2)
http://cdimage.ubuntu.com/kubuntu/releases/natty/alpha-3/ (Kubuntu)
http://cdimage.ubuntu.com/xubuntu/releases/natty/alpha-3/ (Xubuntu)
http://cdimage.ubuntu.com/edubuntu/releases/natty/alpha-3 (Edubuntu)
http://cdimage.ubuntu.com/ubuntustudio/releases/natty/alpha-3/ (Ubuntu Studio)
http://cdimage.ubuntu.com/mythbuntu/releases/natty/alpha-3/ (Mythbuntu)
Alpha 3 includes a number of software updates that are ready for wider
testing. Please refer to http://www.ubuntu.com/testing/natty/alpha3 for
information on changes in Ubuntu.
This is quite an early set of images, so you should expect some bugs. For a
list of known bugs (that you don’t need to report if you encounter), please
see: http://www.ubuntu.com/testing/natty/alpha3
Kernel Bug Day – March 8, 2011
Hi folks,
Tomorrow is the next Kernel Bug Day and will be led by Jeremy Foshee. His nickname is JFo on Freenode.
The focus is again on bugs in the New state. The goal is to get as many of those into the next state with the proper level of information. The work will involve basic triage along with any additional steps, as necessary. A few of the additional steps are outlined in the kernel bug day pages [1].
Thank you all for your help in the past.
Useful links:
[0] https://wiki.ubuntu.com/Kernel/BugTriage/BugDay
[1] https://wiki.ubuntu.com/Kernel/BugTriage/Process
[2] http://voices.canonical.com/kernelteam/?p=6208
Natty Alpha 3 ISO Testing
Hi folks,
The Natty Alpha 3 candidate images are currently being built and will be ready soon. We are planning to release Alpha 3 later this week.
Please help us test those ISO images when they become available. This will ensure that we have the excellent test coverage that we aim for at each release milestone.
The procedures for testing ISO images and reporting results are explained at:
https://wiki.ubuntu.com/Testing/ISO/Procedures
Test results will be tracked at: http://iso.qa.ubuntu.com/
If you already have an account with the ISO test tracker, that’s great! If not, please register so we can keep track of your test results and be able to report on them.
Please let us know if you have any questions. We will coordinate the testing in #ubuntu-testing on freenode. Please go there to see what others are testing or what needs to be tested.
Thank you very much for your help and enjoy!
Ubuntu 10.04.2 LTS Test Report
Thanks to everyone who helped test the Ubuntu 10.04.2 LTS ISO images. The formal release announcement is below. I thought you might be interested in the test report, based on your testing efforts. Thank you to Jean-Baptiste Lallement (jibel) for leading the testing effort and creating the test report.
Lucid 10.04.2 LTS Testing Report – Feb 18th 2011
Test Coverage
27 Contributors provided 232 results and covered 161 test cases.
* Image coverage : 100.00% (26/26)
* Mandatory Test Cases : 100.00% (131/131)
* Run-Once & Optional Test Cases : 78.95% (30/38)
* Overall : 95.27% (161/169)
Failures summary
18 Bugs have been found affecting 10 Test Cases:
* Failure Rate: 5.91% (10/169)
Bugs importance:
* Critical : 4 (2 Fix Released)
* High : 1
* Medium : 8 (1 Wont fix)
* Low : 4
* Undecided : 1 (1 Invalid)
Thanks to all the contributors who made this test coverage possible!
Release Announcement
The Ubuntu team is proud to announce the release of Ubuntu 10.04.2 LTS, the second maintenance update to Ubuntu’s 10.04 LTS release. This release includes updated server, desktop, alternate installation CDs and DVDs for the i386 and amd64 architectures.
The Kubuntu team is proud to announce the release of Kubuntu 10.04.2. This release includes updated images for the desktop, alternate installation CDs and DVDs for the i386 and amd64 architectures.
The Xubuntu team is proud to announce the release of Xubuntu 10.04.2. This release includes the desktop and alternate installation CDs for the i386 and amd64 architectures.
Numerous updates have been integrated, and updated installation media has been provided so that fewer updates will need to be downloaded after installation. These include security updates and corrections for other high-impact bugs, with a focus on maintaining stability and compatibility with Ubuntu 10.04 LTS.
Bug Day for LibreOffice and OpenOffice – February 10, 2011
Hi folks,
This week’s Bug Day targets are LibreOffice and OpenOffice!
* #100 New bugs need a hug
* #43 Incomplete bugs need a status check
* #88 Confirmed bugs need a review
OpenOffice and LibreOffice are free office suites. OpenOffice has been the default office suite for a long time and has more than 1000 open bugs. Some of these are old and others are newer, but all of them need triaging.
Ubuntu is transitioning to LibreOffice and bugs that exist in LibreOffice too should be marked as such. This will help the developers to identify the bugs to focus on.
* February 10, 2011
* http://wiki.ubuntu.com/UbuntuBugDay/20110210
Are you looking for a way to start giving some love back to your adorable Ubuntu Project?
Did you ever wonder what Triage is? Want to learn about that? This is a perfect time! Everybody can help in a Bug Day!
Open your IRC Client and go to #ubuntu-bugs (FreeNode). The BugSquad will be happy to help you to start contributing!
Wanna be famous? It’s easy! Remember to use 5-A-day, so if you do a good job, your name could be listed at the top 5-A-Day Contributors in the Ubuntu Hall of Fame page!
We are always looking for new tasks or ideas for the Bug Days. If you have one, please add it to the Planning page at: https://wiki.ubuntu.com/UbuntuBugDay/Planning
If you’re new to all this, head to http://wiki.ubuntu.com/Bugs
Thanks for all your help!
Marjo
Natty Alpha 2 ISO Testing
Hi folks,
Next Thursday, February 3, Natty Alpha 2 will be released. So, we have to test the ISO images before release.
Please sync your ISO images over the weekend, so you are prepared when the Release Team starts posting images to
the ISO tracker http://iso.qa.ubuntu.com/
To zsync your images, you can use the dl-ubuntu-test-iso script, which is part of the ubuntu-qa-tools package.
To learn more about ISO testing works, please review the process at: https://wiki.ubuntu.com/Testing/ISO/Procedure
Thanks in advance! And enjoy!
– Marjo