Transferring from Parse-Server to dynamoDB. What foreseeable obstacles are there? - ios

As we all know, I'm one of the thousands of devs who relied on Parse and now forced to find Parse alternative. While transferring Parse-Server to AWS+MongoDB, I've discovered DynamoDB. I'm thinking of just tranferring my whole server side logic to DynamoDB. What are some of the problems that Parse doesn't have that might exist for DynamoDB?

Since Parse includes a web server, you can interact with it via simple HTTP requests. DynamoDB is just a database, so you would need to connect directly through the AWS SDK, or build an API in front of it, possibly using API Gateway and Lambda.
In addition, since Parse is a full-featured Backend as a Service, and DynamoDB is only a database, there are some features in Parse that won't be available if you just use DynamoDB directly from your iOS application. For example user password resets require sending an email to the user. DynamoDB has no "password reset" functionality and can't send emails directly. You would have to build that feature yourself using something like Lambda and SES.
Parse also handles file upload and file hosting, which are features you would no longer have if you just used DynamoDB directly from iOS. You would have to build those features yourself, possibly using S3.
If you are only using Parse as a data store then using DynamoDB directly could certainly work for you, but then again so could MongoDB or any other NoSQL database. You should definitely explore how your database schema would look in DynamoDB before committing to it, because there are certain restrictions on index types and query types that might make it difficult to transition your current schema.

AWS + DynamoDB would be your way to go.
I worked extensively in both, DynamoDB and MongoDB systems and can give you a short summary of an advise.
MongoDB is very easy to work with and has unmatched flexibility in query structure, requires very little thinking ahead of setting up the system.
DynamoDB will provide unmatched scalability, much stricter (very strict) set of rules for creating schemas and requires a lot of planning before you do the setup. However, you don't need to worry about setting up or managing database environment, no worry about master/slave architecture and no concerns of scaling your database.
I go with DynamoDB these days and it's been great.

Just completed a migration from Parse to AWS Dynamo (a few thoughts were posted here: https://www.linkedin.com/pulse/parse-aws-migration-server-less-mobile-backend-mike-kirkwood?trk=prof-post
My experience was that DynamoDD was an acceptable replacement for much of Parse. However, it required some data model changes as DynamoDB doesn't support Pointers or Relationships like Parse did. So, in the app had to adjust some of the writes to add more data to the record in DynamoDB. This did offer some nice benefits in the queries.
DynamoDB also allows you to add indexes to match specific queries.
And, for my use, DynamoDB has proven to be much faster queries than Parse was.

DynamoDB is just a database service, so you can use it to store Parse data but you'll still need a server to process the data and host APIs, etc... On AWS, you could spin up an EC2 instance to run the server, or try to make it run on Lambda.
Parse Server does not natively support either Lambda as a hosting environment or DynamoDB as a storage backend, but fortunately members of the community have recently developed integration for both of these:
https://www.npmjs.com/package/parse-server-dynamodb-adapter
https://github.com/parse-community/parse-server/issues/483

Related

Swift: How to properly serve a Realm in deployment

I have an iOS application written in Swift using Realm as a database working locally on my computer.
Right now, when I make reads and writes from Realm, I believe it is to and from a local file on my computer. Obviously this will not work in deployment, because the Realm file needs to be the same for every user, and every user will have the ability to change the Realm, so it seems that the Realm must be on a server.
How can I make it so that when users perform reads and writes to Realm, it maps to the Realm file on a server. What type of server should I use? I currently have an Amazon S3 account, should I just store the Realm file in a bucket and download and rewrite the Realm file anytime someone makes a change (though that seems highly inefficient)?
EDIT:
To ask this in a simpler way, what is the standard way to store user data in iOS applications on a server?
See this answer. Unfortunately what you're proposing doesn't seem to be possible, at least yet.
For what you're proposing you're better off using a more traditional server-side database.
EDIT:
To ask this in a simpler way, what is the standard way to store user data in iOS applications on a server?
That's quite a broad question, but normally saving data on a server is done through using your own custom API + back-end, or utilising a back-end SaaS (such as the soon-to-be-defunct Parse, or AWS.
If you want to store user data on a server you need to do this through network requests on the front-end, and your API would modify the database accordingly. You would never modify the database directly on your front-end.

Is it feasible to do recommendation with Parse and only iOS devices?

I am currently working on a social-networking based app on iOS. I try the online DB service and cloud service provider "Parse". But what i really do through this platform is just to retrieve data for the "users","messages" and "activities" in that DB.
I want to implement the recommendation function into my app which requires some sort of logic after the retrieval of the data. Is it feasible to integrate some of this logic into the "Parse" platform and avoid setting up the server?
If I understand your question correctly, you are asking if you can have server side logic run on the Parse side? Yes, you can and this is fairly standard practice in the Parse universe. You an use Cloud Code, which is Javascript run on the parse servers and you can link the scripts in to before you save objects, after you save objects, or just standalone functions. Here are some details:
https://parse.com/docs/cloud_code_guide
Hope that helps!

Backend for iOS

I need a backend to store location updates and messages, I was thinking of using JSON to connect to the Amazon S3 server and to fetch and store data.
How many clients could be connected to this server? Is there a way to link a MYSQL server to Amazon S3 for login and users accounts?
S3 is not a database store; you write/delete/replace an entire object.
You want AWS RDS. Amazon manages the DB (MySQL supported). Skim the reference architectures for something applicable to your needs. Scale them down; they're designed to make use of as many AWS services as possible.
http://aws.amazon.com/rds/
http://aws.amazon.com/architecture/
Other option is Amazon Dynamo DB. This is an infinite-scale nosql db with a fully managed REST API. You dont worry about the data size growth, speed etc. AWS take care of all these.
http://aws.amazon.com/dynamodb/.
Even in this case, you need to have some code running in the backend, which receives your REST calls from the iOS and writes to the Dynamo.
Other even easier solutions are https://parse.com/ and https://www.firebase.com/
These are solutions specifically for your kind of needs - Make a mobile backend Datastore. They give client SDK, which has a very great value in terms of offline synch. You just invoke the SDK from the apps and will synch with the backend datasore when the connections are available - reduces your code complexity a lot !

Extracting API into another heroku app. Best practice

I'm planning on extracting some API endpoints from a Rails app hosted on Heroku that uses Postgres into a new Heroku app. What is the advisable way to do this?
Share the database with the 2nd app and switch over API end points in my client side code?
Backup and migrate data to a new database using PG Backups?
Other?
Not sure if this is an opinion based question, but I'd appreciate some input.
Both the options you've listed seem perfectly acceptable, but the decision is highly dependent on the nature of the API and what your consumers will be doing with it.
If the API is merely supplying data (i.e. read-only, with no endpoints for updating/creating new data), then I highly recommend creating a 'follower' postgres database, and having your API requests read from the follower. The two dbs are in synch, and you separate API traffic/load from regular app traffic/load.
Heroku's instructions for setting up a follower are here:
https://devcenter.heroku.com/articles/heroku-postgres-follower-databases
If your API involves data updates/writes, then the decision to clone the db (vs) serving API and app from the same db is solely dependent on traffic volumes and your tolerance for managing two databases and keeping them synchronized.
On a side note, for your API endpoints, I always advise the use of ActiveModelSerializers or JBuilder for delivering data.
https://github.com/rails/jbuilder
https://github.com/rails-api/active_model_serializers

iOS Web Database

I need to populate a table in an iOS application with data from a Web database
I already have a MySQL database set up but reading about this it seems there must be an easier way for the iOS to interact with a web database
Any help or pointers would be appreciated,
Thanks
You should make an API interface.
Then use the API to communicate with the database. Using the database directly is a very bad thing to do.
If you are really desperate, consider using the MySQL C library. This article explains it in great detail:
http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/
For my application, I chose to create a web service to act as an intermediary between my application and the database.
This layout has several advantages. Considering you have MySQL database you can try to create some php scripts (I chose php because the API to work with mysql is very very simple and as you said, you don't need very high security or performance).
You can use these scripts through HTTP requests (you can use NSURLConnection to do these).. These scripts connect to mysql , fetch the data you need to pass the result back to the application in an easier to use format (e.g. I use JSON).

Resources