{"id":205,"date":"2019-09-20T01:17:34","date_gmt":"2019-09-20T07:17:34","guid":{"rendered":"https:\/\/www.obsidianworlds.com\/wow\/?p=205"},"modified":"2022-06-06T16:44:06","modified_gmt":"2022-06-06T22:44:06","slug":"site-deployment-automation","status":"publish","type":"post","link":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/","title":{"rendered":"Site deployment automation"},"content":{"rendered":"<p>TL;DR: To support server deployment automation, the WordPress front end has been merged together with other OW sites. Unfortunately, this breaks user registration until the package maintainers fix it. I&#8217;ll have to look into a fix another day. I&#8217;m really busy these days. Existing accounts should work as usual. Please report anything else that&#8217;s broken.<\/p>\n<p>Previously, the WoW site was a stand alone WordPress site served at its URL by the web server under the same domain. Now, it&#8217;s just another site that&#8217;s part of the Obsidian Worlds multi-site deployment. This required merging the stand-alone site and multi-site databases. I&#8217;m documenting the process here for prosperity since the bulk of my time was spent hunting down the information. I also did some work on the authentication between CMangos and WordPress, but I won&#8217;t go over that here.<\/p>\n<p>The databases were from WordPress 4.7.5. Here&#8217;s a overview of the merge.<\/p>\n<ol>\n<li>Backup the stand-alone database<\/li>\n<li>Create the new site<\/li>\n<li>Move user IDs out of the way<\/li>\n<li>Import the stand-alone database into the multi-site database with table renames<\/li>\n<li>Apply some database fixes<\/li>\n<\/ol>\n<h2>Backup the database<\/h2>\n<pre>mysqldump obsidianworlds_wow | pv | pigz &gt; obsidianworlds_wow.sql.gz<\/pre>\n<p>Here, the &#8216;pv&#8217; command just tracks progress and &#8216;pigz&#8217; is a multi-core compressor that can substantially increase compression time.<\/p>\n<h2>Create the new site<\/h2>\n<p>Create a new site with Network Settings -&gt; Sites. Make note of the ID in the URL. You&#8217;ll need that rename tables.<\/p>\n<h2>Move user data out of the way<\/h2>\n<p>This is where things get messy. Fortunately for me, my multi-site only has a few admins that didn&#8217;t clash with other user IDs. All I had to do was move user meta data:<\/p>\n<pre>update wp_usermeta set umeta_id = umeta_id+24332 where user_id = 1;<\/pre>\n<p>For any IDs you change, you&#8217;ll need to fix the auto-increment for:<\/p>\n<pre>alter table wp_usermeta AUTO_INCREMENT = 25900;<\/pre>\n<h2>Import the database<\/h2>\n<p>To rename and import the database at once:<\/p>\n<pre>zcat obsidianworlds_wow.sql.gz | pv | sed 's\/`wp_\/`wp_4_\/g' | mysql obsidianworlds<\/pre>\n<p>Replace 4 with your new site ID from above.<\/p>\n<p>At this point you&#8217;ll have two tables that don&#8217;t belong: &#8216;wp_4_users&#8217; and wp_4_usermeta&#8217;. Multi-site WordPress installations share authentication so these tables will never be used but they&#8217;re imported so we can merge them into the real tables.<\/p>\n<p>To merge the two tables:<\/p>\n<pre>insert into wp_users select * from wp_4_users;\r\ninsert into wp_usermeta select * from wp_4_usermeta;<\/pre>\n<h2>Apply database fixes<\/h2>\n<p>When you go to add the new users to the site, you&#8217;ll notice there are no available roles to select from. To fix this:<\/p>\n<pre>update wp_4_options set option_name = 'wp_4_user_roles' where option_name = 'wp_user_roles';<\/pre>\n<p>Next, fix up users site associations by renaming user capabilities:<\/p>\n<pre>update wp_usermeta set meta_key = 'wp_4_capabilities' where meta_key = 'wp_capabilities' and user_id &gt; 1;\r\nupdate wp_usermeta set meta_key = 'wp_4_user_level' where meta_key = 'wp_user_level' and user_id &gt; 1;<\/pre>\n<p>For me, only user ID 1 didn&#8217;t need to be fixed up. Be careful here, as this may mess up pre-existing users in the original multi-site installation. This&#8217;ll likely be different for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TL;DR: To support server deployment automation, the WordPress front end has been merged together with other OW sites. Unfortunately, this breaks user registration until the package maintainers fix it. I&#8217;ll have to look into a fix another day. I&#8217;m really busy these days. Existing accounts should work as usual. Please report anything else that&#8217;s broken. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-205","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Site deployment automation - Vanilla World of Warcraft - Obsidian Worlds<\/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:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Site deployment automation - Vanilla World of Warcraft - Obsidian Worlds\" \/>\n<meta property=\"og:description\" content=\"TL;DR: To support server deployment automation, the WordPress front end has been merged together with other OW sites. Unfortunately, this breaks user registration until the package maintainers fix it. I&#8217;ll have to look into a fix another day. I&#8217;m really busy these days. Existing accounts should work as usual. Please report anything else that&#8217;s broken. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/\" \/>\n<meta property=\"og:site_name\" content=\"Vanilla World of Warcraft - Obsidian Worlds\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-20T07:17:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-06T22:44:06+00:00\" \/>\n<meta name=\"author\" content=\"rayz0r\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rayz0r\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/site-deployment-automation\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/site-deployment-automation\\\/\"},\"author\":{\"name\":\"rayz0r\",\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/#\\\/schema\\\/person\\\/c9be48d223dfc69e67d494083b10cc5f\"},\"headline\":\"Site deployment automation\",\"datePublished\":\"2019-09-20T07:17:34+00:00\",\"dateModified\":\"2022-06-06T22:44:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/site-deployment-automation\\\/\"},\"wordCount\":415,\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/site-deployment-automation\\\/\",\"url\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/site-deployment-automation\\\/\",\"name\":\"Site deployment automation - Vanilla World of Warcraft - Obsidian Worlds\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/#website\"},\"datePublished\":\"2019-09-20T07:17:34+00:00\",\"dateModified\":\"2022-06-06T22:44:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/#\\\/schema\\\/person\\\/c9be48d223dfc69e67d494083b10cc5f\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/site-deployment-automation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/site-deployment-automation\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/site-deployment-automation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Site deployment automation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/#website\",\"url\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/\",\"name\":\"Vanilla World of Warcraft - Obsidian Worlds\",\"description\":\"World of Warcraft Private Server\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/#\\\/schema\\\/person\\\/c9be48d223dfc69e67d494083b10cc5f\",\"name\":\"rayz0r\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/04c709dbfe60d607684e277e746b0d30ff2c79b9f9dbe2901477da5f36ab3495?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/04c709dbfe60d607684e277e746b0d30ff2c79b9f9dbe2901477da5f36ab3495?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/04c709dbfe60d607684e277e746b0d30ff2c79b9f9dbe2901477da5f36ab3495?s=96&d=retro&r=g\",\"caption\":\"rayz0r\"},\"url\":\"https:\\\/\\\/www.obsidianworlds.com\\\/wow\\\/author\\\/rayz0r-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Site deployment automation - Vanilla World of Warcraft - Obsidian Worlds","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:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/","og_locale":"en_US","og_type":"article","og_title":"Site deployment automation - Vanilla World of Warcraft - Obsidian Worlds","og_description":"TL;DR: To support server deployment automation, the WordPress front end has been merged together with other OW sites. Unfortunately, this breaks user registration until the package maintainers fix it. I&#8217;ll have to look into a fix another day. I&#8217;m really busy these days. Existing accounts should work as usual. Please report anything else that&#8217;s broken. [&hellip;]","og_url":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/","og_site_name":"Vanilla World of Warcraft - Obsidian Worlds","article_published_time":"2019-09-20T07:17:34+00:00","article_modified_time":"2022-06-06T22:44:06+00:00","author":"rayz0r","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rayz0r","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/#article","isPartOf":{"@id":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/"},"author":{"name":"rayz0r","@id":"https:\/\/www.obsidianworlds.com\/wow\/#\/schema\/person\/c9be48d223dfc69e67d494083b10cc5f"},"headline":"Site deployment automation","datePublished":"2019-09-20T07:17:34+00:00","dateModified":"2022-06-06T22:44:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/"},"wordCount":415,"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/","url":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/","name":"Site deployment automation - Vanilla World of Warcraft - Obsidian Worlds","isPartOf":{"@id":"https:\/\/www.obsidianworlds.com\/wow\/#website"},"datePublished":"2019-09-20T07:17:34+00:00","dateModified":"2022-06-06T22:44:06+00:00","author":{"@id":"https:\/\/www.obsidianworlds.com\/wow\/#\/schema\/person\/c9be48d223dfc69e67d494083b10cc5f"},"breadcrumb":{"@id":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.obsidianworlds.com\/wow\/site-deployment-automation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.obsidianworlds.com\/wow\/"},{"@type":"ListItem","position":2,"name":"Site deployment automation"}]},{"@type":"WebSite","@id":"https:\/\/www.obsidianworlds.com\/wow\/#website","url":"https:\/\/www.obsidianworlds.com\/wow\/","name":"Vanilla World of Warcraft - Obsidian Worlds","description":"World of Warcraft Private Server","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.obsidianworlds.com\/wow\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.obsidianworlds.com\/wow\/#\/schema\/person\/c9be48d223dfc69e67d494083b10cc5f","name":"rayz0r","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/04c709dbfe60d607684e277e746b0d30ff2c79b9f9dbe2901477da5f36ab3495?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/04c709dbfe60d607684e277e746b0d30ff2c79b9f9dbe2901477da5f36ab3495?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/04c709dbfe60d607684e277e746b0d30ff2c79b9f9dbe2901477da5f36ab3495?s=96&d=retro&r=g","caption":"rayz0r"},"url":"https:\/\/www.obsidianworlds.com\/wow\/author\/rayz0r-2\/"}]}},"_links":{"self":[{"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/posts\/205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/comments?post=205"}],"version-history":[{"count":4,"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/posts\/205\/revisions"}],"predecessor-version":[{"id":209,"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/posts\/205\/revisions\/209"}],"wp:attachment":[{"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/media?parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/categories?post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.obsidianworlds.com\/wow\/wp-json\/wp\/v2\/tags?post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}