{"id":2570,"date":"2022-06-19T15:45:20","date_gmt":"2022-06-19T15:45:20","guid":{"rendered":"https:\/\/ionoslabs.com\/?p=2570"},"modified":"2022-10-19T14:02:29","modified_gmt":"2022-10-19T14:02:29","slug":"wordpress-load-balanced","status":"publish","type":"post","link":"https:\/\/ionoslabs.com\/index.php\/wordpress-load-balanced\/","title":{"rendered":"Load-Balanced-WordPress"},"content":{"rendered":"<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap\" style=\"max-width:1289.6px;margin-left: calc(-4% \/ 2 );margin-right: calc(-4% \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_2_3 2_3 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-border-color:#000000;--awb-border-style:dashed;--awb-width-large:66.666666666667%;--awb-margin-top-large:0px;--awb-spacing-right-large:2.88%;--awb-margin-bottom-large:20px;--awb-spacing-left-large:2.88%;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-content-boxes content-boxes columns row fusion-columns-1 fusion-columns-total-1 fusion-content-boxes-1 content-boxes-icon-with-title content-left\" style=\"--awb-hover-accent-color:#ff8d61;--awb-circle-hover-accent-color:#ff8d61;--awb-item-margin-bottom:40px;\" data-animationOffset=\"top-into-view\"><div style=\"--awb-backgroundcolor:rgba(255,255,255,0);\" class=\"fusion-column content-box-column content-box-column content-box-column-1 col-lg-12 col-md-12 col-sm-12 fusion-content-box-hover content-box-column-last content-box-column-last-in-row\"><div class=\"col content-box-wrapper content-wrapper link-area-box icon-hover-animation-fade\" data-animationOffset=\"top-into-view\"><div class=\"heading icon-left\"><h2 class=\"content-box-heading fusion-responsive-typography-calculated\" style=\"--h2_typography-font-size:23px;--fontSize:23;line-height:1.29;\">Build a Load Balanced WordPress Environment<\/h2><\/div><div class=\"fusion-clearfix\"><\/div><div class=\"content-container\">\n<p>Goal:\u00a0 Build a WordPress environment with separate DB instance and multiple WordPress instances fronted by a load balancer.<\/p>\n<p>Video:\u00a0 Check out the Webinar where we walk through this process\u00a0 https:\/\/youtu.be\/3OPAoFGgYo8<\/p>\n<p>This how-to is going to go through the following<\/p>\n<ul>\n<li>Building a NAT Gateway and Internal Network<\/li>\n<li>Build DB server<\/li>\n<li>Build Load Balancer and Front end Web Server<\/li>\n<\/ul>\n<p><strong>Building a NAT Gateway and Internal Network\u00a0<\/strong><\/p>\n<ol>\n<li>Login to the IONOS DCD at\u00a0<a href=\"https:\/\/dcd.ionos.com\/\">https:\/\/dcd.ionos.com<\/a><\/li>\n<li>Create your Virtual Data Center<\/li>\n<li>Reserve static IP address from the &#8220;Ip Manager&#8221; under the &#8220;Manager resources&#8221; menu<\/li>\n<li>Create your NAT Gateway by dragging the NAT gateway ICON to the grid.<\/li>\n<li>Assign the reserved IP address by selecting it from the &#8220;Public IP&#8217;s&#8221; dropdown and select the previously reserved IP address<\/li>\n<li>Drag a server instance to the dcd grid (this will only be used temporarily) and click and drag the plus sign from the server icon to the NAT Gateway in order to create the private network<\/li>\n<li>Assign an internal IP address to the NAT gateway by selecting the NAT Gateway&#8221; in the grid and then the &#8220;Gateway IPs&#8221; tab to the right, click &#8220;Add IP&#8221; and enter 192.168.10.1\/24 and then &#8220;add ip&#8221;<\/li>\n<li>\u00a0Click on &#8220;Provision Changes&#8221;<\/li>\n<\/ol>\n<p><strong>Create a DB server<\/strong><\/p>\n<ol>\n<li>Drag and drop another server to the DCD grid<\/li>\n<li>Connect the server to the previously created internal network by clicking the plus sign and dragging to the NAT gateway, the new server should join the same network as the previously created temp server.<\/li>\n<li>Add HDD storage to instance and select most recent version of ubuntu as the image (from IONOS provided images)<\/li>\n<li>Copy the DB deploy cloud-init content from the Database Deploy section to the right and paste into the cloud-init user data section of the storage\/image section.<\/li>\n<li>Provision changes<\/li>\n<\/ol>\n<p><strong>Create the Load Balancer and first front end WordPress server.<\/strong><\/p>\n<ol>\n<li>Drag the server icon to DCD grid and connect to internal network by clicking the plus sign and dragging to NAT Gateway.<\/li>\n<li>Add storage to server and select IONOS images and most recent Ubuntu version<\/li>\n<li>Copy the WordPress deploy cloud-init content from the right under WordPress Deploy and paste into cloud-init user data in DCD<\/li>\n<li>Drag Load Balancer icon to DCD grid and connect one side to internal network by dragging bottom dot on icon to NAT Gateway<\/li>\n<li>Connect the external side of the Load Ba;ancer to the internet by dragging the top dot on the load balancer to the internet icon<\/li>\n<li>On the right Click the drop down on &#8220;Primary Ipv4&#8221; and select previously reserved static IP address.<\/li>\n<li>Click on &#8220;Private IP&#8221; section and click &#8220;Add IP&#8221; assign internal ip address like 192.168.10.250\/24<\/li>\n<li>Click Provision<\/li>\n<\/ol>\n<p><strong>Finish Setup<\/strong><\/p>\n<ol>\n<li>Once provisioning has completed, select the Load Balancer from the DCD grid and select &#8220;Forwarding Rules&#8221;<\/li>\n<li>Click on &#8220;Add Forwarding Rule&#8221; and enter the rule for the traffic you would like to forward.\u00a0 More information here <a href=\"https:\/\/docs.ionos.com\/cloud\/early-access\/network-load-balancer\/configure-nlb\">https:\/\/docs.ionos.com\/cloud\/early-access\/network-load-balancer\/configure-nlb<\/a><\/li>\n<\/ol>\n<p><strong>Happy building!<\/strong><\/p>\n<\/div><\/div><\/div><div class=\"fusion-clearfix\"><\/div><\/div><\/div><\/div><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-1 fusion_builder_column_1_3 1_3 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:33.333333333333%;--awb-margin-top-large:0px;--awb-spacing-right-large:5.76%;--awb-margin-bottom-large:20px;--awb-spacing-left-large:5.76%;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-title title fusion-title-1 fusion-title-text fusion-title-size-one\"><div class=\"title-sep-container title-sep-container-left fusion-no-large-visibility fusion-no-medium-visibility fusion-no-small-visibility\"><div class=\"title-sep sep- sep-solid\" style=\"border-color:#eaeaea;\"><\/div><\/div><span class=\"awb-title-spacer fusion-no-large-visibility fusion-no-medium-visibility fusion-no-small-visibility\"><\/span><h1 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:24;line-height:1.2;\">Video<\/h1><span class=\"awb-title-spacer\"><\/span><div class=\"title-sep-container title-sep-container-right\"><div class=\"title-sep sep- sep-solid\" style=\"border-color:#eaeaea;\"><\/div><\/div><\/div><style type=\"text\/css\" scopped=\"scopped\">.fusion-syntax-highlighter-1 > .CodeMirror, .fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-gutters {background-color:var(--awb-color1);}.fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-gutters { background-color: var(--awb-color2); }.fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color8); }<\/style><div class=\"fusion-syntax-highlighter-container fusion-syntax-highlighter-1 fusion-syntax-highlighter-theme-light\" style=\"opacity:0;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:14px;border-width:1px;border-style:solid;border-color:#eaeaea;\"><div class=\"syntax-highlighter-copy-code\"><span class=\"syntax-highlighter-copy-code-title\" data-id=\"fusion_syntax_highlighter_1\" style=\"font-size:14px;\">Copy to Clipboard<\/span><\/div><label for=\"fusion_syntax_highlighter_1\" class=\"screen-reader-text\">Syntax Highlighter<\/label><textarea class=\"fusion-syntax-highlighter-textarea\" id=\"fusion_syntax_highlighter_1\" data-readOnly=\"nocursor\" data-lineNumbers=\"1\" data-lineWrapping=\"\" data-theme=\"default\" data-mode=\"text\/x-sh\">https:\/\/youtu.be\/3OPAoFGgYo8<\/textarea><\/div><div class=\"fusion-title title fusion-title-2 fusion-title-text fusion-title-size-one\"><div class=\"title-sep-container title-sep-container-left fusion-no-large-visibility fusion-no-medium-visibility fusion-no-small-visibility\"><div class=\"title-sep sep- sep-solid\" style=\"border-color:#eaeaea;\"><\/div><\/div><span class=\"awb-title-spacer fusion-no-large-visibility fusion-no-medium-visibility fusion-no-small-visibility\"><\/span><h1 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:24;line-height:1.2;\">Github Repo<\/h1><span class=\"awb-title-spacer\"><\/span><div class=\"title-sep-container title-sep-container-right\"><div class=\"title-sep sep- sep-solid\" style=\"border-color:#eaeaea;\"><\/div><\/div><\/div><style type=\"text\/css\" scopped=\"scopped\">.fusion-syntax-highlighter-2 > .CodeMirror, .fusion-syntax-highlighter-2 > .CodeMirror .CodeMirror-gutters {background-color:var(--awb-color1);}.fusion-syntax-highlighter-2 > .CodeMirror .CodeMirror-gutters { background-color: var(--awb-color2); }.fusion-syntax-highlighter-2 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color8); }<\/style><div class=\"fusion-syntax-highlighter-container fusion-syntax-highlighter-2 fusion-syntax-highlighter-theme-light\" style=\"opacity:0;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:14px;border-width:1px;border-style:solid;border-color:#eaeaea;\"><div class=\"syntax-highlighter-copy-code\"><span class=\"syntax-highlighter-copy-code-title\" data-id=\"fusion_syntax_highlighter_2\" style=\"font-size:14px;\">Copy to Clipboard<\/span><\/div><label for=\"fusion_syntax_highlighter_2\" class=\"screen-reader-text\">Syntax Highlighter<\/label><textarea class=\"fusion-syntax-highlighter-textarea\" id=\"fusion_syntax_highlighter_2\" data-readOnly=\"nocursor\" data-lineNumbers=\"1\" data-lineWrapping=\"\" data-theme=\"default\" data-mode=\"text\/x-sh\">https:\/\/github.com\/ionoslabs\/wordpress-lb<\/textarea><\/div><div class=\"fusion-title title fusion-title-3 fusion-title-text fusion-title-size-one\"><div class=\"title-sep-container title-sep-container-left fusion-no-large-visibility fusion-no-medium-visibility fusion-no-small-visibility\"><div class=\"title-sep sep- sep-solid\" style=\"border-color:#eaeaea;\"><\/div><\/div><span class=\"awb-title-spacer fusion-no-large-visibility fusion-no-medium-visibility fusion-no-small-visibility\"><\/span><h1 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:24;line-height:1.2;\">Database Deploy<\/h1><span class=\"awb-title-spacer\"><\/span><div class=\"title-sep-container title-sep-container-right\"><div class=\"title-sep sep- sep-solid\" style=\"border-color:#eaeaea;\"><\/div><\/div><\/div><style type=\"text\/css\" scopped=\"scopped\">.fusion-syntax-highlighter-3 > .CodeMirror, .fusion-syntax-highlighter-3 > .CodeMirror .CodeMirror-gutters {background-color:var(--awb-color1);}.fusion-syntax-highlighter-3 > .CodeMirror .CodeMirror-gutters { background-color: var(--awb-color2); }.fusion-syntax-highlighter-3 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color8); }<\/style><div class=\"fusion-syntax-highlighter-container fusion-syntax-highlighter-3 fusion-syntax-highlighter-theme-light\" style=\"opacity:0;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:14px;border-width:1px;border-style:solid;border-color:#eaeaea;\"><div class=\"syntax-highlighter-copy-code\"><span class=\"syntax-highlighter-copy-code-title\" data-id=\"fusion_syntax_highlighter_3\" style=\"font-size:14px;\">Copy to Clipboard<\/span><\/div><label for=\"fusion_syntax_highlighter_3\" class=\"screen-reader-text\">Syntax Highlighter<\/label><textarea class=\"fusion-syntax-highlighter-textarea\" id=\"fusion_syntax_highlighter_3\" data-readOnly=\"nocursor\" data-lineNumbers=\"1\" data-lineWrapping=\"\" data-theme=\"default\" data-mode=\"text\/x-sh\">#cloud-config\n\n\nwrite_files:\n- path: \/etc\/cloud\/cloud.cfg.d\/99-custom-networking.cfg\n  permissions: '0644'\n  content: |\n    network: {config: disabled}\n- path: \/etc\/netplan\/config.yaml\n  permissions: '0644'\n  content: |\n    network:\n        version: 2\n\t\trenderer: networkd\n        ethernets:\n            ens6:\n                dhcp4: false\n                addresses: [192.168.10.20\/24]\n                gateway4: 192.168.10.1\n                nameservers:\n                  addresses: [1.1.1.1]\n\n\n\nruncmd:\n - echo \"runcmd start\"\n - netplan generate\n - netplan apply\n#  set parameters to be used for mysql DB, Username and password\n - export db_name=\"testdb\"\n - export db_user=\"wpuser\"\n - export db_password=\"password1234\"\n - apt update\n - apt install -y mysql-server\n - git clone git:\/\/github.com\/ionoslabs\/mysql-cloud-init \/tmp\/mysql-cloud-init\n - chmod +x \/tmp\/mysql-cloud-init\/mysql-install.sh\n - \/tmp\/mysql-cloud-init\/mysql-install.sh\n - echo > \"runcmd complete\"\n\n\n\n\n<\/textarea><\/div><div class=\"fusion-title title fusion-title-4 fusion-title-text fusion-title-size-one\"><div class=\"title-sep-container title-sep-container-left fusion-no-large-visibility fusion-no-medium-visibility fusion-no-small-visibility\"><div class=\"title-sep sep- sep-solid\" style=\"border-color:#eaeaea;\"><\/div><\/div><span class=\"awb-title-spacer fusion-no-large-visibility fusion-no-medium-visibility fusion-no-small-visibility\"><\/span><h1 class=\"fusion-title-heading title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:24;line-height:1.2;\">WordPress Deploy<\/h1><span class=\"awb-title-spacer\"><\/span><div class=\"title-sep-container title-sep-container-right\"><div class=\"title-sep sep- sep-solid\" style=\"border-color:#eaeaea;\"><\/div><\/div><\/div><style type=\"text\/css\" scopped=\"scopped\">.fusion-syntax-highlighter-4 > .CodeMirror, .fusion-syntax-highlighter-4 > .CodeMirror .CodeMirror-gutters {background-color:var(--awb-color1);}.fusion-syntax-highlighter-4 > .CodeMirror .CodeMirror-gutters { background-color: var(--awb-color2); }.fusion-syntax-highlighter-4 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color8); }<\/style><div class=\"fusion-syntax-highlighter-container fusion-syntax-highlighter-4 fusion-syntax-highlighter-theme-light\" style=\"opacity:0;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:14px;border-width:1px;border-style:solid;border-color:#eaeaea;\"><div class=\"syntax-highlighter-copy-code\"><span class=\"syntax-highlighter-copy-code-title\" data-id=\"fusion_syntax_highlighter_4\" style=\"font-size:14px;\">Copy to Clipboard<\/span><\/div><label for=\"fusion_syntax_highlighter_4\" class=\"screen-reader-text\">Syntax Highlighter<\/label><textarea class=\"fusion-syntax-highlighter-textarea\" id=\"fusion_syntax_highlighter_4\" data-readOnly=\"nocursor\" data-lineNumbers=\"1\" data-lineWrapping=\"\" data-theme=\"default\" data-mode=\"text\/x-sh\">#cloud-config\nwrite_files:\n- path: \/etc\/cloud\/cloud.cfg.d\/99-custom-networking.cfg\n  permissions: '0644'\n  content: |\n    network: {config: disabled}\n- path: \/etc\/netplan\/config.yaml\n  permissions: '0644'\n  content: |\n    network:\n        version: 2\n        renderer: networkd\n        ethernets:\n            ens6:\n                dhcp4: false\n                addresses: [192.168.10.10\/24]\n                gateway4: 192.168.10.1\n                nameservers:\n                  addresses: [1.1.1.1]                          \n\n\nruncmd:\n - echo \"runcmd start\"\n - rm \/etc\/netplan\/50-cloud-init.yaml\n - rm \/etc\/netplan\/01-netcfg.yaml\n - netplan generate\n - netplan apply\n - sleep 30\n - apt update\n - apt install -y apache2\n#  set db credentials below\n - export db_name=\"testdb\"\n - export db_user=\"wpuser\"\n - export db_password=\"password1234\"\n - export db_host=\"192.168.10.20\"\n#  end db credentials\n - git clone https:\/\/github.com\/huegott\/wp-ext-db \/tmp\/wp-install\n - chmod +x \/tmp\/wp-install\/wp-install.sh\n - \/tmp\/wp-install\/wp-install.sh<\/textarea><\/div><\/div><\/div><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":2572,"comment_status":"open","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,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[455,382,391,691],"tags":[],"class_list":["post-2570","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ci-cd","category-how-to","category-resources","category-wordpress"],"_links":{"self":[{"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/posts\/2570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/comments?post=2570"}],"version-history":[{"count":12,"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/posts\/2570\/revisions"}],"predecessor-version":[{"id":2606,"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/posts\/2570\/revisions\/2606"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/media\/2572"}],"wp:attachment":[{"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/media?parent=2570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/categories?post=2570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ionoslabs.com\/index.php\/wp-json\/wp\/v2\/tags?post=2570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}