Skip to content

jamesdabbs/friday

Repository files navigation

Overview

Friday is an over-engineered yak shave to manage meetings with

  • A recurring Google calendar invite
  • Meeting notes for each week, generated from a template and linked in the calendar invite
  • A rotating scribe and emcee amongst the meeting members
  • Slack reminders sent out morning-of with reminders about any pre-reading

inspired by Agile Log Book.

I'm developing this in support of a JavaScriptLA Meetup presentation. The notes for that are in ./docs, and I'll be posting a summary of the talk to my blog once it's presented.

Components

Each of these is a package in packages/

slack

  • NestJS Kafka microservice
  • Posts messages to Slack's API
  • Stateless

schedule

  • NestJS HTTP service
  • Interacts with the Google Calendar API
  • Stateless (for now)

minutes

  • NestJS HTTP service
  • Interacts with the Confluence API
  • Stateless

meetings

  • NestJS HTTP service
  • Coordinates between the other services
  • Persistence with Prisma

nest-platform

  • Library containing shared Nest modules and utilities

infra

Key Flows

Key Flows

Running Locally

To fully run this example locally, you'll want to

Initial Setup

Install Your Tools

  • A Kubernetes cluster (e.g. kind, minikube ... I'm using Docker for Mac)
  • skaffold

Provision Namespace and Secrets

Secrets obviously aren't checked in to source code, but do need to be available to services running in the cluster. You get them there by creating k8s resources of kind: Secret in the same namespace as the services consuming them.

I find it easiest to iterate by creating a stable namespace with its secrets out-of-band, and then letting skaffold manage all the other resources in that namespace. YMMV, but an example:

$ kubectl create namespace friday
$ kubectl create secret generic minutes-secret -n friday --from-env-file=./packages/minutes/.env
$ kubectl create secret generic schedule-secret -n friday --from-env-file=./packages/schedule/.env
$ kubectl create secret generic slack-secret -n friday --from-env-file=./packages/slack/.env

Each service should have an .env.example file which documents the expected variables.

Setup .npmrc

You'll need an .npmrc file which configures access to an NPM repo where nest-platform can be published and downloaded. I'm using Github's NPM registry for this.

(Optional) Configure Cluster Ingress

Skip this if you're happy port-forwarding instead of using e.g. http://meetings.localhost

Setup ingress-nginx following https://kubernetes.github.io/ingress-nginx/deploy, e.g.

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.47.0/deploy/static/provider/cloud/deploy.yaml

Then configure dnsmasq following https://banck.net/2018/12/using-dnsmasq-on-mac-os-for-local-development/, e.g.

Create / update /etc/resolver/localhost to

nameserver 127.0.0.1

Check with scutil --dns and ensure localhost appears, then

$ brew install dnsmasq
$ sudo brew services start dnsmasq
$ echo "listen-address=127.0.0.1" >> $(brew --prefix)/etc/dnsmasq.conf
$ echo "address=/.localhost/127.0.0.1" >> $(brew --prefix)/etc/dnsmasq.conf
$ sudo brew services restart dnsmasq

and update DNS servers if needed, e.g. https://www.macinstruct.com/tutorials/how-to-change-your-macs-dns-servers/

Development

On Applications

Run

$ skaffold dev

Changes will be automatically synced.

On Libraries (e.g. @jamesdabbs/nest-platform)

  • Keep skaffold dev running
  • Make changes in the libary
  • Bump the version in the libraries package.json (using an -alpha# or -rc# if desired)
  • Run npm publish
  • Update the version in the consumer(s)

At this point, skaffold should pick up the changes, rebuild the relevant containers, and redeploy.

On k8s Components

  • Keep skaffold dev running
  • Run npm run start:dev in the packages/infra directory
  • Make changes to the CDK8s constructs

Changes will trigger a manifest build and thus a re-deploy.

You can run unit tests against the constructs with npm run test or test:watch. Note that - in the current workflow - tests do not have to pass before skaffold attempts a deploy.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages