I am setting up a portainer server. I already installed and tested it with some prebuilt images from the registry.
I am trying to deploy an app consisting of a FastAPi back and a React front. There are no errors building and running the app. When I tell Portainer to pull and deploy, I get these errors:
Fastapi:
INFO: Will watch for changes in these directories: ['/app']
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: Started reloader process [1] using WatchFiles
ERROR: Error loading ASGI app. Could not import module "main".
React:
ERROR in ./node_modules/react-plotly.js/react-plotly.js 8:37-69
Module not found: Error: Can't resolve 'plotly.js/dist/plotly' in
'/usr/src/app/node_modules/react-plotly.js'
webpack compiled with 1 error and 1 warning
I already fixed the plotly error, installing it and pushing to remote. The package.json contains the plotly (and the local Docker compose deploy works).
These are the Dockerfiles and the Docker compose files:
Fastapi:
FROM python:3.11.5
WORKDIR /app
COPY ./app/requirements.txt /app/requirements.txt
RUN cat /app/requirements.txt
RUN pip3 install -r requirements.txt
COPY ./app /app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
React:
FROM node:14
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . ./
EXPOSE 3000
CMD ["npm", "start"]
Compose:
version: "3.8"
services:
balancer:
container_name: balancer
build:
context: ./balancer
dockerfile: Dockerfile
ports:
- "8000:8000"
volumes:
- ./balancer/app:/app
environment:
- DOCKER_APP="true"
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=postgres
- DB_USER=postgres
- DB_PASSWORD=postgres
- DB_RESET=false
- HOST_IP=192.168.1.120 # Reemplazar con tu IP actual
front:
container_name: front
build:
context: ./balancer-ui
dockerfile: Dockerfile
ports:
- "3000:3000"
volumes:
- ./balancer-ui:/app
depends_on:
- balancer
environment:
- REACT_APP_DOCKER_APP=true
- REACT_APP_HOST_IP=192.168.1.120 # Reemplazar con tu IP actual
I tested it and it works locally on Windows and Fedora machines, but not in the Debian server.
Is there something I am missing? I can not get it to work. I also reinstalled Portainer but the plotly and main module problems are still appearing.
Thanks in advance