Meeting Rubyists in Vienna

The Vienna Ruby User Group meetup yesterday felt a bit like a home-coming party to me as I actually cofounded it. I am happy to see that many Rubyists make their way to sektor5 every month to share a drink and knowledge. Let’s get straight to the summarizing the talks part!

iPhone Apps with RubyMotion and ProMotion

Jan Jezek showcased how to combine RubyMotion, ProMotion and Teacup to create iOS apps, ‘Ruby-style’. Jezek: “RubyMotion is Ruby compiled into native Objective C, during development you run REAL iOS, not a sandbox or something else.” Indeed the ProMotion scaffold generates .rb files. RubyMotion uses Rake, is extendable with both 3rd party Objective C libraries and gems especially written for RubyMotion (and there are a LOT of those). Jezek: “And the real cool thing is that RubyMotion has access to all iPhone native features like sound, camera, gps and datastorage!”

Jezek praised how RubyMotion is fully supported by RubyMine, including a debugger and code completion, and how TDD and BDD (using frank-cucumber) are considered. That it’s a commercial product and priced as such is one of the cons Jezek mentioned. He’d additionally like to see RubyMotion adopt the MVC pattern from Rails and (better) support for game development.

Skimming over Teacup’s features, Jezek mentioned its CSS like behavior, how it fits nicely into ProMotion and how it enables you to use constraints.

Setup & deploy an Octopress blog in 5(ish) minutes

Aaron Cruz then made an attempt to setup an Octopress blog and deploy it to GitHub Pages in under 5 minutes. Octopress is a framework designed for Jekyll. To get your blog up and running, clone the repo and install the dependencies:
git clone git://github.com/imathis/octopress.git octopress
cd octopress
gem install bundler
rbenv rehash   
bundle install
rake install

In the _config.yml you get to configure your Octopress Blog (read: change the url, title, subtitle and author of your blog):

Third party integrations – like a list of your Github repositories and a button for sharing of posts and pages on Twitter – are already set up for you. Simply fill in the configurations and they’ll be added to your site.

Next, head over to GitHub and create a new repository named username.github.io, where ‘username’ is your GitHub username. Go to the folder where you want to store your project, and clone the new repository. Enter the project folder and add an index.html file. Then add, commit, and push your changes, fire up a browser, head over to https://username.github.io and marvel at your accomplishments.

The 12 Factor manifest – sane guidelines or utopian devop fantasy?

A new concept at the vienna.rb meetups is the group discussion. This time around Andi Fink kick-started a discussion about the 12 Factor App manifest, that lists a number of best practices for building software-as-a-service apps.

The tl;dr for those of you getting the creeps only browsing to 12factor.net:

A 12 Factor app uses declarative formats for setup automation, minimizing time and cost for new devs joining the project. They have a ‘clean contract’ with the underlying operating system and maximum portability between execution environments. 12 Factor apps are suitable for deployment on cloud platforms, minimize divergence between development and production, which in turn enables continuous deployment.

The discussion round was quite conclusive: Ruby developers know and live the manifest. Clemens Helm mentioned how he’d be interested how a similar discussion would go down at a JavaScript meetup, for instance. Florian Motlik from Codeship (who sponsored the meetup yesterday) rather thinks the rules are not strict enough. Someone mentioned how 12 Factor ‘forces you to put your deployment structure under version control and how it provides reliable information which version you are currently running’. Up close and personal style. I enjoyed the mini-discussion about config files versus environment variables (we are all for the latter btw).

The next vienna.rb meetup will take place June 5th, and you should drop by.

Deploy your Padrino app on anynines in 3 steps

Matthias Günther (@wikimatze) runs vimberlin, a gathering for Vim-enthusiasts and is currently writing on his Padrino Book. As such he teamed up with our support team to write a How-to guide for Padrino deployments on anynines.

Padrino is a Ruby framework built upon the Sinatra web library, created to make it easy to code more advanced web applications while still sticking to what makes Sinatra great (like its simplicity). Think: creating a standard library of tools, helpers and functions that ready your Sinatra apps for increasingly complex requirements.

Fun fact: one of the teams applying to Rails Girls Summer of Code this year, proposed to work on Padrino over the course of the summer.

1. Get started with Padrino

To get started with Padrino, run the following commands:
$ gem install padrino
$ padrino g project padrino-hello-world-anynines
$ cd padrino-hello-world-anynines
$ bundle
$ padrino start

Yep, that’s it. The next part is to create a route in app/app.rb:
module PadrinoHelloWorldAnynines
class App < Padrino::Application
...
get "/" do
"Hello Padrino on anynines"
end
end
end

In case you can’t wait to see some code for a ‘Hello World’ program, check out my example app (with MySQL support) on GitHub. You can see the running app on padrino-hello-world-anynines-mysql.de.a9sapp.eu.

2. Get started with anynines

Let’s fetch the example app and deploy it to anynines, shall we?
$ git clone https://github.com/matthias-guenther/padrino-hello-world-anynines-mysql.git
$ cd padrino-hello-world-anynines-mysql/

Before you start it’s necessary to install Ruby 1.9.3 (or higher) and the a9s gem. After you’ve installed Ruby, go to your command line and install the a9s gem which downloads the needed gems for interacting with the anynines system:
$ gem install a9s

Next you will need to select the anynines api endpoint as target and authenticate with the auth service using your user credentials:
$ cf target https://api.de.a9s.eu
$ cf login --email [your@email] --password [yourpassword]

Push the application and follow the CLI to define your project space(s) and services – MySQL in our case:
$ cf push

anynines needs to have a Gemfile.lock for Padrino projects.

3. Use MySQL for your app

Make sure MySQL is in $PATH. If it isn’t, you will need to install a proper MySQL client like mysql-client-5.5 for Ubuntu.

Define the port in database.rb:

ActiveRecord::Base.configurations[:production] = {
:adapter => 'mysql2',
:encoding => 'utf8',
:reconnect => true,
:database => JSON.parse(ENV["VCAP_SERVICES"])["mysql-5.5"].first['credentials']['name'],
:pool => 5,
:username => JSON.parse(ENV["VCAP_SERVICES"])["mysql-5.5"].first['credentials']['username'],
:password => JSON.parse(ENV["VCAP_SERVICES"])["mysql-5.5"].first['credentials']['password'],
:host => JSON.parse(ENV["VCAP_SERVICES"])["mysql-5.5"].first['credentials']['hostname'],
:port => JSON.parse(ENV["VCAP_SERVICES"])["mysql-5.5"].first['credentials']['port']
}

Run your migrations:

cf push --command 'RACK_ENV=production bundle exec rake ar:migrate'

Finally, run the start command:

cf push --command 'RACK_ENV=production bundle exec padrino start -p $PORT -h $VCAP_APP_HOST'

If you now call padrino-hello-world-anynines-mysql.de.a9sapp.eu/ you can see the “Hello Matthias Günther, I know your email: matthias@wikimatze.de” in your browser. Scary, I know.

Enjoy developing with Padrino!

Meet you ‘in the wild’ at the Berlin Web Week!

Next week Berlin will host the Web Week, with re:publica, the Media Convention, Heureka, tools, droidcon, the API Days, the LinuxTag (where our own Julian Weber will give a talk) and many other tech related events.

Earlier today we were present at the press briefing for re:publica (and the Media Convention) and we are excited to see the conference’ main themes evolve into data protection topics. Re:publica, taking place May 6-8, aims to educate the ‘digitale Gesellschaft’ (loosely translated: digital community) on net surveillance and how to protect your data from evil do-ers. (more…)