This post is mainly a reminder to myself, because i’ve made the same mistake a few times in different projects. How and why to deploy Azure functions from a package When using Azure Functions, you can simplify deployment and maintenance of your function by deploying from a package file rather than directly in to the function. This also has the benefit of reducing cold start times, particularly where there are a large number of dependencies. To deploy from a package (without using the Azure deployment tools), you: The WEBSITE_RUN_FROM_PACKAGE setting can either be a 1 if you’ve deployed your code… Continue reading →
Another post which is more to remind me than anything else. When creating an Azure Function in Pulumi, you may get the following error: Cannot modify this site because another operation is in progress After a bit of digging, i found this issue on the Pulumi repo, which points to a page on the Azure Functions wiki where they say: If you run in a dedicated mode, you need to turn on the Always On setting for your Function App to run properly … When running in a Consumption Plan or Premium Plan you should not enable Always On. The Always On setting for… Continue reading →
When uploading images to WordPress, you may get this error. There are plenty of blogs online offering solutions, but they only apply to self-hosted instances – mine is hosted on just-what-i-find.onyx-sites.io/. The error is a little pop up with the text The response is not a valid JSON response at the bottom of the screen when you try and upload an image: Looking in the developer tools console on the browser shows one of two error messages: Failed to load resource: the server responded with a status of 403 () for URL /wp-json/wp/v2/media or POST https://atomic-temporary-181991729.wpcomstaging.com/wp-json/wp/v2/media?_locale=user 403 (Forbidden) I have… Continue reading →
In a previous post, I created a Barman backup script to back up PostgreSQL running in an VM to AWS S3. If you host your PostgreSQL server in Azure, this can get expensive quickly because you pay egress bandwidth fees to Microsoft. In this article, i’ll show you how to use Azure Blob storage instead. Step 1: Install Barman, barman-cli-cloud, snappy etc. see original article. Step 2: Install Azure CLI instead of AWS S3 CLI Follow the instructions on the Microsoft website. Step 3: Install azure-storage-blob Python package Log in as the postgres user and use pip to install azure-blob-storage:… Continue reading →
In my previous post, I showed how to automate backups of a PostgreSQL database to S3 using Barman and barman-cloud-backup. Step 1: verify hardware architecture and PostgreSQL version For a successful restore, Barman requires that the hardware architecture and PostgreSQL version are both identical. You can verify these with some simple terminal commands: Run these on both the source and target. Obviously, if you dont have the source any more (which is why you’re restoring), you’ll need to make some assumptions… Step 2: Install Barman, barman-cli-cloud, AWS CLI, python-snappy Follow the instructions in steps 5-10 of in my original article.… Continue reading →
I was surprised not to find many up to date instructions on this. I have a few basic requirements: After a bit of playing around, I decided to use Barman for the backups – it’s significantly easier to configure and use than pgBackRest and has native support for backing up to S3, point-in-time restore, and more. The major downside compared to, say, running pg_dump every night, is that it requires an identical setup to restore to – identical hardware and PostgreSQL version. Least privileges in the database is tricky – to be able to back up things like roles, the… Continue reading →
I’ve been using timescale.com for about a year, but it’s quite expensive for a hobbyist (their cheapest plan in the UK is about $50/month), so I thought i’d try and implement something cheaper. I know i won’t get the cool automatic DR failover or the sexy continuous backups – but it’s not really mission critical if i lose a small amount of the history of my home energy consumption. Timescale publish some instructions, but they weren’t complete, and didnt work for me. Step 1 – install base OS I use linode. I chose a Linode 2GB which comes in at… Continue reading →
The Aggregation of Marginal Gains is an improvement model attributed to Dave Brailsford. When he took over as the head of British Cycling in 2002, the team was near the bottom of the rankings. Brailsford’s approach was to look at their processes in tiny detail, and improve each part by 1%, the logic being that these would all add up to a significant improvement. He talks about shipping mattresses between hotels so that athletes get a better nights’ sleep, or fastidiously cleaning the team truck to prevent dust and debris undermining the fine tuning of the bikes. And it was… Continue reading →
When running apt-get update i was seeing these errors: I was getting this error after migrating keys from the old, legacy store to a the shiny new one. A quick inspection shows that the new keys have different permissions to the existing ones The fix is pretty simple. Pick one of the pre-existing GPG keys, and copy the permissions to all the other keys in the folder. In my case, i chose the ubuntu-pro-cis.gpg key, but you can pick any that doesnt report the permissions error. Pass it as a –reference argument to the chmod command: Problem solved! Continue reading →
While running apt-get update I was seeing errors: Although the warning is annoying, it doesn’t stop things updating. I understand the reasons why the legacy keyring is being removed. Migrate existing keys to the new keyring First, list the keys: In my case, i’ve got two – one for PostgreSQL and one for timescaledb. You will probably see a bunch of extra keys here too. Export the key by copying the last 8 characters of the identifier. Because I have two keys to export, i did this twice, giving each key a unique filename under /etc/apt/trusted.gpg.d/: Bingo – package updates… Continue reading →
I’m rob. I spend my time exploring the world, playing board games with my family, solving complex technical problems, and learning new things. At work, I lead a team of solution architects designing and building complex realtime trading systems. Sometimes i write about things here, or code them on GitHub. I believe a few things that guide what I do and how I do it: