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

Require bridgetown when booting from Rack #948

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ayushn21
Copy link
Member

@ayushn21 ayushn21 commented Nov 27, 2024

In order to start Bridgetown by running the web server directly (bundle exec puma), we need to require "bridgetown" in the boot file.

Without it, we get all sorts of uninitialized constant errors.

This is one of those fixes where I'm not sure what I'm doing, and whether it'll have any bad consequences. I just hammered it until it worked and seems to be working fine in my tests.

@jaredcwhite is this a valid fix? Please don't merge it until we know for sure it's not gonna make things catch fire haha.

Part of #946

@jaredcwhite
Copy link
Member

@ayushn21 Off the top of my head, I believe if we're completely bypassing Bridgetown's own CLI, we'd need to replicate calling Bridgetown.begin! which loads up the right Bundler context. Not sure where that could go exactly, and we'd want to make sure we don't accidentally call it twice.

@ayushn21
Copy link
Member Author

ayushn21 commented Dec 1, 2024

@jaredcwhite ah ok cool, I'll have a poke around.

@ayushn21
Copy link
Member Author

ayushn21 commented Dec 2, 2024

What if we say that running the web server directly won't trigger a site build ... it'll only run Bridgetown in a live context ... i.e. Roda routes + anything already in the output folder ... do we still need to call Bridgetown.begin! then?

@jaredcwhite
Copy link
Member

@ayushn21 Yeah, the server/Roda context would still need the same bootup sequence. Running a build process is just what could happen after initial boot. See Bridgetown::PluginManager.setup_bundler for an example.

I think we may need some kind of additional global state to indicate if the boot sequence has already run…if not, the rack boot needs to kick it off immediately after require "bridgetown". I think…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants