Skip to content

[#118] Resolve "TECH TASK: support simultaneous https tunnels in local dev"

aguestuser requested to merge 118-simultaneous-https-tunnels into master

Closes #118 (closed)

Context

  • we were using a paid version of ngrok that enabled us to pin a static subdomain for all of our http tunnels (needed to twilio could send us signal auth methods when we create new numbers)
  • however, we mistakenly assumed it was important for this url to be static over all time. since these are (disposable!) dev numbers, we only really care that they remain constant between when a phone number creation API call is issued, and when twilio receives the auth code and hits the callback url
  • therefore, it would suffice for our purposes to read the dynamically-assigned ngrok url every time we spin up a dev session, provided we could find a way to inject that url as SIGNALBOOST_HOST_URL every session
  • this PR provides just such a solution
  • in doing so, it eliminates the following MAJOR pain points:
    • more than one dev could not a local dev env at the same time (and hope to use the boost cli) because of contention over the reserved subdomain (which may only be used by one logged-in user at a time, and/or which would create race conditions if you hacked around this!)
    • it creates the necessity of a $5/fee for something we don't really need, and which creates barriers to entry for people wanting to pitch in with dev. after this PR, we can get rid of our NGROK account entirely AND all the confusing references to it in our docs! (one less barrier to "getting started!")

Changes

  • instead of paying to define a static subdomain on ngrok, allow ngrok to assign us a dynamic public url on every run
  • use the ngrok API to fetch the public url, then assign it to SIGNALBOOST_HOST_URL
    • do this in bin/entrypoint/app to pass the url to the signalboost application server
    • do it in cli/boost-commands/_check-env to pass it to the boost cli command
  • env file changes:
    • we no longer need SIGNALBOOST_HOST_URL in .env.dev (b/c we will define it by querying ngrok!)
    • we no longer need ANY ngrok env vars (because an ngrok account is no longer needed to run signalboost in dev mode! yay!!!)
    • we introduce SIGNALBOOST_ENV env var to help tooling scripts development and production modes (useful for figuring out whether to query ngrok to define an undefined value for SIGNALBOOST_HOST_URL)
  • cosmetic upgrades:
    • log host in registrar.run (useful for debugging ngrok host)
    • remove references to ngrok from README

Usage

WARNING: this MR introduces breaking changes!

to take advantage of these changes (and restore their dev env to a working state) devs should run:

cd path/to/signalboost
git checkout master
git pull origin master
make docker.build
./bin/blackbox/shread_all_files
./bin/blackbox/decrypt_all_files

Merge request reports