sozu-proxy / sozu

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome!

Home Page:https://www.sozu.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto-save the state, auto-create the unix command socket

jpds opened this issue · comments

I just discovered sozu and as a new user - I think it should just autocreate the saved state file and command_socket if they don't exist.

Auto-create the save state, on startup

But why? In what scenario would you need that? What behaviour would you like?

Unix socket

The unix socket is already created automatically on start:

2023-05-22T16:30:29.052732Z 1684773029052732661 106704 MAIN INFO	Listening on "/my-sozu-path/bin/sozu.sock" (pathname)

and if it is not present, it is deleted and recreated:

2023-05-22T16:30:40.772726Z 1684773040772726191 106732 MAIN INFO	A socket is already present. Deleting...

@jpds I agree with you

That's should be fixed! The patch will be in the next release.

@Keksoj I like software to Just Work out of the box.

If you're new to sozu and you git clone it and then cargo build, and then copy and paste the configuration pieces from: https://github.com/sozu-proxy/sozu/blob/main/doc/configure.md

Let's go:

$ ./target/debug/sozu start -c sozu.config
Error: Invalid configuration file.

Caused by:
    0: Invalid saved_state in the config. Check your config file
    1: could not get saved state path from config file input "./state.json"
    2: No such file or directory (os error 2)

Hmm, OK - what is a state file and what is it suppose to look like?

Let's try:

$ touch state.json
$ ./target/debug/sozu start -c sozu.config
initializing logger
2023-05-23T10:35:01.009456Z 1684838101009456801 28001 MAIN INFO	Starting up
2023-05-23T10:35:01.011985Z 1684838101011985062 28001 MAIN INFO	0 launching worker
2023-05-23T10:35:01.012434Z 1684838101012434073 28001 MAIN INFO	0 worker launched: 28002
2023-05-23T10:35:01.012846Z 1684838101012846906 28001 MAIN INFO	sending listeners to new worker: Listeners { http: [], tls: [], tcp: [] }
6 send empty
2023-05-23T10:35:01.012920Z 1684838101012920030 28001 MAIN INFO	sent listeners from main: Ok(())
2023-05-23T10:35:01.013303Z 1684838101013303041 28001 MAIN INFO	1 launching worker
2023-05-23T10:35:01.013685Z 1684838101013685632 28001 MAIN INFO	1 worker launched: 28003
2023-05-23T10:35:01.013972Z 1684838101013972611 28001 MAIN INFO	sending listeners to new worker: Listeners { http: [], tls: [], tcp: [] }
8 send empty
2023-05-23T10:35:01.014030Z 1684838101014030370 28001 MAIN INFO	sent listeners from main: Ok(())
2023-05-23T10:35:01.014088Z 1684838101014088618 28001 MAIN INFO	Created workers
Error: could not get command socket folder path: "./command_folder"

Caused by:
    No such file or directory (os error 2)

OK, I'll mkdir that folder, but is this software expecting me to do anything else that isn't mentioned in the documentation after that?

And as a new user, that is not a good experience.