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

made vgrid_files_readonly ro volume #43

Merged
merged 4 commits into from Mar 7, 2024

Conversation

Bjarke42
Copy link

The way the vgrid_files_readonly was implemented does not honor the way we use docker-compose.override in ansibl-docker-migrid, so now i have changed it so i can override the mountpoint correctly.

@@ -260,6 +272,13 @@ volumes:
device: ${DOCKER_MIGRID_ROOT}/state
o: bind

state-ro:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would choose another name cause this is not the state directory but the vgrid_files dir.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benibr i don't have any good ideas to what else it should be named. All the dirs are in the migrid_root directory, and this also plays with the state dir.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest vgrid_files_readonly as thats what it is now. state-ro is misleading.

driver_opts:
type: none
device: ${DOCKER_MIGRID_ROOT}/state/vgrid_files_writable
o: bind
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better if we add the read only option here so that the volume it self is read only.
Otherwise a container could mount it writeable due to a config error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the new change its reported as:

{
                "Type": "volume",
                "Name": "docker-migrid_state-ro",
                "Source": "/var/lib/docker/volumes/docker-migrid_state-ro/_data",
                "Destination": "/home/mig/state/vgrid_files_readonly",
                "Driver": "local",
                "Mode": "z",
                "RW": false,
                "Propagation": ""
            },

@benibr
Copy link
Contributor

benibr commented Feb 13, 2024

The new volume should also be used in the other environments development and development_gpd

@benibr
Copy link
Contributor

benibr commented Feb 14, 2024

looks good to me!

The read_only: true could even be removed I guess

@Martin-Rehr Martin-Rehr merged commit 9e5d09d into ucphhpc:master Mar 7, 2024
@jonasbardino
Copy link
Contributor

Thanks for the contribution.
I wonder if it would make sense to integrate a generic overrides method here in docker-migrid and to all use that ... @Bjarke42 ?
I'm asking because we currently use slightly modified docker-compose-X.yml files linked from the docker-migrid-ucphhpc repo for our own minor adjustments for our sites e.g. to allow podman use, and already had vgrid volume adjustments overlapping with this PR there.

@Bjarke42
Copy link
Author

Thanks for the contribution. I wonder if it would make sense to integrate a generic overrides method here in docker-migrid and to all use that ... @Bjarke42 ? I'm asking because we currently use slightly modified docker-compose-X.yml files linked from the docker-migrid-ucphhpc repo for our own minor adjustments for our sites e.g. to allow podman use, and already had vgrid volume adjustments overlapping with this PR there.

this is the docker-compose.override vi currently use:
docker-compose.override.au.yml.j2 Its a nice way of not having too many instances of the same thing, but just as you are talking about having one docker-compose. But i do not know your requirements, so if you only change stuff in the already existing parameters, then you could benefint from it alot

@benibr
Copy link
Contributor

benibr commented Mar 19, 2024

For the record, this PR broke the Test CI as you can see here: https://github.com/ucphhpc/docker-migrid/actions/runs/8345752910/job/22841385858?pr=45#step:6:35

I cannot see though why it was not run for this PR. I open a Issue for that.

@jonasbardino
Copy link
Contributor

I can confirm that using the docker-compose_production.yml from the merged revision 9e5d09d breaks docker-compose up on my dev erda instance with the same error as the CI builder reported in the link @benibr posted above:

Creating migrid ... error

ERROR: for migrid  Cannot create container for service migrid: failed to mount local volume: mount ./state/vgrid_files_writable:/var/lib/docker/volumes/docker-migrid-erda_vgrid_files_readonly/_data, flags: 0x1000, data:  ro: no such file or directory
...

It runs fine using the previous reversion b79a882 of that same compose file.

@jonasbardino
Copy link
Contributor

The initial crash could be removed by removing the space in the volume mount options and switching to the new docker compose as the default compose command rather than the old docker-compose.
Even then we kept hitting random mount errors e.g. in the Github Actions CI job for such nested volume remounts. This looks like a potential race in docker itself as @benibr reported upstream in docker/compose#11663
Still, AFAICT there is no point at all in having this vgrid_files_readonly bind mount as a full-blown docker top-level volume as we just need a live read-only copy of the vgrid_files_writable dir. The same applies for the mig_system_run shared cache space referenced in issue #40. I understood from PR 43 that it was changed into top-level volumes for easing docker-compose overrides at AU, which sounds valid enough. So I've reworked them into plain bind mounts but tried to provide similar flexibility with env variables to allow overriding the actual source path and using the long format to hopefully ease any remaining templating needs.
The result is now available in the docker-compose_production_bind.yml file and I'd like your feedback @Bjarke42 and Anders. Will that or can that be made to work with your site setup?
It finally brings consistency back in the build everywhere else so I'd really like to have it replace docker-compose_production.yml.

@benibr
Copy link
Contributor

benibr commented Apr 16, 2024

@jonasbardino can you please add a PR for this so that we can see the diff and have a discussion there?

Please do not commit testing configs to the master branch. We have so many unused config files in Migrid and it just makes things confusing.
Also it's very complicated to make a test deployment when you have to change a file somewhere in the middle of it.
Use git branches plz :-)

@Bjarke42
Copy link
Author

@jonasbardino yes, please continue this in a new PR. Its alot easier for us to see the diff and then relate to what you changed.

@jonasbardino
Copy link
Contributor

You're probably right that it would have been better to either make this as a branch in the first place or to initiate a full revert of this PR with a follow-up retry if needed. Either would introduce breakage or extra work somewhere.
As you know it developed in several steps during that bug hunt, because Github Actions are tricky to simulate/debug and I was hoping we could quickly resolve the matter and just replace the existing production conf. In hindsight that was maybe too optimistic, since we all have other urgent matters to tend to.

Anyway, I've made a PR #55 to do what I intend to do. Namely, replace the current docker-compose_production.yml with the proposed new docker-compose_production_bind.yml. Please have a look and perhaps review to confirm or raise any remaining issues with it.
I hope it makes it easier, although I'm not really sure it is less pain to test from a branch instead... I'll let you decide on that :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants