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

dev/core#4988 enable standaloneusers extension early in Standalone install #29362

Closed

Conversation

ufundo
Copy link
Contributor

@ufundo ufundo commented Feb 10, 2024

Before

Installing Standalone through the web ui fails because we don't have the SessionHandler from standaloneusers early enough.

After

Hook in earlier to enable this extension specifically.

Technical Details

This resolves the main path issue that the installer tries to start a session in BootstrapCivi.civi-setup.php here at \Civi\Setup::PRIORITY_MAIN - 200 .

However you can have a problem earlier if warnings are generated about directories, which CRM_Core_Config_MagicMerge then tries to put in the session, which then causes a crash.

In particular I hit this one: #29354

Comments

Alternative approach just using regular PHP session instead during the whole install #29352

Copy link

civibot bot commented Feb 10, 2024

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@civibot civibot bot added the master label Feb 10, 2024
Copy link

civibot bot commented Feb 10, 2024

The issue associated with the Pull Request can be viewed at https://lab.civicrm.org/dev/core/-/issues/4988

@ufundo ufundo marked this pull request as ready for review February 11, 2024 20:06
@artfulrobot
Copy link
Contributor

I ran this and got it installed, then had the same JWT problems as
#29352 (comment)

@ufundo ufundo force-pushed the standalone-install-early-standaloneusers branch from b13982e to 20691a2 Compare February 22, 2024 23:07
@ufundo ufundo force-pushed the standalone-install-early-standaloneusers branch from 20691a2 to 071033b Compare February 22, 2024 23:12
@ufundo
Copy link
Contributor Author

ufundo commented Feb 22, 2024

Issues at the login screen were fixed by applying #29345 . Rebasing onto master to incorporate that, and I now get a clean install all the way through.

@ufundo
Copy link
Contributor Author

ufundo commented Feb 22, 2024

@totten - it sounded like you might have some concerns about the potential fragility of the container if installing at this point? Potential gremlins around midnight you said?

@totten
Copy link
Member

totten commented Feb 23, 2024

@ufundo Yeah... In my mind, the series of tasks under installDatabase are are split between "pre-BootstrapCivi" and "post-BootstrapCivi". Before boot, the behavior of many services is sort of undefined. Also, this means that there are two things which nominally activate standaloneusers.

I haven't read enough to try the use-case here, but I would flag another possibility like:

diff --git a/setup/res/index.php.txt b/setup/res/index.php.txt
index 42157b5f98..056fcdd9a6 100644
--- a/setup/res/index.php.txt
+++ b/setup/res/index.php.txt
@@ -126,6 +126,7 @@ else {

   $coreUrl = \Civi\Setup::instance()->getModel()->mandatorySettings['userFrameworkResourceURL'];

+  \CRM_Core_Session::useFakeSession();
   $ctrl = \Civi\Setup::instance()->createController()->getCtrl();
   $ctrl->setUrls([
     // The URL of this setup controller. May be used for POST-backs

That function should be pretty low-dependency (doesn't require any services; it only overrides a static variable). In theory, it could also address issues where setStatus() breaks.

(I'm not certain how it interacts with standalone's session-handler. But this function is used in other cases where sessions aren't reliable -- e.g. stateless HTTP API authentication and CLI-pipe APIs.)

@ufundo
Copy link
Contributor Author

ufundo commented Feb 23, 2024

Given these concerns, and not being able to get useFakeSession to work as I'd like, I think I'm going back to falling back to regular PHP session... #29352

@jaapjansma
Copy link
Contributor

I have tested this patch and now the installer works.

@artfulrobot
Copy link
Contributor

Closing as #29352 merged.

@ufundo ufundo closed this Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants