|
15 hours ago | |
---|---|---|
config | 15 hours ago | |
tools/cmd/tester | 16 hours ago | |
.gitignore | 2 days ago | |
.ozai.json | 15 hours ago | |
Makefile | 19 hours ago | |
README.md | 15 hours ago | |
go.mod | 19 hours ago | |
go.sum | 2 days ago | |
main.go | 15 hours ago |
README.md
Ozai the Air Killer
Ozai just does the minimal thing you want in a process watcher/restarter:
- Start thing.
- Watch thing.
- Restart thing.
- No external dependencies at all.
No random ass Hugo includes. No forced upgrades to the latest possible Go. No randomly included entire web interfaces for no reason. Just the simplest thing needed for the task and no more.
Getting Started
WARNING This is imaginary right now. I need to dogfood this in my own dev process and refine these docs.
You can install it with the Go 1.24 go get -tool
feature:
go get -tool https://lcthw.dev/go/ozai
Then you edit a config file that says what to run and how to run it (see below). Once you have that you can run it with:
go tool ozai
And it should start all your configured processes.
Config File Format
The config is a simple JSON file that defines the processes to run and what reset URL to use.
Here's an example that runs two copies of the tools/cmd/tester
test commands:
{
"Processes": {
"tester1": {
"URL": "/tester1",
"Command": "tester",
"Args": ["-count", "100", "-id", "1"]
},
"tester2": {
"URL": "/tester2",
"Command": "tester",
"Args": ["-count", "500", "-id", "2"]
}
}
}
"Processes"
-- All of your processes go in here. There may be other options that are meta option which is why I did this."tester1":
-- This is an internal key used to identify it in logs."URL:"
-- The URL that you'll use to restart this process."Command:"
-- The command (binary, .exe) to run."Args:"
-- The args to pass to the command as options. MUST BE STRINGS
That's it. More may come as I use it but for now it just does what it says it does.
Restart HTTP URLs
Projects like Air try to be a passive build tool (and site generator, and Go promotion systems, and Delta Wing Combat Engine, and Alien Defense System, and Cake Baking Cockroach) but ozai lets you just use your existing build tool to tell it when to restart things. Rather than monitor all of your files (which never goes right), you just do this:
curl http://127.0.0.1:9999/tester1
That's it. When Ozai receives that request it just restarts that process and keeps going. You can then toss this into a Makefile or other build tool and every time you build it'll kick things over. Dead simple and works 100% of the time.
Many things about Air are then fixed with this design:
- Air tries to build your whole web application when you just change one .css file.
- The auto refresh in the browser also needs to have a build error notice because Air is doing your building.
- When there's a build failure, you have to go look at Air's output rather than just using your existing IDE or editor's existing error handline.
- When you accidentally refresh while Air is doing a build you get a huge delay in the browser, it errors out, then you have to wait and hit refresh again anyway, defeating the whole purpose of the auto-refresh feature.
Beta Software
Even though this is working this is a 3 day hack because Air decided their latest release would force me to upgrade my Go, which caused all of my projects to fail and cost me an hour of work. It still need actual usage by me to sort out any necessary features, but for the most part it's useable.
Things I may add:
- Additional configuration options like the port and base URL to use.
- Whether a process should restart or not.
- Logging process output to a file.
- Maybe a little TUI that emulates some tmux stuff. Not sure. I guess just use tmux but I'm on windows so I'd like this.
That's it. Enjoy.