{"id":8506,"date":"2022-09-02T11:50:42","date_gmt":"2022-09-02T11:50:42","guid":{"rendered":"https:\/\/clustercs.com\/kb\/?docs=docly-documentation\/development-environment\/migrations"},"modified":"2022-09-19T12:35:57","modified_gmt":"2022-09-19T12:35:57","slug":"development-environment-migrations","status":"publish","type":"docs","link":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/","title":{"rendered":"Migrations"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>One of the main&nbsp;advantages&nbsp;of using&nbsp;ClusterCS&nbsp;Development Environments is the&nbsp;time saved&nbsp;copying a website from Production to a development environment and back or between other environments.&nbsp;&nbsp;<\/p>\n\n\n\n<p>The Migration section configures all the automation that happens when we want to transfer environment contents to another.&nbsp;&nbsp;<\/p>\n\n\n\n<p>The elements that can be transferred between environments during migration can be any or&nbsp;all of&nbsp;the following:&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1662373924859\">1. Files&nbsp;\u2013 option is enabled by default&nbsp;<\/h3>\n\n\n\n<p>Migrating website files can be done with 2 methods: \u201cGIT push\u201d and simple file copy.&nbsp;&nbsp;<\/p>\n\n\n\n<p>If GIT support has been enabled for the domain, a GIT file transfer option is available. When this migration is performed, a \u201cgit commit\u201d will be executed on the source environment and a \u201cgit push\u201d will be made to the target environment branch. Post-receive hooks will trigger an automatic checkout of the target branch into its assigned root folder and the new version of the files will now be available there.&nbsp;<\/p>\n\n\n\n<p>Either with GIT support enabled or not, simple file transfer is available in 2 variants: Replace and Merge. The Replace option will first erase the contents of the target environment and then will copy the source environment files in the target root. The Merge option will only perform the copy of the source environment root to the target environment so all target files will remain&nbsp;there,&nbsp;and common files will be overwritten with the source environment version.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1662373924890\">2. Databases&nbsp;\u2013 option is enabled by default&nbsp;<\/h3>\n\n\n\n<p>ClusterCS&nbsp;can migrate a source environment database with an associated user to a target environment database and user.&nbsp;<\/p>\n\n\n\n<p>There are 3 database migration options: \u201cAuto\u201d, \u201cCustom\u201d and \u201cCustom with existing database\u201d.&nbsp;<\/p>\n\n\n\n<p>\u201cAuto\u201d is the default option and lets&nbsp;ClusterCS&nbsp;create a database and associated user automatically in the target environment and copy the source database contents in the target database.&nbsp;<\/p>\n\n\n\n<p>\u201cCustom\u201d is mostly automated but gives the option to specify the new database name and user name that should be created in the target environment. Source database contents will be copied into the target database name that has been specified.&nbsp;<\/p>\n\n\n\n<p>\u201cCustom with existing database\u201d will allow the selection of an existing database and user in the target environment. This means that the target database and user have been previously created and they should be used for the migration. The source database will be copied in the selected target database.&nbsp;The copy process will replace tables in the target database that are present in the source database.&nbsp;<\/p>\n\n\n\n<p>It\u2019s important to note that databases names and user names that reside in the same&nbsp;MySQL&nbsp;server system must be unique.&nbsp;Therefore,&nbsp;you will not be able to have an identical database or user names created between environments under a single&nbsp;MySQL&nbsp;server system.&nbsp;ClusterCS&nbsp;can manage clusters of servers from simple to complex architectures. In more complex setups where multiple&nbsp;MySQL&nbsp;server systems are available, database and user names can be identical between environments if each environment creates the database and user in separate&nbsp;MySQL&nbsp;systems. When multiple&nbsp;MySQL&nbsp;systems are available,&nbsp;ClusterCS&nbsp;provides the possibility to select the target&nbsp;MySQL&nbsp;server system under all 3 database migration options.&nbsp;<\/p>\n\n\n\n<p>When combining database migrations with&nbsp;Tracked Items,&nbsp;ClusterCS&nbsp;can automatically&nbsp;overwrite&nbsp;target configuration files defined in Tracked Files section&nbsp;with newly generated or selected database name, user and password. Please read more about this powerful automation&nbsp;\u201chere\u201d&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1662373924854\">3. Rewrite tracked files&nbsp;\u2013 option is enabled by default&nbsp;<\/h3>\n\n\n\n<p>The Tracked Items section helps define&nbsp;special migration&nbsp;variables and files that use those variables. When performing a migration, those files can be automatically&nbsp;overwritten with the defined tracked file version&nbsp;and by replacing the variables in the file with the correct value for the target environment.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Let\u2019s&nbsp;consider a very common example where a configuration file defines the database connection parameters. This file can be&nbsp;pasted as a tracked file in the Tracked Items section and the parameters can be replaced by the&nbsp;ClusterCS&nbsp;generated variable&nbsp;names&nbsp;for the database name, user name password, etc. When the migration is performed for tracked files, the variables will be reevaluated for the target environment, replaced in the tracked file contents and then the file will be overwritten on the specified tracked file path.&nbsp;<\/p>\n\n\n\n<p>When combining&nbsp;file,&nbsp;database&nbsp;and tracked file&nbsp;migration&nbsp;you have full automation that&nbsp;creates an independent copy of the source environment website in the target environment&nbsp;with its own database and configuration&nbsp;files.&nbsp;&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1662373924941\">4. Migrate aliases&nbsp;\u2013 option is&nbsp;disabled&nbsp;by default&nbsp;<\/h3>\n\n\n\n<p>A domain can have aliases&nbsp;that point to the same file contents. When creating a new environment,&nbsp;it will automatically inherit the main domain aliases. These aliases can be changed by the user in the new environment for various reasons&nbsp;and the change will be made only for that target environment. If this new&nbsp;domain alias list should be copied to the target environment during the migration, this option needs to be enabled.&nbsp;&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1662373924901\">5. Update speed rules&nbsp;\u2013 option is enabled by default&nbsp;<\/h3>\n\n\n\n<p>New environments inherit a copy of the main domain speed&nbsp;rules. In many occasions, the new environment is used to test new serving configurations for the domain&nbsp;by using the Speed section to enable or adjust caching configuration, web server configs, https, and www redirects etc.&nbsp;This allows an easy mechanism to test new ideas&nbsp;and when ready,&nbsp;the Migration automation can copy those new Speed rules to the Production environment or any other&nbsp;desired development environment when \u201cUpdate speed rules\u201d option is enabled.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1662373924917\">6. Update public path&nbsp;\u2013 option is enabled by default&nbsp;<\/h3>\n\n\n\n<p>In general, websites use a \u201cpublic_html\u201d web root. The web root is the path where the server will look for the&nbsp;files when resolving the web request.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Let\u2019s understand how the web root relates to the environment root. The environment root is the folder that contains all the files&nbsp;for that specific environment. For&nbsp;example,&nbsp;the live website environment is in \u201c\/home\/&lt;user_name&gt;\/web\/live\/\u201d&nbsp;and any other environment is under \u201c\/home\/&lt;user_name&gt;\/web\/&lt;env_name&gt;\/\u201d. The&nbsp;web root is a path underneath the environment root which will be used to resolve the web request. If we take the&nbsp;common example of \u201cpublic_html\u201d and an example web request&nbsp;<a href=\"http:\/\/example.org\/index.php\">http:\/\/example.org\/index.php<\/a>&nbsp;for the&nbsp;Production website&nbsp;(where example.org should be considered the name of the domain where&nbsp;we are working with the development environments), we can have the following layout:&nbsp;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Live environment root:&nbsp;\/home\/&lt;user_name&gt;\/web\/live\/&nbsp;<\/p><p>Live environment web root:&nbsp;\/home\/&lt;user_name&gt;\/web\/live\/public_html\/&nbsp;<\/p><p>Php file&nbsp;index.php:&nbsp;\/home\/&lt;user_name&gt;\/web\/live\/public_html\/index.php&nbsp;<\/p><\/blockquote>\n\n\n\n<p>If a different environment&nbsp;is opened with the special link provided in the&nbsp;ClusterCS&nbsp;interface under the Dev Env section, the&nbsp;used paths will be as follows:&nbsp;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Environment root: \/home\/&lt;user_name&gt;\/web\/&lt;env_name&gt;\/&nbsp;<\/p><p>Environment web root: \/home\/&lt;user_name&gt;\/web\/&lt;env_name&gt;\/public_html\/&nbsp;<\/p><p>Php file&nbsp;index.php: \/home\/&lt;user_name&gt;\/web\/&lt;env_name&gt;\/public_html\/index.php&nbsp;<\/p><\/blockquote>\n\n\n\n<p>With the above example, we can see why&nbsp;the web root is specific to the&nbsp;environment. Although&nbsp;\u201cpublic_html\u201d&nbsp;is the most common web root path, many scripts default to other paths (ex: \u201cpublic\u201d). If such changes are required, the new environment can be&nbsp;migrated,&nbsp;and the target environment will be updated with this new web root path specified in the source environment.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1662373924942\">7. Update php version&nbsp;\u2013 option is enabled by default&nbsp;<\/h3>\n\n\n\n<p>Php version is another environment specific&nbsp;configuration.&nbsp;If we want to test&nbsp;whether our website works with a newer version of php, we can create a new development environment for the purpose of this test, migrate our Production website on this new environment, change to the new php version and&nbsp;run all the necessary tests. Once we are sure everything works and that we have fixed any incompatibilities we can migrate back to the Production environment and automatically adjust to the new php&nbsp;version during the automated process.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the main&nbsp;advantages&nbsp;of using&nbsp;ClusterCS&nbsp;Development Environments is the&nbsp;time saved&nbsp;copying a website from Production to a development environment and back or between other environments.&nbsp;&nbsp; The Migration section configures all the automation that happens when we want to transfer environment contents to another.&nbsp;&nbsp; The elements that can be transferred between environments during migration can be any or&nbsp;all [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":8445,"menu_order":5,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-8506","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Migrations - ClusterCS Knowledge Base<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Migrations - ClusterCS Knowledge Base\" \/>\n<meta property=\"og:description\" content=\"One of the main&nbsp;advantages&nbsp;of using&nbsp;ClusterCS&nbsp;Development Environments is the&nbsp;time saved&nbsp;copying a website from Production to a development environment and back or between other environments.&nbsp;&nbsp; The Migration section configures all the automation that happens when we want to transfer environment contents to another.&nbsp;&nbsp; The elements that can be transferred between environments during migration can be any or&nbsp;all [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/\" \/>\n<meta property=\"og:site_name\" content=\"ClusterCS Knowledge Base\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-19T12:35:57+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/\",\"url\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/\",\"name\":\"Migrations - ClusterCS Knowledge Base\",\"isPartOf\":{\"@id\":\"https:\/\/clustercs.com\/kb\/#website\"},\"datePublished\":\"2022-09-02T11:50:42+00:00\",\"dateModified\":\"2022-09-19T12:35:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/clustercs.com\/kb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ClusterCS Documentation\",\"item\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Development Environment\",\"item\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Migrations\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/clustercs.com\/kb\/#website\",\"url\":\"https:\/\/clustercs.com\/kb\/\",\"name\":\"ClusterCS Knowledge Base\",\"description\":\"Welcome to ClusterCS Documentation\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/clustercs.com\/kb\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Migrations - ClusterCS Knowledge Base","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/","og_locale":"en_US","og_type":"article","og_title":"Migrations - ClusterCS Knowledge Base","og_description":"One of the main&nbsp;advantages&nbsp;of using&nbsp;ClusterCS&nbsp;Development Environments is the&nbsp;time saved&nbsp;copying a website from Production to a development environment and back or between other environments.&nbsp;&nbsp; The Migration section configures all the automation that happens when we want to transfer environment contents to another.&nbsp;&nbsp; The elements that can be transferred between environments during migration can be any or&nbsp;all [&hellip;]","og_url":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/","og_site_name":"ClusterCS Knowledge Base","article_modified_time":"2022-09-19T12:35:57+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/","url":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/","name":"Migrations - ClusterCS Knowledge Base","isPartOf":{"@id":"https:\/\/clustercs.com\/kb\/#website"},"datePublished":"2022-09-02T11:50:42+00:00","dateModified":"2022-09-19T12:35:57+00:00","breadcrumb":{"@id":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-migrations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/clustercs.com\/kb\/"},{"@type":"ListItem","position":2,"name":"ClusterCS Documentation","item":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/"},{"@type":"ListItem","position":3,"name":"Development Environment","item":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/"},{"@type":"ListItem","position":4,"name":"Migrations"}]},{"@type":"WebSite","@id":"https:\/\/clustercs.com\/kb\/#website","url":"https:\/\/clustercs.com\/kb\/","name":"ClusterCS Knowledge Base","description":"Welcome to ClusterCS Documentation","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/clustercs.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/docs\/8506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/comments?post=8506"}],"version-history":[{"count":2,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/docs\/8506\/revisions"}],"predecessor-version":[{"id":8977,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/docs\/8506\/revisions\/8977"}],"up":[{"embeddable":true,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/docs\/8445"}],"wp:attachment":[{"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/media?parent=8506"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/doc_tag?post=8506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}