DEV Community

Antonio Sánchez
Antonio Sánchez

Posted on

Use SSL to develop Rails projects using Puma-dev

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'
Enter fullscreen mode Exit fullscreen mode

Install Puma-dev using Homebrew.

brew install puma/puma/puma-dev
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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 .
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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)