We've moved discussions to Discord

Do we use rails server or foreman start in development?

Jake Smith
Hello,

I'm wondering if we should be using `rails server` or `foreman start` to be running in development?  I've been using `foreman start` as the documentation suggests, but I notice that my local port is 5000.  However, I found some instances of port 3000 being used and was wondering if they all should be 5000 or 3000?  I can submit a pull request if that is the correct assumption, but I'm not quite sure if those were deliberately different.

I noticed this when I was looking at emails being sent, and the link to "View invitation" takes me to the link with the port 3000 when my app is running in 5000.

Sorry if I'm missing something!
Chris Oliver
It's really your preference. Foreman is what I typically use since I also need to run sidekiq, webpack-dev-server, and maybe other commands like guard alongside the rails server. Nice to have all those processes managed together instead of opening up for tabs and running them manually.

I'd just pick one and stick to it. You can always specify ports so you're on 3000 either way or vice versa.
Jake Smith
Okay good, I figured foreman was the way to go.  I'd never used it before, but I recognized, right away, how nice it was to just have one command to run for it all.

I'm getting back into rails, after an unfortunately long time off of it.  I've been trying to figure out why the links in the email previewer were pointing to :3000 despite using `foreman start` and the rest of the app using :5000.  But when I search the repo for usages of :3000 "hard-coded," I'm not really seeing a reason why this is happening locally for me.
Chris Oliver
Yeah, so there is a line setting the port for actionmailer to 3000 in the development environment.

config/environments/development.rb:  config.action_mailer.default_url_options = {host: "localhost", port: 3000}

That can probably be tweaked to use ENV.fetch("PORT", "3000") to make it better match the port if you're using foreman or not. I'll have to update that.
Chris Oliver
Just pushed an update for that.
Notifications
You’re not receiving notifications from this thread.