PouchDb on PAAS (Heroku, Bluemix, etc)
Asked Answered
R

1

6

I've gotten some great feedback from Stackoverflow and wanted to check on one more idea.

Currently I've got a webapp that runs nodejs on a PAAS (Heroku and trying out bluemix). The server is being configured to talk to a Couchdb (hosted on cloudant). There are two types of data saved to the db, first, user data (each user will have it's own database), and second, app data itself (metrics, user account info (auth/admin stuff).

After some great feedback from here, the idea is that after the user logs in, they will sync there local (browser) pouchdb instance with Cloudant (probably proxied through my server as was recommended here).

Now the question is, for the app/admin data, maybe I run a couchdb instance on my server so i'm not making repeated network calls for things like user logins, metrics data, etc. The data would not be very big, and is already separated from the user data calls. The point is to have a faster/local instance for authentication mainly, changes/updates get synced outside of user requests.

The backend is in express web framework and it looks like my options are pouchdb.... to sync to the Cloudant instance?

If I want local db access (backed a Couchdb instance), on a node/express server running on a PAAS, is that the recommended setup?

Thanks vm for any feedback, Paul

Rhodonite answered 8/5, 2015 at 12:22 Comment(3)
Anyone? Bueller?... Bueller?... Bueller...Rhodonite
I'm curious if you ever got this sorted out. :) Overall it looks like a feasible approach, but not sure of all the factors you were considered back then.Rhomb
These PaaS providers only let you store data on the filesystem temporarily, so you wouldn't be able to run PouchDB on them, I guess. Well, you could run, sync everything to the memory -- or to the local filesystem, then sync to Cloudant, and hope your PaaS don't erase the temporary files in the meantime. That can get harder as the amount of data to sync increases.Odessaodetta
T
0

Not sure if you found a solution, but this is what I would try.

Because heroku clears any temp data, you wouldn't be able to run a default express-pouch database, you will need to change pouch db from using file system to using LevelDOWN adapter.(Link to Pouchdb adapters: https://pouchdb.com/adapters.html)

Some of these adapters would include: https://github.com/watson/mongodown https://github.com/kesla/mysqldown https://github.com/hmalphettes/redisdown

You can easily get heroku mondo, mysql, or redis addon, and connect that to you express-pouchdb backend.

This way you will be able to keep your data.

Tate answered 15/1, 2017 at 7:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.