Encountered an error when deploying a custom app to Frappe Docker

I followed the Frappe Docker guide. I successfully installed ERPNext, but not with my custom app. My custom app was initially built only on Frappe and doesn’t depend on any other application

Clone frappe_docker repo

git clone https://github.com/frappe/frappe_docker
cd frappe_docker

Create configuration and resources directory

mkdir ~/gitops

Install Traefik

echo 'TRAEFIK_DOMAIN=test.thanhpci.me' > ~/gitops/traefik.env
echo 'EMAIL=cthanhm4@gmail.com' >> ~/gitops/traefik.env
echo 'HASHED_PASSWORD='$(openssl passwd -apr1 chanit78u | sed -e s/\\$/\\$\\$/g) >> ~/gitops/traefik.env
docker compose --project-name traefik \
  --env-file ~/gitops/traefik.env \
  -f overrides/compose.traefik.yaml \
  -f overrides/compose.traefik-ssl.yaml up -d

Install MariaDB

echo "DB_PASSWORD=pachtii" > ~/gitops/mariadb.env
docker compose --project-name mariadb --env-file ~/gitops/mariadb.env -f overrides/compose.mariadb-shared.yaml up -d

Here I performed two cases: installing ERPNext and the second case is installing my custom app. To do this, I made adjustments in the compose.yaml file in the /frappe-docker directory. In each instance, I only installed one application (ERPNext or my custom app).

Case 1:

x-customizable-image: &customizable_image
  image: ${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-${ERPNEXT_VERSION:?No ERPNext version or tag set}}
  pull_policy: ${PULL_POLICY:-always}

Case 2:

x-customizable-image: &customizable_image
  image: thanhpci/msp_image:latest
  pull_policy: always

Just to add: with the custom app, I have frozen the environment into a requirements file. I also built the image with the same versions of Python, Node, and Frappe as the development environment. Then, I pushed it to Docker Hub

Install APP

cp example.env ~/gitops/bench-one.env
sed -i 's/DB_PASSWORD=123/DB_PASSWORD=pachtii/g' ~/gitops/bench-one.env
sed -i 's/DB_HOST=/DB_HOST=mariadb-database/g' ~/gitops/bench-one.env
sed -i 's/DB_PORT=/DB_PORT=3306/g' ~/gitops/bench-one.env
sed -i 's/SITES=`erp.example.com`/SITES=`thanhpci.games`/g' ~/gitops/bench-one.env

echo 'ROUTER=bench-one' >> ~/gitops/bench-one.env
echo "BENCH_NETWORK=bench-one" >> ~/gitops/bench-one.env

Editing for compose:

docker compose --project-name bench-one \
  --env-file ~/gitops/bench-one.env \
  -f compose.yaml \
  -f overrides/compose.redis.yaml \
  -f overrides/compose.multi-bench.yaml \
  -f overrides/compose.multi-bench-ssl.yaml config > ~/gitops/bench-one.yaml

Using compose file

docker compose --project-name bench-one -f ~/gitops/bench-one.yaml up -d

In each case, I ran these two commands and checked. But only with ERPNext: After running the compose up command, when I accessed the Traefik monitor page that was set up, I saw that in the router section of the dashboard, the rule displayed both the domain of Traefik and the domain of the site. However, with my custom app, after running compose-up, the rule only displayed the domain of Traefik, without the domain of the site. Maybe I did something wrong

docker compose --project-name bench-one exec backend bench new-site --no-mariadb-socket --mariadb-root-password pachtii --install-app dental_stock_app --admin-password pachtii thanhpci.games

I ignored the issue of the rule not displaying and continued to install the app on a new site. However, I received a notification that a package is missing, even though this package already exists in my requirements file. To verify, I used the exec command to access the backend container, activated the virtual environment, and checked. The package is clearly present in the virtual environment.

thanhpci@ubuntu-s-2vcpu-4gb-120gb-intel-sgp1-01:~/frappe_docker$ docker compose --project-name bench-one exec backend bash
frappe@7d21442800d6:~/frappe-bench$ ls
apps  config  env  logs  patches.txt  sites
frappe@7d21442800d6:~/frappe-bench$ source env/bin/activate
(env) frappe@7d21442800d6:~/frappe-bench$ pip list

I don’t understand why the environment already contains this package, but when I try to install it, it reports that it’s missing.

In summary, I encountered two issues:

  1. When running compose-up, I don’t see the Traefik rule containing the site domain.
  2. Although the environment already contains all the necessary packages, it still reports that a package is missing during the install-app process