Troubleshooting
This guide is designed to help if things don’t quite work as expected.
Finding Denvig resources on disk
Section titled “Finding Denvig resources on disk”In order to uniquely identify resources on disk we need to normalise the paths to a project and the resources within them. An ID is constructed for each resource based on the following format:
@{{project-slug}}|{{workspace}}|{{resource-type}}/{{resource-name}}The ID is then converted to a sha256 hash to ensure a valid filesystem path string that is predictable and unique. This hash is used for various internals such as log paths, service names and more.
Examples of resource IDs:
- Project:
@marcqualie/denvig#root - Action:
@marcqualie/denvig#root|action/hello - Workspace + Action:
@marcqualie/denvig#apps/web|action/dev
You can find the hash details for a resource with the following command:
denvig internals:resource-hash service/hello # Example output: abc123...
# You can also use workspace notation:denvig internals:resource-hash "apps/web|action/dev"
# Or use the --workspace flag:denvig internals:resource-hash action/dev --workspace apps/web
# a full ID can also be passed in:denvig internals:resource-hash "@marcqualie/denvig#apps/web|action/dev"You can also find the ID to verify it has been resolved correctly:
denvig internals:resource-id service/hello # @marcqualie/denvig#root|service/helloDirectly manage launchctl services
Section titled “Directly manage launchctl services”Denvig uses launchctl under the hood to manage services so everything can also be interacted with directly there.
Directly list all denvig launchctl services that are currently loaded by running:
launchctl list | grep denvigYou can forcefully stop and remove all denvig services at once by running:
launchctl list | grep denvig | awk '{print $3}' | xargs -I {} -n 1 launchctl bootout gui/$(id -u)/{}rm ~/Library/LaunchAgents/com.denvig.*You can target a specific service by using its resource hash (detailed above):
launchctl bootout gui/$(id -u)/com.denvig.<resource-hash>rm ~/Library/LaunchAgents/com.denvig.<resource-hash>.plistBrowsing Raw Logs
Section titled “Browsing Raw Logs”All logs are stored in ~/.denvig/logs/. You can tail the logs of a specific service by running:
tail -f ~/.denvig/logs/<resource-hash>.logThe easiest way to follow a service’s logs is with
denvig services logs <name> --follow.
Inspecting the gateway
Section titled “Inspecting the gateway”Every service routed through the gateway is written into a single
~/.denvig/nginx.conf, with each server block annotated with its service and
log location. Read it to see exactly which domains route where:
cat ~/.denvig/nginx.confIf it doesn’t match your running services, rebuild it with
denvig gateway configure.
Debug traces
Section titled “Debug traces”Set DENVIG_DEBUG to record a trace of what denvig is doing. It accepts a
comma-separated list of scopes, or * for all of them. The deps scope traces
dependency checks, network requests, and git commands:
DENVIG_DEBUG=deps denvig deps outdatedTraces are written to ~/.denvig/logs/debug/traces/<date>/ (override the path
with DENVIG_DEBUG_TRACE_PATH) and can be opened in https://ui.perfetto.dev.