Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 24, 2013, 12:20 PM   #1
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
I want to Host a Database... Need Help Getting Started

I'd like to set up a database with an API that other developers can use to make apps that can view and modify my database.

I'd like to keep my costs at a minimum.

I'd like to control the developers accessing my database, the apps accessing my database, and the end users accessing my database.

I want to ensure that the database is secure and restrict the modifications that can be made to my database - IE, I'd like to make sure that people don't add things to my database that don't belong, and I'd like to ensure that people don't add incomplete entries to my database, and I'd like to make sure that people don't delete entries such that they render other data illogical.

I have no experience with setting up a server or online database (although I have some experience with SQL/MySQL Workbench.) I was hoping people could answer these questions for me:

1 - Do I need to write my own server side code to do everything, or is there something magical I can do that allows me to avoid writing my own server side code?

Skip 1a and 1b if I don't need to write my own server side code...

1a - What language(s) should I use for my server side code? I know C, C++, Obj-C, Obj-C++, Java, JavaScript, and SQL. I've got nothing against learning more languages, I just provide that list so you might know which language would be easiest for me to learn for this.

1b - Are there hosting services where I can upload this server side code?

2 - I have a few old Macs laying around the house (a Mac Mini, a G4 tower, and a G5 tower,) that I feel I could use to host this database. Should I use them or some other hosting service? If I should use them, how would I go about doing so?

Thanks in advance! (This all pertains to the same topic as one that I had in iOS Programming yesterday, but I feel like the questions I wrote here have a much different approach to the root of the things I want done in my iOS app.)
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Apr 24, 2013, 02:56 PM   #2
wedgeantilles
macrumors newbie
 
Join Date: Apr 2013
The easiest way of hosting a database and associated API is to use the AWS Free Tier. This gives you access to enough free hours to run a Micro EC2 instance to host your code and free usage of a SQL/NoSQL database depending on your requirements.

AWS offers a choice of databases, but if you don't like any of their options, you can always install and run your own on EC2 instead of using one of the on-demand options.

As for your questions about how to control access to the database, you've already answered this in terms of discussing an API. The key in writing an API is to expose a series of functions and methods via the API that developers can use in their own applications to request changes to your data.

You are then able to sanitise requests and use your own logic to transform API requests into actionable changes on the database - but you control the logic and access to allow this to happen.

I.E. You write an API function that allows users to pass through data to update a record in the database. As you control the API and the methods you're exposing, no-one else has access to the underlying code that actually makes the change - they only see and can only call the API functions.

Regarding the choice of language, this is partially a personal preference and partially down to what you want your users to use. JSON is popular right now, so would be worth taking a look at.
wedgeantilles is offline   0 Reply With Quote
Old Apr 24, 2013, 03:17 PM   #3
ArtOfWarfare
Thread Starter
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by wedgeantilles View Post
The easiest way of hosting a database and associated API is to use the AWS Free Tier. This gives you access to enough free hours to run a Micro EC2 instance to host your code and free usage of a SQL/NoSQL database depending on your requirements.

AWS offers a choice of databases, but if you don't like any of their options, you can always install and run your own on EC2 instead of using one of the on-demand options.

As for your questions about how to control access to the database, you've already answered this in terms of discussing an API. The key in writing an API is to expose a series of functions and methods via the API that developers can use in their own applications to request changes to your data.

You are then able to sanitise requests and use your own logic to transform API requests into actionable changes on the database - but you control the logic and access to allow this to happen.

I.E. You write an API function that allows users to pass through data to update a record in the database. As you control the API and the methods you're exposing, no-one else has access to the underlying code that actually makes the change - they only see and can only call the API functions.

Regarding the choice of language, this is partially a personal preference and partially down to what you want your users to use. JSON is popular right now, so would be worth taking a look at.
I looked into AWS and it looks to me like it was just a data storage service - it seemed like apps are expected to send raw CRUD commands which would allow users to maliciously change my database. But if you think I can add my own server side code to it, I guess I'll keep looking at it.
ArtOfWarfare is offline   0 Reply With Quote
Old Apr 24, 2013, 05:08 PM   #4
Ap0ks
macrumors regular
 
Join Date: Aug 2008
Location: Cambridge, UK
You'll want a free tier instance of AWS RDS (relational database) or DynamoDB (NoSQL) and then a free tier instance of EC2 to run the API code for the database.

You can use most languages, but it really depends on what you want to do and the purpose of the database. Languages popular for Web/API projects at the moment include Ruby/Rails, Python, NodeJS or you can go for one of the bigger solutions PHP, .Net or Java.

There's bound to be plenty of frameworks for each language too should you not want to code the whole thing by hand
Ap0ks is offline   0 Reply With Quote
Old Apr 24, 2013, 06:53 PM   #5
ArtOfWarfare
Thread Starter
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by Ap0ks View Post
You'll want a free tier instance of AWS RDS (relational database) or DynamoDB (NoSQL) and then a free tier instance of EC2 to run the API code for the database.
Thanks for that! I had just been looking at their database services and was scratching my head about how I could define any sort of API using that. I'll have to look at EC2 and decide whether I want to use an RDB or NoSQL... I'm leaning towards NoSQL even though I know nothing about it just because I've heard it's less limited than an RDB and scales better...

Edit: EC2 seems to completely lack a free tier... I really don't want to have any chance of being changed any money when I'm just testing this stuff out...

Last edited by ArtOfWarfare; Apr 24, 2013 at 08:38 PM.
ArtOfWarfare is offline   0 Reply With Quote
Old Apr 25, 2013, 04:53 AM   #6
Ap0ks
macrumors regular
 
Join Date: Aug 2008
Location: Cambridge, UK
Quote:
Originally Posted by ArtOfWarfare View Post
Thanks for that! I had just been looking at their database services and was scratching my head about how I could define any sort of API using that. I'll have to look at EC2 and decide whether I want to use an RDB or NoSQL... I'm leaning towards NoSQL even though I know nothing about it just because I've heard it's less limited than an RDB and scales better...

Edit: EC2 seems to completely lack a free tier... I really don't want to have any chance of being changed any money when I'm just testing this stuff out...
It is there, similar to the RDS and DynamoDB free tiers you get 750 hours a month of a Linux or Windows micro instance for nothing. However one thing to note is that the free tier only lasts for 12 months, so if your project is going to run longer than that you'll end up having to pay standard rates.

As for NoSQL vs RDB it does depend on what you're going to be storing and what you'll be doing with the data.
Ap0ks is offline   0 Reply With Quote
Old Apr 25, 2013, 09:12 AM   #7
brohan711
macrumors newbie
 
Join Date: Apr 2012
Parse?

Are you talking about a service like parse which has a simple api and free for basic services (Which go a long way btw). They use a mongodb which uses javascript. Check out both parse and mongodb!
brohan711 is offline   0 Reply With Quote
Old Apr 25, 2013, 09:40 AM   #8
Ap0ks
macrumors regular
 
Join Date: Aug 2008
Location: Cambridge, UK
Quote:
Originally Posted by brohan711 View Post
Are you talking about a service like parse which has a simple api and free for basic services (Which go a long way btw). They use a mongodb which uses javascript. Check out both parse and mongodb!
That Parse service does look pretty useful, thanks for bringing it to light
Ap0ks is offline   0 Reply With Quote
Old Apr 25, 2013, 11:30 AM   #9
ArtOfWarfare
Thread Starter
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by brohan711 View Post
Are you talking about a service like parse which has a simple api and free for basic services (Which go a long way btw). They use a mongodb which uses javascript. Check out both parse and mongodb!
Hmmm... it looks promising. It looks vastly more straight forward than Amazon's services, and I managed to sign up for it in 3 button clicks ("Sign Up" -> "Use Facebook" -> (On Facebook) "Approve")... whereas signing up for Amazon involved getting an automated phone call and typing in codes and giving them my credit card information...

The only drawback is it goes from free to $200/month with nothing in between. Hopefully the free is adequate for me, because right now my plans are to offer my app and service for free (without so much as ads initially) with the idea of turning it into a revenue source if it turns out that I end up with a lot of users loving it and willing to pay a small fee...
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Apr 29, 2013, 10:53 AM   #10
brohan711
macrumors newbie
 
Join Date: Apr 2012
Quote:
Originally Posted by ArtOfWarfare View Post
Hmmm... it looks promising. It looks vastly more straight forward than Amazon's services, and I managed to sign up for it in 3 button clicks ("Sign Up" -> "Use Facebook" -> (On Facebook) "Approve")... whereas signing up for Amazon involved getting an automated phone call and typing in codes and giving them my credit card information...

The only drawback is it goes from free to $200/month with nothing in between. Hopefully the free is adequate for me, because right now my plans are to offer my app and service for free (without so much as ads initially) with the idea of turning it into a revenue source if it turns out that I end up with a lot of users loving it and willing to pay a small fee...

They do offer 7 cents /1000 Api requests and push notifications you go over the original 1million. So if you do go over you don't have to pay THAT much. Although i haven't reached the level of scalability to actually analyze the costs in a real situation.

And no problem. It is a great service. I use it for all of my applications i make for iOS. The API is PHENOMENAL. I haven't had one issue with it except integration with facebook into the applications. But Facebook just acquired it so who knows??
brohan711 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Host of Problems nelsonizer MacBook 6 Dec 17, 2013 02:28 PM
GW2 Database- iPhone and iPad database for Guild Wars 2 skoroapps iPad Apps 19 Jul 20, 2013 05:59 AM
GW2 Database - iPhone and iPad database for Guild Wars 2 skoroapps iPhone and iPod touch Apps 14 Jul 20, 2013 05:58 AM
Best Web Host? clearaway Web Design and Development 10 Mar 15, 2013 04:38 AM

Forum Jump

All times are GMT -5. The time now is 11:41 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps