问题
I just started working on a ruby project which is set up through Vagrant. I've successfully gotten a remote interpreter working but I'm having trouble connecting to databases.
Here's my Vagrantfile
:
# This Vagrantfile is for development use only.
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "markusproject/ubuntu"
# Allow instance to see project folder.
# Warning: This may cause problems with your Vagrant box!
# Enable at your own risk.
# config.vm.synced_folder ".", "/home/vagrant/Markus"
# Access the server running on port 3000 on the host on port 42069.
# config.vm.network "forwarded_port", guest: 3000, host: 42069
config.vm.network :private_network, ip: '192.168.50.50'
config.vm.synced_folder '.', '/home/vagrant/Markus', nfs: true
config.vm.provider "virtualbox" do |vb|
# Uncomment the following line if you want a GUI.
# vb.gui = true
vb.name = "markus"
end
end
I've set up the VM to use NFS. Here's the output of vagrant ssh-config
:
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/paymahn/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
I've left the defaults for the Database connection but have tried several variations on setting up an SSH Tunnel for the connection.
These variations include:
- setting Proxy Host to 127.0.0.1
- setting Port to 2222
- setting the proxy host to 192.168.50.50
- setting Port to 22
All of the variations have resulted in a failed connection when I test the connection. Any help on getting this config set up would be greatly appreciated!
回答1:
Well...I figured it out thanks to this guy.
Here's how the final dialogs look like:
I did the exact same thing for the test
database except I changed the database name from markus_development
to markus_test
来源:https://stackoverflow.com/questions/28004380/connect-to-db-through-vagrant-using-rubymine