-
Notifications
You must be signed in to change notification settings - Fork 445
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 a "static site" handler to serve resources from a camliRoot #1579
base: master
Are you sure you want to change the base?
Conversation
Hey, that looks pretty cool. Looking at this, I am thinking of the following:
The I'd be willing to help with some of that work if you also agree that it makes sense. |
@aviau I think that's an interesting idea. Do you think the idea would be that this new implementation could eventually replace the pk-mount backend? I know that's built with fuse, but I'm not sure if the implementations would align well. I took a cursory glance at the mount code and it seems like that uses a 3rd party FS interface for emulating the filesystem. Maybe we would just keep them separate, but I could see some overlap between the filesystem emulation currently built in the existing fuse package, and whatever would be added to this proposed fs package. What are your thoughts? |
In other words, I hadn't thought about it until your comment, but maybe it would have made more sense if I had initially used the existing |
Actually, on further thought, it probably doesn't make sense to try to make the existing CamliFileSystem conform both to a |
Yes, exactly. The current FUSE package should eventually be switch to a user of the FS interface. If we implement io/fs we can get WebDAV almost for free too, and that would help mac users since basil no longer supports macos. |
Addresses #1275
This PR adds a static site app handler to enable serving static web resources, like a single page app, from a configured camliRoot node.
Once you configure the handler, you can "install" the app by uploading the files to a camliRoot.
Build everything:
$ go run make.go
Start the app:
$ devcam server
Upload the app's source files:
$ pk-put file --permanode --title='Static App Source' ./test-app-source
Make the source permanode a camliRoot:
$ pk-put attr --add [last permanode sha from previous output] camliRoot "Static App Source"
Note: You can also configure a search root for the app handler to enable searching via the app route:
pk-put permanode --title='Test App Search Root'
This will add search support to the app's endpoint while limiting queries to the nodes contained in the specified search root:
$ curl -X POST http://localhost:3179/static-app/search -d' { "expression" : "is:image", "describe": {} } '
Finally, add the static app prefix configuration to your server's config:
And restart the server:
$ devcam server -staticapp
You should be able to now visit your static app at the app prefix hosted by your Perkeep server.