-
Notifications
You must be signed in to change notification settings - Fork 221
Make ov
base image updates overall more convenient and take immediate effect
#4560
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
Conversation
I'm working on a broader change for this, because just doing this doesn't help. There are a couple of problems that make an evolving environment cumbersome that we can fix, I think. The main issue is that updates to the base image don't automatically take effect in the running container, so even with this change, new base-system packages aren't immediately available. Technically just Since #4490, we reuse the same container each time. That's great, but when the base image changes, we aren't automatically using it, and we should be doing so (otherwise you have to manually run I have changes that are almost working for this I'll push soon. |
ab1b0f5
to
c1daab5
Compare
Also make run.sh a lot faster for most runs
c1daab5
to
43426b7
Compare
ov
base image updates overall more convenient and take immediate effect
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.
Really cool. The testing instructions worked perfectly locally. ov pnpm store path
works too.
I am not too worried about losing personal customizations, as I don't intend to make any myself.
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.
While I would love to be able to extend the ov
container with custom commands, we need to keep ov
simple enough that supporting it never becomes more work than maintaing Openverse.
The changes look good and make sense based on the goals in the description. Nevertheless, I will checkout this PR and use it for a while so that I can make sure these changes work just as well on macOS and there aren't any strange edge cases.
It's true, and because host-machine tools still work, you can pipe Regardless, this makes certain things (like optional extensions, for example, to support Playwright inside of |
Fixes
Fixes #4545 by @dhruvkb
Description
@dhruvkb and I came up with the fix during a donut chat just now, so I thought I'd go ahead and open the PR for it 😁
The PR ended up being slightly more complicated than just the solution Dhruv and I came up with. Additionally, I worked on this PR today on my laptop, which has been behaving very strangely and being suuuper slow for some things. I noticed a significant issue with
dev_env/run.sh
performance, and I made some additional improvements to increaseov
's execution speed under most circumstances.pipx install --global
in the Dockerfile. Alongside configuringPIPX_GLOBAL_HOME
to/pipx
(it defaults to/opt/pipx
), this has two effects that solve the problem described in the issue without creating a new one:/opt
volume on the host.ov pipx install
without causing permissions issues on Linux hosts that would be caused if we moved pipx entirely out of opt for all cases, while also allowing users to retain those tools even if the base system is updated. The issue with using an entirely separate location for all of pipx was that it would always get wiped out if the base system is updated or changed, and in those cases, you'd unexpectedly have to reinstall a tool you relied on being available inov
. You could cache those in a volume, but then you're back to where we started. Instead, we separate the concerns of the base system's pipx install usage from the user, so that they don't overlap and run into each other.npm install -g
works, by the way, and you can prove that byov which n
showing that it's installed in/usr/local/bin
just likeov which pdm
will now show.pnpm store path
can be super slow for some reason, and so can the pdm config queries. I've cached the relevant results of these queries into a newdev_env/.cache
directory, andov
execution is noticeably faster on slower computers.docker stop
was enough because of how we would restart a stopped container anyway. Instead, I updatedrun.sh
to detect whether the existing container is using the latest base system image, and if not, to replace it with one that is. This will unfortunately have an effect of wiping out modifications outside/opt
, but that's already the case with our existing non-working strategy (where you needov clean
to get it to work, which actually destroys/opt
as well). This way we always stay up to date with the base image, while keeping/opt
safe in these circumstances. The main silent negative effect this will have is if you rundnf install
in the container (to install some additional personal tool), you wouldn't have those packages installed anymore. We could devise a way of syncing personalisations of this sort, similar to.ov_aliases.json
, for example.PNPM_HOME
. It was exporting PATH, but that only worked whensetup_env
was the entrypoint. Now that it's just a one-time script afterov init
, that won't work. Instead, now the Dockerfile configures a pre-set location already inPATH
in the base system, andsetup-env
just puts the right thing there whenPNPM_HOME
exists. Onmain
,ov pnpm store path
would fail with an error about the path not being right. On this branch, it should work.setup_env.sh
needs to run as root inside the container. I already added the capability to run commands as root in Refactorov
to create a persistent container #4490, but that only affects linux hosts. macOS already runs everything as root in the container anyway, so you wouldn't have write issues when creating the symlink toPNPM_HOME
.I added
pgcli
to the base system image as a test, I thought I'd just leave it and we could eventually replace running pgcli inside the various containers with just running it inov
directly (and then remove it as a dev dependency from our apps!).Testing Instructions
ov init
then install a pipx package like,ov pipx install mycli
and confirm that (a) you can install it, (b) you can run it (ov mycli --help
), (c) you cannot reproduce the problem from the issue.Confirm after
ov init
, you get a message logged about creating a new container with the latest base system image. Confirm that this does not affect modifications in/opt
such as personally installed pipx packages (e.g.,mycli
is retained afterov init
). Removepgcli
from the Dockerfile, andov init
, and then confirm thatov which pgcli
can't find it.Checklist
Update index.md
).main
) or a parent feature branch../ov just catalog/generate-docs
for catalogPRs) or the media properties generator (
./ov just catalog/generate-docs media-props
for the catalog or
./ov just api/generate-docs
for the API) where applicable.Developer Certificate of Origin
Developer Certificate of Origin