< 042022-07-05⋎06 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
05:07*jonasbits has quit (Ping timeout: 244 seconds)
05:07*jonasbits has joined
17:33*farmB173 has joined
17:33*farmBOT has quit (Remote host closed the connection)
17:35*farmBOT has joined
17:47*farmBOT has joined
18:07*MarcosCarballal[ has joined
18:07*uploaded an image: (43KiB) < libera.ems.host/_matrix/media/r0/downloa >
18:09MarcosCarballal[Hi all, we are looking for support on an issue we are having with our build/deploy process.... (full message at libera.ems.host/_matrix/media/r0/downloa)
20:33mstenta[m]Marcos Carballal: Sorry can't stay for long, but I would be curious to see your `composer.json` file. The part that is responsible for populating Drupal's "scaffolding" (eg the `index.php` file) is `drupal/core-composer-scaffold` package: github.com/farmOS/farmOS/blob/e434715e74
20:33mstenta[m]You should make sure that your `composer.json` file is using `composer-merge-plugin` to merge in the `composer.project.json` file provided by farmOS core
20:34*sent a code block: libera.ems.host/_matrix/media/r0/downloa
20:34mstenta[m]The farmOS `composer-project` template does that here: github.com/farmOS/composer-project/blob/
20:35mstenta[m]ok, i think that looks right
20:35mstenta[m](looks like you started with the `composer-project` template 👍️)
20:35mstenta[m]> This was working just fine on Friday, and as of yesterday we are facing this issue.
20:35mstenta[m]I would be curious about what changed between friday and yesterday, anything?
20:36MarcosCarballal[Nothing at all.
20:36MarcosCarballal[When I run the `composer install` with this composer.json, I get lots of messages saying it is downloading/installing various packages, but it doesn't say where it put those files and that directory is appearing empty
20:37MarcosCarballal[composer.json hasn't changed for weeks
20:39mstenta[m]So just to give an overview of how it (should) work... normally `composer` will put packages into the `vendor` directory. In our case, we want it to put some things (Drupal and modules) into the `web` directory. That's done via the `oomphinc/composer-installers-extender`, along with these lines:
20:39MarcosCarballal[That is the most confusing bit to me. This issue appeared in all of our local dev environments and is reproducible on all of our branches. I'm thinking maybe it is a dependency that was updated (Since we pull the dependencies on build) and broke something?
20:39*sent a code block: libera.ems.host/_matrix/media/r0/downloa
20:40mstenta[m]It looks like it is working in the core farmOS repo... we run a build nightly via GitHub Actions to catch that sort of thing: github.com/farmOS/farmOS/actions
20:41mstenta[m](The most recent one failed for a different known issue - but the build step itself worked fine)
20:41mstenta[m]You can see all the logs from those builds if you want something to compare against that you know is working as intended
20:42MarcosCarballal[Yeah, we are not facing any error messages in our build step, it just doesn't populate the web folder like expected
20:43mstenta[m]Do you have a `core` folder with most of the Drupal core code?
20:43mstenta[m]The scaffolding piece is just for `index.php` and a few other things so it *sounds* like that's the issue... but let's be sure
20:43MarcosCarballal[No
20:44mstenta[m]OK so nothing is in `web` except for what you have in your repo itself?
20:44MarcosCarballal[Yes, and it only gets there because I mount the folder in my docker-compose file
20:44MarcosCarballal[` - './web/modules/custom/cig_pods:/opt/drupal/PODS/web/modules/custom/cig_pods'
20:44MarcosCarballal[`
20:45mstenta[m]Can you check the `vendor` directory to see if perhaps they are ending up in there instead? eg: maybe the `composer-installers-extender` isn't working and they aren't being put where they should (so they are going to the default `vendor/[org]/[package]` dir
20:45MarcosCarballal[Sure, I'll try that
20:45mstenta[m]Oh is it possible that you changed your volume mounting or Docker config recently?
20:46mstenta[m](Long shot, but curious... I know that if you bind-mount a volume into a container it REPLACES that directory in the container - thereby making it empty - so if you were mounting `web`, then it would replace anything that was built IN the container itself, if that makes sense)
20:47MarcosCarballal[Interesting, I'll try launching the docker image without any of the mounts and see what happens.
20:48mstenta[m]eg: if you have the following in `docker-compose.yml`, then I think it would cause what you're seeing:... (full message at libera.ems.host/_matrix/media/r0/downloa)
20:48*sent a code block: libera.ems.host/_matrix/media/r0/downloa
20:48mstenta[m]oh ok
20:49mstenta[m]yea that looks ok
20:49mstenta[m]so yea i would check the `vendor` dir... see if that's there at all!
20:49mstenta[m]maybe `composer install` is actually failing, and nothing is being populated?
20:50mstenta[m]But the fact that you say nothing changed is very odd
20:51MarcosCarballal[I see a whole bunch of stuff under vendor
20:52*uploaded an image: (67KiB) < libera.ems.host/_matrix/media/r0/downloa >
20:52*posted a file: (34KiB) < libera.ems.host/_matrix/media/r0/downloa >
20:53MarcosCarballal[It doesnt look like the composer install is failing. Log attached
20:55mstenta[m]ok hmm... it does looks like everything is going into `vendor`, when some should be going into `web`
20:55mstenta[m]open `vendor/drupal` - is there a `core` dir in there?
20:56MarcosCarballal[Yup I see the core dir in there
20:57mstenta[m]alright so we know what the problem is :-)
20:57mstenta[m]now to figure out the solution...
20:57MarcosCarballal[🙂 that's always progress
20:57mstenta[m]not really sure why that wouldn't be working
20:58mstenta[m]could you be using Composer v1 by any chance?
20:58MarcosCarballal[2.3.7
20:58mstenta[m]ok
20:59mstenta[m]Oh... hmm maybe you need this:
20:59mstenta[m]github.com/farmOS/farmOS/blob/e434715e74
20:59mstenta[m]Oh I bet this is it, actually! paul121 said this was going to change upstream in July :-)
21:00mstenta[m]Here is the PR that he made a while back to prepare for it: github.com/farmOS/farmOS/pull/467
21:00mstenta[m]Actually this explains it better: github.com/farmOS/composer-project/pull/
21:00mstenta[m]> For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See getcomposer.org/allow-plugins
21:00mstenta[m]> You have until July 2022 to add the setting. Composer will then switch the default behavior to disallow all plugins.
21:01MarcosCarballal[The `allow-plugins` config goes in the composer.json, or elsewhere?
21:01mstenta[m]I think if you were running `composer install` manually you would be given a prompt - but because you are running it via Docker build you don't have the option (maybe? @paul121 might have better sense)
21:02mstenta[m]Yes I think you can add it to your `composer.json`
21:02mstenta[m]We do it slightly differently in our Dockerfile - I forget why exactly
21:02mstenta[m]But yes I think you can do that
21:03mstenta[m]We can take a look at the built farmOS composer.json file to see what it needs to look like... one sec...
21:04*sent a code block: libera.ems.host/_matrix/media/r0/downloa
21:04mstenta[m]Add that to your `composer.json` and try again
21:04MarcosCarballal[Trying it now!
21:07MarcosCarballal[It worked!
21:07MarcosCarballal[You are a wizard Mike
21:07mstenta[m]Huzzah!
21:08mstenta[m]That was a sneaky one... paul121 was right - he said this might cause folks trouble
21:08mstenta[m]It is a result of an upstream change in the way Composer handles plugins, for security reasons
21:09MarcosCarballal[I'll let you return to your vacation 😅. That is definitely a sneaky one I would not have got there on my own.
21:09MarcosCarballal[So it is that the composer-installers-extender and composer-merge-plugin were not able to do their thing because we didn't explicitly allow them?
21:09MarcosCarballal[Is this just for plugins that need to run when composer is run? For example, why do I need to add every single module that the project depends on into this list?
21:09MarcosCarballal[* do I NOT need to
21:10mstenta[m]Exactly. Some packages are composer plugins - and those have a bit more power (for good or evil)
21:10mstenta[m]So Composer decided to change the way they work by default, to make it harder to exploit
21:11mstenta[m]By forcing you to explicitly allow them, rather than allowing them by default
21:12MarcosCarballal[Makes sense why they did that. Adding a blurb to the composer output explaining that wouldn't have killed them though. It just doesn't run them and is very silent about it.
21:12mstenta[m]Yea agreed! I'm surprised it doesn't give any clues!
21:12mstenta[m]I wonder if there's a more verbose `composer install` flag that does
21:13MarcosCarballal[Yeah, probably worth adding to the build process if there is
21:13MarcosCarballal[Anyways
21:13MarcosCarballal[I'll let you get back to what you were doing. Thanks so much Mike
21:13mstenta[m]No problem - glad we could figure that out :-)
21:13MarcosCarballal[What day are you back?
21:14mstenta[m]I'll be back Monday
21:27MarcosCarballal[Cool, I think you will be excited by the progress we have made

< 042022-07-05⋏06 >