Skip to content

Instantly share code, notes, and snippets.

View brentjanderson's full-sized avatar

Brent Anderson brentjanderson

View GitHub Profile
@brentjanderson
brentjanderson / README.md
Last active June 8, 2018 19:41
Example Dockerfiles for phoenix app packaged with distillery (Production ready image and testing image)

Note that these dockerfiles depend on:

  • Having Docker installed on your machine
  • Rebuilding the image every time you want to try your latest code
  • Passing necessary environment variables when you docker run
  • Your app includes distillery and coveralls

Make modifications as needed to meet those requirements.

Note that multi-stage builds can be used to combine the prod and test files described below, I haven't updated the gist yet to reflect that option.

@brentjanderson
brentjanderson / Procfile
Last active August 23, 2023 07:21
Running RedwoodJS on Heroku
release: yarn rw prisma migrate deploy
web: bin/start-nginx node index.js
@brentjanderson
brentjanderson / Readme.md
Last active April 16, 2021 22:25
Running graphql-codegen on Redwood

I'm assuming you're using Apollo. This can be changed

  1. Install a few dependencies: yarn add -WD @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typescript-react-apollo @graphql-codegen/typescript-resolvers npm-run-all ts-node

  2. In my setup, I also threw in npm-run-all and made some edits to my root package.json "scripts": yarn add -WD npm-run-all

     "dev": "npm-run-all --parallel dev:**",

"dev:rw": "rw dev",

@brentjanderson
brentjanderson / README.md
Created June 14, 2022 15:53
Elixir runtime-controlled supervision tree using feature flags (circuit breaker)

These snippets provide a foundation for starting and stopping supervision trees at runtime using feature flags (e.g. Launch Darkly).

Some things to note when adapting these snippets:

  1. application.ex needs to be adapted into an existing application. The important part is that each child spec provided is compliant, and that there is a feature flag (ld_key) specified.
  2. As written, if a feature flag fails for some reason, it defaults to starting all children. There is room for adaptation here as needed.
  3. This implementation will still require a FeatureFlags module to be available that implements is_on?/2. Adjust as needed to accomodate your own feature flag setup.
@brentjanderson
brentjanderson / .env.local
Created January 25, 2023 20:06
Knock In-app Notifications with NextAuth/AuthJS
# These values all come from the dashboard
NEXT_PUBLIC_KNOCK_PUBLIC_API_KEY=pk_test_1234567890_abcdefghijklmnop
NEXT_PUBLIC_KNOCK_FEED_ID=b935c367-2347-43b1-8f28-867330a2a636
# Replace each line break with `\n` and then wrap the whole thing in JSON. JSON.parse will properly decode all of it.
KNOCK_SIGNING_KEY='{"key": "-----BEGIN RSA PRIVATE KEY-----\n<The rest of the key goes here>\n-----END RSA PRIVATE KEY-----"}'