Skip to content

Asset mismatch between backend and frontend after running bench migrate #1883

@silicht

Description

@silicht

Description of the issue

I run a CI powered, docker based setup with a custom image.

In my CI environment, I build the custom container image. After the image is built, I run some docker compose commands on my server:

docker compose down
docker compose pull
docker compose up -d
docker compose exec backend bench migrate
docker compose exec redis-cache redis-cli FLUSHALL

This worked well, until #1879. Now, the bench migrate command creates a new assets.json, which is stored with the frontend container as it is stored in /home/frappe/frappe-bench/sites/assets/ folder, and with that in the sites volume.

The css/js files itself are stored in /home/frappe/frappe-bench/apps/, which is not shared between the containers. There are symlinks from the assets forlder to the apps folder. So after running the migration in the backend container, the css/js files in the backend container are updated, but not that files in the frontend container. But as the assets.json file is shared, the frontend cannot find the assets and the user get's 404 errors.

In the past, it looks like it worked by accident. I run bench migrate in the backend container, and bench updated css/js in the backend container, and the assets.json in a unnamed volume, which was not shared with the frontend container. So the frontend container still served the "old" version of these files.

I understand that the css/js files should not be build in productive environment. But I need to run the migrations.

How to run migrations without building the assets?

Context information (for bug reports)

Steps to reproduce the issue

  1. Build a custom app image
  2. Update container using that image
  3. Run bench migrate in the backend container

Observed result

assets.json and accessable files are out of sync.

Expected result

bench migrate should not manipulate assets.json file.

Stacktrace / full error message if available

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions