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

[WIP] Plack testing #2901

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

[WIP] Plack testing #2901

wants to merge 1 commit into from

Conversation

zorkian
Copy link
Member

@zorkian zorkian commented Sep 9, 2021

DO NOT MERGE. Just posting for early visibility.

This makes the minimal changes necessary to enable supporting Plack as a
runtime environment instead of Apache.

The idea is to make running the code much, much simpler since we can
have a pure Perl web server and never need to deal with system modules
and the increasingly difficult to deal with Apache/mod_perl stuff.

However, Plack is a pluggable runtime so it still does support mod_perl
so we can do that for efficiency in production if we want. Or, we can
start to look at something like Starman.

CODE TOUR: Major, massive, sweeping backend changes just designed to make it easier to develop on Dreamwidth code, which, y'know, hopefully makes people want to work on it more. Because that'd be cool!

This makes the minimal changes necessary to enable supporting Plack as a
runtime environment instead of Apache.

The idea is to make running the code much, much simpler since we can
have a pure Perl web server and never need to deal with system modules
and the increasingly difficult to deal with Apache/mod_perl stuff.

However, Plack is a pluggable runtime so it still does support mod_perl
so we can do that for efficiency in production if we want. Or, we can
start to look at something like Starman.
# to startup time)
BEGIN {
# Do not run if we're in a test
unless ($LJ::_T_CONFIG) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These moved here because this is basically what mod_perl.pl was doing on startup and I needed to replicate it so that Plack would benefit from the preloading before startup/forking.

@@ -74,9 +74,6 @@ BEGIN

use MIME::Words;

# Try to load DBI::Profile
BEGIN { $LJ::HAVE_DBI_PROFILE = eval "use DBI::Profile (); 1;" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module is never used anywhere.

# of systems ourselves.
my $uri = $r->path;
$log->debug('Routing for URI: ', $uri);
if ( $uri =~ qr!^/api/v\d+/! ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only dispatches to API routes now, but this is where we need to add the rest of the dispatch engines... TT, BML, etc.

Although BML is probably a nightmare to pull off of Apache and maybe we should never support it here, which means Plack can't really be deployed until we finish the BML migration.

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

Successfully merging this pull request may close these issues.

2 participants