Skip to content
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

Tested on s3 backed by localstack #3

Open
anudeepreddy opened this issue Nov 26, 2023 · 8 comments
Open

Tested on s3 backed by localstack #3

anudeepreddy opened this issue Nov 26, 2023 · 8 comments

Comments

@anudeepreddy
Copy link
Contributor

Hi,

I have tested this with a little modifications on the rsapi side to get it to work with s3 backed by localstack and I think it's working. I am able to see objects created in the s3 bucket.

@bcspragu
Copy link
Owner

Thanks for testing it out! I hadn't even considered using localstack to test. The telltale signs that it's working are:

  1. Logseq shows the green dot on the cloud sync icon
  2. Your S3 bucket is populated at <user-id>/<graph-id>/e.<random hex identifiers>, those should be the encrypted files

eg

image

(looking at that screenshot, the filetypes being inferred as random strings is probably harmless, but also not great, filed #4)

@anudeepreddy
Copy link
Contributor Author

The main motive to test with localstack is to use it during development instead of deploying an s3 bucket on AWS.

And I do see the signs you mentioned.

Thank you for working on this

@bcspragu
Copy link
Owner

bcspragu commented Nov 29, 2023

I have tested this with a little modifications on the rsapi side to get it to work with s3 backed by localstack

For posterity, what other changes did you make to the rsapi package? I'm trying to keep track of all the necessary upstream changes, since those will need to be exposed via some interface in Logseq's settings at some point

@anudeepreddy
Copy link
Contributor Author

anudeepreddy commented Nov 29, 2023

since amazonaws.com is hardcoded in s3-presign crate, I have directly used the presigned_url function from the crate which accepts url as input to generate a presigned url.

I just got a chance to look at your fork of rsapi, May I know the reason to use rust-s3 crate?

@bcspragu
Copy link
Owner

bcspragu commented Nov 29, 2023

May I know the reason to use rust-s3 crate?

The short answer is that I was debugging some signing issues. The longer answer is that I believe that the s3-presign does indeed fail under specific (still unknown) circumstances, see the upstream bug for all the details.

@enigma
Copy link

enigma commented Sep 2, 2024

Thank you @bcspragu and @anudeepreddy for working on this!

I'm dipping my toe and managed to make my local electron logseq talk to my local logseq-sync server.
At some point though the electron app tries to reach the sync server via a hardcoded url, causing [0].

@anudeepreddy do you happen to have your rsapi/localstack work published anywhere?

[0]

› update remote files: reqwest error: HTTP status client error (404 Not Found) for url (https://foiv3ndsvlkkas.frp.bsprague.com/file-sync/get_temp_credential)
Error occurred in handler for 'main': [Error: reqwest error: HTTP status client error (404 Not Found) for url (https://foiv3ndsvlkkas.frp.bsprague.com/file-sync/get_temp_credential)] {

@bcspragu
Copy link
Owner

bcspragu commented Sep 2, 2024

frp.bsprague.com is my personal frp instance. The reason you're hitting that is because I've built my own rsapi packages (here), and those point to my own server. You're likely using one of my forks of the Logseq codebase that updated the packages.json to use my rsapi forks.

The short term solution is to build your own rsapi fork with URLs to your instance (e.g. some localhost-like domain, but I think it needs HTTPS unless you update that too), the longer term solution is that Logseq passes in the URL as configuration to the rsapi package, so that these things are not hard-coded everywhere.

@enigma
Copy link

enigma commented Sep 2, 2024

Yes, I did replicate most of your fork by hand just to get a sense of where the hooks are and made my logseq point to your rsapi package.

I was curious about whether anyone already had published a version of rsapi that points to localhost. If not I'll go ahead and do it as it might be useful to share for development.

I agree that, as you suggest, longer term there should be a way to specify the endpoint from the call site. I haven't digged enough to see how many points that has to touch within logseq codebase.

but I think it needs HTTPS unless you update that too

I did have to disable CORS in logseq-sync to let logseq web (on :3001) be able to call logseq-sync (on :8000), but it turned out to be necessary only when using logseq on a browser and not via electron.
Later I discovered sync only works on electron/mobile, rsapi is not called from web, I'll check what happens for rsapi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants