vrtmrz / obsidian-livesync

MIT License
5.1k stars 165 forks source link

Fly.io Error:Request failed, status 502, replication error #225

Open xBlady opened 1 year ago

xBlady commented 1 year ago

Hello!

Sync was working for a while and then started giving errors. Report below/

Actually happened

----remote config---- cors: credentials: "true" origins: app://obsidian.md,capacitor://localhost,http://localhost chttpd: bind_address: any enable_cors: "true" max_http_request_size: "4294967296" port: "5984" require_valid_user: "true" admins: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 vendor: name: The Apache Software Foundation feature_flags: partitioned||*: "true" chttpd_auth: hash_algorithms: sha256, sha require_valid_user: "true" indexers: couch_mrview: "true" prometheus: additional_port: "false" bind_address: 127.0.0.1 port: "17986" httpd: WWW-Authenticate: Basic realm="couchdb" bind_address: 127.0.0.1 enable_cors: "true" port: "5986" smoosh: state_dir: ./data couch_httpd_auth: authentication_db: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 secret: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 authentication_redirect: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 couchdb_engines: couch: couch_bt_engine couchdb: database_dir: ./data max_document_size: "50000000" uuid: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 view_index_dir: ./data

---- Plug-in config --- couchDB_URI: self-hosted couchDB_USER: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 couchDB_PASSWORD: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 couchDB_DBNAME: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 liveSync: false syncOnSave: false syncOnStart: true savingDelay: 200 lessInformationInLog: false gcDelay: 300 versionUpFlash: "" minimumChunkSize: 20 longLineThreshold: 250 showVerboseLog: true suspendFileWatching: false trashInsteadDelete: true periodicReplication: true periodicReplicationInterval: 60 syncOnFileOpen: true encrypt: true passphrase: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 usePathObfuscation: true doNotDeleteFolder: false resolveConflictsByNewerFile: false batchSave: true deviceAndVaultName: "" usePluginSettings: false showOwnPlugins: false showStatusOnEditor: true usePluginSync: false autoSweepPlugins: false autoSweepPluginsPeriodic: false notifyPluginOrSettingUpdated: false checkIntegrityOnSave: false batch_size: 50 batches_limit: 40 useHistory: false disableRequestURI: false skipOlderFilesOnSync: true checkConflictOnlyOnOpen: false syncInternalFiles: false syncInternalFilesBeforeReplication: false syncInternalFilesIgnorePatterns: \/node_modules\/, \/.git\/, \/obsidian-livesync\/ syncInternalFilesInterval: 60 additionalSuffixOfDatabaseName: "" ignoreVersionCheck: false lastReadUpdates: 19 deleteMetadataOfDeletedFiles: false syncIgnoreRegEx: "" syncOnlyRegEx: "" customChunkSize: 100 readChunksOnline: true watchInternalFileChanges: true automaticallyDeleteMetadataOfDeletedFiles: 0 disableMarkdownAutoMerge: false writeDocumentsIfConflicted: false useDynamicIterationCount: false syncAfterMerge: true configPassphraseStore: "" encryptedPassphrase: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 encryptedCouchDBConnection: 𝑅𝐸𝐷𝐴𝐢𝑇𝐸𝐷 permitEmptyPassphrase: false useIndexedDBAdapter: true useTimeouts: false writeLogToTheFile: false doNotPaceReplication: false hashCacheMaxCount: 300 hashCacheMaxAmount: 50 concurrencyOfReadChunksOnline: 100 minimumIntervalOfReadChunksOnline: 333

vrtmrz commented 1 year ago

Thank you for opening this issue! The settings look good. Could you please capture the network pane of the DevTools while the error has happened? It should be indicated as a red line. Some more information about the DevTools is written here.

tyamanak commented 1 year ago

The same problem happened to me. I recreated the CouchDB on fly.io and synchronization was probably completed. But then, replication was not activated. The log is below.

023/6/18 1:54:09->LiveSync begin... 2023/6/18 1:54:09->Replication activated 2023/6/18 1:54:14->TypeError:Failed to fetch

On DevTool, 502 error returned.

xBlady commented 1 year ago

I think that's server plan limitations and a huge, few GB vault that caused problem, anyone tested this while having a premium paid server plan?

tyamanak commented 1 year ago

my vault size is just 256mb and I've tried to do it again with the new fly.io account, but it didn't work as well. I went through the process with this doc (https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/setup_flyio.md), and initial synchronization looked going well.

vrtmrz commented 1 year ago

Thank you all for the detail! Could you please check the metrics on the dashboard on fly.io? Perhaps memory had been exhausted. (Sometimes CouchDB uses a lot of memory to filter documents) Adding swap memory may improve this. Could you please try adding the command which enables that as like below:

fallocate -l 512M /swapfile 
chmod 0600 /swapfile 
mkswap /swapfile 
echo 10 > /proc/sys/vm/swappiness 
swapon /swapfile 
echo 1 > /proc/sys/vm/overcommit_memory

docker-entrypoint.sh would be appropriate. I made a sample as a colab notebook. Would you mind if I ask you to check this? https://gist.github.com/vrtmrz/37c3efd7842e49947aaaa7f665e5020a

Suzuki-Re commented 1 year ago

I tried the colab, and it did sync successfully this time!

Thanks for the help :)

tyamanak commented 1 year ago

I've tried the process written in colab notebook, and it looks working well. But currently, is the plugin not working on mobile Obsidian? I can't set up it from scratch on my iPhone. anyway, thank you for your support!

vrtmrz commented 1 year ago

@tyamanak Sorry for being late! I am so happy to hear that the plugin working! However, the plugin should be able to be configured from a mobile device, even if it is the initial setting. Would you mind If I ask you about the trouble which is preventing configuration?