< 012024-08-02⋎03 >

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
06:20*SebastianBui[m] has joined
06:29SebastianBui[m]hi just wanted to introduce myself as a newbie to the farmos. i am not technically inclined but am here to learn mostly. hope thats okay. i wont have much technical knowledge to contribute. hope that does not disqualify me from being here.
08:58*farmBOT has joined
11:08mstenta[m]Hi Sebastian Bui - welcome! You're in the right place, regardless of your background. :-)
11:08mstenta[m]I recommend joining the community forum too (better than chat for discussions): farmOS.discourse.group
11:09mstenta[m]Hope to see you around!
14:55symbioquine[m]Created github.com/farmOS/farmOS/pull/864 as a draft. Still need to test...
14:57mstenta[m]Wow awesome!
14:58paul121[m]symbioquine: so this doesn't require any changes to the dockerfile? would upcoming/remaining changes for the dockerfile from the previous PR potentially break multi-platform builds?
14:59paul121[m]I've been wanting to pickup those remaining changes but it seemed like these buildx discussions were going to conflict so I've been waiting...
15:00symbioquine[m]paul121[m]: I don't think so - obviously anything can break anything but...
15:01mstenta[m]It would be awesome to offer v3.3.0 on ARM!
15:01mstenta[m](added this PR to the milestone, but no pressure if it doesn't make it in in time)
15:01mstenta[m](just thinking that would be another cool thing to mention in the minor release blog post!)
15:02mstenta[m](there's also a fair bit to do before v3.3.0 is ready anyway...)
15:03symbioquine[m]I guess I should look over those additional proposed Docker file changes again in order to answer your question more confidently @paul121
15:05paul121[m]symbioquine[m]: This comment is a good tldr of what I'm thinking: github.com/farmOS/farmOS/pull/751#pullre
15:10mstenta[m]re: the composer ENV vars... my preference is to only include ones that are demonstrably necessary
15:11mstenta[m]specifically COMPOSER_ALLOW_SUPERUSER and COMPOSER_NO_INTERACTION
15:11mstenta[m](we already set COMPOSER_MEMORY_LIMIT, unless you're talking about changing that somehow)
15:15paul121[m]It looks like COMPOSER_ALLOW_SUPERUSER and COMPOSER_MEMORY_LIMIT are already set. Maybe we got confused because the PR was just moving those within the Dockerfile
15:23symbioquine[m]<paul121[m]> "This comment is a good tldr of..." <- > <@paul121:matrix.org> > <@symbioquine:matrix.org> I guess I should look over those additional proposed Docker file changes again in order to answer your question more confidently @paul121... (full message at <matrix.org/_matrix/media/v3/download/mat>)
15:30mstenta[m]Ah maybe. I knew COMPOSER_MEMORY_LIMIT was already there...
15:31mstenta[m]I think the bit I'm most interested in is around disolving build-farmOS.sh
15:32mstenta[m]but all in all, it seems like everything is just cleanup/rearranging at this point. we might make things a little smaller/more efficient here and there, but i don't think there are any big changes
15:33mstenta[m]github.com/farmOS/farmOS/pull/855 was the bigger change I think
15:34mstenta[m]before #855 we were essentially running composer install twice to build the dev image (once in the production image build, and then we ran it again to overwrite that in the dev image. now we essentially "fork" the build into doing one or the other.
15:35mstenta[m](i guess in terms of deliver.yml we're still running composer install the same number of times, technically speaking... but now it's possible to build a standalone dev image with a single composer install step)
15:36mstenta[m]makes me wonder... would we be able to squeeze a little more speed out of the build steps if we built the prod and dev images in parallel now 🤔
15:36mstenta[m]probably splitting hairs... i doubt it would be a big improvement
15:41paul121[m]mstenta[m]: do we only need to build prod when tagging a release?
15:41mstenta[m]yep i think so! that could be another improvement
15:42mstenta[m]3.x is always pushed in parallel, which would build the dev image at the same commit
15:42symbioquine[m]Hmmm, I'm not convinced...
15:42mstenta[m]oh wait
15:43mstenta[m]sorry i misunderstood
15:43symbioquine[m]I think we run the tests against the Dev IMG as a prerequisite to tagging a release.
15:43mstenta[m]no, it's still useful to have a farmos/farmos:3.x image that does not include dev dependencies etc
15:44mstenta[m]paul121: or did you mean: "can we SKIP building dev when tagging a release?" that's how I interpretted it initially, but maybe you meant "can we SKIP building prod when we're only pushing 3.x"
15:45mstenta[m]skipping dev build on tag push could make sense
15:45mstenta[m]we don't publish farmos/farmos:x.y.z-dev
15:45mstenta[m]that would certainly shave off some time for tagged releases
15:46paul121[m]oh - yeah I meant skip building prod unless we are making a release, but it makes sense we want the 3.x image.
15:46mstenta[m]> I think we run the tests against the Dev IMG as a prerequisite to tagging a release.
15:46mstenta[m]Oh but that's the critical bit symbioquine is right :-)
15:46mstenta[m]yep yep... so everything makes sense as-is, in both cases :-)
15:48paul121[m]it feels like we should be "testing the prod image" since that it is what might be used in the wild... and it is built separately from testing...
15:49paul121[m]s/testing/*dev/
15:49paul121[m]the only difference would be a separate composer install run. in theory they will be the same, but it is composer... :D
15:50mstenta[m]dev dependencies are installed with prod though
15:50mstenta[m]aren't* i mean
15:50mstenta[m](eg: phpunit)
15:50paul121[m]it would be nice if we could share a composer lock file but only install dev dependencies into the dev image
15:51mstenta[m]that's essentially what we do... just without committing the composer.lock file
15:51mstenta[m]we run composer install --no-dev for prod, and composer install for dev
15:52mstenta[m](whether or not we commit composer.lock is another question... but wouldn't change how that works)
15:54paul121[m]no, its not about committing the lock file. we run composer install two separate times "from scratch", so I don't think we can guarantee they would end up with the same lock file/dependencies
15:54mstenta[m]that's true. that's the question about committing composer.lock.
15:55mstenta[m]but we would be running those same commands regardless
15:55symbioquine[m]It wouldn't need to be committed to git necessarily
15:55symbioquine[m]Just shared between the two stages I think
15:55mstenta[m]true
15:55mstenta[m]that would be a nice next step perhaps
15:55mstenta[m]for that specific concern
15:55symbioquine[m]We could have a "composer lock resolver" stage that just does that, then uses the lock file in either of the target stages.
15:56symbioquine[m]Then in my proposed GH workflow, that stage would be cached and shared.
15:56symbioquine[m](I think)
15:56mstenta[m]notably, we're talking about a composer.lock at the project level, right? not the farmos/farmos install profile
15:56mstenta[m]?
15:56mstenta[m]this: github.com/farmOS/composer-project
15:56paul121[m]yep
15:57symbioquine[m]mstenta[m]: Well, derived from that I think.
15:57mstenta[m]yea. we basically just git clone that, and a temporary composer.lock gets generated in the build environments, but is never committed
15:58mstenta[m]but you're right paul121 - that's getting created twice, and *could* be different
15:58symbioquine[m]mstenta[m]: But for example [this line](github.com/farmOS/farmOS/blob/3a73ccf636) alters the `composer.json` prior to running `composer install` right?
15:58mstenta[m]true. we do make some changes to the composer.json after cloning it
15:59mstenta[m]that's also how we point it to another repo for PRs
15:59mstenta[m]github.com/farmOS/farmOS/blob/3a73ccf636
15:59mstenta[m]and github.com/farmOS/farmOS/blob/3a73ccf636
16:00paul121[m]If we check the production image I think it will actually have dev dependencies in it's lock file - which is fine - but also confirms a prerequisite to do a separate "composer lock resolver" step. It means that composer install --no-dev should respect not including the dev dependencies even if present in a lock file :-)
16:00mstenta[m]this is a side track but... why does it take so long to push/pull docker images to/from github cache??
16:01paul121[m]Maybe relevant: github.com/farmOS/farmOS/pull/764
16:02mstenta[m]Oh yea that PR that wotnak started might overlap with what you're doing too symbioquine
16:02symbioquine[m]mstenta[m]: Yeah, I wasn't aware of that one...
16:03mstenta[m]It was built on top of almavizca's original PR, so needed to be rerolled, but I didn't look closely at it
16:04mstenta[m]paul121: yea afaik there isn't a way to JUST build a `composer.lock` file, you need to run `composer install`... so this might be moot
16:04mstenta[m]stackoverflow.com/questions/44805083/can
16:05symbioquine[m]stackoverflow.com/a/70972005
16:05mstenta[m]this is a bit tricky... (if i'm thinking about it correctly)
16:06paul121[m]mstenta[m]: No, I believe we do that with `composer require farmos/farmos:${FARMOS_COMPOSER_VERSION} --no-install`
16:06mstenta[m]because we are trying to balance two things...
16:06mstenta[m]hmm i'm not sure that makes composer.lock 🤔 worth testing!
16:07mstenta[m]it might only update composer.json
16:07mstenta[m]the two things we are trying to balance are: 1) building a single composer.lock (to ensure that the same is used in both prod and dev builds), and 2) only running composer install once per dev/prod build
16:08*uploaded an image: (97KiB) < matrix.org/_matrix/media/v3/download/mat >
16:08symbioquine[m]getcomposer.org/doc/03-cli.md#update-u-u
16:09mstenta[m]> stackoverflow.com/a/70972005
16:09mstenta[m]symbioquine: According to this, it sounds like you can't run `composer update --no-install` to generate a `composer.lock` though
16:09symbioquine[m]I think so
16:09mstenta[m]You need a composer.lock to begin with (I haven't tested... just going by that answer)
16:09symbioquine[m]Anyway, gotta run. Hopefully I'll get a chance to look into this more from my end tomorrow morning...
16:10paul121[m]Yea, I actually do this a lot in my own build/deploy process. When I update farmos I do something like composer update farmos/farmos --no-install and it updates the lock file. Then I commit composer.lock and push to my deploy process and it installs the new deps in an environment there.
16:10mstenta[m]Right. But you have a lock file already in that case, right?
16:10mstenta[m]I do that too.
16:10mstenta[m]But in this case we don't have a lock file.
16:11mstenta[m]I think the lock file only gets created on composer install - but i could be wrong!
16:11paul121[m]I believe it does but will test again :-)
16:12mstenta[m]I'm curious now too :-)
16:12mstenta[m]I'll try a clean test from scratch
16:15mstenta[m]ok interesting...
16:15mstenta[m]# composer update farmos/farmos --no-install
16:15mstenta[m]Cannot update only a partial set of packages without a lock file present. Run `composer update` to generate a lock file.
16:16mstenta[m]But then when I run composer update it appears to do the same exact thing as composer install...
16:17mstenta[m]It makes composer.lock but also installs everything (vendor, web etc are all created)
16:17mstenta[m]So composer update without composer.lock == composer install
16:18mstenta[m]So... I don't think we can share a composer.lock file between dev and prod builds without taking a step backwards in the sense that we need to build one first )without --no-dev) and then build again on top of that (with --no-dev)
16:18mstenta[m]Orrrr.... unless we start committing composer.lock ;-)
16:18paul121[m]<paul121[m]> "No, I believe we do that with `..." <- try `composer require`
16:19mstenta[m]K let me reset
16:20mstenta[m]oh looks like that worked!
16:20mstenta[m]much faster :-) and only the composer.lock file was created
16:21mstenta[m]oh that's great! (someone should update that SO answer 😆)
16:21paul121[m]This might be an artifact of one of the composer plugins... maybe merge plugin? That runs something "twice"....
16:21mstenta[m]oh hmmmmmmm good question... i wonder if this misses anything
16:23mstenta[m]gah that's probably an issue... because i think merge plugin looks at stuff in the vendor directory to find things that need to be merged
16:23mstenta[m](i think)
16:26mstenta[m]i don't know if there's any way around it... i think if we want to ensure that composer.lock is the same for prod and dev builds we would NEED to run composer install to build the dev codebase and run composer install --no-dev AGAIN from th same composer.lock that was generated to build the prod codebase
16:27mstenta[m]Which essentially undoes the improvement that our recent PR just made
16:27mstenta[m]But maybe that's just something we have to accept
16:29mstenta[m](perhaps ultimately because we use composer merge, we're stuck with this ugly truth)
16:30mstenta[m](i am testing to confirm this now)
16:30paul121[m]Is there an issue with doing the install twice? The second time should be much faster since all the dependencies are resolved
16:31paul121[m]The first install would be in common, the prod could do composer install --no-dev to remove dev dependencies
16:31mstenta[m]No not really. It's what we were doing before the recent PR.
16:31mstenta[m]yup
16:31mstenta[m]I think that's the only way to ensure we share composer.lock
16:32mstenta[m](this would still be an improvement over what we had before the recent PR though... because previously we deleted /var/farmOS and ran composer install again from scratch)
16:34mstenta[m]> (i am testing to confirm this now)
16:34mstenta[m]confirmed. the `composer.lock` that is generated from `composer require farmos/farmos:3.2.3 --no-install` is different from the `composer.lock` generated from `composer install`. at quick glance it looks like it's missing everything that would be added by composer merge.
16:34mstenta[m]iirc composer merge works by essentially running composer update twice itself when composer install runs... or something like that
16:35mstenta[m]anyway... i need to work on other stuff. this was an interesting dig though. :-)
16:36mstenta[m]sounds like we have one way forward... a composer install build step before both dev/prod build steps, and then another composer install --no-dev for prod
16:37mstenta[m]what does this mean for symbioquine's `buildx` work though... will we be building multiple `composer.lock`s anyway? (one for each architecture)
16:37mstenta[m](assuming that we use a matrix to run tests on all archs too)
16:39paul121[m]ah hmm. yeah I guess so
16:39mstenta[m]unless we did one arch first, built the composer.lock, and then copied it into the builds for other archs
16:39mstenta[m]feels like it's starting to spiral out 😅
16:40mstenta[m]or.... maybe we don't need to run composer install inside the docker container? 🤔
16:41mstenta[m]what if we had a simple step before all the docker builds that just ran composer install in the github action native environment (not in a container within that)
16:41mstenta[m]presumably composer will work the same regardless
16:42mstenta[m](just thinking out loud, not suggesting)
16:42paul121[m]yea... and I guess ultimately, there are various shortcomings in using this single prod github image. Most people will want it further customized with additional contrib dependencies. In this regard the state of the composer.lock is somewhat out of our control
16:43paul121[m]Honestly it might make more sense to do the buildx/multi-plaform outside of core.... so then we don't need to maintain it as much....
16:44mstenta[m]yea. so maybe we're trying to solve a problem that doesn't actually exist? in theory composer.lock could be different between prod and dev builds, which could hypothetically lead to something broken in prod that passes tests in dev (i think that's the problem we're talking about here ultimately, right?)...
16:45mstenta[m]well i do think it's worth providing official images for arm
16:45paul121[m]<mstenta[m]> "or.... maybe we don't need to..." <- yeah i see this. its more about providing the base images rather than a full "out of the box working env"
16:46mstenta[m]yea just thinking that would allow us to build a composer.lock file BEFORE we start building/testing in Docker images
16:46mstenta[m]so it could be shared into all of them
16:46mstenta[m]again... if we need to have the same composer.lock file... but maybe this isn't that big of a concern
16:47mstenta[m]> could hypothetically lead to something broken in prod that passes tests in dev (i think that's the problem we're talking about here ultimately, right?)...
16:47mstenta[m]this *would* be a very confusing issue, if it happened 😂
16:48paul121[m]it seems easy enough to adapt a single composer.lock to our existing build steps... but would introduce a lot more complexity to do the same for buildx
16:48mstenta[m]but we would probably figure it out pretty quickly
16:48mstenta[m]the next push of 3.x would fail too
16:48mstenta[m]and then we could debug
16:49paul121[m]yea. like that recent consumers issue
16:49mstenta[m]oh did that happen in between dev/prod builds?
16:49paul121[m]that's basically what we're hoping to avoid
16:49paul121[m]no no it didn't
16:49paul121[m]at least I didn't notice haha
16:49mstenta[m]oh... well then that's a different issue
16:50mstenta[m]that's just because we don't commit composer.lock in the first place
16:50mstenta[m]all of this stuff we're talking about wouldn't avoid the consumers issue
16:50mstenta[m](i don't think?)
16:51paul121[m]that's correct - but the consumers issue is an example of something that could happen between dev/prod builds :-)
16:51mstenta[m]true
16:55mstenta[m]whelp. without committing composer.lock anyone building farmOS with composer has the same risk... regardless of whether we catch it between dev/prod build.
16:55mstenta[m]i guess it's a bit out of our hands though
16:56mstenta[m]the line between the "app" and the "project" is blurry in that regard
16:56paul121[m]yeah. ideally you run the tests yourself before you push to production 😅
16:56paul121[m]but that's really it
16:56paul121[m]or farmos pins a lot more of our dependencies
16:56mstenta[m]i was just typing that :-)
16:56mstenta[m]yup
16:57mstenta[m]but even that would only catch issues with top-level deps
16:58mstenta[m]eg: if there was some bug in a lower-level symfony package, we'd still be susceptible to that
16:58mstenta[m]this might be unavoidable to some degree
16:58mstenta[m]although it reminds me of this old PR...
16:58mstenta[m]github.com/farmOS/farmOS/pull/739
17:00paul121[m]k I actually gtg now :-)
17:01mstenta[m]> Apart from fixing farmOS/composer-project#10, there are two other small benefits to doing this:... (full message at <matrix.org/_matrix/media/v3/download/mat>)
17:01mstenta[m]Maybe that + making composer based installs the recommended path is really the best we can do
17:02mstenta[m]Then we would be committing composer.lock for tags at least
17:18mstenta[m]> Anyway, gotta run. Hopefully I'll get a chance to look into this more from my end tomorrow morning...
17:18mstenta[m]symbioquine FWIW everything we've been discussing is only tangentially related to your `buildx` work, and the issue we're imagining is an edge case... just to say I don't think any of this `composer.lock` discussion needs to block/affect the `buildx` PR IMO
17:19mstenta[m]IMO providing official ARM images provides more of a win than preventing the composer.lock edge case (and we can figure out a solution to that afterwards if we need to)
17:20mstenta[m]But now my gears are turning on some of the ideas in github.com/farmOS/farmOS/pull/739 again as a different way of solving the composer.lock issue 😄
17:21mstenta[m]If we did commit composer.lock to farmOS/composer-project (only on tagged releases), then we would be certain that the build for a tag would use that lock
17:21mstenta[m]the issue would still be possible for 3.x images, but it's really the tagged releases we want reproducibility on first and foremost I think
18:14symbioquine[m]I think that's a really good compromise, personally
18:17symbioquine[m]<mstenta[m]> "> Anyway, gotta run. Hopefully I..." <- > <@mstenta:matrix.org> > Anyway, gotta run. Hopefully I'll get a chance to look into this more from my end tomorrow morning...... (full message at <matrix.org/_matrix/media/v3/download/mat>)

< 012024-08-02⋏03 >