-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Standalone - Add support for development-friendly file-layouts #26771
Conversation
The `tools/` folder is not in public releases. We want to make sure it's available for HAN-C deployments.
…-asset-plugin) This should still work the same way when `civicrm-asset-plugin` is present (HAN-C). It affects other builds (HAN-D, SRV).
Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷 Introduction for new contributors
Quick links for reviewers |
__FUNCTION__, | ||
ts('In PHP 7.x, the built-in HTTP server cannot execute some security checks. This problem only affects local development on older versions of PHP.'), | ||
ts('Incomplete Security Checks'), | ||
\Psr\Log\LogLevel::ERROR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intended as level ERROR? It causes a problem in front-end tests that have php 7.4 as part of the matrix since it interprets it the same as any other red popup and so the test fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@demeritcowboy Sort of, but I'm ambivalent about the level - for the developer-user (foreseen audience of 5e8a6bb), one can imagine rationales for ERROR or WARNING or NOTICE. I've downgraded it to WARNING in hopes that it avoids knock-on effects in other suites.
Tangentially - Are you pointing out a general/likely issue (for any ERROR-level check) or an observed regression (with this specific check)? My observation was that several Security
checks hung on php 7.4.29 cli-server
(macOS; Civi-standalone). But if there's some other php74 where those tests work, then that's an interesting data-point.
Some security checks don't work on PHP 7.4's built-in HTTPD -- they cause the system hang for >1min (*while internal HTTP calls timeout*). The checks run whenever the admin logs in -- so having it hang is fairly annoying (*for the developer who uses PHP built-in HTTPD*). This only affects local development, so it's not critical to run the checks. We'll skip the affected tests and show a simple (quick) error instead.
It was with this specific check. Here's an example I ran earlier against cdntax with the earlier version of the PR applied, and it would be similar for webform tests: https://github.com/SemperIT/CiviCARROT/actions/runs/5501383178/jobs/10024925252#step:22:38. The giant inscrutable error message is saying "failed asserting no red alert popups", and if you were to download the html snapshots zip file for the run it shows them stopping on a page where the alert popup div is present.
I can run it again against this version and see what happens. And actually that may explain one of the results in the earlier run where it seemed like WSOD, which I didn't bother looking into at the time. |
That passed. It's ubuntu 22.04.2, php 7.4.33, drupal 9.5.10. |
I just realized that as-is this PR would skip those checks, so the above didn't actually test them. I've run again with a modified version where it doesn't skip those checks. Still passes: https://github.com/SemperIT/CiviCARROT/actions/runs/5503275390/jobs/10028315079 |
@demeritcowboy OK, thanks. I'll keep that in mind as a point of reference - and when the various pieces are in place to try it more easily in more environments, I might try and see if my hang still appears in other environments. (But I think it's still good to proceed with skipping these checks for Incidentally, I said "hang", but it's a strong word -- the status-checks do eventually finish. It just takes >1 min each time. Interesting thing about those last two tests you linked (with and without HTTP-security checks) -- the "Run PHPUnit" step goes much faster without HTTP-security checks (3m vs 13m). Yet the outcome is the same (9 tests, 167 assertions). I don't know what timeframes are typical on that suite, but it could be that you've been experiencing the same issue as a drag on execution-time... |
Hmm, no the expected time is about 10-15 min, so 3m seems way off. I ran it again with the PR and it was also 3m. Hmm, tbd. |
Are the issues with tests something introduced by this PR? (a blocker to merging) or something general that needs fixing later? (I have to admit I'm not sure I understand) |
The latest round no I don't think it's a blocker. |
I would be tempted to merge this @artfulrobot any objections? |
Commenting on the php7.4 built-in server slowness part - it happens in php 8.1 too, and it's the call to |
@totten this sounds great. No objections from me. I've not tried it yet. And I see you can support HAN-D in buildkit too - nice. This is a really good how to install, and why the options are like this documentation page. We probably need to make sure that it gets copied into somewhere suitable. Up until this point, I might have suggested civicrm-standalone.git/readme but now we don't need that repo...! Maybe we need a special standalone section in one of the main docs, e.g. installation guide? |
That sounds wild...
Yeah, you're probably right - migrate to the installation guide (and also include suitable disclaimers about the experimental/WIP status of -- I did a bit more r-run on a different workstation. This basically still worked, but it did bubble up some other issues (e.g. compatibility with different flavors of PHP). But it doesn't change the utility of what's in here, and I don't think this stuff poses danger to any other use-cases. So I'll deal with new things in new PR. |
Thanks @totten. FWIW I tried for a couple of hours to r-run this on Friday but didn't manage it. I had been trying to run a patched buildkit to run the buildkit install from there but it was failing (couldn't find tools/scaffold). I'm sure this was caused by needing patched BK to bring in patched civi-SA to bring in patched core etc. I'll retry now a few more of the key planks are merged, and hopefully get further. |
(Aside: If anyone else has the same problem as ^^^, there's some parallel discussion here.) |
Here's a draft in the style of the other installation guides -- but with a big warning at the top. https://lab.civicrm.org/documentation/docs/installation/-/merge_requests/56 |
Overview
If you are doing development on
civicrm-core.git
and using theStandalone
UF, then it's easier to checkout the git repo directly -- without creating a bespoke, top-levelcomposer.json
. (See: https://lab.civicrm.org/dev/core/-/issues/2998#note_92686)This patch makes it possible to install the
Standalone
UF. I've tested with a total of 3 different layouts.ping @artfulrobot
Technical Details
The essence of this update is to move a few files from
civicrm-standalone.git
(index.php
,.htaccess
,civicrm.config.php.standalone
) tocivicrm-core.git
. Instead, there's a script (StandaloneScaffold.php
aka./tools/standalone/bin/scaffold
) which will install these files.This allows you to install the scaffolding in other structures. (One may use
civicrm-standalone.git
as a top-level project, but it is no longer required.)Related PRs
cv.git
): Standalone - Support for HAN-C, HAN-D, and SRV layouts cv#167civicrm-standalone.git
): Drop scaffolding files. Install them via composer-compile-plugin. civicrm-standalone#9civircm-buildkit.git
): Standalone - Support for HAN-C and HAN-D civicrm-buildkit#788Layout: HTTPD/Apache/Nginx - Composer (HAN-C; Existing)
Summary: This is the layout that's already/previously permitted.
Process: A site-builder sets up a vhost on Apache/Nginx or similar HTTPD. The site runs a top-level project (either a clone of
civicrm-standalone.git
or a new repo). The project usescomposer
to require key CiviCRM packages likecivicrm-core
,civicrm-packages
, andcivicrm-asset-plugin
.Example:
Trade-offs:
For production deployments (which merely consume
civicrm-core
), this has a few advantages:vendor/
tree outside of the web-root.composer
. (For example, you can get security updates for third-party dependencies without modifyingcivicrm-core
.)But for development deployments (which test+modify
civicrm-core.git
), it has a few disadvantages:civircm-core:composer.json
. (You can't simply runcomposer install
.)composer install
.)vendor/civicrm/civicrm-core
folder when updating the top-level project.Layout: HTTPD/Apache/Nginx - Direct (HAN-D; New)
Summary: This is a new layout. It flips the advantages/disadvantages above. It retains support for running on standard HTTPD's like Apache/Nginx.
Process: A developer sets up a vhost on Apache/Nginx or similar HTTPD. They clone
civicrm-core.git
into a public folder./core
.Example:
Layout: PHP Built-in Server (SRV; New)
Summary: This is a new layout. It drops the requirement to setup Apache/nginx/etc. Instead, you can treat
civicrm-core
as the main folder.Process: A developer clones
civicrm-core.git
into a private folder. (For example, I often put development repos in~/src/PROJECT-NAME
.) Then one can launch PHP's built-in HTTP server.Example:
Note that you don't need any particular HTTPD (Apache/Nginx) or PHP-FPM -- merely PHP-CLI. In lieu of a vhost, we create the folder
./srv
with all the public+private data files that would otherwise appear in the vhost.