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

Bind mount is not working for the mfe apps in tutor dev mode. #57

Closed
dagg opened this issue Jul 20, 2022 · 1 comment
Closed

Bind mount is not working for the mfe apps in tutor dev mode. #57

dagg opened this issue Jul 20, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@dagg
Copy link

dagg commented Jul 20, 2022

I have experienced the following problem while trying to bind-mount (using the --mount option) some of the mfe apps in tutor dev mode.

After I copy the learning mfe to a local directory:

tutor dev copyfrom learning /openedx/app ./frontend-app-learning

I try to mount the learning mfe app (according to tutor's documentation) while starting the learning app as shown below:

cd frontend-app-learning
tutor dev start --mount=. learning

and I get the following error:

Bind-mount: /home/user/TUTOR_DEV/frontend-app-learning -> /openedx/app in learning
docker-compose -f /home/user/.local/share/tutor/env/local/docker-compose.yml -f /home/user/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/user/.local/share/tutor/env/local/docker-compose.tmp.yml --project-name tutor_local stop
ERROR: The Compose file is invalid because:
Service learning has neither an image nor a build context specified. At least one must be provided.
Error applying action 'compose:project:started': func=<function _stop_on_dev_start at 0x7fcf5dfd91b0> contexts=[]'
Error: Command failed with status 1: docker-compose -f /home/user/.local/share/tutor/env/local/docker-compose.yml -f /home/user/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/user/.local/share/tutor/env/local/docker-compose.tmp.yml --project-name tutor_local stop

The exact same happens also with the profile app (learning and profile are the mfe apps I have tried so far).

I have to note that after I run the "copyfrom" command I have to recursively chown the directory "frontend-app-learning" because it's contents are owned by the "root" user.

Also the following command (without the "--mount" option) works perfectly:

tutor dev start learning

When I try to mount (using the --mount option) the lms or other non-mfe apps it seems to be working correctly though...

The only workaround that worked for me so far was to override the "docker-compose.yml" file by creating a "docker-compose.override.yml" file in the directory "../env/dev" ("$(tutor config printroot)/env/dev") which is a clone of the original "docker-compose.yml" that already exists in there, and put in the learning/volumes part the volume I want to be mounted when starting the learning app, like it's shown below:

      volumes:
          - ../plugins/mfe/apps/mfe/webpack.dev.config.js:/openedx/app/webpack.dev.config.js:ro
          - /home/user/TUTOR_DEV/frontend-app-learning:/openedx/app

But I guess that's not the most proper way of doing it.

I think there is a fix in a similar problem in v13.2.2 of Tutor: Here

Maybe it's something similar but specific for bind mounting the mfe apps...

I use the latest (at this time) tutor version (14.0.3).

@regisb regisb added the bug Something isn't working label Jul 25, 2022
regisb added a commit to overhangio/tutor that referenced this issue Jul 25, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close #711. Close also overhangio/tutor-mfe#57.
regisb added a commit to overhangio/tutor that referenced this issue Jul 25, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close #711. Close also overhangio/tutor-mfe#57.
regisb added a commit to overhangio/tutor that referenced this issue Jul 25, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close #711. Close also overhangio/tutor-mfe#57.
regisb added a commit to overhangio/tutor that referenced this issue Jul 29, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close #711. Close also overhangio/tutor-mfe#57.
regisb added a commit to overhangio/tutor that referenced this issue Jul 29, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close #711. Close also overhangio/tutor-mfe#57.
regisb added a commit to overhangio/tutor that referenced this issue Jul 29, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close #711. Close also overhangio/tutor-mfe#57.
regisb added a commit to overhangio/tutor that referenced this issue Jul 29, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close #711. Close also overhangio/tutor-mfe#57.
moonesque pushed a commit to edSPIRIT/tutor that referenced this issue Jul 31, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close overhangio#711. Close also overhangio/tutor-mfe#57.
moonesque pushed a commit to edSPIRIT/tutor that referenced this issue Jul 31, 2022
The -m/--mount option makes it possible to bind-mount volumes at runtime. The
volumes are declared in a local/docker-compose.tmp.yml file. The problem with
this approach is when we want to bind-mount a volume to a service which is
specific to the dev context. For instance: the "learning" service when the MFE
plugin is enabled.

In such a case, starting the service triggers a call to `docker-compose stop`
in the local context. This call fails because the "learning" service does not
exist in the local context. Note that this issue only seems to occur with
docker-compose v1.

To resolve this issue, we create two additional filters for
the dev context, which emulate the behaviour of the local context. With this approach, we convert the -m/--mount arguments right after they are parsed. Because they are parsed just once, we can get rid of the de-duplication logic initially introduced with the COMPOSE_CLI_MOUNTS context.

Close overhangio#711. Close also overhangio/tutor-mfe#57.
@kdmccormick
Copy link
Contributor

Thanks for reporting this @dagg . It should be fixed in the latest Tutor release (v14.0.4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants