You Only Live Up to the Standards You Set
While I’m not one to advocate many personal development hacks, there is one
Do something you have never done before.
How to install Ruby 1.9.2, Rails 3, PostgreSQL, Git and Heroku on Ubuntu 11.04
This post is a copy of a question that I answered some days ago on AskUbuntu.com and is my first english post.
I think if you follow this instructions you won’t have problems.
1- First install RVM
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
2- After, you have to put this snippet on your .bashrc or .bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
3- Install Ruby 1.9.2 via RVM
rvm install ruby-1.9.2-p180 #NEVER USE SUDO WITH RVM
4- Set Ruby 1.9.2 as your default version:
rvm use 1.9.2-p180 --default
5- Now, you have to install PostgreSQL DB, change password from user ‘postgres’ and restart PostgreSQL server.
sudo apt-get install postgresql-8.4
sudo -u postgres psql template1
ALTER USER postgres with encrypted password 'your_password';
sudo /etc/init.d/postgresql restart
6- Installing GIT:
sudo apt-get install git-core git-gui git-doc
7- Finally, install gems Rails, Heroku e PG(PostgreSQL):
gem install rails pg heroku
I hope this may have helped you! :)
(via nerdpride)
Se algum dia alguém fechar as portas para você não se desespere, pule a janela, você não é aleijado.
Write in C (by albertveli)
Deploying a Sinatra + DataMapper + SQLite app to Heroku
Recently I followed the excellent Nettuts’ session on Singing with Sinatra, and I learned a lot about Rack-only apps.
I pushed the app to Heroku and all I was getting was “Application Error”. I found out that Heroku only uses PostgreSQL as database, so SQLite will not work at all. This is what you should do:
a) Make sure you have a
.gemsfile on the top folder with all the gems you need:sinatra data_mapper rack-flash sinatra-redirect-with-flash builder dm-postgres-adapterDid you notice the
dm-postgres-adapterat the end?. That gem is ABSOLUTE NECESSARY if you coded your app using SQLite and DataMapper and you want to push it to Heroku. I repeat. ABSOLUTE NECESSARY.b) We also need a
configure.rufile at the top folder:require 'your_sinatra_app_file_name' run Sinatra::Applicationc) On your Sinatra file (the one that has all the code) we need to tell DataMapper which database to use:
# Setting up the database DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/mydatabase.db")The part
ENV['DATABASE_URL']is used by Heroku to assign a database to our app. If we are developing locally, we just usemydatabase.db, which is SQLite. Got it?d) Finally, we push the DB to Heroku:
heroku db:push sqlite://mydatabase.db #assuming you are on your app directoryOur SQLite database will be translated to a PostgreSQL database automatically. No hassle!
Just push it (the app, I mean) and there you go. It will work. You are a hero.





