Only thing not working as expected is that the h helper did escape html_safe output, but we can fix that easily…
A Fresh Start with Ubuntu Natty Narwahl
A fresh install for my laptop, with some Desktop tools ans all the rails/ruby stuff I need.
- Enable canonical partners in synaptic package manager
- Unmap main menu from super key (for rubymine + gnome-do)
sudo apt-get install compizconfig-settings-manager
open compiz application and rebind unity laucher @ “ubuntu unity plugin” - Java sudo apt-get install sun-java6-jre && sudo apt-get remove openjdk-6-jre
- Git: sudo apt-get install git-core git-svn
- System wide RVM
sudo su bash <<(curl -s https://rvm.beginrescueend.com/install/rvm) apt-get install zlib1g-dev libssl-dev libreadline5-dev rvm install 1.9.2 rvm 1.9.2
add rvm script to your .bashrc and to /root/.bashrc
set defaults via rvm use xxx –default
Re-login (or you get permisson denied on gem install).
rvmsudo xxx to use gems as sudo. - Ruco gem install ruco
- copy important dotfiles + firefox history/forms/… database from .mozilla
- dotfiles
- Multi-clipboard: sudo apt-get install glipper (available after restart)
- Skype + add skype to startup
- Application laucher: sudo apt-get install gnome-do + enable skype plugin
- Rubymine+ choose “meta is mapped to left win” in advanced keyboard layout options
fix multi-clipboard issues:
echo ‘idea.use.alt.clipboard.sync=true’ >> /opt/rubymine/bin/idea.properties - Mysql:
sudo apt-get install mysql-server mysql-client libmysql-ruby libmysqlclient-dev
sudo aa-complain /usr/sbin/mysqld # fix apparmor denied bug - Redis: sudo apt-get install redis-server
- Memcached: sudo apt-get install memcached
- ImageMagic: sudo apt-get install imagemagick libmagick9-dev
- Arial/Verdana etc fonts: sudo apt-get install msttcorefonts
- VirtualBox
- Nginx + Passenger
- Restrcited codes etc: sudo apt-get install ubuntu-restricted-extras
- Set a shortcut for clear+reset in terminal, so the history gets removed on keypress
Config files for heroku or duostack
To get config variables to herkou / duostack simply base64 encode them and store them into the ENV.
The cfg.rb is kept very simple, so you can also load it where rails is not yet loaded.
This scales to up to 3900 characters for duostack and 10000+ for heroku. Add gzip to get even more…
# lib/cfg.rb
require 'active_support/core_ext/hash/indifferent_access'
env = defined?(Rails.env) ? Rails.env : (ENV['RAILS_ENV'] || 'development')
config = if encoded = ENV['CONFIG_YML']
require 'base64'
Base64.decode64(encoded)
else
File.read('config/config.yml')
end
CFG = YAML.load(config)[env].with_indifferent_access.freeze
# config/application.rb
require File.expand_path('../../lib/cfg', __FILE__)
# script/configure_heroku.rb
#! /usr/bin/env ruby
require 'rubygems'
require 'rake'
require 'base64'
config = Base64.encode64(File.read('config/config.heroku.yml')).gsub("\n","")
sh "heroku config:add CONFIG_YML=#{config}"
Capistrano: start EC2 instance, install ruby+passenger+nginx+deploy app in ~ 5 minutes
Hope this helps someone, took some time to get it working 🙂
Creating a EC2 Micro instance via Fog
0.03c/hour (14€/month) is pretty cheap for a small server so lets try this 🙂
Generate and download a key-pair, so you can login to the instance via ssh.
AMI-id used is a micro ebs ubuntu 10.04 instance on eu-west-1, choose your own at http://uec-images.ubuntu.com/releases/lucid/release
Be sure to add ssh port to your security group or you will get a nice “port 22: Connection timed out”
Start the servers!
Connect via ssh