Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Allow running in dev server without rails server (e.g. with puma directly) #57

Open
kjlape opened this issue Dec 31, 2024 · 4 comments · May be fixed by #75
Open

Feature: Allow running in dev server without rails server (e.g. with puma directly) #57

kjlape opened this issue Dec 31, 2024 · 4 comments · May be fixed by #75
Labels
enhancement New feature or request

Comments

@kjlape
Copy link

kjlape commented Dec 31, 2024

I've been using puma-dev to run my rails apps for local dev. By default it starts them with the puma command resulting in Rails::Server not being defined, which disables this plugin as of version 0.1.12. This is my cursory assessment.

I haven't had a chance to run down any solutions yet, but wanted to open this issue to see if this project would accept PRs to support this workflow.

Possible solution brainstorm:

  • Detect if we're running inside puma or rails server
  • Force enable with an environment variable

Of course open to other ideas I haven't thought of! I'd be happy to do the work on this when my schedule permits. Possibly this weekend.

@jorgemanrubia jorgemanrubia added the enhancement New feature or request label Jan 1, 2025
@jorgemanrubia
Copy link
Member

Good one 👍 . There must be a better way of detecting that the process is running within a web server than checking that constant.

@joshuay03
Copy link

I'm using this to get it working: main...joshuay03:spark:support-direct-puma-process

Open to better ideas.

@kjlape
Copy link
Author

kjlape commented Jan 29, 2025

@joshuay03 Nice! I've got a similar solution working locally. Relevant lines highlighted in this gist: https://gist.github.com/kjlape/b3aecccbd033e3de2246feb53ffda3a5#file-hotwire-spark-rb-L26-L33

I don't feel great about it. I'd be ok with either option, considering that they're both pretty simple. Would love to find a de facto Rails feature that tells us if we're running in a server process regardless of the server though.

Of the two solutions, I'm leaning toward the … || $PROGRAM_NAME =~ /puma/ option, especially since it would be easy to add this as a configuration option if we needed to support alternative servers or rather names for the server command.

@joshuay03 do you want to take this? I can PR it if you'd rather not. Just let me know!

@joshuay03 joshuay03 linked a pull request Feb 1, 2025 that will close this issue
@joshuay03
Copy link

@joshuay03 do you want to take this? I can PR it if you'd rather not. Just let me know!

Soz for the delay, #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

3 participants