retspen / webvirtcloud

WebVirtCloud is virtualization web interface for admins and users
1.7k stars 372 forks source link

service "backend_db_migration" didn't complete successfully: exit 1 #659

Open charnet1019 opened 3 days ago

charnet1019 commented 3 days ago

Deploy according to the following document and encounter an error: https://webvirt.cloud/docs/installation/setup-controller

root@collective:/home/webvirtcloud# ./webvirtcloud.sh start
 __        __   _  __     ___      _    ____ _                 _ 
 \ \      / ___| |_\ \   / (_)_ __| |_ / ___| | ___  _   _  __| |
  \ \ /\ / / _ | '_ \ \ / /| | '__| __| |   | |/ _ \| | | |/ _` |
   \ V  V |  __| |_) \ V / | | |  | |_| |___| | (_) | |_| | (_| |
    \_/\_/ \___|_.__/ \_/  |_|_|   \__|\____|_|\___/ \__,_|\__,_|

Docker version 27.3.1 is sufficient.

Building WebVirtCloud backend...
[+] Building 157.4s (14/14) FINISHED                                                                                                                                                       docker:default
 => [backend internal] load build definition from Dockerfile.backend                                                                                                                                 0.0s
 => => transferring dockerfile: 1.76kB                                                                                                                                                               0.0s
 => [backend internal] load metadata for python:3.10-alpine                                                                                                              3.1s
 => [backend internal] load .dockerignore                                                                                                                                                            0.0s
 => => transferring context: 109B                                                                                                                                                                    0.0s
 => CACHED [backend backend-deps 1/6] FROM python:3.10-alpine@sha256:039508c234f83314a3be8eed523f347f6f26816541be7caa4a9ef4a4bf1bfb66                                    0.0s
 => [backend internal] load build context                                                                                                                                                            0.1s
 => => transferring context: 888.43kB                                                                                                                                                                0.1s
 => [backend backend-deps 2/6] RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && apk add --no-cache gcc g++ pango fontconfig openssh-client            107.4s
 => [backend backend-deps 3/6] WORKDIR /requirements                                                                                                                                                 0.1s 
 => [backend backend-deps 4/6] COPY ./webvirtbackend/requirements/production.txt /requirements/requirements.txt                                                                                      0.1s 
 => [backend backend-deps 5/6] COPY ./optional-requirements.txt* /requirements/                                                                                                                      0.1s 
 => [backend backend-deps 6/6] RUN pip install -U uv -i https://mirrors.aliyun.com/pypi/simple/;     uv pip install --system -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/;     i  44.6s 
 => [backend backend 1/2] WORKDIR /backend                                                                                                                                                           0.1s 
 => [backend backend 2/2] COPY ./webvirtbackend/ /backend/                                                                                                                                           0.2s 
 => [backend] exporting to image                                                                                                                                                                     1.5s 
 => => exporting layers                                                                                                                                                                              1.5s 
 => => writing image sha256:4f2a634056a4aad6057d612ed17c39683093c82840acf4452584c313893f51c9                                                                                                         0.0s 
 => => naming to docker.io/library/webvirtcloud:backend                                                                                                                                              0.0s 
 => [backend] resolving provenance for metadata file                                                                                                                                                 0.0s
Building WebVirtCloud frontend...
[+] Building 36.6s (19/19) FINISHED                                                                                                                                                        docker:default
 => [frontend internal] load build definition from Dockerfile.frontend                                                                                                                               0.0s
 => => transferring dockerfile: 1.51kB                                                                                                                                                               0.0s
 => [frontend internal] load metadata for caddy:2.6.4-alpine                                                                                                             2.6s
 => [frontend internal] load metadata for node:18-alpine                                                                                                                 2.5s
 => [frontend internal] load .dockerignore                                                                                                                                                           0.0s
 => => transferring context: 109B                                                                                                                                                                    0.0s
 => CACHED [frontend frontend 1/3] FROM caddy:2.6.4-alpine@sha256:993f27cb24190f8b714f6ffd0cd487281b48b64a70d6575be8eee18b6c2b02af                                       0.0s
 => [frontend frontend-deps 1/4] FROM node:18-alpine@sha256:7e43a2d633d91e8655a6c0f45d2ed987aa4930f0792f6d9dd3bffc7496e44882                                             0.0s
 => [frontend internal] load build context                                                                                                                                                           0.1s
 => => transferring context: 5.95MB                                                                                                                                                                  0.1s
 => CACHED [frontend frontend-deps 2/4] WORKDIR /frontend/apps/web/                                                                                                                                  0.0s
 => [frontend frontend-deps 3/4] COPY ./webvirtfrontend/ /frontend/                                                                                                                                  0.6s
 => [frontend frontend-deps 4/4] RUN npm install --registry=https://registry.npmmirror.com/                                                                                                         19.5s
 => [frontend frontend-build 1/5] WORKDIR /frontend/apps/web/                                                                                                                                        0.1s 
 => [frontend frontend-build 2/5] COPY ./webvirtfrontend/apps/web/ /frontend/apps/web/                                                                                                               0.2s 
 => [frontend frontend-build 3/5] COPY ./global.env /frontend/global.env                                                                                                                             0.1s 
 => [frontend frontend-build 4/5] COPY ./custom.env /frontend/custom.env                                                                                                                             0.1s 
 => [frontend frontend-build 5/5] RUN set -a; . /frontend/global.env; . /frontend/custom.env; set +a; npm run build                                                                                 12.4s 
 => [frontend frontend 2/3] COPY --from=frontend-build /frontend/apps/web/dist/ /usr/share/caddy/client/                                                                                             0.1s 
 => [frontend frontend 3/3] COPY ./webvirtbackend/static/admin/ /usr/share/caddy/assets/admin/                                                                                                       0.3s 
 => [frontend] exporting to image                                                                                                                                                                    0.1s 
 => => exporting layers                                                                                                                                                                              0.1s 
 => => writing image sha256:879ce0206395300a9d52c1a5d66c91c552f5623ead1df1fa93c757ff7b89ff64                                                                                                         0.0s 
 => => naming to docker.io/library/webvirtcloud:frontend                                                                                                                                             0.0s 
 => [frontend] resolving provenance for metadata file                                                                                                                                                0.0s
Start WebVirtCloud...
[+] Running 8/8
 ✔ Container webvirtcloud-rabbitmq      Healthy                                                                                                                                                      2.0s 
 ✔ Container webvirtcloud-mariadb       Healthy                                                                                                                                                      2.0s 
 ✔ Container webvirtcloud-frontend      Started                                                                                                                                                      0.7s 
 ✔ Container webvirtcloud-backend       Recreated                                                                                                                                                    0.3s 
 ✔ Container webvirtcloud-novnc         Started                                                                                                                                                      1.5s 
 ✔ Container webvirtcloud-scheduler     Recreated                                                                                                                                                    0.4s 
 ✔ Container webvirtcloud-worker        Recreated                                                                                                                                                    0.3s 
 ✘ Container webvirtcloud-db-migration  service "backend_db_migration" didn't complete successfully: exit 1                                                                                          2.0s 
service "backend_db_migration" didn't complete successfully: exit 1

error log:

root@collective:/home/webvirtcloud# docker-compose logs -f backend_db_migration
webvirtcloud-db-migration  | Traceback (most recent call last):
webvirtcloud-db-migration  |   File "/backend/manage.py", line 11, in main
webvirtcloud-db-migration  |     from django.core.management import execute_from_command_line
webvirtcloud-db-migration  | ModuleNotFoundError: No module named 'django'
webvirtcloud-db-migration  | 
webvirtcloud-db-migration  | The above exception was the direct cause of the following exception:
webvirtcloud-db-migration  | 
webvirtcloud-db-migration  | Traceback (most recent call last):
webvirtcloud-db-migration  |   File "/backend/manage.py", line 22, in <module>
webvirtcloud-db-migration  |     main()
webvirtcloud-db-migration  |   File "/backend/manage.py", line 13, in main
webvirtcloud-db-migration  |     raise ImportError(
webvirtcloud-db-migration  | ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
charnet1019 commented 2 days ago

Resolved.

Just need to modify the ansible version number in the webvirtbackend/inquiries/production.txt file to 10.0.0a1