Netflix / dispatch-docker

Apache License 2.0
206 stars 87 forks source link

Remove core or clarify how it works #135

Closed JamesTimms closed 2 years ago

JamesTimms commented 2 years ago

Is your feature request related to a problem? Please describe. I'm trying to understand how the core component works and what it's used for but as far as I can tell it isn't used at all (as of v20220214). I ended up removing it from the docker setup and the application still ran perfectly fine. Is it deprecated or am I missing some crucial insight?

It seems to be using the same entry point as the web component except it isn't exposing itself in the same way.

Describe the solution you'd like The core component should be removed or its use better documented.

Describe alternatives you've considered I've stopped the core container within the local docker setup, which seemed to be the best work around.

Additional context Notice the command for dispatch_web_1 versus dispatch_core_1.

> docker ps -a --no-trunc
CONTAINER ID                                                       IMAGE            COMMAND                                                    CREATED      STATUS      PORTS                    NAMES
8e0779724b3c63485f32acd97ef3685148eaa539ef81290b3111323af4baa4d9   dispatch-local   "dispatch server start dispatch.main:app --host=0.0.0.0"   3 days ago   Up 3 days   0.0.0.0:8000->8000/tcp   dispatch_web_1
7d988c92d094b2f4bad2ef9da8f1ca9b538819e7f55860b4ccf92b74b0533200   dispatch-local   "dispatch scheduler start"                                 3 days ago   Up 3 days   8000/tcp                 dispatch_scheduler_1
2f022ac6c602314269b6fd3dcbef9308c117c074dec9c3a8f72aa97ce7734669   postgres:12      "docker-entrypoint.sh postgres"                            3 days ago   Up 3 days   0.0.0.0:5432->5432/tcp   dispatch_postgres_1
fbf1d0c81be4ac63addb0ef0b5d57e5b64dab57f20a9978c2db222505190d9bf   dispatch-local   "dispatch server start dispatch.main:app --host=0.0.0.0"   3 days ago   Up 3 days   8000/tcp                 dispatch_core_1

This was left running for 2 days and no logs were generated until I stopped the container. Whereas the web and scheduler components are a lot noisier.

> docker logs dispatch_core_1
INFO:     Started server process [1]
INFO:uvicorn.error:Started server process [1]
INFO:     Waiting for application startup.
INFO:uvicorn.error:Waiting for application startup.
INFO:     Application startup complete.
INFO:uvicorn.error:Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:uvicorn.error:Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     Shutting down
INFO:uvicorn.error:Shutting down
INFO:     Waiting for application shutdown.
INFO:uvicorn.error:Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:uvicorn.error:Application shutdown complete.
INFO:     Finished server process [1]
INFO:uvicorn.error:Finished server process [1]

The environment variables appear to be identical.

> docker exec -it dispatch_web_1 env > dispatch_web_1.env
> docker exec -it dispatch_core_1 env > dispatch_core_1.env
> diff dispatch_web_1.env dispatch_core_1.env
2c2
< HOSTNAME=8e0779724b3c
---
> HOSTNAME=fbf1d0c81be4
mvilanova commented 2 years ago

The web service depends on the core one, which builds the dispatch-local image. Does the following hold true if you delete the dispatch-local image from your system and remove the core service from the docker-compose.yml file?

I ended up removing it from the docker setup and the application still ran perfectly fine.

kevgliss commented 2 years ago

It's entirely likely that the docker-compose is not efficient. You're correct that after the web and schedule containers are built core is no longer needed but was the easiest way to speed up the build (instead of making scheduler and web both build all their deps). Happy to accept to PRs if something can be done better here. We don't deploy using docker so our investment is limited.

JamesTimms commented 2 years ago

Thanks for clarifying. I think this just needs adding to documentation somewhere as it's not very obvious what the core is used for.

@mvilanova I deleted just the container and not the image. I imagine I'd have issues if I deleted the image and removed core from the Dockerfile.

github-actions[bot] commented 2 years ago

This issue is stale, because it has been open for 30 days with no activity. Remove the stale label or comment, or this will be closed in 5 days.

mvilanova commented 2 years ago

Added a note for it in this section of the documentation: https://hawkins.gitbook.io/dispatch/installation#installing-dispatch-server