Is your feature request related to a problem? Please describe.
We use an automated deployment for our ERPNext instances. When modifying custom images, i.e. updating apps, it is best practice to run bench migrate in order to update the database schema or DocTypes.
Most instructions show executing the command from docker host or backend container, which interferes with automated deployment.
Describe the solution you'd like
Find a good way to automate migration. Our current approach:
Adding a "migrator" container to the stack:
migrator:
<<: *backend_defaults
entrypoint:
- bash
- -c
command:
- >
if [ -d "sites/$$SITE_NAME" ]; then
bench --site $$SITE_NAME migrate;
else
echo "Site $$SITE_NAME does not exist yet, skipping migrate.";
fi
depends_on:
configurator:
condition: service_completed_successfully
db:
condition: service_healthy
redis-cache:
condition: service_started
redis-queue:
condition: service_started
restart: on-failure
This will run once after startup or update, check if the defined site exists and then run migration.
Feel free to point out other/ better solutions or problems with the above approach.
Is your feature request related to a problem? Please describe.
We use an automated deployment for our ERPNext instances. When modifying custom images, i.e. updating apps, it is best practice to run
bench migratein order to update the database schema or DocTypes.Most instructions show executing the command from docker host or backend container, which interferes with automated deployment.
Describe the solution you'd like
Find a good way to automate migration. Our current approach:
Adding a "migrator" container to the stack:
This will run once after startup or update, check if the defined site exists and then run migration.
Feel free to point out other/ better solutions or problems with the above approach.