Skip to content

Instantly share code, notes, and snippets.

@FernandoEscher
Created September 10, 2012 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FernandoEscher/3694187 to your computer and use it in GitHub Desktop.
Save FernandoEscher/3694187 to your computer and use it in GitHub Desktop.
Server configuration for Rails: Configure the application
# Add your server's rsa public key to github (http://github.com/settings/ssh)
cat .ssh/id_MyAppName_rsa.pub
# Download your application to your home dir
git clone <repo>
# Enter your aplications folder
cd MyAppName/
# Go as root user
sudo su
# load rvm
source /etc/profile.d/rvm.sh
# Install the ruby required for your app
sudo rvm install <ruby_version>
exit
#This might take a while, so you can try to run another console and follow the other steps left.
# Install Postgresql along with the server dev package
sudo apt-get install postgresql postgresql-server-dev-9.1
# Access the console with the postgres role to the postgres database
sudo -u postgres psql postgres
# Create rol YourAppName
create role YourAppName with createdb login password 'YourAppRolePassword';
# Verify that the rol has been created
select * from pg_user;
# Verify that the rol has been created with a password
select * from pg_shadow;
# Create your application's databases (only the production on is required)
create database YourAppName_development owner YourAppName;
create database YourAppName_test owner YourAppName;
create database YourAppName_production owner YourAppName;
# Exit the postgresql console
\q
# Open the configuration file to set how Postgresql will authenticate to your database
sudo vim /etc/postgresql/9.1/main/pg_hba.conf
# Add these lines just after the line that has TYPE, DATABASE, USER, ADDRESS, METHOD, and then save (only the production one is required).
local YourAppName_production YourAppName md5
local YourAppName_development YourAppName md5
local YourAppName_test YourAppName md5
# Restart the Postgresql service
sudo service postgresql restart
# Migrate and seed your database
rake db:migrate
rake db:seed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment