hoodie-server icon indicating copy to clipboard operation
hoodie-server copied to clipboard

Sync two (or more) hood.ie servers

Open ooii opened this issue 6 years ago • 7 comments

Is there any way to run two instances of hood.ie servers that keep in sync? Hood.ie is based on couchdb which has a built-in sync feature. Is it used by hood.ie? I see that there is a replicate function, how can I use it? Thanks.

ooii avatar Sep 04 '19 13:09 ooii

I think that would be configuring continuous replication between the two DBs. Hoodie doesn't have this feature AFAIK, so you'll manually set this up.

pmbanugo avatar Sep 04 '19 15:09 pmbanugo

Thanks for your answer. I was editing my question probably while you're answering. I added a link to the api server replicate function. How one could configure continuous replication between the two DBs? Can we configure hood.ie's database?

ooii avatar Sep 04 '19 15:09 ooii

You can try that but I haven't used it and don't know how that works from the store api. Hoodie is not a database, it's backed by CouchDB or some other database that implements the couchdb replication protocol. You are likely to connect it to a CouchDB instance you've setup or use Cloudant (hosted couchdb). Otherwise, I guess you're using the default config which I think sets you up with an in-memory data store. If you choose to set up a CouchDB instance or use Cloudant, this video can explain how to set up replication between servers

https://www.youtube.com/watch?v=uGcxFHZsy10

pmbanugo avatar Sep 04 '19 15:09 pmbanugo

You're absolutely right, I'm using the in-memory data store. I'll connect it to a CouchDB instance, try, and comeback here to report. Thanks again.

ooii avatar Sep 04 '19 15:09 ooii

Do I need to create the database myself or hoodie will do that at first start? I have a running couchdb instance and hoodie has the right credentials. But when starting it, it ends with Error: Could not set necessary CouchDB config. I don't see in the config doc any field to provide database name. BTW: thanks for your phonebook app tutorial, well written and very good help.

ooii avatar Sep 04 '19 16:09 ooii

you don't have to create the databases yourself. Just give hoodie config options so it knows how to connect to the DB. I guess you're missing some config that's why you're getting that error. check the documentation for details on config

pmbanugo avatar Sep 05 '19 08:09 pmbanugo

Thanks @pmbanugo. I'm digging.

ooii avatar Sep 05 '19 09:09 ooii