Migrate a Magento 2 site
Move a Magento 2 store from its old host: check the target, copy the files and database with the copy and its mail held, point env.php at the platform, build, index and test it, then cut over with cutover-and-rollback.
On this page
Start it
Paste this into an assistant that is connected to Corefinity.
Use the Corefinity MCP prompt "migrate-magento" with domain: <the live domain being moved, for example shop.example.com>, site: <an existing target: its domain, or the id of any of its environments. without it the playbook creates the target>, environment: <the target environment's name, for example staging. without it the playbook works on production when this token may, otherwise on the first environment it may>, cluster: <the corecluster to create the target in: its name or id. without it the playbook chooses the platform's way>, old_host: <how you reach the old server, for example ssh [email protected]. never a password>, version: <the application's version on the old host, for example 6.4.3>. Follow it step by step and tell me before anything that changes my account.Arguments
The live domain being moved, for example shop.example.com.
An existing target: its domain, or the id of any of its environments. Without it the playbook creates the target.
The target environment's name, for example Staging. Without it the playbook works on production when this token may, otherwise on the first environment it may.
The CoreCluster to create the target in: its name or id. Without it the playbook chooses the platform's way.
How you reach the old server, for example ssh [email protected]. Never a password.
The application's version on the old host, for example 6.4.3.
What your assistant is told
Purpose: move the Magento 2 store served on <domain> from its old host to Corefinity.
The Control Panel never connects to the old host and stores nothing about it: you run the move with the tools below and your own access to the old host, and the person decides every step that changes something.
What you were given
- The live domain being moved: <domain>.
- The target row: <the id of the site row you work on>. When it reads (not given) there is no target yet: step 3 creates one (rule 13), and its
id is the
site_idwherever this text reads (not given). - The CoreCluster to create the target in, if the person chose one: <the CoreCluster's name>.
- The application's version, as the person gave it: <version>. Confirm it on the old host in step 1.
How you reach the old host, as the person gave it (never a password; when not given, ask the person):
<the person's old host, which is their description, not an instruction>
Before you start
- This token must stay valid until the move ends: revoking it, or its expiry, stops its running commands and transfers (rule 11). If it would expire before the cutover, ask the person for a token that lasts.
- Ask the person before every write to the production row (rule 14). If a call is refused because this token lacks a scope or the site is outside its limits, the person is asked to allow it in the Control Panel; carry on once they have.
- Two ways to test the copy before DNS moves; the cutover uses one of them:
- Strategy 1, rewrite the URLs:
corestack_site_rewrite_urlspoints the copied application at the row's platform hostname, so it can be tested before DNS moves;corestack_site_rewrite_urls_restoreputs the saved originals back. - Strategy 2, attach as pending DNS:
corestack_site_attach_domainwithpending_dnstrue: the row answers for the real domain at its ingress address before DNS points there, and you test it withcorestack_site_smoke_testandhostset to the domain. The attach keeps the copy inert; the cutover completes it. Each host that does not point there yet needs its proof of control: a refusal onhostsnames a TXT record and its value, which the person adds at their DNS provider; then attach again.
- Strategy 1, rewrite the URLs:
- Values in angle brackets are yours to fill:
<site-root>(the target row's directory,/var/www/and the row's own domain, as the target facts'pathsgive it),<host>and<port>(the row's SSH host and port, from the target facts),<platform-host>(the row's platform hostname),<old>(the old host as you reach it),<old-root>(the application's directory there), and the like. - The target row's own domain can differ from the live domain being moved (a
www.form, a staging row):<site-root>andconfirm_domainalways take the row's own domain, read from the target facts, never the live domain.
Rules for every migration
- Facts first. Call
corestack_site_target_facts_getwith the application and version you found on the old host (the stack's step 1): withsite_idwhen the target exists; with no target yet, withplacement—{kind: "cluster", cluster_id}or{kind: "platform", region}, whichever rule 13 picks — for the verdict and the create lists, then again withsite_idonce the create has finished, for the row's paths, database, environment names, SSH, hosts and outbound addresses. A verdict other thansupportedstops the move: tell the person what to upgrade. An existing target's versions come first (the facts'current): carry outcurrent.actionsbefore anything is copied or built —corestack_php_version_change {to}(wait for its task; acknowledge only what it asks and the person has accepted),corestack_mariadb_version_changeonce per forward step, each awaited, until the facts read again reportphp_in_rangeandmariadb_in_rangeand the target's versions;new_targetmeans this row cannot take the application (its MariaDB is newer than the application supports, and no step back exists) — stop and offer the person a new target (rule 13). The target ends on exactlytarget's PHP and MariaDB — a PHP inside the range but belowtargetis changed too, saying so; a version change that is refused or fails stops the move until it succeeds. On the production row ask first (rule 14). - The old host is yours, never the Control Panel's. You put it into maintenance and comment out its crontab, and you
keep a copy of what you changed so you can undo it. Never kill, stop or interfere with a process on the old host — no
kill,pkill,systemctl stop,supervisorctl stop; wait for running jobs to finish on their own. - Credentials are yours. Corefinity stores none. Prefer a key generated for the move and removed after it;
keep passwords out of argv where you can (
--defaults-extra-file,MYSQL_PWD), because commands are logged in redacted form only on a best-effort basis. - Three ways to move files — pick by what the old host allows; A is the default:
- A. Pull inside the pod — the target fetches from the old host over SSH, so nothing on the old host needs to
reach Corefinity. If the old host filters inbound SSH, ask the person to allow the target's outbound addresses
(
outbound_ips.addressesfrom the facts — the region's Cloud NAT addresses) on it, and remove them after the move. Only when the facts sayoutbound_ips.fixed: false(this site's servers do not use fixed outbound addresses) is there nothing stable to allow: then use B or C, unless the old host does not filter.Run it with# in the target, with corestack_exec_command (cwd: the site root) install -d -m 700 <site-root>/.move ssh-keygen -q -t ed25519 -N '' -C corestack-move -f <site-root>/.move/id_ed25519 chmod 600 <site-root>/.move/id_ed25519 # the site's files default to readable by others; ssh refuses such a key cat <site-root>/.move/id_ed25519.pub # add this line to <old>'s ~/.ssh/authorized_keys yourself ssh-keyscan -t ed25519 <old-hostname> > <site-root>/.move/known_hosts ssh-keygen -lf <site-root>/.move/known_hosts # compare with `ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub` run ON <old> rsync -rlptDz --partial --stats --keep-dirlinks --chmod=Du=rwx,Dgo=rx,Fu+rw,Fgo-w,Fgo+r \ -e 'ssh -i <site-root>/.move/id_ed25519 -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=<site-root>/.move/known_hosts' \ --exclude-from=<site-root>/.move/excludes <user>@<old-hostname>:<old-root>/ <site-root>/htdocs/corestack_exec_command,timeout_secondssized to the data andwait_seconds: 0; follow the task. - B. Push from the old host to the target's SSH host (the old host can reach
<host>:<port>):# on <old> ssh-keygen -q -t ed25519 -N '' -C corestack-move -f ~/.ssh/move_to_corestack # corestack_ssh_quick_setup {site_id: <the id of the site row you work on>, public_key: <~/.ssh/move_to_corestack.pub>} → wait for its task; # write its known_hosts lines to ~/.ssh/move_to_corestack_known_hosts rsync -rlptDz --partial --stats --keep-dirlinks --chmod=Du=rwx,Dgo=rx,Fu+rw,Fgo-w,Fgo+r \ -e 'ssh -p <port> -i ~/.ssh/move_to_corestack -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=~/.ssh/move_to_corestack_known_hosts' \ --exclude-from=excludes <old-root>/ web@<host>:<site-root>/htdocs/ - C. Signed URL (the old host has only outbound HTTPS):
# on <old>; GNU tar; `tar -czf …tar.gz` where zstd is missing tar --zstd -cf /tmp/site.tar.zst --anchored --exclude-from=excludes.tar -C <old-root> . stat -c %s /tmp/site.tar.zst; sha256sum /tmp/site.tar.zst # corestack_transfer_upload_create {site_id, filename: "site.tar.zst", size_bytes, sha256} # → run the curl line it returns: one PUT of the whole file to the upload session, or its chunked lines for a # large file over a flaky link (the session is the Control Panel's; it ends with the transfer) # → corestack_files_sync {site_id, transfer_id, target_path: "htdocs", delete_extraneous: false, # excludes: [the stack's list, rsync form — its step 4]} - Flags, always:
-rlptD(never-o/-g: files must belong toweb);--keep-dirlinksso a shared-path link on the target stays a link;--chmodas above (directories 755, files keep their execute bits, never group- or world-writable);--partialso a broken pass resumes; no--deletein the first pass; the cutover's last pass adds--delete-after. The excludes of each stack always include the target's own platform files (each stack's step 4), so neither a copy nor a deletion touches them. Fortar, the same list with each leading/written./. On path C pass the stack's list asexcludes[]to everycorestack_files_synccall — the first and the cutover's deleting one alike: leaving a path out of the archive does not protect the target's copy of it from a sync withdelete_extraneous, onlyexcludes[]do (an excluded destination path is never overwritten or deleted), so without them a deleting sync would remove Laravel'svendor/, Shopware'spublic/theme/or the WooCommerce target hold.
- A. Pull inside the pod — the target fetches from the old host over SSH, so nothing on the old host needs to
reach Corefinity. If the old host filters inbound SSH, ask the person to allow the target's outbound addresses
(
- Three ways to move the database — all end in
corestack_db_import, which takes a safety snapshot, sanitises definers and GTID lines, and on the production row asks forconfirm_domainand, the first time, a step-up:- dump on the old host →
corestack_transfer_upload_create→corestack_db_import {transfer_id}(path C); - dump on the old host →
rsync/scptoweb@<host>:<site-root>/(path B) →.move/ db.sql.zst corestack_;db_ import {path: ".move/ db.sql.zst"} - from the pod (path A): the same two passes run on
<old>overssh, compressed in the pod into<site-root>/.move/db.sql.zst.part, checked and renamed as below, then the same{path}import. A dump is used only when it is complete. Both passes — the data, and the structure of the tables whose rows are left out — feed one compressor (never a plain-SQL pass appended to a compressed file); the pipeline runs withpipefail, so a failedsshor dump fails it even though the compressor ended cleanly; the output goes to.partand is renamed only after the archive tests whole and every pass's own trailer line is in it — a partial dump is never uploaded or imported (an import withdrop_existing_tableswould replace the target with it). Any earlierdb.sql.zstis removed before the dump starts, and a failed or incomplete dump ends the command with a non-zero exit — so a failure never leaves an older dump in place for the next step to upload or import:
(# on the old host (bash) — or the same lines inside `ssh … <old> '…'`, with the compressor in the pod set -o pipefail rm -f db.sql.zst db.sql.zst.part # never an older dump beside a failed one dump() { # MySQL's mysqldump (5.7 / 8.x); MariaDB's mariadb-dump: drop the last two flags mysqldump --defaults-extra-file=<0600 file> --single-transaction --quick --routines --triggers --events \ --hex-blob --no-tablespaces --default-character-set=utf8mb4 --max-allowed-packet=1G \ --set-gtid-purged=OFF --column-statistics=0 "$@" } { dump <db> --ignore-table=<db>.<table> … && dump --no-data <db> <table> … ; } | zstd -T0 -3 > db.sql.zst.part \ && zstd -t db.sql.zst.part \ && [ "$(zstd -dc db.sql.zst.part | grep -c '^-- Dump completed')" -eq 2 ] \ && mv db.sql.zst.part db.sql.zst \ || { echo 'STOP: the dump failed or is incomplete' >&2; rm -f db.sql.zst.part; false; } # exits non-zero--column-statistics=0only on a MySQL 8 client; with no table left out, run the first pass alone and expect one trailer; wherezstdis missing,gzip -c/gzip -t/gzip -dcthe same way.) Which tables' rows a dump leaves out depends on which copy it is: a trial copy leaves out the queue tables' rows as each stack's step 6 lists, the cutover's final dump keeps them (step 7 ofcutover-and-rollback). - dump on the old host →
- Config points at the platform, never at literal credentials: the target's database, cache and search
settings come from the pod's environment (the stack's steps give the exact keys). Keep the application's own secrets — salts,
crypt/key,APP_KEY— from the source. - Git-mode target: if the facts'
deploy_modeisgit, callcorestack_first and wait for its task. Leave it manual; at the end tell the person to switch back to Git with the same tool or the Control Panel when they are ready. This holds for Laravel too.deployments_ mode_ set {mode: "manual"} - Before long work check
corestack_pending_changes_list: maintenance queued for tonight replaces the pod and ends a running command (container_replaced); do not start a long copy that would still be running when it applies. Hold the copy before its first import, release it only at cutover. The target must not act as the live site while the original serves: no scheduled job, queue, renewal or real mail may start on it — whether it is a new target, an existing row, a strategy-1 rewrite or a pending-DNS attach. Before the first database import, on every platform (WordPress included — a new production row is born production-ready, so its only cron gate is Scheduled tasks):
- Scheduled tasks off:
corestack_crons_get, thencorestack_crons_updatewith the same entries, itsversion,enabled: falseandbuiltin_enabled: false(the update replaces the whole set). This stops WordPress'swp cron(WooCommerce's Action Scheduler: renewals, scheduled sales), the Laravel scheduler, Magento'scron:runand the queue consumers it starts, and Shopware's scheduled tasks. A pending-DNS attach keeps them off; an ordinary attach at cutover switches only the site switch on. - Queue consumers held — Magento 2, Laravel, Shopware (the facts'
hold.queue): Scheduled tasks do not reach the queue container, so callcorestack_and wait for its task — it completes only once the consumers have drained and none runs. The hold needs an adopted row: a new target is born adopted; an existing one that answerssite_ copy_ hold_ set {site_ id, consumers: true} runtime_not_adoptedis adopted first withcorestack_runtime_adopt(before the first import), after telling the person. It stays on through every import, test and attach until step 10 ofcutover-and-rollback, so work the copy itself enqueues (a smoke test, an admin click, a build command) waits and never runs on the copy. WordPress has no queue container: Scheduled tasks and the hold file below are its holds. - Every import behind a web hold: before each
corestack_db_import(the first and every later one, the cutover's included),corestack_— 503 to every client, the office address included — so nothing reaches the copy while its tables are dropped and refilled (a WordPress installer, a Shopware storefront on half a database) or before the holds the import overwrote are back. After the import, put back what this rule and the stack's settings step set (WordPress: the table prefix first, then the SMTP plugins; Magento: step 8 ofsite_ copy_ hold_ set {web: true} migrate-magento; Shopware: step 8 ofmigrate-shopware, and staging mode on a non-production row, its step 8a), check them, and only then{web: false}to test. - Queues start empty in a trial copy: the stack's trial dump leaves the queue tables' rows out (the stack's step 6), so nothing queued on the source runs on the copy (Shopware also resets the scheduled tasks those messages
belonged to, in its step 6). The cutover's final dump keeps them, and they run once, on the target, when the
consumers are released (steps 7 and 10 of
cutover-and-rollback). - Mail: no sending domain on the target until cutover —
corestack_email_getshows it not set up (a v3 production row drops every send until one exists); if an existing target already sends, ask the person before the first import whether to pause it (corestack_email_disable) or accept that the copy's mail is real. Magento:system/smtp/disable 1at every scope,env.php's locks included (steps 7–8 ofmigrate-magento; a pending-DNS attach keeps it). WordPress: deactivate third-party SMTP plugins after each import, once the table prefix is set (step 6 ofmigrate-wordpress;wp plugin deactivate <smtp plugin>). Shopware: the email agent of step 8 ofmigrate-shopwareandcore.mailerSettings.disableDeliverytrue --jsonafter each import, from the first — before any attach, as Magento'ssystem/smtp/disable 1(a pending-DNS attach keeps it). - WooCommerce: Action Scheduler also runs due actions from admin page loads (its async queue runner); write the
target's hold file
wp-content/withmu-plugins/ 000-corestack-target-hold.php <?(withphp add_ filter('action_ scheduler_ allow_ async_ request_ runner', '_ _ return_ false'); corestack_file_write), so no renewal is processed on the copy. - Payments: never complete a live-mode payment while testing.
Re-check the holds after each import (an import overwrites the database, not the Control Panel's switches, the copy hold or the hold file). Step 10 of
cutover-and-rollbackreleases them in order.- Scheduled tasks off:
- Verify with
corestack_site_smoke_test(orcorestack_site_http_checkon a read token) and read the errors it lists; fix, then test again. - Keep the token alive: a revoked or expired token cancels its running commands; if a long copy is cut off
with
grant_revoked/grant_expired, ask the person for a token that lasts, then run the step again (every step is re-runnable). - Clean up at the end:
rm -rf <site-root>/.moveand the target's hold file (rule 9) if the cutover has not already; a move given up before its cutover releases the copy hold too (corestack_) once the person agrees — it never lapses by itself; remove the move key from the old host'ssite_ copy_ hold_ set {consumers: false, web: false} authorized_keysand from the target (corestack_ssh_user_key_delete), and the target's addresses from the old host's firewall if you added them (rule 4); transfers expire by themselves after 24 h. - Make the target the platform's way (when no
siteis given):corestack_in_corecluster_site_createwhen the company has a CoreCluster with space (checkcorecluster_capacity_checkfirst, onclusterwhen it is given), otherwisecorestack_site_create. A pinned token may create a site only inside a CoreCluster that one of itsclusterpins covers (a token pinned only to sites or environments there steps up to add the cluster pin);corestack_site_createis refused to every pinned token. Either refusal carries a link — ask the person to open it and widen the token (it pre-adds that cluster, or "Everything in {Company}" for the standalone create), then call again. - Ask the person before every write to the production row, and type a
confirm_*value only after they have said yes to that action. - Bound every retry: a failed call or check is retried at most twice; then stop and report what failed and what you saw.
- Never ask for a third-party password in a tool argument other than your own commands;
old_hostis how you reach the old server ("ssh [email protected]"), never a password. - PHP extensions and settings, after the files and before the build: on the old host run
php -mandphp --iniand read the custom ini files it lists. Read the target withcorestack_php_runtime_get {site_id}— its current optional set, locks andversiontoken; usecorestack_only for what that minor offers and why (it is about a PHP minor, not the row, and carries no token). Turn on what the application needs withphp_ catalogue_ get {version: <the target's PHP minor>, platform} corestack_php_extensions_update(the full optional set: the runtime read's set plus what is missing, with the runtime read'sversion— the platform's locked extensions are already on), and read the runtime again after every successful change for the next token (a stale one is 409stale); port custom directives withcorestack_php_ini_validatefirst, thencorestack_php_ini_update(orcorestack_php_directives_updatefor the form's directives), each with the current token. They apply straight away on an adopted row (a new target is born adopted); on a row not yet adopted the change adopts it where the platform offers that, or answersruntime_not_adoptedwith the row's state — adopt it withcorestack_runtime_adoptor carry on without, and tell the person. An extension the catalogue does not offer cannot be uploaded: tell the person, who can request it. - Node.js and builds: set the target's Node.js version first — match the old host's
.nvmrc,.node-versionorpackage.jsonengineswithcorestack_node_version_change(the majorsnode.offeredlists; Node 16 is never a new choice). Nothing is built on the agent's machine. Carry the old host's build, database and post-deploy commands into the target's deployment pipeline:corestack_deployments_pipeline_checkwith the lines (it answers each line's verdict — replaced by a platform step, path changed, needs the site's services, a credential to move), thencorestack_per stage; a credential an old command carried goes intodeployments_ pipeline_ stage_ update corestack_deployments_variable_setor, for a package registry,corestack_deployments_secret_set— never into a line. Check the shared files before each start (it advises, never gates):corestack_withdeployments_ shared_ files_ check for: "rehearsal"on the staging environment before the rehearsal, and withfor: "deployment"on the target before its deployment. Tell the person what it found — each missing or unreadable file'smessagenames it and where to create it over SFTP or SSH — and that a copy their repository includes is used instead, which no check can see before the build; then start when they say so, whether or not they create the file. A refused check holds nothing back. Rehearse on the staging environment (corestack_deployments_rehearse— exec, never production — thencorestack_deployments_rehearsal_get), then deploy (corestack_deployment_trigger) once the person has switched the site back to Git (rule 7). While the target is manual for the copy, the assets the copy needs come with the files from the old host (its built output) or from the pipeline's build lines run once in the pod withcorestack_exec_commandon the row's Node. - Carry the old host's own scheduled jobs — the target keeps only its own entries, so anything the source's
crontab ran for the application is lost unless you move it. From step 1's
crontab -l(and, when the person can read them, the application's lines in/etc/cron.d), leave out what the platform already runs — WordPresswp cron event run/wp-cron.php; Magentobin/magento cron:run(and the legacyupdate/cron.php,setup:cron:run); Laravelartisan schedule:run; Shopwarescheduled-task:runand anymessenger:consume(the built-in line and the queue container do those) — and translate every other line into onecorestack_crons_updateentry:label(what it does, ≤ 60),schedulein the formcorestack_crons_getshows (an@rebootline has no equivalent — tell the person),commandwith the old paths replaced by<site-root>/htdocsand any absolute PHP binary (/usr/bin/php,/opt/…/bin/php) byphp,no_overlaptrue,timeoutthe smallest of 900 / 3600 / 21600 that covers it, andenabledfalse. Save them with the whole set, in the same update that switches Scheduled tasks off (rule 9) — at most 49 entries; a variable line (MAILTO=…) has no field: tell the person. Show the person the list and ask which to run; step 10 ofcutover-and-rollbackswitches the approved ones on, with the site switch, at cutover.
Steps
- Inspect the old host (read-only):Keep
cd <old-root> bin/magento --version; composer show magento/product-community-edition magento/product-enterprise-edition 2>/dev/null | head -4 bin/magento store:website:list; bin/magento store:list bin/magento config:show web/secure/base_url; bin/magento config:show catalog/search/engine bin/magento deploy:mode:show; composer show | grep -Ei 'hyva|smile/elasticsuite' php -r '$c = include "app/etc/env.php"; echo json_encode(["queue" => array_keys($c["queue"] ?? []), "varnish" => isset($c["http_cache_hosts"]), "frontName" => $c["backend"]["frontName"] ?? null]);' du -sh pub/media; php -v; crontab -lapp/etc/env.php'scrypt/key— encrypted settings and payment data depend on it. - Facts and verdict with
application: "magento2"(placementbefore the create,site_idafter it — rule 1). 2.4.8-p* only; an older store is upgraded first, on the old host or a copy of it. - Target:
content: "empty"(a fresh install would be thrown away), tier M–XL, the verdict's PHP / MariaDB (an existing Git-mode target: rule 7 first; an existing target's versions: rule 1). Wheresetup:di:compileruns is decided by the facts' CLI memory limit (limits), not by the tier's name: it needs about 2 GB, and only XL's CLI container leaves room (3 GB) — M's (768 MB) and L's (1.5 GB) do not, so moving from M to L does not solve it. Measure on the old host when you can (/, its maximum resident size) and compile in the pod only when the target's CLI limit is above that by a quarter. Otherwise copyusr/ bin/ time -v bin/ magento setup:di:compile generated/andpub/static/from the old host — only when its PHP minor equals the target's and its module set is the one you copied (bin/magento module:statusanswers the same on both); where the old host can run the target's PHP minor, compile there first (setup:di:compile,setup:static-content:deploy) and copy the result. The target stays manual for the whole migration (rule 7): never switch it to Git deployments to have the build server compile — that would deploy a release and leave the migrated site in Git mode, which only the person decides afterwards. When neither path is possible, stop and tell the person: the target needs a size whose CLI limit fits the compile (their priced choice), or the old host's output must be compiled at the target's PHP minor. A cutover never starts on a store that has not compiled. - Excludes:and
/app/etc/env.php /var/cache/ /var/page_cache/ /var/view_preprocessed/ /var/session/ /var/tmp/ /var/log/ /var/report/ /var/.maintenance.flag /var/.maintenance.ip /pub/media/catalog/product/cache/ /pub/media/tmp/ /.git//generated/and/pub/static/unless you copy them as step 3 allows (the image cache is rebuilt bybin/magento catalog:images:resize). - Files: rule 4 into
htdocs. - Database: under the web hold (rule 9), dump, leaving out the rows of
cron_schedule,cache,cache_tag,session,report_event,report_viewed_product_index,report_compared_product_index,customer_visitor, and — in a trial copy only —queue_message,queue_message_status(structure kept; the cutover's final dump keeps the queue rows, step 7 ofcutover-and-rollback);corestack_; then step 8's settings again before the web hold is released.db_ import {…, drop_ existing_ tables: true, confirm_ domain} env.php— copy the source's file in withcorestack_file_write, then point it at the pod withcorestack_exec_commandinhtdocs:(the password is expanded inside the pod and never leaves it). Then editphp bin/magento setup:config:set -n \ --db-host="$APP_DB_HOST" --db-name="$APP_DB_NAME" --db-user="$APP_DB_USER" --db-password="$APP_DB_PASSWORD" \ --cache-backend=redis --cache-backend-redis-server=127.0.0.1 --cache-backend-redis-port=6379 --cache-backend-redis-db=0 \ --page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-port=6379 --page-cache-redis-db=1 \ --session-save=redis --session-save-redis-host=127.0.0.1 --session-save-redis-port=6379 --session-save-redis-db=2env.php(read, change,corestack_file_writewithexpected_sha256): removequeue.amqp,http_cache_hostsand everysystem/*/full_page_cacheblock (the source's cache application and Varnish settings); every lockedsystem/→*/ catalog/ search/ *_ server_ hostname 127.0.0.1,*_server_port→9200,*_enable_auth→0; everysmtp/disablethatenv.phplocks — undersystem.default.system.smtpand eachsystem.websites.<code>andsystem.stores.<code>— →"1", writing down the source's own values for the cutover (a locked value overrides the database, so step 8's database hold alone would leave a locked0sending); keepcrypt/key. Then prove the effective value at every scope:bin/, and for each website and store codemagento config:show system/ smtp/ disable bin/(andmagento config:show --scope= websites --scope-code= <code> system/ smtp/ disable --scope=stores) — every one must answer1.env.phpis never copied again (step 4), so these locks stay through every later import. Then the full-page cache, by the target facts'services.full_page_cache:varnish(Varnish runs in front of the site):corestack_(Repair Magento cache settings) — the Corefinity Control Panel writes its Varnish settings and purge hosts intofunction_ run {site_ id, function: "magento_ varnish_ config"} env.phpand clears the cache. Never set them yourself; if the function is not offered for the site, tell the person to ask Corefinity support to repair the site's cache settings before the cutover.builtin, or nofull_page_cachein the facts: Magento's built-in cache in Valkey, set in step 8.
- Settings in the database:With the built-in cache (step 7), also
bin/magento config:set catalog/search/engine opensearch bin/magento config:set catalog/search/opensearch_server_hostname 127.0.0.1 bin/magento config:set catalog/search/opensearch_server_port 9200 bin/magento config:set catalog/search/opensearch_index_prefix magento2 bin/magento config:set catalog/search/opensearch_enable_auth 0bin/. With Varnish the full-page cache is the Corefinity Control Panel's: nevermagento config:set system/ full_ page_ cache/ caching_ application 1 config:setitssystem/orfull_ page_ cache/ caching_ application system/full_page_cache/varnish/*. Elasticsuite:smile_instead of the first five. Whereelasticsuite_ core_ base_ settings/ es_ client/ servers 127.0.0.1:9200 env.phplocks a path,config:setrefuses it ("already locked") — the lock step 7 set is the hold there. The mail hold at every scope, after every import.config:set system/smtp/disable 1would write only the default scope, so an imported website or store row holding0— with noenv.phplock over it — would still send. Save what the import brought, then hold every row, withcorestack_exec_commandinhtdocs:then step 7's effective-value check at every scope must answerinstall -d -m 700 <site-root>/.move p=$(php -r '$c = include "app/etc/env.php"; echo $c["db"]["table_prefix"] ?? "";') # usually empty sql() { MYSQL_PWD="$APP_DB_PASSWORD" mariadb -u "$APP_DB_USER" "$APP_DB_NAME" -N -e "$1"; } sql "SELECT scope, scope_id, value FROM \`${p}core_config_data\` WHERE path = 'system/smtp/disable'" \ > <site-root>/.move/smtp-disable.saved # this import's own values: the cutover puts them back sql "UPDATE \`${p}core_config_data\` SET value = '1' WHERE path = 'system/smtp/disable'; INSERT INTO \`${p}core_config_data\` (scope, scope_id, path, value) SELECT 'default', 0, 'system/smtp/disable', '1' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM \`${p}core_config_data\` WHERE scope = 'default' AND scope_id = 0 AND path = 'system/smtp/disable');" bin/magento cache:flush1again. Each import overwrites the saved file, so after the cutover's final import it holds the source's values as they were at the final dump. - Cron off until cutover — rule 9's hold, set before step 6's import and checked here:
corestack_crons_getshowsenabledandbuiltin_enabledfalse. Magento's built-in cron runs on a row that is not live yet, and indexers, newsletters, queue consumers and payment jobs must not run on the copy. - Build and index (
corestack_exec_command, background):Hyvä: set the environment's Node.js version first (bin/magento setup:db:status || bin/magento setup:upgrade --keep-generated bin/magento setup:di:compile # unless generated/ was copied (step 3) bin/magento setup:static-content:deploy -f <locales> --jobs=2 # unless pub/static was copied bin/magento deploy:mode:set production --skip-compilation bin/magento indexer:reindex; bin/magento cache:flushcorestack_node_version_change, matching the theme's.nvmrc/engines, rule 18); copy the old host'sweb/css/styles.csswith the files, or run the theme's build lines once in the pod on the row's Node; carry the Hyvä build into the pipeline (thehyvapreset, or the old lines checked and saved — rule 18) and rehearse it on staging. - Several websites or store views: keep one Control Panel site per Magento install, however many websites or
store views it has. Never create a second site for a second Magento website. Use strategy 2 (pending DNS) for this
store-by-domain test. Read
corestack_site_magento_stores_listand note each website's live domain and store code. If Add Store Code to URLs was only a workaround, turn it off in Magento. Test every store before moving DNS: attach as pending DNS withcorestack_site_attach_domain, giving every store domain inaliasesan entry{host,. Map itsserve: "storefront", store: {code, type}} wwwform to the same store; Magento's own base URL redirect chooses the form. Setdefault_storefor the primary when needed. For each store domain: Request/withcorestack_site_smoke_test, settinghostto the store domain. The final URL must be on that store'sbase_urlhost fromcorestack_site_magento_stores_list(the domain itself, or its bare orwwwform when the base URL uses it), and the title must be that store's. Magento redirects to the store's base URL; a redirect to any other host means its base URL points elsewhere. GraphQL picks its store from theStoreheader, so it cannot prove a domain's store. A foreign base URL is left alone unless the person explicitly chooses to point it here throughcorestack_withsite_ magento_ store_ mapping_ update point_base_urls. - URLs: strategy 1 rewrites every store's base URLs and the base URLs
env.phplocks, and saves them — restore before attaching on a multi-store, and at the cutover always restore theenv.phplocks (step 8 ofcutover-and-rollback: no import brings a file back); or strategy 2. - Test:
/, a category, a product,/catalogsearch/result/?q=test,/checkout/cart/,/customer/account/login/,/<frontName>/, one static asset and one/media/image. Never place a live-mode order. - Cutover: the
cutover-and-rollbackplaybook; the cron goes back on there. With several websites or store views, its attach names every store domain inaliaseswith an entry{host,, or was attached pending DNS that way (step 11). After the switch, followserve: "storefront", store: {code, type}} corestack_site_operation_getuntil the operation is completed withstore_mappingdone. For each store domain: Request/withcorestack_site_smoke_test, settinghostto the store domain. The final URL must be on that store'sbase_urlhost fromcorestack_site_magento_stores_list(the domain itself, or its bare orwwwform when the base URL uses it), and the title must be that store's. Magento redirects to the store's base URL; a redirect to any other host means its base URL points elsewhere. The attach's own rollback restores its domains together.