When developing Rails apps we use http://localhost:3000 as a default URL to access. It would be nice to use custom domains like awesome-rails-app.test
. Even better if we can use https so it could be accessed using https://awesome-rails-app.test . in this case puma-dev can help you.
Installation
I will describe the installation for macOS, for Linux you can use https://github.com/puma/puma-dev#linux-support.
Add puma in the Gemfile.
# Gemfile
gem 'puma'
Install Puma-dev using Homebrew.
brew install puma/puma/puma-dev
Setup
Next we need to configure some DNS settings and Configure puma-dev to run in the background. By default it uses the domain .test
sudo puma-dev -setup
puma-dev -install
Usage
Symlink you app's folder into ~/.puma-dev
.
Also you can use puma-dev link
.
cd awesome-rails-app
puma-dev link -n awesome-rails-app .
Now access to the URL: https://awesome-rails-app.test
That's it!
Restart
Just touch tmp/restart
inside your Rails project.
Stop
These will stop all the apps added into ~/.puma-dev
puma-dev -stop
Bonus - Debugging using Rubymine
If you use Rubymine as your IDE you can debug your app simply by pressing Option + Shift + F5
to attach to the puma-dev process. (See References below)
References
https://github.com/puma/puma-dev
https://www.jetbrains.com/help/ruby/attaching-to-process.html
Top comments (0)