{"id":8507,"date":"2022-09-02T11:50:52","date_gmt":"2022-09-02T11:50:52","guid":{"rendered":"https:\/\/clustercs.com\/kb\/?docs=docly-documentation\/development-environment\/tracked-items"},"modified":"2022-09-19T12:36:01","modified_gmt":"2022-09-19T12:36:01","slug":"development-environment-tracked-items","status":"publish","type":"docs","link":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/","title":{"rendered":"Tracked Items"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>ClusterCS&nbsp;offers a completely&nbsp;automated process for creating a full replica of a&nbsp;website in a new environment. The most common case is to create a new development environment for our&nbsp;production website, migrate&nbsp;Production to this new&nbsp;environment, apply all new features, plugins and any other changes that are needed, test to make sure everything works correctly and then migrate the new updated code and database to the Production environment.&nbsp;<\/p>\n\n\n\n<p>When we\u2019re making a full replica&nbsp;of the original website, meaning a complete copy of the original code and database, the new&nbsp;location would normally contain&nbsp;the same config files that point to the original database location and perhaps other&nbsp;configurations that should be updated in the new environment.&nbsp;<\/p>\n\n\n\n<p>This is where Tracked Items comes into action to complete the entire migration process automatically by updating specific files to the new environment specific values. The primary purpose of Tracked Items section is to allow the user to define those files that are environment specific and provide special variables that can be used within those files that will take different values&nbsp;based on&nbsp;the environment where they are being migrated.&nbsp;<\/p>\n\n\n\n<p>It\u2019s worth to mention that if&nbsp;we&nbsp;are using the&nbsp;ClusterCS&nbsp;installers to deploy&nbsp;the initial code, the Tracked Items sections is configured automatically to keep track of the right files and variables&nbsp;so migrations can be performed in a fully automated way.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Let\u2019s see how we can configure this section if we need custom setups.&nbsp;<\/p>\n\n\n\n<p>As&nbsp;mentioned before, the primary target for Tracked Items is to define the files that can be automatically updated on migrations. But those files need to use Tracked Variables so let\u2019s see what those are first.&nbsp;<\/p>\n\n\n\n<p>Tracked Variables&nbsp;can be of 2 kinds: generated and custom.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Generated variables correspond to&nbsp;databases and users available on the&nbsp;environment that is currently selected. For each&nbsp;selected database a set of 3 variables&nbsp;are being automatically defined:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>$ENV_DB_NAME_&lt;number&gt;$<\/strong>&nbsp;\u2013 this will contain the database name. The value represents the current environment database name&nbsp;<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>$ENV_DB_HOST_&lt;&nbsp;number&nbsp;&gt;$<\/strong>&nbsp;\u2013&nbsp;this variable represents the database host, usually \u201clocalhost\u201d. Since&nbsp;ClusterCS&nbsp;can be deployed in&nbsp;many&nbsp;clustered configurations, this value is \u201cdetermined\u201d based&nbsp;on various factors but for complicated scenarios,&nbsp;if the determined value is not correct,&nbsp;you may want to hardcode per environment specific values.&nbsp;<\/li><li><strong>$ENV_DB_PORT_&lt;number&gt;$<\/strong>&nbsp;\u2013&nbsp;this is the database port, usually \u201c3306\u201d and most often not specified in config scripts. If the&nbsp;ClusterCS&nbsp;setup&nbsp;has special&nbsp;configurations such as database proxies, this variable can be used to set the correct port. As in the case of the previous \u201chost\u201d variable, this can be hardcoded to specific&nbsp;per environment values if the&nbsp;ClusterCS&nbsp;determined value on migrations is not what is desired.&nbsp;<\/li><\/ul>\n\n\n\n<p>Each selected database user will have 2 variables generated automatically:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>$ENV_DB_USER_&lt;number&gt;$<\/strong>&nbsp;\u2013 this variable will contain the user name. The value represents the current environment user name.&nbsp;<\/li><li><strong>$ENV_DB_PASS_&lt;number&gt;$<\/strong>&nbsp;\u2013 the user password.&nbsp;Values are displayed as \u201c&lt;hidden&gt;\u201d for security purposes but they contain the per environment user password.&nbsp;<\/li><\/ul>\n\n\n\n<p>Custom variables are a way to define any other specific values that need to change per environment.&nbsp;<\/p>\n\n\n\n<p>Both generated and custom variables have the default value that will be used for all environments. In the case of generated variables, those default&nbsp;values are reevaluated for each&nbsp;environment,&nbsp;but custom variables will remain as defined. In order to ensure a specific value is being used for an environment, \u201cEnv Custom\u201d button allows defining hardcoded values per environment.&nbsp;<\/p>\n\n\n\n<p>The &lt;number&gt; in each of the generated&nbsp;variable is automatically determined by the system in order to differentiate&nbsp;the resource they refer to&nbsp;in the case where several&nbsp;databases or users are available.&nbsp;The selected databases are defined in the Tracked Database section and can be \u201cAll\u201d selected by default in an unknown setup or can be set to \u201cCustom\u201d and specific database and users selected. It is recommended to use the \u201cCustom\u201d option and only select the databases and users that are actually needed in the migration as these will be selected by default in the \u201cMigrate\u201d tab.&nbsp;<\/p>\n\n\n\n<p>Once we have the&nbsp;Tracked&nbsp;Variables defined, we can use them in&nbsp;Tracked&nbsp;Files.&nbsp;The files that we&nbsp;want to rewrite with environment specific values on migrations can be defined here and&nbsp;we are required to provide the file path (the path of the file that will be deployed\/overwritten) and the file contents. File path&nbsp;will be appended&nbsp;to the environment root, for example, a file path \u201cpublic_html\/config.php\u201d will result in&nbsp;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>\/home\/&lt;user_name&gt;\/web\/&lt;env_name&gt;\/public_html\/config.php <\/code><\/pre>\n\n\n\n<p>If we take a simple example for WordPress, the file path in default setups would be \u201cpublic_html\/wp-config.php\u201d and in file contents, we can paste the entire original file and replace the relevant values with variables, ex:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>define(\u2018DB_NAME\u2019, \u2018$ENV_DB_NAME_1$\u2019); \ndefine(\u2018DB_USER\u2019, \u2018$ENV_DB_USER_1$\u2019); \ndefine(\u2018DB_PASSWORD\u2019, \u2018$ENV_DB_PASS_1$\u2019); \ndefine(\u2018DB_HOST\u2019, \u2018$ENV_DB_HOST_1$\u2019);<\/code><\/pre>\n\n\n\n<p>Once we have the tracked files setup, migrations are now fully automated. When going to \u201cMigrate\u201d page, databases and users will be automatically selected&nbsp;and \u201cAuto\u201d selected for target environment,&nbsp;the option \u201cRewrite tracked files\u201d&nbsp;enabled&nbsp;by default. Under these conditions,&nbsp;ClusterCS&nbsp;will create a new database and user in the target environment,&nbsp;the defined tracked file paths will be overwritten with the provided file contents and variables in the file contents replaced with environment specific values (ex: the new database name, user name, user password).&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ClusterCS&nbsp;offers a completely&nbsp;automated process for creating a full replica of a&nbsp;website in a new environment. The most common case is to create a new development environment for our&nbsp;production website, migrate&nbsp;Production to this new&nbsp;environment, apply all new features, plugins and any other changes that are needed, test to make sure everything works correctly and then migrate [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":8445,"menu_order":6,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-8507","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>Tracked Items - 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-tracked-items\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tracked Items - ClusterCS Knowledge Base\" \/>\n<meta property=\"og:description\" content=\"ClusterCS&nbsp;offers a completely&nbsp;automated process for creating a full replica of a&nbsp;website in a new environment. The most common case is to create a new development environment for our&nbsp;production website, migrate&nbsp;Production to this new&nbsp;environment, apply all new features, plugins and any other changes that are needed, test to make sure everything works correctly and then migrate [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/\" \/>\n<meta property=\"og:site_name\" content=\"ClusterCS Knowledge Base\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-19T12:36:01+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=\"5 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-tracked-items\/\",\"url\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/\",\"name\":\"Tracked Items - ClusterCS Knowledge Base\",\"isPartOf\":{\"@id\":\"https:\/\/clustercs.com\/kb\/#website\"},\"datePublished\":\"2022-09-02T11:50:52+00:00\",\"dateModified\":\"2022-09-19T12:36:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/#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\":\"Tracked Items\"}]},{\"@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":"Tracked Items - 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-tracked-items\/","og_locale":"en_US","og_type":"article","og_title":"Tracked Items - ClusterCS Knowledge Base","og_description":"ClusterCS&nbsp;offers a completely&nbsp;automated process for creating a full replica of a&nbsp;website in a new environment. The most common case is to create a new development environment for our&nbsp;production website, migrate&nbsp;Production to this new&nbsp;environment, apply all new features, plugins and any other changes that are needed, test to make sure everything works correctly and then migrate [&hellip;]","og_url":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/","og_site_name":"ClusterCS Knowledge Base","article_modified_time":"2022-09-19T12:36:01+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/","url":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/","name":"Tracked Items - ClusterCS Knowledge Base","isPartOf":{"@id":"https:\/\/clustercs.com\/kb\/#website"},"datePublished":"2022-09-02T11:50:52+00:00","dateModified":"2022-09-19T12:36:01+00:00","breadcrumb":{"@id":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/clustercs.com\/kb\/docs\/clustercs\/development-environment\/development-environment-tracked-items\/#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":"Tracked Items"}]},{"@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\/8507","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=8507"}],"version-history":[{"count":2,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/docs\/8507\/revisions"}],"predecessor-version":[{"id":8978,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/docs\/8507\/revisions\/8978"}],"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=8507"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/clustercs.com\/kb\/wp-json\/wp\/v2\/doc_tag?post=8507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}