21

I'm currently developing an iOS app and have reached the point where I need to implement a server backend in order to support the core functionality. Essentially, the app deals with text strings that need to be uploaded to a server. After receiving the strings, I need the server to perform some tasks with it and then send the result of the tasks (also string-based) back to the iPhone app.

I have zero server experience and am need of some advisement as to where I should begin with this. In order to avoid financial risk, I am attempting to avoid dedicated hosting at initial launch, and so I was wondering if at-home server hosting would be at all possible for the launch and then, if the server-side component was developed appropriately, simply transfer the software to a more permanent dedicated solution if the app's usage warranted.

I have done some research and I have found Amazon S3 to be a popular iPhone app server solution due to its integration with the also popular wrapper, ASIHTTPRequest. This seems to be a more permanent hosting solution, however. In the meantime, for local app testing on a smaller scale, what would the recommended server platform be? Something along the lines of ubuntu with LAMP installed? If so, would the scripts developed on the local platform (I'm assuming in PHP) be directly transferrable to a larger-scale server for the most part?

Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
Harrold Kenning
  • 213
  • 1
  • 2
  • 4
  • You could use Amazon EC2 instead of S3. It offers a micro-instance for free upto a certain limit which is sufficient for most cases when you're starting out - http://aws.amazon.com/ec2/ – Anurag Jun 22 '11 at 17:48
  • That sounds very interesting, this is pretty lame but would you happen to know if the ASIHTTPRequest wrapper supports that as well. I would assume a server is a server as far as the wrapper is concerned, but I'm just checking. Thanks for the quick response! – Harrold Kenning Jun 22 '11 at 17:53
  • ASIHTTPRequest is merely a wrapper for making http requests. You would have to setup a web server on the instance and make it publicly accessible which ASI will then connect to. ASI can make HTTP requests to any accessible web server, so that shouldn't be a problem. – Anurag Jun 22 '11 at 17:56
  • Oh ok, so if I chose to even bypass the free Amazon EC2 for a little while just to get my feet wet in server-client communication, would something like an apache server running on an old pc in my house suffice? – Harrold Kenning Jun 22 '11 at 18:04
  • Oh definitely, you can setup Apache on your own machine, and connect to it from the iOS app. I have a similar setup where I sometimes connect to a local web server running on my laptop using a 10.0.x.x IP. Once you feel the need to grow further, you could go with EC2 or any other hosting provider. – Anurag Jun 22 '11 at 18:09
  • Thanks for your help, Anurag... that's exactly the sort of clarification I seeking. – Harrold Kenning Jun 22 '11 at 18:25
  • you can use a public folder in dropbox. each file has its own link. – Jordan Brown Jun 22 '11 at 18:46

1 Answers1

3

I would go with shared hosting: http://webfaction.com or http://linode.com. It's unlikely that you're going to have so much traffic that your shared host will not be able to tolerate it. I run a few high traffic apps on Webfaction without difficulty.

From your description of the functionality in your app, it doesn't seem too complicated, and wouldn't be difficult to scale.

PHP development environment on OS X:

OS X has PHP and Apache already installed. It just needs to be enabled, this page describes the process to get it going:

http://foundationphp.com/tutorials/php_leopard.php

Alternatively you can install a package like MAMP ( http://www.mamp.info/en/index.html ), which will provide you with a full stack. (And is what I would recommend.)

The code:

As for the code, you'll more than likely use ASIHttpRequest to do a POST request to URI on your server. The script at the URI will connect to the database, store the string, and then disconnect from the database.

Less than 10 lines of code.

peterp
  • 3,145
  • 1
  • 20
  • 24
  • Wow that's great to hear, I went and installed ubuntu yesterday on an old desktop but hearing I can do it all on my MBP is great news. I'll be sure to try and get this up and running later today. Thanks for all the help. – Harrold Kenning Jun 22 '11 at 18:24
  • Great. If you need any more help don't hesitate to comment. Also, if this worked for you, don't forget to accept the answer. – peterp Jun 22 '11 at 18:42
  • I have an additional offshoot question regarding MySQL (if you're unsure about the answer, that's fine. It's sort of a different area than the question asked.) The question is whether MySQL is the preferred method storing data on servers now or if there are a wide range of options. Right now, my app currently stores data locally to the device using NSCoder standards, which completely bypasses anything with MySQL. However, when the data reaches the server, it will probably be very wise to keep it all in a database of some sort. For a small-to-medium sized app, is MySQL still recommended? Thanks – Harrold Kenning Jun 22 '11 at 20:19
  • Yes, Some reasons: 1) It's widely supported on shared hosts. 2) It scales 3) PHP and MySQL have worked together for ages. – peterp Jun 23 '11 at 08:19
  • I personally haven't used PHP/ MySQL for ages. I'm using Django + PostgreSQL. But, I believe that the PHP/ MySQL stack is a great place to start, and should provide you with everything that you need. – peterp Jun 23 '11 at 08:20