-
Notifications
You must be signed in to change notification settings - Fork 537
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
Add named volume for mounting host files via OLYMPIA_MOUNT #22929
Conversation
a442f56
to
0371ce4
Compare
c978d4b
to
906ffb7
Compare
b619b89
to
ec052e8
Compare
28af358
to
19484d4
Compare
19484d4
to
095c5e7
Compare
Could you resolve the few conflicts in that PR ? |
b30eeed
to
1e42984
Compare
@diox this is now done, and:
Turns out this PR was too primitive to land after some of the other PRs landed. The goal was to strip as much out as possible to make it smaller. That doesn't work anymore so I added as little back until it is now working.
Edit: eating my words. we need proper validation on the setup script values. |
047cec0
to
8490d9f
Compare
8490d9f
to
fc63c15
Compare
dd214d3
to
1ab4848
Compare
1ab4848
to
a783d2e
Compare
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.
🤔
docker-compose.yml
Outdated
# production: (data_olympia):/data/olympia/storage | ||
# development: (./):/data/olympia/storage | ||
x-olympia-mount: &olympia-mount | ||
${HOST_MOUNT_SOURCE:?}:/data/olympia |
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.
should we have a default for HOST_MOUNT_SOURCE
here, like the development value. (I guess something like ${HOST_MOUNT_SOURCE:?-./
but I'm not super familiar with the docker-compose syntax).
(same for the next usage of HOST_MOUNT_SOURCE
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.
We should not. This syntax :?
is actually requiring this value to be set. This value must be defined and a valid value and there are no circumstances where it should be undefined.
a783d2e
to
4814b7a
Compare
75eab84
to
b1080ba
Compare
- Removed the deprecated docker-compose.ci.yml file, consolidating configurations into docker-compose.yml. - Updated environment variable mappings to use OLYMPIA_UID and OLYMPIA_MOUNT for improved clarity and consistency. - Enhanced entrypoint script to adjust user IDs based on the new environment variables. - Modified setup.py to determine the appropriate olympia mount based on the target environment. - Updated GitHub Actions workflows to reflect changes in environment variable usage and remove references to the old compose file.
b1080ba
to
6568376
Compare
Rleates to: mozilla/addons#15066
Description
Context
Follow up to #22912
By introducing a specific argument for the desired mounting strategy we can unify our docker compose files and have a simpler flow for mounting files correctly.
We must use bind mounts when mounting files from the host, named volumes (even with a host mounted device) do not send appropriate inotify events in a timely manner. This sucks and should be fixed in docker but for now it seems safer to use bind mounts
We map arguments
OLYMPIA_*
toHOST_*
in the .env file. This is because thesetup.py
script does not always accept the user input and we don't want to let an internal command (like docker compose<whatever>
) to rely on a potentially invalid value lingering on the environment but instead only read the explicitly set values in the .env. By using different names in that transaction we can guarantee this.It is possible that we should raise errors in setup.py when invalid values are passed for OLYMPIA_MOUNT but this patch introduces enough changes and we can see if this is an issue and raise it then.
Testing
Prod Mode
To verify expected mount behavior, run each:
expect the .env to have a value
HOST_MOUNT
equal to the specified valueexpect the web/worker containers to have an environment variable set to the specified value
expect settings.OLYMPIA_MOUNT to equal the specified value
If
developmemnt
is providedHOST_MOUNT_SOURCE
equal to"./"
if
production
is providedHOST_MOUNT_SOURCE
equal to"data_olympia_"
data_olympia
that is not mounted on the host. (changing files on the host should not impact files in the container, no uwsgi reload)To test this, attach a shell in the containers and inspect the files. Additionally, you can run the check command to verify expectations.
Additionally, verify that volumes are correctly mounted to
nginx
And to
worker
Important
Worker gets shared storage but not static files. these should be accessed via URL in the worker container if at all
Dev Mode
When running the project in dev mode (DOCKER_TARGET=dev) then the OLYMPIA_MOUNT will always be set to dev, even if specified otherwise.
Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.