Posts

Quickstarting a Spring Boot project

Image
Spring Boot is a way of building stand-alone Java applications. These applications can embed web servers, schedulers and so on, so they don't need to be deployed on app servers. Instead, they run from the command line and can start up or attach to whatever they need to run. This works well with the 12 Factor methodology, which encourages building scalable, more maintainable applications.  We'll look at this a bit more in posts. The Spring Boot project provides a lot of starter projects to get you up and running, and you can use these to quickly add the features you need to your application. This is fantastic for prototyping or quickly getting an application up and running. There are lots of ways to get started. There's a Spring Boot command line, Eclipse and other IDE plugins, and a website, https://start.spring.io/ , that can build a project for you. The Spring Initializr lets you select the features you want your project to have, then download a template that you c

Renaming files with Find on Unix

A quick handy hint for Unix command line users today - I had a lot of files to rename, spread through a file system. Sort of like this: The files were all named the same thing, but were in a whole lot of directories - I needed to rename each site-data.json file to just be data.json. I also had a bunch of other files that I wanted to leave alone - I didn't want to rename everything. I have done this sort of thing before, but every time I do I have to search again. I found lots of StackOverflow posts that didn't quite do what I wanted - which is: Find is an incredibly useful tool, and can look for names matching a pattern or word (site-data.json here) then pass that full file name to another command via the -exec option. The full path of the file is kept in {} - so that rename command applies the Perl regular expression (s/site-//g) to the full file name, and this chops off the site- prefix. It only affects the files I wanted to remain (they were the only things found

Setup a Kubernetes Cluster on Azure

Image
Photo by  Joseph Barrientos  on  Unsplash I finally received my copy of Kubernetes: Up and Running by Kelsey Hightower  (put on pre-order more than a year ago!), and want to set up a Kubernetes cluster to experiment with.  I'm going to use Microsoft's Azure Container Service, but I want to set this up programmatically.  This will let me set up and tear down the cluster whenever I want to, and make sure that it's configuration doesn't drift over time.  This gives me confidence that I can recreate the cluster in exactly the same way later on, if I need to - if I want to move to a different region or resource group or whatever.  This also fits with the DevOps Infrastructure As Code philosophy, allowing you to check your resource scripts into source control and treat them the same as the code that's running on them. There are a couple of prerequisites I need to set up before I get started.  Firstly - I've just talked about versioning the setup, so I need to

Setting VSTS variables from PowerShell

Image
Snapshot of my Environment Tear-up Release Phase I was using a VSTS release pipeline to build an Azure environment today with ARM Templates, and needed to set up a secure connection from a Web App to a Blob Storage account so the app could write logs. As with a lot of things in ARM, you can set up the connection and grab the template, but then you end up having a fixed access URL (SAS URL, or Shared Access Signature) in your JSON file: This is bad from a portability and security point of view, as the URL only gives access to one named account, but if you have that URL you can write whatever you want to storage. This URL will also expire in around a year's time - which will mean your site suddenly stops working like it used to!  That'll be an fun and interesting day. Fortunately its easy to create a SAS URL and pass it to a script as a parameter.  This PowerShell will create the access token: $rg = "my-storage-resource-group" $name = "mystorageacc

Feature Toggles on a .Net Core API

This is my second tutorial on feature toggling.  You can read the first here . There are many languages and frameworks to choose from when it comes to back ends - I wanted to make a REST service to deliver all of the Time Entries to my Angular application, and almost every language available has REST server capabilities.  I chose to use .Net Core (C#) and Java for my example app.  My background is in Java, and I was really interested to see how .Net Core works.  If you don't know, .Net Core is Microsoft's cross platform offering - it has the Windows-specific parts taken out and runs on Docker. Linux, MacOSX, and of course Windows too.  It can also be compiled on other platforms too, which is very handy. Today I'll be setting up LaunchDarkly using the .Net libraries - I'll do the Java version later on.  LaunchDarkly provides some samples  to help you get started, but I wanted to change a few things.  Just like I did in the Angular front end, I wanted to use a type to

Feature Toggles for Angular UIs

Image
I had a chance to demonstrate a feature toggling library to a customer last week, and wanted to share what I did.  Feature toggles, in case you don't know, let you to configure how your system behaves without redeploying code.  This is fantastic if you have a feature that needs to launch at a particular time, or you want to experiment with by switching off and on in different environments.  Feature toggles act like an if statement around a code of block and can be switched on or off as desired, without requiring a restart.  Martin Fowler covers this in some detail  here . Filling out my timesheet is one of the least favourite parts of my week, but I thought I would build a simple timesheeting system for my demo.  I have a UI written in Angular using the Angular Seed  project and the Angular Material components.  The basic UI looks like this: I am working on a couple of features that aren't quite ready yet - being able to add and remove time entries, and to look up projec

Automatically Logging PowerShell in to Azure

Image
I've been working with Azure Resource Manager templates a lot lately, as an easy, repeatable way to create deployment environments for my code.  ARM templates are a JSON description of a resource or grouping of resources and can be applied to create or update an environment.  This means you can roll out a new environment quickly and easily - perfect for quickly setting up a Dev or Test system, and you know that if you use the same templates to configure Production you won't have any surprises, or "Well, it worked in Dev..." conversations. The best thing about ARM templates for me is how easy it is to generate them.  If you have a resource group, you can create a template by clicking on the Automation Script button: This will create a show you a JSON template and supporting files that can be downloaded as a Zip.  It contains all the information needed to reproduce your resource group's infrastructure.  It isn't a backup though - it doesn't have the we