通过Vagrant使用RubyMine连接到DB [英] Connect to DB through Vagrant using RubyMine
问题描述
我刚刚开始一个ruby项目,它是通过Vagrant设置的。我已成功获得了一个远程解释器工作,但我无法连接到数据库。
这是我的 Vagrantfile
:
#此Vagrant文件仅供开发使用。
VAGRANTFILE_API_VERSION =2
Vagrant.configure(VAGRANTFILE_API_VERSION)do | config |
config.vm.box =markusproject / ubuntu
#允许实例查看项目文件夹。
#警告:这可能会导致您的Vagrant框的问题!
#自行承担风险。
#config.vm.synced_folder。,/ home / vagrant / Markus
#在端口42069上访问主机上运行在端口3000上的服务器。
# config.vm.networkforwarded_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.providervirtualboxdo | vb |
#如果需要GUI,请取消注释以下行。
#vb.gui = true
vb.name =markus
end
end
我已将虚拟机设置为。
最后的对话框如下所示:
我做了除了我将数据库名称从 markus_development
更改为 markus_test ,
/ code>
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!
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
这篇关于通过Vagrant使用RubyMine连接到DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!