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

Volatile CORS Config? #221

Closed
walterinsect opened this issue Jun 1, 2023 · 5 comments
Closed

Volatile CORS Config? #221

walterinsect opened this issue Jun 1, 2023 · 5 comments

Comments

@walterinsect
Copy link

Abstract

The LiveSync set up to use CouchDB on Fly.io does not seem to retain the DB config.

Expected behaviour

  • the server config shows multiple fix buttons, and resolve the error upon pressing
  • the setting is retained and regular sync can be used

Actually happened

  • The fix button persists to appear. Even if all the FIX buttons are gone, CORS section at the end gives us error (capacitor://localhost and http://localhost) saying "CORS is not allowing credential / CORS Origin is unmatched:app://obsidian.md->undefined
  • Replication attempt fails in error saing replication error occurred.

Reproducing procedure

  1. Configure LiveSync to use Fly.io (https://www.lisz-works.com/entry/obsidian-self-hosted-livecync)
  2. Attempt to FIx the server settings
  3. Sometimes it goes through, sometimes it does not.
  4. Even if the sync starts upon "Connected to Server XXX", it then fails after a few seconds.
  5. Replication ends in error.

Report materials

Report from the LiveSync

Report from hatch

https://gist.github.com/walterinsect/2d9a214f156e904a73409721e9cddd98

Obsidian debug info

Debug info

https://gist.github.com/walterinsect/9de14b038414de390de7639e0cd2f326

Plug-in log

Plug-in log

https://gist.github.com/walterinsect/703bd29fe5fdb2789f8e37d2a6d16180

Network log

The log is unbelievably long with almost the same information as in the Plugin log,. If needed I'll post it on gist.

Other information, insights and intuition.

The Fly.io's behaviour seems to have changed after the update to their App v2.
I've screwed up by updating the app to the new version without any thought and I had to start anew, but Fly.io does not allow creation of new v1 apps.
The v1 app I made 6 month ago was working fine.

@vrtmrz
Copy link
Owner

vrtmrz commented Jun 2, 2023

Thank you for opening the issue and filling in the form! I am delighted to respond with an informative answer since the first.

It possibly has been caused by fly.io v2, as you pointed out. The official docker image of CouchDB does not have a persistent configuration. Unfortunately, some of my instances are also automatically migrated to v2. I think this could not be avoidable any more, and we have to adapt to the new.

There are two ways.

  1. Configure to not autoscaled:
    Add the following configuration to fly.toml to prevent stopping the machine automatically.
auto_stop_machines = false
auto_start_machines = false

This might work. However, we do not know about V2 and its stability.

  1. Make it be persistent
    This way requires recreating the instance. however, we have to migrate from v1 to v2. It might be good timing.
    Just today, I wrote the new document to make a CouchDB instance on fly.io, and it is based on v2. Could you please check the doc once? I hope that this will help us!

P.S. After two instances have been up, we can transfer the database by Replication between servers. If the vault is large and you want to avoid rebuilding, try replicating it. Replication can be started from Fauxton (http://example.com/_utils/#/replication).

@walterinsect
Copy link
Author

Thank you so much for the detailed instructions and the guide documents on the new Fly.io environment.

I have tried this on my end, (albeit using my PowerShell terminal instead of the provided Colaboratory notebook) and the Self-Hosted LiveSync is working without issues on a Windows 11 machine and Android 13 syncing the vault.

I think the problems I have encountered is resolved and this Issue can be closed now.

Thank you again for the help and making this awesome plugin.

Have a nice day!

@vrtmrz
Copy link
Owner

vrtmrz commented Jun 2, 2023

I am very glad to hear that!

@vrtmrz vrtmrz reopened this Jun 2, 2023
@vrtmrz
Copy link
Owner

vrtmrz commented Jun 5, 2023

Sorry, miss operated!

@vrtmrz vrtmrz closed this as completed Jun 5, 2023
@M-Davies
Copy link

#408 might be a duplicate of this but I'm self-hosting, so not entirely sure 🤷

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