# Beyond Basecamp
[Enrique García Cota](http://kiki.to) ([@otikik](http://twitter.com/otikik))
[Barcelona on Rails](http://www.meetup.com/Barcelona-on-Rails/) - Nov 2014
#### [kikito.github.io/beyond-basecamp](https://kikito.github.io/beyond-basecamp)
## Basecampy Apps
* One relational database + ActiveRecord
* Light on the client-side
* Conventions (helpers, erb, turbolinks, ...)
## [PostgreSQL](http://www.postgresql.org/)
> Relational Databases FTW
``` bash
$ rails new myapp --database=postgresql
```
``` ruby
# Gemfile
gem 'sqlite3'
```
``` ruby
# Gemfile
gem 'pg'
```
## [CoffeeScript](http://coffeescript.org)
> CoffeeScript is better than Javascript
```ruby
# Gemfile
gem "coffee-rails"
```
```ruby
# Gemfile
# gem "coffee-rails"
```
```bash
$ mv myapp.coffee myapp.js
```
```bash
# Gemfile
# gem "coffee-rails"
...
gem "turbolinks"# -> coffee-rails
```
## [RSpec](http://rspec.info/)
> I consider rspec to have the worst DSL of any major piece of Ruby software.
```ruby
# Gemfile
group :development, :test do
gem 'rspec-rails', '~> 3.0.0'
end
```
```bash
rails generate rspec:install
```
```bash
$ git clone github.com/rspec/rspec-rails
$ cloc rspec-rails
```
### ☞ ~120 ruby files, ~4600 LOC
### api.myapp.com/foo
#⇩
### myapp.apitools.com/foo
* Overhead order: ~20ms
* Roundtrip to our servers (worst case): 1s
* Opensource self-hosted version available
1 nginx + 1 redis in 1 docker container =
## ~ 6MB
# ✘
## Lots of DIY
## Very Bleeding Edge
## Provisioning API
#### Divided into 3 parts:
### Restful API Server
#### Built with Sinatra & Redis
``` bash
$ curl http:://nixonserver.com/status
=> { "redis_connection" : true }
```
### CLI client
#### Built with Thor
``` bash
$ nixon assign af8bae 4
=> Assigned container af8bae to account 4
```
### Ruby client gem
```ruby
# Gemfile
source 'https://usr:pwd@geminabox.net'
...
gem 'nixon-client'
...
# Some controller / service
nixon.accounts.put_to_sleep(slug_name)
```
# ✘
## Triple work
## Naming
## Rails APP
* MySQL database
* Login access point
* Contains account info
* Connected with nixon via `nixon-client`
* Hosts backups
# ✘
## Many Classes
## Naming
# ✓
## Small Classes
## Easy to test
### api.myapp.com/foo
#⇩
### myapp.apitools.com/foo
# ✓
## Small
## Zero-downtime deployment
![dwight](./img/dwight.jpg)
[github.com/3scale/dwight-conrad](https://github.com/3scale/dwight-conrad)
-------------------------
files code
-------------------------
Ruby 599 16413
Lua 147 10772
Coffee 73 4380
YAML 35 4263
SASS 81 4206
HTML 65 2581
-------------------------
SUM: 1000 42615
-------------------------
# ✘
## Complex
## DIY
## Naming
# ✓
## Played to our strenghts
## Fun
## Works
## Questions?
---
[Enrique García Cota](http://kiki.to) ([@otikik](http://twitter.com/otikik))
Thank you!