Profile picture of Liam Moat

Liam Moat

Cloud Dev Consultant.

Using kubectl to generate Kubernetes YAML

By Liam Moat. .

When you get started with Kubernetes, the first thing you will probably do is create a Deployment using the kubectl command-line interface. When you create an object in Kubernetes, including a Deployment, you must provide the object spec that describes its desired state, as well as some basic information about the object (such as a name). Most often, you provide this information using a YAML file. This post will explore how to use kubectl, and commands that you may already be familiar with, to generate this YAML.

Naming convention for Azure Resources

By Liam Moat. .

For a long time, I have wanted to document my naming conventions for Azure Resources - this post does just that. A consistent naming convention makes resources easier to find and easier to understand. It can provide structure amongst the chaos of potentially hundreds (if not, thousands) of resources deployed across different regions and environments. A consistent naming standard is the first pillar of the Azure enterprise scaffold and a best practice for cloud applications.

Import JSON files with TypeScript

By Liam Moat. .

TypeScript 2.9, which was released in May 2018, introduced a new compiler option called resolveJsonModule. This allows you to import .json files and interpret the contents as a well-typed JavaScript Object - which means the compiler will recognise types like string, number and boolean.

Take the example below. This file is called config.json. It has two properties isProduction and logLevel with type boolean and string respectively.

{
    "isProduction": false,
    "logLevel": "info"
}

With resolveJsonModule enabled, you can import this file like any other module:

import * as config from './config.json';
config.isProduction === true; // Okay

config.logLevel === 2; // Error - Can't compare a `string` and `number`

By default, this feature is disabled. You can enable it in your project’s tsconfig.json file:

{
    "compilerOptions": {
        "module": "commonjs",
        "resolveJsonModule": true,
        "esModuleInterop": true,
        "outDir": "lib"
    },
    "include": ["src"]
}

Alternatively, you can enable it when running tsc:

tsc --resolveJsonModule 

You can also selectively import individual properties from your .json file:

import {isProduction} from './config.json';
isProduction === true; // Okay

Take a look at TypeScipt 2.9 announcement to see what other new features came with TypeScript 2.9.

My Annual Retrospective - 2018 in Review

By Liam Moat. .

I recently read Jeremy Likness’s 2018 in Review. I was drawn to the section titled “Goals Retrospective.” As an agile advocate, I was inspired by the idea of an annual retrospective - an opportunity to reflect on the previous year. It felt like a simple way to apply “Inspect and Adapt” to my goals, aspirations and objectives (both professional and personal). Jeremy also shared his major goals for 2019. Six measurable and achievable objectives that ensure both personal and professional development.

Push a Docker image to Azure Container Registry from VSTS

By Liam Moat. .

Azure Container Registry (ACR) is a fully managed private Docker registry in Azure. In this post, I will show you how to create a continuous integration pipeline in Visual Studio Team Services to build a Docker image and push it to Azure Container Registry.

Create a Visual Studio solution using the dotnet cli

By Liam Moat. .

The .NET Core command-line interface (CLI) is a cross-platform toolchain for developing .NET applications. This post will explore creating a Visual Studio solution using the CLI without needing to rely on Visual Studio.

Deploy to Firebase with Bitbucket Pipelines

By Liam Moat. .

Firebase is a cloud platform from Google offering a number of great products giving you everything you need to build and grow your web and mobile apps. This post shows you how to take advantage of Hosting, which when combined with Bitbucket Pipelines can give you cost-effective hosting and CI/CD for your static website.

Resource functions with Azure Resource Manager templates

By Liam Moat. .

Azure Resource Manager (ARM) provides a collection of resource functions that can be used to reference your resource’s configuration and state in an ARM deployment template. In this blog post, I have collated some common use cases for these functions and provided some snippets for your reference.

Pull an SQLite database file from an Android device for debugging

By Liam Moat. .

SQLite is the default database used for local storage across most mobile operating systems. Many cross-platform frameworks offer first class support for SQLite too, including the Ionic Framework and Azure Mobile App Service. I often find it useful to get access to the SQLite database to aid development, testing and debugging. Mostly for my own future reference, this is a quick guide to pull an SQLite database from an Android device and then open it using SQLite Database Browser. While these steps are written for Windows they are mostly the same from macOS.

Find the outbound IP addresses used by Azure App Services

By Liam Moat. .

When making an outbound network call from Azure App Services it can be useful to know your application’s outbound IP addresses. Usually, you will use this information to configure the firewalls of external services to allow requests from your application. In Azure, your application’s outbound IP addresses are fixed. This post explains where to find your application’s IP addresses using the portal, the Resource Explorer, Powershell and the cross-platform CLI.