building web from master branch
Hello,
I ran in to some issues while trying to build web part of dispatch (scheduler builds fine with docker build)
However it fails because it can't determine dispatch version or build.
logs from ./install.sh
Checking minimum requirements...
./.env already exists, skipped creation.
./requirements.txt already exists, skipped creation.
Creating volumes for persistent storage...
Created dispatch-postgres.
Generating secret key...
Secret key written to ./.env
Building and tagging Docker images...
Step 1/47 : FROM python:3.8-slim-buster as sdist
---> 091e4db1c781
Step 2/47 : LABEL maintainer="[email protected]"
---> Using cache
---> acdfc509e3b8
Step 3/47 : LABEL org.opencontainers.image.title="Dispatch PyPI Wheel"
---> Using cache
---> 91cb95d33068
Step 4/47 : LABEL org.opencontainers.image.description="PyPI Wheel Builder for Dispatch"
---> Using cache
---> 65b0248c3c11
Step 5/47 : LABEL org.opencontainers.image.url="https://dispatch.io/"
---> Using cache
---> c09412441b65
Step 6/47 : LABEL org.opencontainers.image.source="https://github.com/netflix/dispatch"
---> Using cache
---> ada4df40987e
Step 7/47 : LABEL org.opencontainers.image.vendor="Netflix, Inc."
---> Using cache
---> 1571b0bce440
Step 8/47 : LABEL org.opencontainers.image.authors="[email protected]"
---> Using cache
---> b4d0ba9fe5e9
Step 9/47 : RUN apt-get update && apt-get install -y --no-install-recommends dirmngr gnupg2 ca-certificates wget && rm -rf /var/lib/apt/lists/*
---> Using cache
---> f91d54c18b0e
Step 10/47 : RUN set -x export GNUPGHOME="$(mktemp -d)"
---> Using cache
---> ea14440bcdaf
Step 11/47 : RUN for key in B42F6819007F00F88E364FD4036A9C25BF357DD4 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 FD3A5288F042B6850C66B31F09FE44734EB7990E 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 DD8F2338BAE7501E3DD5AC78C273792F7D83545D C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 B9AE9905FFD7803F25714661B63B535A4C206CA9 77984A986EBC2AA786BC0F66B01FBB92821C587A 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 4ED778F539E3634C779C87C6D7062848A1AB005C A48C2BEE680E841632CD4E44F07496B3EB3C1762 B9E2F5981AA6E0CD28160D9FF13993A75599653C ; do gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; done
---> Using cache
---> 8cd0afcaf664
Step 12/47 : ENV GOSU_VERSION 1.12
---> Using cache
---> 9d99a31ab685
Step 13/47 : RUN set -x && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu && rm -rf /usr/local/bin/gosu.asc && chmod +x /usr/local/bin/gosu
---> Using cache
---> 85bb2cb8b4c7
Step 14/47 : ENV TINI_VERSION 0.18.0
---> Using cache
---> 93086518b654
Step 15/47 : RUN set -x && wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini" && wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini.asc" && gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini && rm -f /usr/local/bin/tini.asc && chmod +x /usr/local/bin/tini
---> Using cache
---> 08239be6a050
Step 16/47 : COPY .nvmrc /usr/src/dispatch/
---> Using cache
---> cae6f499ebeb
Step 17/47 : RUN cd /usr/src/dispatch && export NODE_VERSION="$(cat .nvmrc)" && wget "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" && wget "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" && gpg --batch --verify SHASUMS256.txt.asc && grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - && tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 && rm -f "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc
---> Using cache
---> 04a5e89269e2
Step 18/47 : ARG SOURCE_COMMIT
---> Using cache
---> 3368eeba6ea4
Step 19/47 : ENV DISPATCH_BUILD=${SOURCE_COMMIT:-unknown}
---> Using cache
---> dee919013a42
Step 20/47 : LABEL org.opencontainers.image.revision=$SOURCE_COMMIT
---> Using cache
---> d94421def47f
Step 21/47 : LABEL org.opencontainers.image.licenses="https://github.com/netflix/dispatch/blob/${SOURCE_COMMIT:-master}/LICENSE"
---> Using cache
---> 8a840b3382c8
Step 22/47 : ARG DISPATCH_LIGHT_BUILD
---> Using cache
---> 92164c879acc
Step 23/47 : ENV DISPATCH_LIGHT_BUILD=${DISPATCH_LIGHT_BUILD}
---> Using cache
---> 259f29c595b3
Step 24/47 : RUN echo "DISPATCH_LIGHT_BUILD=${DISPATCH_LIGHT_BUILD}"
---> Using cache
---> 7d5fb94fcd25
Step 25/47 : COPY . /usr/src/dispatch/
---> 98a56d0621d6
Step 26/47 : RUN export YARN_CACHE_FOLDER="$(mktemp -d)" && cd /usr/src/dispatch && python setup.py bdist_wheel && rm -r "$YARN_CACHE_FOLDER" && mv /usr/src/dispatch/dist /dist
---> Running in 1502e4b0ed2e
running bdist_wheel
running build
running build_assets
using node (v12.16.2)
[91mnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
[0m[91mnpm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[0m[91m
[0m[91m- Building for production...
[0m[91mCould not determine dispatch version or build
[0mbuilding assets for dispatch vUNKNOWN (build UNKNOWN)
Removing intermediate container 1502e4b0ed2e
Cleaning up...
Any ideas how to fix it ?
Thanks.
I just ran into this as well, the problem occurs in setup.py because the import fails, whereas this used to work in the previous master version. The newest version in master has __init__.py import the models, and somewhere tries to import pydantic, and that fails at build time because it's not available. This issue was introduced in #249. The setup.py tries to fall back to loading from a json file with the path src/dispatch/static/dispatch/assets.json, which doesn't exist by default but worked for me when I added a dummy file like the following and it will build:
{
"version": "master",
"build": "master"
}
I'm not sure this helps you if you're using the install.sh method, though, as you wouldn't be able to place that file in the correct location. If you try to just do docker build . via the main project there are currently errors in the Dockerfile which will also get in your way.
I've been able to reproduce this locally, will take a look to see if I can avoid the circular dependency.
I was able to build it successfully after using assets.json file, however not sure if that is related, but after starting service, it throws exception that Directory '/usr/local/lib/python3.8/site-packages/dispatch/static/dispatch/dist' does not exist
Attaching to dispatch_postgres_1, dispatch_scheduler_1, dispatch_web_1
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m PostgreSQL Database directory appears to contain a database; Skipping initialization
[36mpostgres_1 |[0m
[36mpostgres_1 |[0m LOG: database system was shut down at 2020-05-19 15:39:29 UTC
[36mpostgres_1 |[0m LOG: MultiXact member wraparound protections are now enabled
[36mpostgres_1 |[0m LOG: database system is ready to accept connections
[36mpostgres_1 |[0m LOG: autovacuum launcher started
[33mscheduler_1 |[0m No metric providers specified metrics will not be sent.
[32mweb_1 |[0m No metric providers specified metrics will not be sent.
[33mscheduler_1 |[0m WARNING:dispatch.common.utils.cli:Failed to load plugin: zoom_conference Reason: "Config 'ZOOM_API_USER_ID' is missing, and has no default."
[32mweb_1 |[0m WARNING:dispatch.common.utils.cli:Failed to load plugin: zoom_conference Reason: "Config 'ZOOM_API_USER_ID' is missing, and has no default."
[33mscheduler_1 |[0m Traceback (most recent call last):
[33mscheduler_1 |[0m File "/usr/local/bin/dispatch", line 5, in <module>
[33mscheduler_1 |[0m from dispatch.cli import entrypoint
[33mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/dispatch/cli.py", line 14, in <module>
[33mscheduler_1 |[0m from .main import * # noqa
[33mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/dispatch/main.py", line 130, in <module>
[33mscheduler_1 |[0m frontend.mount("/", StaticFiles(directory=STATIC_DIR), name="app")
[33mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
[33mscheduler_1 |[0m raise RuntimeError(f"Directory '{directory}' does not exist")
[33mscheduler_1 |[0m RuntimeError: Directory '/usr/local/lib/python3.8/site-packages/dispatch/static/dispatch/dist' does not exist
[32mweb_1 |[0m INFO: Started server process [1]
[32mweb_1 |[0m INFO: Waiting for application startup.
[32mweb_1 |[0m INFO: Application startup complete.
[32mweb_1 |[0m INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
[35mscheduler_1 |[0m No metric providers specified metrics will not be sent.
[35mscheduler_1 |[0m WARNING:dispatch.common.utils.cli:Failed to load plugin: zoom_conference Reason: "Config 'ZOOM_API_USER_ID' is missing, and has no default."
[35mscheduler_1 |[0m Traceback (most recent call last):
[35mscheduler_1 |[0m File "/usr/local/bin/dispatch", line 5, in <module>
[35mscheduler_1 |[0m from dispatch.cli import entrypoint
[35mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/dispatch/cli.py", line 14, in <module>
[35mscheduler_1 |[0m from .main import * # noqa
[35mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/dispatch/main.py", line 130, in <module>
[35mscheduler_1 |[0m frontend.mount("/", StaticFiles(directory=STATIC_DIR), name="app")
[35mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
[35mscheduler_1 |[0m raise RuntimeError(f"Directory '{directory}' does not exist")
[35mscheduler_1 |[0m RuntimeError: Directory '/usr/local/lib/python3.8/site-packages/dispatch/static/dispatch/dist' does not exist
[33mdispatch_scheduler_1 exited with code 1
[0m[34mscheduler_1 |[0m No metric providers specified metrics will not be sent.
[34mscheduler_1 |[0m WARNING:dispatch.common.utils.cli:Failed to load plugin: zoom_conference Reason: "Config 'ZOOM_API_USER_ID' is missing, and has no default."
[34mscheduler_1 |[0m Traceback (most recent call last):
[34mscheduler_1 |[0m File "/usr/local/bin/dispatch", line 5, in <module>
[34mscheduler_1 |[0m from dispatch.cli import entrypoint
[34mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/dispatch/cli.py", line 14, in <module>
[34mscheduler_1 |[0m from .main import * # noqa
[34mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/dispatch/main.py", line 130, in <module>
[34mscheduler_1 |[0m frontend.mount("/", StaticFiles(directory=STATIC_DIR), name="app")
[34mscheduler_1 |[0m File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
[34mscheduler_1 |[0m raise RuntimeError(f"Directory '{directory}' does not exist")
[34mscheduler_1 |[0m RuntimeError: Directory '/usr/local/lib/python3.8/site-packages/dispatch/static/dispatch/dist' does not exist
[35mdispatch_scheduler_1 exited with code 1
The issue with just making an assets.json file is that it indicates that the assets don't need to be built, but for the docker images they do need to be built (and you're effectively skipping that step).
Please try again, #345 should resolve the issue.
Hi, this resolves the issue for building the container, when:
- you use Dockerfile from the develop branch, since the one from master fails( #341 + #344 fixes that in develop branch ).
- add 9b4a5ff08170_.py file by dispatch/src/dispatch/alembic/versions/ (it was complaining that it does not exist 💁
However, I am still having same issues when container starts ** I disabled zoom plugin in setup.py file, so warning is no longer shown, but error message is the same as in post above
dispatch_postgres_1 is up-to-date
Recreating dispatch_scheduler_1 ... done
Recreating dispatch_web_1 ... done
Attaching to dispatch_postgres_1, dispatch_scheduler_1, dispatch_web_1
scheduler_1 | No metric providers specified metrics will not be sent.
postgres_1 |
postgres_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_1 |
postgres_1 | LOG: database system was shut down at 2020-05-19 20:41:35 UTC
postgres_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_1 | LOG: autovacuum launcher started
postgres_1 | LOG: database system is ready to accept connections
postgres_1 | LOG: received smart shutdown request
postgres_1 | LOG: autovacuum launcher shutting down
postgres_1 | LOG: shutting down
postgres_1 | LOG: database system is shut down
postgres_1 |
postgres_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_1 |
postgres_1 | LOG: database system was shut down at 2020-05-19 20:53:59 UTC
postgres_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_1 | LOG: autovacuum launcher started
postgres_1 | LOG: database system is ready to accept connections
postgres_1 | LOG: received smart shutdown request
postgres_1 | LOG: autovacuum launcher shutting down
postgres_1 | LOG: shutting down
postgres_1 | LOG: database system is shut down
postgres_1 |
postgres_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_1 |
postgres_1 | LOG: database system was shut down at 2020-05-19 20:54:26 UTC
postgres_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_1 | LOG: database system is ready to accept connections
postgres_1 | LOG: autovacuum launcher started
web_1 | No metric providers specified metrics will not be sent.
scheduler_1 | Traceback (most recent call last):
scheduler_1 | File "/usr/local/bin/dispatch", line 5, in <module>
scheduler_1 | from dispatch.cli import entrypoint
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/dispatch/cli.py", line 14, in <module>
scheduler_1 | from .main import * # noqa
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/dispatch/main.py", line 130, in <module>
scheduler_1 | frontend.mount("/", StaticFiles(directory=STATIC_DIR), name="app")
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
scheduler_1 | raise RuntimeError(f"Directory '{directory}' does not exist")
scheduler_1 | RuntimeError: Directory '/usr/local/lib/python3.8/site-packages/dispatch/static/dispatch/dist' does not exist
web_1 | INFO: Started server process [1]
web_1 | INFO: Waiting for application startup.
web_1 | INFO: Application startup complete.
web_1 | INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
scheduler_1 | No metric providers specified metrics will not be sent.
scheduler_1 | Traceback (most recent call last):
scheduler_1 | File "/usr/local/bin/dispatch", line 5, in <module>
scheduler_1 | from dispatch.cli import entrypoint
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/dispatch/cli.py", line 14, in <module>
scheduler_1 | from .main import * # noqa
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/dispatch/main.py", line 130, in <module>
scheduler_1 | frontend.mount("/", StaticFiles(directory=STATIC_DIR), name="app")
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
scheduler_1 | raise RuntimeError(f"Directory '{directory}' does not exist")
scheduler_1 | RuntimeError: Directory '/usr/local/lib/python3.8/site-packages/dispatch/static/dispatch/dist' does not exist
dispatch_scheduler_1 exited with code 1
scheduler_1 | No metric providers specified metrics will not be sent.
scheduler_1 | Traceback (most recent call last):
scheduler_1 | File "/usr/local/bin/dispatch", line 5, in <module>
scheduler_1 | from dispatch.cli import entrypoint
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/dispatch/cli.py", line 14, in <module>
scheduler_1 | from .main import * # noqa
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/dispatch/main.py", line 130, in <module>
scheduler_1 | frontend.mount("/", StaticFiles(directory=STATIC_DIR), name="app")
scheduler_1 | File "/usr/local/lib/python3.8/site-packages/starlette/staticfiles.py", line 55, in __init__
scheduler_1 | raise RuntimeError(f"Directory '{directory}' does not exist")
scheduler_1 | RuntimeError: Directory '/usr/local/lib/python3.8/site-packages/dispatch/static/dispatch/dist' does not exist
dispatch_scheduler_1 exited with code 1
When it starts building it value for build key is unknown, by any chance that might be an issue ?
Step 25/46 : RUN export YARN_CACHE_FOLDER="$(mktemp -d)" && cd /usr/src/dispatch && python setup.py bdist_wheel && rm -r "$YARN_CACHE_FOLDER" && mv /usr/src/dispatch/dist /dist
---> Running in fd10998da497
running bdist_wheel
running build
running build_assets
using node (v12.16.2)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
- Building for production...
pulled version information from 'dispatch' module. /usr/src/dispatch/src/dispatch/__init__.py
building assets for dispatch v0.1.0.dev0 (build unknown)
writing version manifest
recorded manifest
{
"createdAt": "2020-05-19T20:22:16.337905Z",
"version": "0.1.0.dev0",
"build": "unknown"
}
running build_py
creating build
creating build/lib
creating build/lib/dispatch
Please pull the latest dispatch-docker build I believe https://github.com/Netflix/dispatch-docker/pull/54 should fix your issue.
yes this fixes it.