BetaNYC is one of a growing number of civic-minded technology groups that are working to improve their community by rapidly prototyping software solutions that address common problems in their neighborhood. These groups are often associated with the larger Code for America organization through their volunteer-based, technology Brigade program.
Code for America promotes civic engagement across the country, with the goal of improving the relationship between citizens and their government. Their mission statement reads: "Code for America envisions a government that works by the people, for the people, in the 21st century".
As someone who frequently feels rather detached and powerless regarding the direction in which our government is heading, these aspirations give me hope, and inspire me to act.
I joined Oakland California's OpenOakland Brigade last year, and have participated in plenty of civic hacking events from out on the West Coast since. However, this was my first event on the East Coast, and my first look at CitiBike's data.
A large part of these "civic hacking" efforts really just involve using modern, open source software tools and data analysis techniques to help gain a greater understanding of the information stored in public records, and in other data made publicly available by civic-focused organizations and groups.
For these folks, the term hacking does not imply theft. Instead, it usually represents working toward a creative, innovative, or unexpected reuse of readily available tools, goods, or information. Or more generally, to fix, upgrade, or improve.
This night's theme focused on making use of the public data from New York's CitiBike bike sharing program - a popular topic, which filled the night's meeting space to capacity.
The meeting format was familiar: We started off with ten minutes of introductory announcements, followed by an hour of fast, 5-minute presentations from local developers who had prepared an application demo to share. The final two hours of the event were left open for general collaboration, team building, and more hacking.
Representatives from groups such as the Department of Transportation, Socrata, and other large public and private sector organizations were also in attendance. These groups were not only there to promote the availability their own data sets, but they were also expected to be able to handle questions about the data, and to collect feedback about the quality and accessibility of the information.
As a visitor from another Brigade city, I was really interested in seeing how we could make our successful apps more portable, allowing us to multiply our wins by enabling other communities to quickly replicate and reuse our project code.
As it turns out, the format of the publicly available NYC bike data is almost an exact match for the data provided by the bike sharing programs in Philadelphia and in Washington DC. This means that a single bike dashboard application (with some slight modifications), may be reusable in a wide variety of communities.
Edgar's citibike dashboard uses his own Citibike ruby client library to fetch data on the status of selected local bike hubs nearby. Very impressive!
Last month, when I had originally looked into making this application available on OpenShift, we were missing support for setting custom environment variables from outside a hosted application. In the last week, we've added that feature along with quite a few more.
The following two lines represent the majority of the effort in getting this application ported to run on OpenShift:
set :port, ENV['OPENSHIFT_RUBY_PORT'] if ENV['OPENSHIFT_RUBY_PORT'] set :bind, ENV['OPENSHIFT_RUBY_IP'] if ENV['OPENSHIFT_RUBY_IP']
While on OpenShift, your application's port and IP address will be provided automatically (read-only).
Now you can define your own custom environment variables while creating an app:
rhc app create citibikes ruby-1.9 --env CITIBIKE_NEARBY_STATIONS="268,257,2010" --from-code=https://github.com/edgar/citibikenyc_dashboard.git
The command output should include a live web URL where your application clone can be accessed.
To update an existing OpenShift-hosted application clone with new list of station ids:
rhc env set CITIBIKE_NEARBY_STATIONS="268,257,258" -a citibikes
Then, restart the application to load your new station id list:
rhc app restart
This is great because it allows me to run the upstream project source directly, without requiring any downstream modifications in order to configure the app for my needs.
Maintaining a clean and configurable upstream source for these projects should also help improve security by keeping secrets and keys out of the application source, and by providing a central location for people to collaborate and discuss security patches and other issues.
For more information about the newly added support for user-defined application variables, update your
rhc command-line tools to the latest version, and use the included
help command to print the usage notes:
gem update rhc rhc help env
The Brigade teams are hard at work on a growing list of applications that can be quickly redeployed in your area. Let us know if you've developed a portable civic application, or if you've redeployed a civic app for use in your own neighborhood - We'd love to hear about it, and help you spread the word.
My stop in NYC was the first in a series of Brigade visits that OpenShift has planned over the coming months. Stay tuned, and hopefully we'll be dropping by a brigade near you soon!
- Spin up your own copy of the Citibike dashboard
- Join a Brigade near you!
- Apply to have your civic application listed in the OpenShift Application Gallery.
- Host your own private Platform As a Service (PaaS) by evaluating OpenShift Enterprise, or by running your own copy our upstream source, OpenShift Origin.
- Need Help? Ask the OpenShift Community your questions in the forums.
- Keep up to date on our latest community news by following the @OpenShift twitter account.