Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
23 stars 12 forks source link

[Bug] Vault docker image not available when starting the app #1315

Closed tschaffter closed 1 year ago

tschaffter commented 1 year ago

Is there an existing issue for this?

What projects are you seeing the problem on?

OpenChallenges

Current behavior

The issue happens when starting from a clean environment where even images have been removed. Starting the app then leads to the following issue:

$ nx serve openchallenges-app
...
>  Nx Container  Removing temp folder /tmp/docker-build-push-jiqJpj

> nx run openchallenges-api-gateway:serve-detach

openchallenges-vault Pulling 
openchallenges-vault Error 
Error response from daemon: manifest for sagebionetworks/openchallenges-vault:latest not found: manifest unknown: manifest unknown

 >  NX   ERROR: Something went wrong in run-commands - Command failed: docker/openchallenges/serve-detach.sh openchallenges-api-gateway

   Pass --verbose to see the stacktrace.

> nx run openchallenges-organization-service:build-image-base

Expected behavior

The image sagebionetworks/openchallenges-vault should be built as part of the deployment process, then successfully started.

Anything else?

Rang experienced this issue too when deploying the app on the new EC2 instance.

Commit ID

eb135fc

Are you developing inside the dev container?

Code of Conduct

tschaffter commented 1 year ago

@rrchai I realize now that the issue is actually a limitation that I described in the section Future Work of the the PR #1302.

  • There is a small risk that not all Docker images will be built when executing a container.
    • Image build dependency is defined by the Nx graph.
    • Container dependency is defined in the Docker Compose file (depends_on).
    • Ideally, the knowledge of which images must be built should match the images needed to run the containers, i.e. building the image should be done with Docker Compose.
    • Building docker images for Spring boot add is a multi-command process and is not as simple as building an image from a Docker file. I don't know yet whether this would be an issue if we want to trigger the image build from the Docker Compose files.

There are two options:

  1. First build all the docker images, then serve the stack.
  2. Find a way to trigger the build from Docker compose files.

I don't know if Option 2 is possible as we have a few projects that need a multi-command process to build their image. It doesn't look like we can specify a custom command as part of the build docker compose property, which I would have used otherwise to run nx build-image <project>.

References