On-prem vs. IaaS vs. PaaS vs. SaaS

  On-prem IaaS PaaS SaaS
Infrastructure
(Hardware)
You Provider Provider Provider
Platform
(Operating System)
You You Provider Provider
Web Application You You You Provider
Data/Content You You You You

What’s the difference between these types of hosting?

On-prem AKA “on-premise” is the traditional way of hosting on-site. The storage, RAM, electricity, networking, operating system, applications, web servers… everything is managed by you. This typically involves multiple system administrators to keep the service running. Examples of these are traditional engineering organizations or development teams.

Infrastructure-as-a-service AKA IaaS is where you manage the platform, applications, and data. The infrastructure is managed for you. Example: Virtual Machines.

Platform-as-a-service is where you manage the applications and data. The platform and infrastructure is managed for you. Example: Azure App Service.

Software-as-a-service is where you manage data or content. The platform, infrastructure, and application is managed for you. Example: Managed WordPress.

Out of these four types of WordPress hosting, both IaaS and PaaS are available on Azure.

1024 x 768 Display Resolution on External Monitor

Recently, my computer started to set my 4k monitor resolution to 1024 x 768. Not kidding! My solution was to disable and enable the Display Adapter.

How to fix your Display Resolution in 4 easy steps:

1. Open Device Manager by going the Start Menu and searching for ‘Device Manager‘.

2. Find the display adapter and right-click to select, ‘Disable device‘.

Device Manager - Display Adapter
Device Manager – Display Adapter

3. Select Yes‘ when prompted.

Display Adapter Disable Prompt
Display Adapter Disable Prompt

4. Right-click and select ‘Enable Device‘.

Display Adapter > Enable Device” class=”wp-image-264″/><figcaption>Display Adapter – Enable Device</figcaption></figure></div>



<p><strong>5</strong><em>Right-click</em> on desktop, <em>select </em>‘<strong>Display Settings</strong>‘</p>



<div class=
Verify Display Settings resolution
Verify Display Settings Resolution

WordPress MySQL Database options on Azure

Azure has a plethora of products and can be confusing to the first-time customer. This post will cover a popular MySQL database options for WordPress when hosting on Azure.

ProductDatabase TypePROsCONsRecommendation
IaaS (Virtual Machines)MySQL on Virtual MachineFull control of MySQL Server
Multitude of VM options
Maintenance
Multitude of VM options

VM cost
If you enjoy/don’t mind server maintenance
PaaS (App Service)MySQL In-App (Windows only)Easy to enable

Free withWindows web app

Windows-only
Not production-ready
App cannot scale horizontally
Shares resources with web app
Requires additional configuration for MySQL port umber
For development or 1-instance situations
DBaaSAzure Database for MySQLProduction-ready
Microsoft-backed
Easy to upgrade
Supports app scaling
DB CostFor production websites receiving constant traffic

These are the three main database options when hosting WordPress on Azure. I have tried all of them. I prefer the Azure DB for MySQL for production-ready scenarios the best. Microsoft maintains the database and you don’t have to worry about patching, security fixes, etc.

If you are on budget, MySQL In-App is great for getting started in development scenarios.

Those with DB/Admin/Webmaster experience may prefer the Virtual Machines option. They are all good and offer their advantages and disadvantages.

What about you? Which database type do you prefer on Azure for WordPress?

2019 Toddler Education

2019 Toddler Education is an Android App developed with young kids in mind. The main menu has the following options: Alphabet, Alphabet Quiz, Numbers and Numbers Quiz.

Alphabet

This mode goes through all the letters of the alphabet in order.

Alphabet

Alphabet Quiz

This mode will display a letter and will speak it on touch.

Alphabet Quiz

Numbers

This mode goes through numbers 1 – 20.

Numbers

Numbers Quiz

This mode will display a number and will speak it on touch.

Privacy Policy

Absolutely no information is collected.

Xamarin Android “App not installed”

While getting started on Xamarin Android, I had trouble installing the app on my LG v20 phone. I kept seeing the message “App not installed” and could not figure out why? I knew my phone’s debug settings were correct. I spent some time searching online and then came to the conclusion that I needed to sign the Android application package. This is not a well-discussed problem! If this post has helped you, please leave a comment below! Thanks!

Improving performance with application initialization on Azure App Service (Windows)

Often, performance on a website isn’t what it needs to be. One way you can improve performance is to cache files to the local disk. On Azure App Service Web Apps, an application can access the local disk at D:\local\temp. This location is specific to each instance. Due to the nature of Platform-as-a-service, this location is not easily accessible to the user. However, the application has access to this location pro-grammatically. Moreover, many popular applications and frameworks have file caching as a default feature.

PHP, a popular programming language in the Open Source community, has several MVC Frameworks that include file caching. Frameworks such as Laravel, Symfony, CodeIgniter and many others. In these frameworks, the cache location can be set to the local disk on the VM rather than the storage.

An easy way to clear this cache is to restart the App Service Web App. However, this causes your application to go offline for some time. An alternate way to clear the cache is to utilize the AppInit module within IIS. The IIS AppInit module can execute a script on a W3WP process recycle. These recycles occur on restarts, application settings updates, scaling to new instances, etc. This is not a complete list and more information can be found online.

In this article, you will learn how to execute a script through an application settings update. This is not intended to be a complete solution as your use-case may vary. It is intended to show you how the AppInit module can be used within App Service Windows.

The solution has three components:

  1. Create an initialization page to be executed upon a recycle. This is the clear cache script.
  2. Set the initialization page in the web.config.
  3. Update an application setting to trigger the recycle

Here is a sample initialization page written in PHP:

<?php 
/***** File Location: wwwroot/appInit/maybeCacheClear.php
***** This script runs when the web app is recycled.
**************************************************************
You can lock the cache in two ways so it is not cleared on a recycle:
1) add the application setting 'cacheLock' and set the value to true
2) create a file, cache.lock, within this directory
******************/
if ( file_exists('cache.lock') || ("true" == strtolower(getenv('cacheLock'))) ) 
{
$message = "================================\n" . 'Time Stamp: '. date('m/d/Y H:i:s') ."\n" . "--------------------------------\n" . "Cache is locked. Cannot clear cache.\n" . 'Computer Name: ' .$_SERVER['COMPUTERNAME'] ."\n" . 'Instance ID: ' . $_SERVER['WEBSITE_INSTANCE_ID'] . "\n\n";
}
else {
//!!CLEAR THE CACHE!!
//<INSERT CODE HERE TO CLEAR CACHE>
$message = "================================\n" . 'Time Stamp: '. date('m/d/Y H:i:s') ."\n" . "--------------------------------\n" . "*** CLEARING CACHE***\n" . 'Computer Name: ' .$_SERVER['COMPUTERNAME'] ."\n" . 'Instance ID: ' . $_SERVER['WEBSITE_INSTANCE_ID'] . "\n\n";
}
// Write the contents back to the file file_put_contents('cache.log', $message, FILE_APPEND);

Now that the initialization page has been created, tie this into the web.config so it is executed on a recycle. Here is a sample snippet with the Application Initialization script configuration

<configuration> 
<system.webServer>
<applicationInitialization doAppInitAfterRestart="true" skipManagedModules="true">
<add initializationPage="/appInit/maybeCacheClear.php" hostName="mangeshnew.azurewebsites.net"/>
</applicationInitialization>
</system.webServer>
</configuration>

The last piece of the solution is within Application Settings. Here we will create a key named “cacheLock” with a value of “true”. This setting determines if the cache should be cleared or not. When the value is set to “true”, the cache is locked and will not be cleared. However, when set to “false” the cache is no longer locked and it will erase the cache from the local disk.

Now that web.config, cache clear script and Application Settings are in place, trigger a recycle by updating an Application Setting. If everything went well, you will see a message within cache.log. It should look like this:

That’s it! As simple as that. Once you’ve placed these components in place, you can utilize Application Initialization to clear cache from local instances. I hope this has helped your application design be more performant. Questions or comments? Please leave feedback below!

I moved my Git repo to a new folder and now I’m getting a ton of modified files, help!

I’m running Windows Subsystem for Linux (WSL) on Windows 10. I downloaded a Git repo under the WSL mount. I noticed that whenever I used Windows/Visual Studio Code to save files, the permissions would reset to 000. I spoke with a colleague and his setup was different than mine.

I had the Git repo inside WSL mount.

His Git repo was on the Windows/C-drive mount and he had a soft-link to the repo. He did not face the permission issue.

So after I pushed out my latest changes, I decided to move my repo. This was the easy part. I made a softlink using

ln /directory/ /linkdirectory/

However, after the repo was moved and I modified one file, it was a bit unnerving to find out that ALL the files were listed as modified. I browsed around and saw that this could’ve been due to the line-endings on Linux vs. Windows.

It wasn’t until I updated these two settings that the rotten state in Denmark became a happy state:

git config core.autocrlf true
git config core.filemode false

WordPress Assistant for Azure App Service on Windows

App Service Assistant is a WordPress plugin that provides details on important settings and configuration. This can be helpful to troubleshoot WordPress issues. Information such as current theme, theme path, WP defines, plugins, php_errors.log (if enabled), debug.log (if enabled), user.ini, app settings.

Installing this plugin is a cinch! Just follow the steps below to get it activated and running in your WordPress application.

Installation:

Plugins > Add new

Search for: app service assistant

Click Activate


How to use:

From settings menu, select “App Service Assistant”

Sample screenshot:

Location of Log File – AppAssistant.html is saved in the D:\home\LogFiles directory.

Feedback / Suggestions – Email msangapu@outlook.com

Import a WordPress MySQL Database using WordPress Buddy+ on Azure App Service

This post discusses how to use the Azure Web App Site Extension, WordPress Buddy+, to import a WordPress MySQL Database (.sql file) into MySQL In-App.

If you haven’t already, review and install (link here) the WordPress Buddy+ Site Extension for Azure Web Apps. The steps below require MySQL In-App to be enabled.

Import Steps

  • From Kudu CMD console (<webappname>.scm.azurewebsites.net), browse to D:\home\SiteExtensions\WPBuddy\sqldumps\ folder.
  • From your desktop, drag and drop the .sql file into sqldumps folder
  • Launch WP Buddy+ Site Extension
  • Click on Migration
  • From the Menu, Select Import
  • Select the .SQL file from the drop-down. If the file you copied is not visible. Revisit step 2 and ensure the extension is .sql
  • Select the Database to Import To [For MySQL In-App, choose: 127.0.0.1 (azuredb]
  • Click Start Import!

Once the import has finished, ensure the settings in wp-config.php is accurate for MySQL In-App.

WordPress Buddy+ site extension for Azure App Service on Windows

WordPress Buddy+ is an Azure Web Apps Site Extension that facilitates WordPress configuration and especially useful for WordPress migrations. It has features for updating HOME and SITE_URL, viewing list of plugins and updating passwords. In addition, it can also help migrate the MySQL database, whether it be MySQL In-App, ClearDB or on a Virtual Machine (VM).

Installation


Fig 1. Install WordPress Buddy+ Site Extension


In the Azure Portal, select Web App and scroll to Development Tools section

  1. Select Extensions
  2. Click +Add
  3. Select Choose Extension
  4. Scroll to find WordPress Buddy+
  5. Confirm the Legal Terms and click OK

If you need additional help installing this or other Site Extensions, check out the article here.


Prerequisites – Connection Strings

ClearDB or MySQL Server on VM

If using ClearDB or MySQL on VM, ensure that the connection string is in place within application settings.

The format is as follows: Database=<db name>;Data Source=<host name>;User Id=<username>;Password=<password>

Example:


Fig 2. Application Settings > Connection Strings

MySQL In-App

When using MySQL In-app, the connection string is created automatically. Ensure In-app is enabled.’


Fig 3. MySQL In-App Blade

Fig 3. MySQL In-App Blade


WordPress Tools

Fig 4. WordPress Tools

  1. When using multiple connection strings, select the appropriate database
  2. Displays list of Active Plugins and provides an option to Disable All Plugins
  3. Update Home and SITE_URL in WP_OPTIONS table by updating fields
  4. Used to update passwords

MySQL Migration

Overview

Fig 5. Migration Assistant

  1. List of databases (from connection strings)
  2. Downloadable .SQL files on the server
  3. Help – description of features
  4. Import .SQL to MySQL Database
  5. Export a MySQL Database to .SQL
  6. Delete .SQL files listed in (2)

Import

Fig 6. Import Menu

  1. Select .SQL file to import
  2. Select Database to import TO
  3. Click to begin the import

Export

Fig 7. Export Menu

  1. Clicking the button will export all databases listed in connection strings

Clean-up

Fig 8. Clean-up

  1. Delete all .SQL files