Skip to content

Instantly share code, notes, and snippets.

View wheresrhys's full-sized avatar

Rhys Evans wheresrhys

View GitHub Profile
@wheresrhys
wheresrhys / script.js
Last active January 3, 2023 16:12
Update team membership
import {BizOpsClient} from '@financial-times/biz-ops-client';
const client = new BizOpsClient({
apiKey: process.env.BIZ_OPS_API_KEY,
userID: "rhys.evans",
host: "https://api-t.ft.com/biz-ops"
})
const {teams} = await client.graphQL.get(`{teams {
code
@wheresrhys
wheresrhys / output.sh
Created December 18, 2020 10:30
JSON schema test
/*** Validating ***/
{ a: 'some' }
strict mode: missing type "string" for keyword "pattern" at "#/if/properties/a" (strictTypes)
/*** Validating ***/
{ b: 'other' }
ValidationError: validation failed
at validate (/Users/rhys.evans/Projects/or/treecreeper/packages/tc-schema-validator/validation/ajv-test.js:28:15)
at Object.<anonymous> (/Users/rhys.evans/Projects/or/treecreeper/packages/tc-schema-validator/validation/ajv-test.js:33:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
@wheresrhys
wheresrhys / 1. Overview.md
Last active October 19, 2020 10:36
Upgrading circleci pipelines to authenticate with docker

On 1st November dockerhub (and underlying platform used by circleci) will be imposing rate-limits on all unauthenticated requests.

In order to avoid this making it impossible for us to build any of our projecs, we need to add authentication to every circleci config.

Below is an outline of how to apply these changes to a typical config file

// Allow package.json scripts property to be defined in a separate .npmscripts.js file
// (Prior art all the *rc files for various other tools - once there is need for, comments, multiline
// dependencies, logic... it pays to support .js as well as .json
// can require any libraries you like
require('dotenv').exec();
module.exports = {
// strings are run with shell
test: "jest",
@wheresrhys
wheresrhys / maxi.md
Last active March 11, 2020 22:11
PR comment

It looks like you've made significant changes to this repository's source code. Have you given enough thought to reliability?

If you've added/removed a dependency on another service...

  • Have you updated the dependencies list in the runbook?
  • Have you got healthchecks that probe the health of each dependency?
  • Have you added integration tests that cover scenarios where the dependency is down?

If you've changed the architecture...

@wheresrhys
wheresrhys / strawman.md
Last active January 18, 2019 15:46
Runbooks in repos

Runbooks in repos straw man proposal

open questions

  • discovery of repos that contain docs - how. pull or push model
  • default docs folder name & structure. Coexistence with other docs?
  • discourage linking to people & teams? (Too hard to bulk change?)
  • how to avoid having to list refs to each .md file
  • how to put properties related to a md file with the content e.g. failOverInfo = free text field => md file failOverType = enum => ... front matter in md file?
@wheresrhys
wheresrhys / communique.md
Created October 26, 2018 12:54
Dewey is end of life

TLDR;

Dewey is on its way out, to be replaced by https://biz-ops.in.ft.com. It's new, and by implication, imperfect. Please use it and let us know what you think.

Why replace Dewey?

FT's technical estate and its relationship to other aspects of the business are a complex web. Dewey's data layer was inadequate to the task of modelling this, so a decision was made to try rebuilding on top of a graph database. A few months later, and with a number of key dependencies (e.g. AWS cost allocation) already migrated from Dewey to the new Biz-Ops (Business Operations) data layer, it's time to migrate the administration of the data to a UI that talks directly to the new data layer, rather than via the imperfect proxy of an event log coming from Dewey.

What's different about Biz-Ops?

As touched on above, the major difference is that the underlying data structure is a graph. This means for example that where previously Cost Centre was a direct property on systems, now finding which Cost Centre to bill a system

@wheresrhys
wheresrhys / ft-observable.md
Last active October 15, 2018 22:45
Logging/metrics idea

Basic motivation

  • We want to observe our systems. Sometimes we may want a log with messages in it, other times just a metric is fine. BUT the times we want either of these can be arbitrary... don't want to have to make a release of an app just because we're in the middle of an incident and want more detailed logs of something.
  • Want to untangle next-metrics from express
  • BUT ideally want any new thing to be reasonably backwards compatible

Sketch proposal

ft-observable

  • collects both logs & metrics in a unified interface
@wheresrhys
wheresrhys / you might not need lodash.md
Last active July 27, 2018 11:09
You might not need lodash

You might not need lodash

_.chunk

(arr, size) => [...Array(Math.ceil(arr.length/size))].map(() => arr.splice(0, size))

_.compact

(arr) => arr.filter(it => !!it)

_.concat

(arr, values) => arr.concat(...values)

@wheresrhys
wheresrhys / sw.md
Last active February 5, 2018 23:07
Service workers union

Service Workers Union, Financial Times branch

Report of the Extraordinary Working Group on Controlling the Means of Releasing to Production

Contents:

  1. Introduction - Comrade Evans
  2. Universal test coverage - Comrade Florisca
  3. Cooperation, and freedom, among independent features - Comrade Legg
  4. Some workers are more equal than others - Comrade Phillips
  5. The purge of service worker traitors - Comrade Militaru
  6. Any other business