mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-17 13:55:08 +00:00
feat(migrator): add multi-site support to migration
This commit is contained in:
parent
815946194c
commit
ae221ebf7a
2 changed files with 12 additions and 13 deletions
|
|
@ -26,7 +26,7 @@ docker compose -f compose.yaml -f overrides/compose.mariadb.yaml -f overrides/co
|
||||||
| **Redis** | | |
|
| **Redis** | | |
|
||||||
| compose.redis.yaml | Adds Redis service for caching and background job queuing | |
|
| compose.redis.yaml | Adds Redis service for caching and background job queuing | |
|
||||||
| **Services** | | |
|
| **Services** | | |
|
||||||
| compose.migrator.yaml | Runs a dedicated migration container performing `bench migrate` on a site at every start | Set `SITE_NAME` |
|
| compose.migrator.yaml | Runs a dedicated migration container performing `bench --site all migrate` on a site at every start | Control via `MIGRATE_SITES` - defaults to true |
|
||||||
| **TBD** | **The following overrides are available but lack documentation. If you use them and understand their purpose, please consider contributing to this documentation.** | |
|
| **TBD** | **The following overrides are available but lack documentation. If you use them and understand their purpose, please consider contributing to this documentation.** | |
|
||||||
| compose.backup-cron.yaml | | |
|
| compose.backup-cron.yaml | | |
|
||||||
| compose.custom-domain-ssl.yaml | | |
|
| compose.custom-domain-ssl.yaml | | |
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
# Provides a service for automated migration of a given site.
|
# Provides a service for automated migration of a given site.
|
||||||
# Add SITE_NAME to .env
|
|
||||||
|
|
||||||
# Compose extension fields of base compose.yaml. See https://github.com/frappe/frappe_docker/blob/main/compose.yaml
|
# Compose extension fields of base compose.yaml. See https://github.com/frappe/frappe_docker/blob/main/compose.yaml
|
||||||
# Needed for merging compose files.
|
# Needed for merging compose files.
|
||||||
|
|
@ -30,16 +29,16 @@ services:
|
||||||
- -c
|
- -c
|
||||||
command:
|
command:
|
||||||
- >
|
- >
|
||||||
if [ -z "$$SITE_NAME" ]; then
|
if [ "$$MIGRATE_SITES" != "true" ]; then
|
||||||
echo "[migrator] SITE_NAME is not set";
|
echo "[migrator] Migration disabled";
|
||||||
exit 1;
|
exit 0;
|
||||||
fi;
|
fi;
|
||||||
if [ -d "sites/$$SITE_NAME" ]; then
|
if [ -z "$$(find sites -mindepth 2 -maxdepth 2 -name site_config.json 2>/dev/null)" ]; then
|
||||||
echo "[migrator] Migrating $$SITE_NAME";
|
echo "[migrator] No sites found, skipping migration";
|
||||||
bench --site $$SITE_NAME migrate;
|
exit 0;
|
||||||
else
|
fi;
|
||||||
echo "[migrator] Site $$SITE_NAME not found, skipping migrate";
|
echo "[migrator] Migrating all sites";
|
||||||
fi
|
bench --site all migrate;
|
||||||
environment:
|
environment:
|
||||||
SITE_NAME: ${SITE_NAME}
|
MIGRATE_SITES: ${MIGRATE_SITES:-true}
|
||||||
restart: on-failure
|
restart: on-failure:5
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue