0

I'm trying to locally start my rails server

but do I have to start my postgresql db each time I want to rails s?

I'm new to rails so I'm not sure how this works. I remember not having to do such a thing on something I've worked on before..

2
  • Nope. Your postgresql server just runs merrily away in the background whether or not you've started your rails server. Commented Apr 21, 2017 at 4:22
  • rails server command and Postgres service are not related whatsoever, but you'll need to have Postgres running if you want to use the DB from Rails, of course. You should have Postgres service start automatically with your OS. Commented Apr 21, 2017 at 4:26

2 Answers 2

1

As mentioned in other answers you have to make sure that Postgres is runnign and serving your database. This is not handled by Rails.

Usually you would configure the Postgres server as an OS background service that starts with your system. Which operating system do you use? In case it's MacOS and you're already using Homebrew, I'd recommend using Hombrew services. You can read more about it here: https://github.com/Homebrew/homebrew-services

Basically you'd tell Homebrew to start postgres with your system, like this: brew services start postgres

Sign up to request clarification or add additional context in comments.

Comments

0

You can use system commands to run postgresql server automatically on system boot

sudo systemctl enable postgresql 

or

sudo update-rc.d postgresql enable

However it also belongs on how you install postgres

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.