I have my discourse up and running through the guideline Discourse as Your First Rails App. which put the postgre in the VM connected through ssh. How could I connect to the database?
If you do
vagrant up vagrant ssh rm -rf tmp bundle install bundle exec rake db:migrate bundle exec rails c
do you get a “pry” prompt?
If you are not familiar with ActiveRecord the query syntax may take a little getting used to. eg.
SELECT * FROM topic_links ORDER BY clicks DESC LIMIT 1
If you want to connect to the database directly with a program running on the vagrant host, run
vagrant ssh -- -L 15432:localhost:5432 and simply leave the session running in the background. You can now connect to the VM’s PostgreSQL database through an SSH tunnel at host’s
I get this error:
vagrant ssh -- -L 15432:localhost:5432 An invalid option was specified. The help for this command is available below. Usage: vagrant ssh [options] [name] [-- extra ssh args] Options: -c, --command COMMAND Execute an SSH command directly -p, --plain Plain mode, leaves authentication up to user -h, --help Print this help
Do you know why?
I can only guess that it’s because Vagrant doesn’t stick to its own documentation or uses an
ssh client binary behind the scenes that doesn’t understand the
Looks like this might be an issue for the vagrant community support?
is working has expected on mac os x
Perhaps it’s a problem with Vagrant on Windows. I worked around this by connecting directly to my VM using its IP address on port 5432.