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.
Each of these is a package in packages/
- NestJS Kafka microservice
- Posts messages to Slack's API
- Stateless
- NestJS HTTP service
- Interacts with the Google Calendar API
- Stateless (for now)
- NestJS HTTP service
- Interacts with the Confluence API
- Stateless
- Library containing shared Nest modules and utilities
- Contains CDK8s constructs for declaring the application's
k8s
manifest
To fully run this example locally, you'll want to
- A Kubernetes cluster (e.g.
kind
,minikube
... I'm usingDocker for Mac
) skaffold
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.
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.
Skip this if you're happy port-forward
ing 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/
Run
$ skaffold dev
Changes will be automatically synced.
- 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.
- Keep
skaffold dev
running - Run
npm run start:dev
in thepackages/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.