-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add daemon command #52
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
===========================================
- Coverage 58.28% 46.78% -11.51%
===========================================
Files 20 27 +7
Lines 2069 2302 +233
===========================================
- Hits 1206 1077 -129
- Misses 829 1189 +360
- Partials 34 36 +2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shutdown behavior can be simplified a lot
- no need for interrupt code, urfave cli will pick up those signals and cancel its context
- you can avoid handling context and server errors seperately but just setting the BaseContext propery on http.Server
func versionCommand(cctx *cli.Context) error { | ||
if version == "" { | ||
log.Warn("executable built without a version") | ||
log.Warn("set version with `go build -ldflags=\"-X main.version=v0.0.0\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to adapt our release build github workflow to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was meaning to look into that and haven't yet. Ideally we have that build flag use the version.json to set that value.
af88596
to
7695126
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
various file organization feedback
but ultimately, two key pieces:
- only one retriever instantiated for the daemon
- remove putCBBlockstore where it's not needed
fb9a511
to
6687eca
Compare
The server now instantiates a Lassie that is passed to the
|
6687eca
to
e2019b7
Compare
res.Header().Set("Cache-Control", "public, max-age=29030400, immutable") | ||
res.Header().Set("Content-Type", "application/vnd.ipld.car; version=1") | ||
res.Header().Set("Etag", fmt.Sprintf("%s.car", rootCid.String())) | ||
res.Header().Set("C-Content-Type-Options", "nosniff") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hannahhoward typo :)
res.Header().Set("X-Ipfs-Path", req.URL.Path) | ||
// TODO: set X-Ipfs-Roots header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 fwiw these two make sense mostly in deserialized contexts like website hosting: allow for partial HTTP Cache invalidation based on DAG/path subset that changed (ipfs/kubo#8720, based on request from Cloudflare)
For requests for /ipfs/cid
without any sub path they don't bring much value ( Etag
is more than enough).
So fine to skip X-Ipfs-Roots header until you support sub-paths (if its even planned)
Adds a
lassie daemon
command for running an http server. Some things are not very pretty, but the HTTP interface should be okay to use while we clean up everything behind.Notable Changes:
daemon
command that starts a running http serverversion
command for logging the version. lassie needs to be built with-ldflags="main.version=v0.0.0"
to set the version.-v
and-vv
verbose flags for additional logging/ipfs
endpoint that implements issue HTTP Daemon #34Notes:
Lassie
object that you can callFetch
on. Makes a nicelassie.Fetch()
call.application/vnd.ipld.car
(including wildcard types), the request is accepted.format
query parameter is provided but is not the valuecar
, the server responds with a 400.filename
query parameter value extension is not.car
, the server responds with a 400.Known TODOs: