Change unicorn port from 3000 in development

There are 2 schools of thought when it comes to launching a rails server in development.

The @sam school of thought, where you want to keep console pristine cause you are a fanatical puts debugger. That way you can just add puts statements around the app and see the output in the same window you run the server.

If you subscribe to @sam’s school of thought you launch your rails server with:

bin/unicorn

If you want a different port, you run

bin/unicorn -p 7777

The other school of thought is the @tgxworld school of thought / Rails official setup. In this case are not a puts debugger and want to see all the debug rails logs in the console.

If you are like this you would launch unicorn in dev via

bin/rails s

If you want a custom port you will use

bin/rails s -p 7777

Note, I had to push a few fixes to make this post true, so pull latest.

12 Likes