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

make standard PHP frameworks work (drupal, laravel, symfony) #46

Closed
till opened this issue Aug 31, 2022 · 29 comments
Closed

make standard PHP frameworks work (drupal, laravel, symfony) #46

till opened this issue Aug 31, 2022 · 29 comments
Assignees
Labels
bug Something isn't working

Comments

@till
Copy link

till commented Aug 31, 2022

This is a follow-up to:
paketo-buildpacks/php#253
paketo-buildpacks/php#284
paketo-buildpacks/php#366

(Was asked by @sophiewigmore to move it here.)

Expected Behavior

Setting up a demo app through one all of the frameworks, should produce a runnable application.

Current Behavior

After providing configuration such as the following:

[ build ]
  [[ build.env ]]
    name="BP_PHP_SERVER"
    value="httpd"
  [[ build.env ]]
    name="BP_PHP_WEB_DIR"
    value="public"
  [[ build.env ]]
    name="BP_COMPOSER_INSTALL_OPTIONS"
    value="--no-dev --no-scripts -o"

... an image is produced, but the applications fail with all kinds of errors about being unable to load classes:

logs

Possible Solution

I haven't figured this out completely yet, but it seems like the composer autoload is broken. And all frameworks rely on that to be there. I am only guessing, but maybe due to how the layers work. I've explained in the other ticket how autoloading works, and why.

A possible solution is to squash the layers, I think it's related tot his:

[builder] Paketo Composer Install Buildpack 0.1.1
[builder]   Executing build process
[builder]   Building new layer /layers/paketo-buildpacks_composer-install/composer-packages
[builder]   Running 'composer install'
[builder]   Ran 'composer install --no-progress --no-dev --no-scripts -o'
[builder]       Completed in 23.728s
[builder] 
[builder]   Generating SBOM for /layers/paketo-buildpacks_composer-install/composer-packages
[builder]       Completed in 42ms
[builder] 
[builder]   Writing symlink /workspace/vendor => /layers/paketo-buildpacks_composer-install/composer-packages/vendor

But not yet sure how to debug this or change this to verify my assumption.

Another thing I would try is, if I can composer dump-autoload before the httpd starts. But I haven't found a hook yet. Maybe someone else has an idea.

Steps to Reproduce

You need to have composer installed and set up a project, using laravel as an example:

composer create-project laravel/laravel ./example-laravel-app
cd example-laravel-app/
git init
mkdir .php.ini.d/
echo 'extension="fileinfo.so"' > .php.ini.d/custom.ini
composer require ext-fileinfo
git add -A && git commit -a -m 'my app'

Run pack with full builder, etc..

Log output 👇🏼 , the pack run is successful. But then the app doesn't run.

===> ANALYZING
[analyzer] Previous image with name "registry/org/technological-vehicle:git-8cc7bf3b" not found
===> DETECTING
[detector] 8 of 13 buildpacks participating
[detector] paketo-buildpacks/ca-certificates  3.2.4
[detector] paketo-buildpacks/php-dist         1.0.1
[detector] paketo-buildpacks/composer         0.1.0
[detector] paketo-buildpacks/composer-install 0.1.1
[detector] paketo-buildpacks/httpd            0.4.2
[detector] paketo-buildpacks/php-fpm          0.1.2
[detector] paketo-buildpacks/php-httpd        0.2.1
[detector] paketo-buildpacks/php-start        0.2.0
===> RESTORING
===> BUILDING
[builder] 
[builder] Paketo CA Certificates Buildpack 3.2.4
[builder]   https://github.com/paketo-buildpacks/ca-certificates
[builder]   Launch Helper: Contributing to layer
[builder]     Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[builder] Paketo PHP Distribution Buildpack 1.0.1
[builder]   Resolving PHP version
[builder]     Candidate version sources (in priority order):
[builder]       composer.lock -> "^8.0.2"
[builder]       <unknown>     -> ""
[builder] 
[builder]     Selected PHP version (using composer.lock): 8.1.7
[builder] 
[builder]   Executing build process
[builder]     Installing PHP 8.1.7
[builder]       Completed in 2.446s
[builder] 
[builder]   Generating SBOM for /layers/paketo-buildpacks_php-dist/php
[builder]       Completed in 0s
[builder] 
[builder]     Generating default PHP configuration
[builder] 
[builder]   Configuring build environment
[builder]     MIBDIRS           -> "/layers/paketo-buildpacks_php-dist/php/mibs"
[builder]     PATH              -> "/layers/paketo-buildpacks_php-dist/php/sbin:$PATH"
[builder]     PHPRC             -> "/layers/paketo-buildpacks_php-dist/php/etc"
[builder]     PHP_API           -> "20210902"
[builder]     PHP_EXTENSION_DIR -> "/layers/paketo-buildpacks_php-dist/php/lib/php/extensions/no-debug-non-zts-20210902"
[builder]     PHP_HOME          -> "/layers/paketo-buildpacks_php-dist/php"
[builder]     PHP_INI_SCAN_DIR  -> "$PHP_INI_SCAN_DIR:/layers/paketo-buildpacks_php-dist/php/etc:/layers/paketo-buildpacks_php-dist/php/etc:/workspace/.php.ini.d"
[builder] 
[builder]   Configuring launch environment
[builder]     MIBDIRS           -> "/layers/paketo-buildpacks_php-dist/php/mibs"
[builder]     PATH              -> "/layers/paketo-buildpacks_php-dist/php/sbin:$PATH"
[builder]     PHPRC             -> "/layers/paketo-buildpacks_php-dist/php/etc"
[builder]     PHP_API           -> "20210902"
[builder]     PHP_EXTENSION_DIR -> "/layers/paketo-buildpacks_php-dist/php/lib/php/extensions/no-debug-non-zts-20210902"
[builder]     PHP_HOME          -> "/layers/paketo-buildpacks_php-dist/php"
[builder]     PHP_INI_SCAN_DIR  -> "$PHP_INI_SCAN_DIR:/layers/paketo-buildpacks_php-dist/php/etc:/layers/paketo-buildpacks_php-dist/php/etc:/workspace/.php.ini.d"
[builder] 
[builder] Paketo Composer Buildpack 0.1.0
[builder]   Resolving Composer version
[builder]     Candidate version sources (in priority order):
[builder]        -> ""
[builder] 
[builder]     Selected composer version (using ): 2.3.5
[builder] 
[builder]   Executing build process
[builder]     Installing Composer 2.3.5
[builder]       Completed in 49ms
[builder] 
[builder]   Generating SBOM for /layers/paketo-buildpacks_composer/composer
[builder]       Completed in 0s
[builder] 
[builder] Paketo Composer Install Buildpack 0.1.1
[builder]   Executing build process
[builder]   Building new layer /layers/paketo-buildpacks_composer-install/composer-packages
[builder]   Running 'composer install'
[builder]   Ran 'composer install --no-progress --no-dev --no-scripts -o'
[builder]       Completed in 23.728s
[builder] 
[builder]   Generating SBOM for /layers/paketo-buildpacks_composer-install/composer-packages
[builder]       Completed in 42ms
[builder] 
[builder]   Writing symlink /workspace/vendor => /layers/paketo-buildpacks_composer-install/composer-packages/vendor
[builder]   Running 'composer check-platform-reqs'
[builder]   Ran 'composer check-platform-reqs', found extensions ''
[builder] Paketo Apache HTTP Server Buildpack 0.4.2
[builder]   Resolving Apache HTTP Server version
[builder]     Candidate version sources (in priority order):
[builder]       <unknown> -> ""
[builder] 
[builder]     Selected Apache HTTP Server version (using <unknown>): 2.4.54
[builder] 
[builder]   Executing build process
[builder]     Installing Apache HTTP Server 2.4.54
[builder]       Completed in 335ms
[builder] 
[builder]   Configuring launch environment
[builder]     APP_ROOT    -> "/workspace"
[builder]     SERVER_ROOT -> "/layers/paketo-buildpacks_httpd/httpd"
[builder] 
[builder]   Assigning launch processes:
[builder]     web (default): httpd -f /workspace/httpd.conf -k start -DFOREGROUND
[builder] 
[builder] Paketo PHP FPM Buildpack 0.1.2
[builder]   Setting up the FPM configuration file
[builder]   Configuring build environment
[builder]     PHP_FPM_PATH -> "/layers/paketo-buildpacks_php-fpm/php-fpm-config/base.conf"
[builder] 
[builder]   Configuring launch environment
[builder]     PHP_FPM_PATH -> "/layers/paketo-buildpacks_php-fpm/php-fpm-config/base.conf"
[builder] 
[builder] Paketo PHP HTTPD Buildpack 0.2.1
[builder]   Setting up the HTTPD configuration file
[builder] 
[builder]   Configuring build environment
[builder]     PHP_HTTPD_PATH -> "/layers/paketo-buildpacks_php-httpd/php-httpd-config/httpd.conf"
[builder] 
[builder]   Configuring launch environment
[builder]     PHP_HTTPD_PATH -> "/layers/paketo-buildpacks_php-httpd/php-httpd-config/httpd.conf"
[builder] 
[builder] Paketo PHP Start Buildpack 0.2.0
[builder] 
[builder]   Determining start commands to include in procs.yml:
[builder]     HTTPD: httpd -f /layers/paketo-buildpacks_php-httpd/php-httpd-config/httpd.conf -k start -DFOREGROUND
[builder]     FPM: php-fpm -y /layers/paketo-buildpacks_php-fpm/php-fpm-config/base.conf -c /layers/paketo-buildpacks_php-dist/php/etc
[builder] 
[builder]   Assigning launch processes:
[builder]     web (default): procmgr-binary /layers/paketo-buildpacks_php-start/php-start/procs.yml
[builder] 
===> EXPORTING
[exporter] Adding layer 'paketo-buildpacks/ca-certificates:helper'
[exporter] Adding layer 'paketo-buildpacks/php-dist:php'
[exporter] Adding layer 'paketo-buildpacks/composer-install:composer-packages'
[exporter] Adding layer 'paketo-buildpacks/httpd:httpd'
[exporter] Adding layer 'paketo-buildpacks/php-fpm:php-fpm-config'
[exporter] Adding layer 'paketo-buildpacks/php-httpd:php-httpd-config'
[exporter] Adding layer 'paketo-buildpacks/php-start:php-start'
[exporter] Adding layer 'launch.sbom'
[exporter] Adding 1/1 app layer(s)
[exporter] Adding layer 'launcher'
[exporter] Adding layer 'config'
[exporter] Adding layer 'process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] Saving registry/org/technological-vehicle:git-8cc7bf3b...
[exporter] *** Images (1ff229987755):
[exporter]       registry/org/technological-vehicle:git-8cc7bf3b
[exporter] Adding cache layer 'paketo-buildpacks/php-dist:php'
[exporter] Adding cache layer 'paketo-buildpacks/composer:composer'
[exporter] Adding cache layer 'cache.sbom'

Motivations

Trying to make demo apps run, without editing composer.json and other hacks. I think that if we can figure out how to make these three frameworks run, all almost any project using composer should work.

@till
Copy link
Author

till commented Sep 1, 2022

I might be testing this against the wrong version — I see 0.1.1 in my builder, but 0.1.2 contains #5.

@till
Copy link
Author

till commented Sep 1, 2022

Ok, I ran the following for Laravel (to get the latest updates from here):

pack build my-app-image --builder paketobuildpacks/builder:full --buildpack "paketobuildpacks/php:1.2.0"
docker run --rm -p 3000:8080 --env PORT=8080 my-app-image

Also had to add a few extensions, but that's kinda expected.

I'll test the others.

@till
Copy link
Author

till commented Sep 1, 2022

For completeness, here are the necessary extensions for laravel (that I added to custom.ini and to composer.json) to make it work:

  • curl
  • fileinfo
  • openssl

@till
Copy link
Author

till commented Sep 1, 2022

I briefly tried Drupal, but the setup is too involved right now as it requires database, etc. and I lack time.

I then tried a symfony app, to contain it a little, I used their API skeleton:

composer create-project symfony/skeleton:"6.1.*" example-symfony-api

And used the following project.toml:

[ build ]
  [[ build.env ]]
    name="BP_PHP_SERVER"
    value="httpd"
  [[ build.env ]]
    name="BP_PHP_ENABLE_HTTPS_REDIRECT"
    value="false"
  [[ build.env ]]
    name="BP_PHP_WEB_DIR"
    value="public"
  [[ build.env ]]
    name="BP_COMPOSER_INSTALL_OPTIONS"
    value="--no-scripts -o"

Then run, pack build symfony-app --builder paketobuildpacks/builder:full --buildpack "paketobuildpacks/php:1.2.0"

Start the app like so: docker run --rm -p 3000:8080 --env PORT=8080 symfony-app

Produces the following exceptions once I access a route:

[Thu Sep 01 11:53:28.734826 2022] [proxy_fcgi:error] [pid 24:tid 140592214415104] [client 172.17.0.1:50346] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Symfony\\Component\\Dotenv\\Exception\\PathException: Unable to read the "/layers/paketo-buildpacks_composer-install/composer-packages/.env" environment file. in /layers/paketo-buildpacks_composer-install/composer-packages/vendor/symfony/dotenv/Dotenv.php:557\nStack trace:\n#0 /layers/paketo-buildpacks_composer-install/composer-packages/vendor/symfony/dotenv/Dotenv.php(105): Symfony\\Component\\Dotenv\\Dotenv->doLoad(false, Array)\n#1 /layers/paketo-buildpacks_composer-install/composer-packages/vendor/symfony/dotenv/Dotenv.php(148): Symfony\\Component\\Dotenv\\Dotenv->loadEnv('/layers/paketo-...', 'APP_ENV', 'dev', Array, false)\n#2 /layers/paketo-buildpacks_composer-install/composer-packages/vendor/symfony/runtime/SymfonyRuntime.php(107): Symfony\\Component\\Dotenv\\Dotenv->bootEnv('/layers/paketo-...', 'dev', Array, false)\n#3 /layers/paketo-buildpacks_composer-install/composer-packages/vendor/autoload_runtime.php(17): Symfony\\Component\\Runtime\\SymfonyRuntime->__construct(A...'
172.17.0.1 - - [01/Sep/2022:11:53:28 +0000] "GET / HTTP/1.1" 500 - vcap_request_id=- peer_addr=172.17.0.1
[Thu Sep 01 11:53:29.424061 2022] [proxy_fcgi:error] [pid 23:tid 140592378939136] [client 172.17.0.1:50352] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Symfony\\Component\\Dotenv\\Exception\\PathException: Unable to read the "/layers/paketo-buildpacks_composer-install/composer-packages/.env" environment file. in /layers/paketo-buildpacks_composer-install/composer-packages/vendor/symfony/dotenv/Dotenv.php:557\nStack trace:\n#0 /layers/paketo-buildpacks_composer-install/composer-packages/vendor/symfony/dotenv/Dotenv.php(105): Symfony\\Component\\Dotenv\\Dotenv->doLoad(false, Array)\n#1 /layers/paketo-buildpacks_composer-install/composer-packages/vendor/symfony/dotenv/Dotenv.php(148): Symfony\\Component\\Dotenv\\Dotenv->loadEnv('/layers/paketo-...', 'APP_ENV', 'dev', Array, false)\n#2 /layers/paketo-buildpacks_composer-install/composer-packages/vendor/symfony/runtime/SymfonyRuntime.php(107): Symfony\\Component\\Dotenv\\Dotenv->bootEnv('/layers/paketo-...', 'dev', Array, false)\n#3 /layers/paketo-buildpacks_composer-install/composer-packages/vendor/autoload_runtime.php(17): Symfony\\Component\\Runtime\\SymfonyRuntime->__construct(A...'

As you can see, while my app code is in /workspace, but all the libraries installed via composer are in /layers/paketo-buildpacks_composer-install/composer-packages/vendor.

I think they should be in /workspace/vendors (which is a symlink to the other, but somehow this doesn't work).

I disabled the use of DotEnv by adding the following to the composer.json:

{
    "extra": {
        "runtime": {
            "disable_dotenv": true
        },
    }
}

And then the application works. Using or not using DotEnv is debatable. Would be nice if it did work out of the box.

@sophiewigmore
Copy link
Member

sophiewigmore commented Sep 12, 2022

Hey Till! Thanks for the details, and for trying out a different types of apps. I'm glad that including #25 solved the Laravel issue, but it's helpful to know that the other cases still have some hiccups. It seems like the implementation I put in to solve that issue was incomplete, and doesn't cover all of the cases for different directories that might be needed.

I think you're completely on the right track. With the examples you've given we should be able to pin down how the symlinking behaviour should work without having to make tons of changes to the apps, but hopefully we can retain the ability to reuse the layer on rebuilds. As a PHP maintainer I'd definitely like to see this issue prioritized so we can have a better user experience for real use cases, @paketo-buildpacks/php-maintainers what do you think

@sophiewigmore sophiewigmore added the bug Something isn't working label Sep 12, 2022
@till
Copy link
Author

till commented Sep 13, 2022

I looked into the weird dotenv errors, and the symlinking.

Not sure how to guard against that:

  • dotenv is installed into: /layers/paketo-buildpacks_composer-install/composer-packages/vendor
  • it assumes it's in /workspace/vendor
  • the error is from trying to access a file in /layers/paketo-buildpacks_composer-install/composer-packages/.env (or similar), which doesn't exist
  • the actual file it's looking for is in /workspace/.env

You can override this behaviour via composer.json, but generally it seems like a weird implementation. Just unfortunate that Symfony is so wide spread.

But I guess it goes to show that somehow, I would like the dependencies to end up in /workspace (actually), not just via symlink. I haven't looked into the other scripts (yet) if they exhibit similar problems.

@sophiewigmore
Copy link
Member

Our implementation should definitely try to follow the most common use-case standards, so it's worthwhile to fix this.

@till
Copy link
Author

till commented Sep 17, 2022

I did a debugging session with one of the composer folks yesterday.

So for Symfony, I think this is the TL;DR:

  • When I disable the DotEnv component, I make local dev harder than it has to be. Sourcing the environment is a hurdle for users.
  • When I set the root-dir (via composer.json, then again, it breaks local dev as it then always expects a /workspace path.

I am guessing in order to make this work, I either implement my own buildpack or somehow convince you that this needs changing. The current layers don't work for this.

Any idea how to move this forward?

@sophiewigmore
Copy link
Member

sophiewigmore commented Sep 19, 2022

Composer folks as in, someone who works on composer? That's awesome!!

I think we are aligned that this is a valuable use case to support in the Paketo buildpacks in order to make the buildpacks actually useful for PHP developers. I am definitely interested in looking into this, it's more of a question of finding time to investigate this within the core team. I'll see about that. If time is of the essence, we're obviously happy to accept a contribution (I realize this issue requires a lot of buildpack knowledge though). More likely, when we're able to get to this, perhaps we can confer with you as a reviewer to understand if we are doing the right thing.

@thitch97
Copy link
Contributor

thitch97 commented Sep 19, 2022

@fg-j made the suggestion that Slice Layers could work well for this situation. If, for example, /workspace/vendor and /workspace/.env were added to the list of slice layers, we could reap the benefits of optimized cache reuse while preserving the location of those artifacts which the PHP frameworks depend on.

@TisVictress TisVictress moved this from ❓Not scoped to 🕵️‍♀️ Exploring in Paketo Workstreams Sep 19, 2022
@sophiewigmore sophiewigmore moved this from 🕵️‍♀️ Exploring to 📝 Todo in Paketo Workstreams Sep 22, 2022
@till
Copy link
Author

till commented Sep 28, 2022

@thitch97 @sophiewigmore Is there anything I can do to move this along? We are currently debating options as to how to move forward. We have a few people on our end waiting for a solution.

@sophiewigmore
Copy link
Member

@till we currently have this prioritized as something we will work on in the near future, but it is sitting below a few other things we need to get done first, like finishing rolling out Jammy stack support. I'd estimate it'll be a few weeks before we can get to it. You've already given us a lot of help with how to create sample apps to test against, but beyond that, you are welcome to contribute any way you see fit. (Assuming CLA woes are resolved?) If you are interested in contributing, I'm happy to add more context about that.

Repository owner moved this from 📝 Todo to ✅ Done in Paketo Workstreams Sep 28, 2022
@sophiewigmore sophiewigmore reopened this Sep 28, 2022
@sophiewigmore
Copy link
Member

(Oops, didn't mean to close the issue 😅 )

@till
Copy link
Author

till commented Sep 28, 2022

If you are interested in contributing, I'm happy to add more context about that.

Yes, definitely interested to contribute once I understand scope.

@sophiewigmore
Copy link
Member

sophiewigmore commented Sep 29, 2022

Right, you've already created some simple sample apps for each framework, which would be helpful to add as sample apps that we can then add some to failing integration tests for. This would be a really great starting place.

For context, the integration tests work by performing real builds of the apps with the buildpack, and running the final app image. We run them locally using scripts/integration.sh.

After adding tests for each of the frameworks, I think it would be helpful to nail down exactly what about each framework app is failing. I think we have a lot of that information spread out in the various issues already. Specifically, can we enumerate all of the potential paths that we'll need to include in a layer? Once we're at this point it's going to be figuring out the best way to rework the buildpack either using the layer slicing suggestion above, or in another way.

@sophiewigmore sophiewigmore moved this from ✅ Done to 📝 Todo in Paketo Workstreams Oct 19, 2022
@sophiewigmore sophiewigmore self-assigned this Dec 1, 2022
@sophiewigmore sophiewigmore moved this from 📝 Todo to 🚧 In Progress in Paketo Workstreams Dec 1, 2022
@sophiewigmore sophiewigmore moved this from 🚧 In Progress to 📝 Todo in Paketo Workstreams Dec 6, 2022
@sophiewigmore sophiewigmore removed their assignment Dec 6, 2022
@sophiewigmore
Copy link
Member

sophiewigmore commented Dec 14, 2022

@till I have opened #92 to try to fix symlinking issues. Hopefully this will resolve the main bug we're seeing with all framework apps. More work will need to be done on other buildpacks to resolve the issue you have with the amount of configuration needed

I'd like to also follow up and say thank you for the context you shared, and the examples of how you gave here of how to set up apps, and configuration you provided. It made my experience much easier working on this.

@sophiewigmore sophiewigmore moved this from 🚧 In Progress to 📨 PR Opened in Paketo Workstreams Dec 16, 2022
@sophiewigmore
Copy link
Member

Repository owner moved this from 📨 PR Opened to ✅ Done in Paketo Workstreams Dec 22, 2022
@sophiewigmore sophiewigmore reopened this Dec 22, 2022
@sophiewigmore
Copy link
Member

@till if you get a chance to test out the changes, please let us know if this has resolved this issue by closing this issue out!

@till
Copy link
Author

till commented Dec 22, 2022

@sophiewigmore Is this already part of a release of the php buildpack?

@sophiewigmore
Copy link
Member

@till I am working on a release of the PHP buildpack right now

@sophiewigmore
Copy link
Member

@sophiewigmore
Copy link
Member

@till any update here or shall I close this out?

@till
Copy link
Author

till commented Jan 5, 2023

@sophiewigmore give me a day. Latest by Monday. To test. Sorry for the delay. 😐

@sophiewigmore
Copy link
Member

No worries! It's not urgent.

@owlfog
Copy link

owlfog commented Jan 9, 2023

@sophiewigmore it's a pity that this fix is ​​only available for php8, is it possible to extend it to php7.4 as well?

@sophiewigmore
Copy link
Member

Hey @owlfog, the reason that this doesn't work for PHP 7.4 is because we removed support for PHP 7.4 from the buildpacks all together in December, because it has gone EOL upstream

@sophiewigmore
Copy link
Member

sophiewigmore commented Jan 17, 2023

It's been a bit so I'm going to close this out so we can stop tracking it. Feel free to reopen it if this problem comes back or is not satisfied by our fix

@effulgentsia
Copy link

effulgentsia commented Feb 9, 2023

Hi. I'm one of the maintainers of Drupal. Even though this issue is closed, I thought it might help to post this comment here anyway.

I took the Paketo buildpack for a spin with installing Drupal, and overall I'm very happy and impressed with what the Paketo community has done. Thank you for creating a well thought out and implemented system for creating container images of PHP (and other language) apps.

Even if the Paketo buildpack worked perfectly, I would still expect to need some Drupal-specific scaffolding, for things like creating a group-writable directory for CMS file uploads, for setting up a database connection (which could be as simple as a SQLite file), and for sourcing Drupal-required settings from environment variables (which isn't the default for non-containerized Drupal, but is the idiomatic approach for containers). Drupal already comes with a Composer plugin for installing scaffold files, so I created https://github.com/effulgentsia/drupal-paketo-scaffold, which is just 4 files in the scaffold directory and a composer.json file that specifies where each of those 4 files needs to be installed. A Drupal app simply needs to composer require that package and set a Composer config value that authorizes that package to install its scaffold files. The commands for that are explained in that package's README.

The only Paketo-related stumbling blocks that I ran into while building the above were:

Per above, none of them showstoppers, so again, thank you!

@sophiewigmore
Copy link
Member

Hey @effulgentsia, welcome! 👋
Thank you for the details on this. This original issue was the first step is unblocking building PHP framework applications but it's clear that there are a number of other fixes we could make to improve some of the buggy behaviour that still exists.

I haven't had a chance to really dig into the issues you've provided, but they're valuable context for us to use as a starting place to improve the user experience. I look forward to collaborating with you on these issues!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

5 participants