Skip to content

Instantly share code, notes, and snippets.

@jalcine
Forked from rondale-sc/gist-1.sh
Created October 3, 2012 18:59
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 jalcine/3829031 to your computer and use it in GitHub Desktop.
Save jalcine/3829031 to your computer and use it in GitHub Desktop.
setting-up-a-remote-environment
$ vi ~/.ssh/config
# Add the following information
Host rails_blog_db
HostName 0.0.0.0 # your remote's public facing IP
Port 3122
User jjackson # your username
LocalForward 3307 192.168.100.1:3306
# ~$ touch rails_blog/config/environments/development_remote.rb
# ~$ vi config/environments/development_remote.rb
# Add this and save!
require File.join(File.expand_path(File.dirname(__FILE__)),'development')
# rails_blog/config/database.yml
default: &default
adapter: mysql
username: rails_blog_user
password: ENV['your_super_secret_password']
host: 192.168.100.1
development:
database: rails_blog_development
<<: *default
production:
database: rails_blog
<<: *default
# set the database option to your development db and the host to your
# ssh forward
development_remote:
database: rails_blog_development
host: 127.0.0.1
port: 3307 # This is where the ssh is forwarding your DB traffic
<<: *default
# rails_blog/config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# Add your new development_remote environment to the assets hash below
Bundler.require(*Rails.groups(:assets => %w(development development_remote test)))
end
# Rest of file...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment