core.io-cli-local-env
core.io cli tool to manage local environments for development.
Install
It can be installed globally and it will be available as shuttle
. To install run npm i -g core.io-cli-local-env
.
Local Development Environment
CLI
shuttle 0.0.1 - CLI utility to create local development environments
USAGE
shuttle <command> [options]
COMMANDS
install Install all dependencies. Needs sudo
list List all local domains
open <domain> Open domain in default browser
share <project> Generate a shareable URL for a project
restart Restart Caddy and Dnsmasq services
stop Stop Caddy and Dnsmasq services
start Start Caddy and Dnsmasq services
serve <domain> <proxy> Proxy a local domain and save it
remove <domain> Remove a previously added domain
update Update toolchain
uninstall Uninstall all files and binaries
help <command> Display help for a specific command
GLOBAL OPTIONS
-h, --help Display help
-V, --version Display version
--no-color Disable colors
--quiet Quiet mode - only displays warn and error messages
-v, --verbose Verbose mode - will also output debug messages
MORE INFO
This program uses Caddy server and Dnsmasq. It generates various files and uses brew to install dnsmasq.
MacOS
Local domains
Since browsers started forcing .dev domains to HTTPS via preloaded HSTS
it became apparent that using .dev for local development might not be a good idea.
Another popular option are .local domains, but those might have name resolution issues with multicast DNS software- e.g. Bonjour.
We are going to use .test domains.
For each development domain you want to support you need to create a entry in your mac's resolvers directory- you might need to create the directory if not present:
$ sudo mkdir /etc/resolver
Create a file with the name of the domain, test in our case, and add the following line nameserver 127.0.0.1
. A quick way of doing this:
$ sudo echo "nameserver 127.0.0.1" > /etc/resolver/test
After you add the file if you scutil --dns
you should see an entry:
resolver #11
domain : test
nameserver[0] : 127.0.0.1
flags : Request A records, Request AAAA records
reach : Reachable, Local Address, Directly Reachable Address
Reverse Proxy
We use Caddy server as a reverse proxy.
Caddy is distributed as a single binary file and has a simple configuration similar to nginx's.
DNS
Dnsmasq is a lightweight DNS forwarder and DHCP server. We use dnsmasq for DNS resolution.
Ngrok
Ngrok is used to share local URLs.
Credits
This is a rework of marina-cli with small modifications to suit a different setup.
License
® License MIT by goliatone