Wrench is the name of the Mach engine mascot, who also helps us automate and maintain Mach project development from time to time.
Join the #wrench channel in the Mach discord to get an idea of what wrench can do.
Issues are tracked in the main Mach repository.
Wrench is written in Go (convenient due to its ecosystem for this kind of task); install the latest version of Go and go test ./... or go install . to install wrench into your $GOBIN.
- Navigate to the Discord Applications page
- Select one of your bot applications (you may need to create one for testing.)
- Under Settings, click Bot. If needed create the bot.
- Under the Build-A-Bot section, select Click to Reveal Token
In your config.toml enter the token:
DiscordBotToken = "SECRET"
To add the bot to a server:
- Under OAuth2, select URL Generator
- Select scopes:
- Bot
- Select permissions:
- Send messages
- Create public threads
- Create private threads
- Send messages in threads
- Send TTS messages
- Embed links
- Attach files
- Read message history
- Add reactions
- Use slash commands
This will give you a URL you can visit to add the bot to your server.
- Install Git
sudo apt-get install git- ensure v2.39+ - Download release binary
- Move to
/usr/local/bin/wrenchandchmod +x /usr/local/bin/wrench - Run
sudo wrench setupand follow instructions
- Ensure Git v2.39+ is installed (use
brew install git) - Download release binary
- Move to
$HOME/.bin/wrenchandchmod +x $HOME/.bin/wrench - Place
$HOME/.binon PATH if desired - Run
sudo wrench setup
- Install Git:
winget install --id Git.Git -e --source winget- ensure v2.39+ - Download release binary, rename to
.exe - Place at
C:/wrench.exeor some other location. Put on PATH if desired. - In admin terminal run
wrench.exe setup
If you want to mirror https://ziglang.org/download on-demand, similar to what https://pkg.machengine.org does,
you may do so using e.g. this config.toml with Mode = "zig" which disables all other Wrench functionality so it only mirrors Zig downloads:
# Note: data will be written in a directory relative to this config file.
Mode = "zig"
# HTTP configuration
ExternalURL = "http://foobar.com"
Address = ":80"
# HTTPS configuration (optional, uses LetsEncrypt)
#ExternalURL = "https://foobar.com"
#Address = ":443"
#LetsEncryptEmail = "[email protected]"Wrench will save data relative to that config file, so generally you should put that config.toml into e.g. a wrench/ directory somewhere.
Running wrench svc run will start the server. Then you can fetch e.g.:
- http://localhost/
- http://localhost/zig/zig-linux-x86_64-0.13.0.tar.xz
- http://localhost/zig/index.json - a strict superset of https://ziglang.org/download/index.json
Downloads like http://localhost/zig/zig-linux-x86_64-0.13.0.tar.xz will be fetched on-demand from ziglang.org and then cached on the local filesystem forever after that.
http://localhost/zig/index.json is like https://ziglang.org/download/index.json with some small differences:
- It is fetched from ziglang.org once every 15 minutes and cached in-memory.
- Entries from https://machengine.org/zig/index.json are added so the index.json additionally contains Mach nominated Zig versions
tarballfields are rewritten to point to the configuredExternalURL
If you want to run Wrench as a system service, have it auto-start after reboot, etc. then you can e.g. put the config file in /root/wrench/config.toml, run wrench svc install as root to install the systemd service, use wrench svc start to start the service, and wrench svc status to see the status and log file locations.