Resolved Dumb question: How to host a server for Apple app?

Discussion in 'Mac Programming' started by Timerez, Jun 16, 2014.

  1. Timerez, Jun 16, 2014
    Last edited: Jun 17, 2014

    Timerez macrumors newbie

    Jun 4, 2014

    I am familiar with java programming, but I never hosted a server before though... so I don't know where to start. Can someone point me in right direction on how to host and I can take care of the rest.

    Also, I'm learning how to use xcode. I have xcode 6 beta and OS X Server on my computer. OS X Server seems easy to use but I can't seem to figure out how to make it "communicate" with clients (apps)?

  2. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    You have to write your own server or use a web server that responds with JSON or XML in order to communicate with your own apps. Whether you write your own server or use a web server depends a lot on the type of data you'll be sending and receiving.

    For instance if you wanted a game server you'd probably want to write a custom server yourself (in whatever server side language you prefer) and have it communicate with your app over UDP in order to ensure low latency. On the other hand if you app simply shows information it gets from other sources then having a web server return JSON or XML will work just fine and will be significantly easier to manage.

    Non of this stuff though is built into Mac OS X Server you need to configure / write it yourself. In fact I would say ditch Mac OS X Server entirely and use Linux instead. That way you can host your server on someone like Linode which provides VPS instances on demand.

    Never host your servers at your home address if this is something you care about. Always use professionally hosted hosting in a decent datacentre for a number of reasons that should be obvious to you.
  3. Timerez thread starter macrumors newbie

    Jun 4, 2014
    Well, I am not going to design gaming app - but some type of app similar to Instagram (without taking picture part, share picture, etc) but to view variety of photos that I'll acquire from my organization. I am slightly familiar with XML but not JSON. I'll look into those if that still apply.

    Reason why I took OS X Server is because I want to avoid using iCloud - they charge monthly for storage and I will have at least over 100GB worth of photos. And I want to reduce cost on server hosting. So that means no Linode, I think... unless I really have to, then I will look into this. I also already have external harddrive that I plan to use along with OS X Server... so...

    I asked this question because I also do not know if Swift language is ideal language for server itself. I never tried cross language (Swift app to Unix Server, for example... )

    But thanks for your reply!
  4. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    Saving money is fine. Not spending any money on a solution because you don't understand the ramifications of your decisions is not.

    I can not begin to explain how much of a bad idea it is to host your site on your own server presumably in your home or place of business.

    Even if you did decide to put your own computer in a datacentre (which by the way costs money as well) you still need to pay for spare parts.

    Pay a professional company for hosting your data. You'll thank yourself in the future.

    Also think about backing up your data. You say you have an external hard drive to store the photos on. What happens if that drive decides to die? Do you have a copy somewhere else you can restore from? Where are you going to store it? You'll need at least two external hard drives and probably an off site backup as well to ensure you don't lose your data.
  5. Timerez thread starter macrumors newbie

    Jun 4, 2014
    My organization paid for everything I got - including external harddrive. I'm on this job as intern and I never had a job like this before. So part of the job is learning.

    And I'm not saying I'm avoiding paying - but trying to minimize the organization's spending. Still this doesn't answer my question: how do I host?

    I never said this is "only" place to store all data. (You sorta assumed) This is a place I will have copies from original I will be getting from my organization. I am using external harddrive to hopefully host a server and storing those photos.

    I took harddrive over cloud approach to avoid using cloud service because it seems to NOT fit what I'm trying to do. Cloud service requires monthly fee and I won't finish the project until possibly next year. This job is all about "design an idea in mind, polish up the app, and test trial among scientists" - therefore I need something temporary but working demo. And I feel the need to point out one thing too... this won't be released to public, only scientists for time being so I highly doubt they would try and hack or something as you seem to imply. I'm not really worried about that... I am more worried about making app workable by end of summer and used as demo to be shared among scientists.

    Again, how do I host? lol
  6. JohnsonK macrumors regular

    Mar 6, 2014
    It is not as simple as you seem to think :(

    OSX Server, for instance, is dumb, you can't expect to boot it and expect it to act as a custom server for your app.

    You say you are only familiar with java. That would not be enough to develop a custom server and I don't think java would be the best choice either.

    To start learning I would google backend and work from there, but for a working demo by the end of summer, I'd start looking for a professional company
  7. thejadedmonkey macrumors 604


    May 28, 2005
    You could always use a LAMP stack and connect with plain ol JSON over HTTP. That's probably easiest, but you'll have to implement some sort of authentication scheme.
  8. Timerez thread starter macrumors newbie

    Jun 4, 2014
    I didn't expect OS X Server to start working the way I want it as soon as I set it up. I just wanted to have a safe means to host a server where I can place a server file (program, or whatever the right word is) and have it run from there. But yeah, I sorta knew that. I also sorta figured that Java wasn't best choice for server as well.

    I kinda did that - but I don't know any other language yet. I'm actually first year in RIT. Only learned Java and now taking SQL courses (this fall, though) and I saw that SQL seems to be popular choice for backend server.

    Basically, you're suggesting I look into cloud server regardless of how temporary it can be?

    I am not familiar with LAMP stack, but googled. I'll read more on this tomorrow when I can. I haven't learned how to use JSON yet either. But I'm sure I can pick something up soon!

    Thank you both for answering my question though!
  9. JohnsonK macrumors regular

    Mar 6, 2014

    Have you checked AWS? They have a free tier. How about They also have a free tier.
  10. 960design macrumors 68030

    Apr 17, 2012
    Destin, FL
    Yep, like they said. Have your app communicate with your server. Have your server waiting for a 'hit' with the proper credentials, have server process and respond using JSON or depending on the app type you could just have it communicate via websockets. Be sure look into HTML5 new tech stuff, it will make your life easier and your app more responsive... like localhost storage.

    Also like they said, if this is for production, have someone else host. You should spend your skills and expensive time writing code, not dealing with hosting headaches ( and there are ALOT to be had with hosting ). If it is for learning, then have at it and have fun!
  11. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    This is a weird thread.

    The only requirement mentioned is that the server will deal with 100 GB of photos. We have no idea what it will do with them, if that's fixed or if it will grow, what the clients accessing the server need to do, if this is an internal intranet app or external internet app, if the images can be edited or deleted, how many users you need for your demo, if your clients are iOS/OS X/Windows/Linux/Android/Windows Phone/whatever, if there is a team of iOS or OS X developers or admins on staff already, etc. We have approximately no information, and people are guessing based on their assumptions and own experience.

    You're an intern. You've been asked to prototype some sort of photo viewing app for a large corpus of internal photos for "scientists". You have OS X server, but you don't know if that's the right tool. You need to learn a lot about what questions to ask about requirements and start asking them. Can this be browser-based? What's the monthly budget to keep it running? How available does it need to be (or: how much downtime is tolerable)? Are there performance requirements? If it has to be an app, should it appear in the App Store or only be distributed internally (this affects which dev program you should join)? What do you need to learn? How expensive it will be to build? To maintain? Is this feasible in some time frame? How many developers it will take to deliver by a certain time? Is it feasible to host this on OS X if this is internal? What if it's external? Do you or the firm have the expertise to secure this app, if security matters (hint: it does)?

    You aren't getting super useful answers here because you haven't provided enough data. Find out a lot more, share it here, and we can give you better advice.

    My thought: build a web app styled for mobile devices. Implement an image catalog and keyword search with paged (or infiniscroll) results. Once you have that you can move on to an app, that you won't finish, so document things well so a full timer or future intern can pick up where you left off.

    Find small, impactful, measurable steps. Execute them and report to your superiors. Your goal is not a robust, internet-enabled client-server platform enabling immediate access to a huge catalog of images. That's asking to fail, and having 3/4 of that but nothing really working is the same as having nothing. Build small pieces that function, and build up from there.

    Good luck.

  12. ohbrilliance macrumors 6502a


    May 15, 2007
    Melbourne, Australia
    You'll need a machine to host server software. If you're self-hosting, then you'll need a physical box or a VM on an existing server.
    Then pick your server software. Linux works well on a PC server. Apache or nginx are two picks for web servers. Then pick a language to code in. PHP is the most straightforward to throw something together. Since you know Java, you may want to look into coding a Java EE web app, running on something like Tomcat or Glassfish.
    Once that's sorted, code your app. When it's ready for production, harden your server and make it available on the web. Get yourself a dedicated IP, and set the DNS to point your domain or subdomain to the server.

    (During development you'll probably want to code on your own PC or Mac. Setup an equivalent web server on your own machine and code in the target language.)
  13. whooleytoo macrumors 604


    Aug 2, 2002
    Cork, Ireland.
    You could take a look at something like Firebase, for "no back-end" solutions. Obviously, it's not "no back-end" but rather they host it for you and you can use a web-based admin to manage it, and they have a variety of clients (including an Obj-C library) to connect to it.

    While it's not trivial, it might be a lot easier to learning Java (or similar) and starting to implement a server-side solution.
  14. Timerez, Jun 17, 2014
    Last edited: Jun 17, 2014

    Timerez thread starter macrumors newbie

    Jun 4, 2014
    Indeed. I am new to this sort of thing. So I'm trying my best. :)

    I can clarify a bit on that. I was told I will have approximately 100GB worth of photos and growing, but slowly though. I will receive photos from astronomers collecting photos. There will be no photoshopping involvement, just some type of scoring system involved. Something like: I see a photo but I don't see what I'm looking for, I dismiss it with a zero. If I see a photo with something that I "think I see it but not sure" - score it of 1. But then if I see a photo with something that's painfully obvious, I mark it 2. And on server side, I want to collect all photos that has scores separated into group based on scores. The more 2s it is, goes into folder of that score. (To speed up searching for specific photos from 100GB worth of photos if shared among scientists). We won't be moving photos around, just putting those photos on file so we know which is which. But I also want to include accounts for each users so we also can track down who's who, who can really see well and who can't really see well, etc.

    Also, for now - they want to only focus on iOS side. And once they have a working app and server, they will move on to android app. So we thought OS X Server plus xcode 6 beta would suffice. Seems wrong?

    I was hired to solve this and try and provide a demo so that they could test, evaluate its functionality (and not on appearance), and then fund for next intern job to make this better. And I know security matters. :) I just know that this is not going to hit market, only shared among scientists, but the question is how to make this work.

    I know, I apologize for being vague. I thought I could only focus on how to make server work for app. Since I never made an app. App seems easy to make. I already got xcode 6 beta, etc. I just don't want to ask too many questions on everything. I just want to focus on making app that connects to a server. And go from there. But seems it's more complicated than that. Ugh.

    Interesting... I thought making a server and an app is small step, but designing them in depth was bigger steps. I will try and improvise as to your suggestion.

    Thank you. I appreciate your feedback and points on my being unclear.
  15. theluggage macrumors 68040

    Jul 29, 2011
    From your description I'd suggest starting with a dynamic website rather than an iOS app. Phone/tablet users would run it via a web browser and it could be very easily made to work across iOS, Android and desktop machines, and would be much easier for your proof-of-concept stage. For one thing, you don't need to worry about the difficulty of getting your App to testers without going through the Apple App store.

    Look for tutorials on creating database-driven websites. Also look up 'AJAX' - building your server and client app that way will be a bit more work but make it easier to move to a flashier iOS-based client app later.

    You can do that using Java Server Pages in conjunction with free software (probably Apache Tomcat) - which is powerful and scalable if your project ends up getting huge, but there's one heck of a lot of jargon to wade through to get started.

    Using PHP would probably be easier to get started with, and there are lots of 'dummies' books and guides around for building dynamic websites with PHP.

    The other avenue is to look at content management/blogging systems like Joomla, Drupal or Wordpress - there are lots of pre-written plug ins for these and you might be able to lash up a demo of what you want using a 'survey' or 'like/dislike' plug-in without resorting to any significant programming - plus, all the user account management stuff is already in place.

    However - you're going to have to do your own research/background reading - nobody is going to write you a custom tutorial here when there are plenty of good ones around.
  16. robvas macrumors 68030

    Mar 29, 2009
    Digital Ocean will give you a VPS for $5/month

    You can just use VirtualBox to run a virtual Linux machine for testing, though.
  17. gnasher729 macrumors P6


    Nov 25, 2005
    Have a look at the cost of CloudKit. It's free "with limits", and I'd expect it to be not too expensive when you exceed the limits since 200GB on iCloud is $3.99 per month. And you will save on awful lot of time writing code, because you don't need to write any server code, and the client code is a lot simpler.
  18. simon48 macrumors 65816


    Sep 1, 2010
    Running a LAMP stack sounds like a good fit, especially because it looks like having a database would be good.

    If a web app works, can you use a pre-made CMS? That would surely help development go quickly. It might be a bit overkill for this, but I highly recommend Craft.

Share This Page