README
Blockfolio Development Tools
A collection of useful ad hoc development tools and scripts, intended for local use by developers.
💥🔥🚨 IMPORTANT: These tools are not intended for production use!! 🚨🔥💥
🎬 Getting Started
Just globally install this npm package; that's it!
yarn global add @blockfolio/devtools
🛠 Bundled Tools
devtools
devtools is a bundled global shell command for installing and configuring common utilities, such as dnsmasq.
Using subdomains on *.localhost
Install DNSMasq using devtools to resolve all localhost subdomain DNS queries to your local machine:
devtools install dnsmasq
nginx-proxy
Nginx-proxy (written by jwilder) is a docker image that listens to http/s traffic on localhost:80 and localhost:443 and intelligently proxies that traffic to locally-running docker containers based on environment variables defined within them.
The nginx-proxy command
A global nginx-proxy shell command comes bundled, and simply proxies docker-compose commands to the nginx-proxy/ install directory for convenience.
nginx-proxy up -d # start global nginx-proxy
nginx-proxy down # stop global nginx-proxy
For the lazy [ed: aka for matt], you can set a bash alias for less typing via
alias np='nginx-proxy', and then simply donp up -dandnp down
Port bindings
All processes binding to localhost:80 and localhost:443 must be terminated prior to starting nginx-proxy, or it will not be able to bind to those ports, and will silently fail.
SSL certificate
A self-signed SSL certificate comes bundled and is pre-configured to be used with nginx-proxy. To silence browser warnings when visiting local hostnames, the certificate must be manually added to the system keychain and marked as valid.
The following command reveals the SSL certificate in the macOS Finder, so that they may be added to the system keychain:
nginx-proxy --reveal-ssl-certificate
Proxying other containers
Any docker containers you wish to be proxied by nginx-proxy have to be run with --network=bridge (or network_mode: "bridge" in a docker-compose.yml file). A container's virtual host is configured by defining environment variables within that container, via -e 'VIRTUAL_HOST=myhost.localhost'. If you wish to disable nginx-proxy's ssl-auto-redirect behavior (you probably do), also pass -e 'HTTPS_METHOD=noredirect'.
Get more usage and configuration info at the source: jwilder/nginx-proxy
😱 FAQ
- Did you have a previous version of
blockfolio-devtools? You might have manually added the cloned repository'sbin/directory to your shell's path, which will cause that project's version ofnginx-proxyto be used instead of the yarn-globally-installed version!
🗽 Contributing
Have a problem, or is a useful tool/script missing? Feel free to fork this repository and add new tools to this project! We only ask that everyone abides by the Contributor Covenant Code of Conduct.
IMPORTANT! All commits must adhere to the semantic-release naming convention, in order to properly calculate the npm version increment and auto-publish to the npm registry.
Run yarn link to get in-development local binaries into your shell (remember to yarn unlink afterwards 😛).