Cloud based alternative to LAMP that can communicate to external API's - php

I am developing PHP plugins for CMS systems that at the moment communicates with my LAMP (PHP server) setup. As I am about to rewrite my server and PHP plugins and I am looking for a way to bypass the server konfiguration, maintaining and so on.
The server receives JSON, saves information from the JSON to my MySQL database, creates new JSON calls to external API's handles the response, saves part of it to the database. Merges pdf files from the different API's and creates a final JSON response to the CMS plugins.
My questions is in regards to a big update of my modules; Is there a setup that allows me to disgard my LAMP setup and use a cloud service? I have looked at Apigee and Parse but I don't know if they can make external API calls and handle the response of the API's?
If this can be done is it using Node.js?
Thanks.

Certainly Apigee can make outbound calls either through our policy based proxies or with a Node based proxy. Passivation of data can be accomplished through our KVM policies.
You can try it out with the free offering and see if it makes sense.

So you want standard website hosting with a MySQL database?
Any web host can do this for you. They manage the server, handle updates, etc. You just run your code in your little folder. Setup your domain. Connect to the database that they setup.
How much traffic are you doing? Do you need a whole server? A wee one or a giant one? Failover? Backups?
You should also look into Application Hosting with one of the big providers if you are worried about scaling.
http://aws.amazon.com/application-hosting/
http://www.rackspace.com/saas

Related

Mobile App - Communicating with an external server

I'm building a mobile project that needs to be in constant communication with a server and i need some information . I know how to build local apps but this is the first time that i'm building an app that requires external call to a server / authentication service .
I'm asking for guidance how to proceed and which services/servers to use.
What type of server/database do i need ?
I'm guessing i will be requiring an API service but no idea how to choose/make one.
I want to use azure services/database but i also don't want to be dependent on it. I want to have my own url that i send request to and interact with a server/db that i can later move to another host fairly easily.
I develop websites mostly and i'm familiar with php/laravel + Mysql but i think in this case it will be overkill to create a laravel app simply for the server backend .
The app will be mobile only so i don't expect to have a webpage for it . simply an external server/database where the data will be saved.
First i need an authentication service - where each user will register on the phone which will then be saved in my external server/database . Then when they need to login - they will input the login details on the phone , which will query the esternal server/database and if validated - get their details from the server.
First, you need to decide which kind of server communication you'll need. it's in real time and constant? then you'll need a websocket. It's in bursts when you need to send or get data? then you'll need some kind of webservice (REST, RPC, SOAP). Then you have to evaluate the user load you'll have. And finally, the human resources you'll have.
Based on your question, I think a REST webservice will be more than enough. You may:
-Create a REST service for every group of related resources. Example: the /user URL should handle the signup, login, logout and user update operations.
-Create a method for each one of those operations and handle them. Then, call the method from the REST service class.
-Depending on the amount of users and the technology you're using, create a server to handle the requests, or upload your REST project to a server (tomcat, for example).
-Create an app and consume the REST services from there.
There are tons of tech you can choose for these things. PHP allows creating REST services, I think. Java is a very good choice too, since you can use the same code in both server and android apps. Node.Js is pretty popular, too, since you don't need servers and uses NIO (althought java can do both things using jetty and also has multithreading); golang and scala both have superb performance (golang is a lot more easier to learn, though, and it has no need to use external webservers).
Hope this helps.
For mobile applications the best will be REST (representational state transfer),becouse is lightweight and flex to use in other technology. I had project which include REST and mobile app and web app and it working very well.
In this scenario, we usually will build a REST API service for client end. As you are familiar with Laravel, you can refer to http://www.programmableweb.com/news/how-to-build-restful-apis-using-php-and-laravel/how-to/2014/08/13#apiu for how to build a REST API service with Laravel. Also you can leverage other light 3rd part PHP frameworks to build REST API service.
You can create and develop the application on local and then deploy to Azure Web Apps. Please refer to https://azure.microsoft.com/en-us/documentation/articles/app-service-web-php-get-started/ for more info.
And there several vendors provide MySQL services on Azure. ClearDB is a BaaS on Azure for MySQL. You also can use the VM to host your MySQL Service. E.G. MySQL by Bitnami and MySQL by Docker.

Azure with API for WPF and javascript

I want to create following project :
Server application hosted on Azure - it connects to databse via Entity framework and gives and API for anyone who want to connect (but with account stored in SQL database)
WPF application - it consumes server methods, objects etc.
Web app (php & javascript) - also consumes server methods and object etc.
IMPORTANT : I have only azure student's subscription and I want to hold onto it - buying anything else is out of the question unless it has strong argumentation.
I figured that to do this I have to create REST Web API because I have no other choice to connect to server than via HTTPWebRequest (because I want to have the same API for WPF nad web app).
My question is : does better solution exists?
I think I can create different API's for desktop client than web app but I have no idea how to do that. Whould you be so kindly to show me other way?
Why dont I want to have this solution?
Reason is simple. For big databases and slow internet connection it would take ages to download whole data in few seconds. As far as my knowledge goes there is no lazy loading in REST thus my WPF application's thread reponsible for downloading database would freeze for a big period of time.
If my question is too broad please leave a comment before you put up a flag.
Also, any tips regarding my project design are well appreciated.
Different APIs for Desktop and Web: this can be done easily enough. Assume you have a class library to contain your business logic (domain stuff). Create a web api project that makes use of it, then create yet another web api project separately that also makes use of the core models. When you deploy, deploy each separately to a different domain/subdomain (I'm unsure if you'll require further Azure resources for this, but consider api.desktop.myapp.com and api.web.myapp.com... no real technical reason why you can't do it that way, though for architecture reasons I'd avoid it (it's really coming close to if not definitely is duplication of code).
Same API for Desktop and Web: you stated that you thought you'd have to do this differently for the desktop and web, specifically because of the resource usage on the server. I disagree here, and think you should implement some standardized rate limiting into your API. Typically this is done by allowing only X amount of resources to be returned in a single call. If the initial request asks for more than X limit, an offset/nextID is returned by the API, and the client submits a new request noting that offset/nextID. This means you have subsequent calls from the client to get everything it needs, but gives your server a chance to handle it in smaller chunks (e.g., check for rate limits, throttling, load balancing, etc). See the leaky bucket algorithm for an implementation that I prefer, myself: https://en.wikipedia.org/wiki/Leaky_bucket)

How do I use a server for mobile application?

I recently started to do development in the Haxe language with OpenFL (AS3 background).
But I have never worked on an app that communicates with a server - or never done any programming for servers for that matter!
I have to make a mobile app (for which I intend to use Haxe) where the new user creates an account on the server, and thus also interact withe other user accounts in a desired way.
So could someone guide me in the right direction to approach this situation? I'm guessing I will need to use PHP or ruby etc.
or can I use Haxe to program on the server? are there any good libraries that also provide security while making facility for user accounts? Is AWS or Google app engine something I can use?
check this simple but complete tutorial by filtreck
http://mromecki.fr/blog/post/haxite-writing-entire-website-using-haxe
You will want to create normal web pages that you can host on the server which will retrieve the needed information.
After having uploaded these, use a type of webview in the application to load the pages and retrieve this information.
You can write your server in Haxe if you want, and if you use a platform that supports it you could use TCP and haxe.remoting to pass data between the client and the server.
haxe.remoting is intended to make calling haxe function in a server from a client easier so that may be what you want.
If you don't feel confortable with using TCP you could do as Max wrote, just make some HTTP API (you can do this too in haxe) and do normal HTTP request from the client.

Running PHP on Windows Azure

I have a Windows Azure subscription.
My requirement is to run a PHP script on my server. This PHP script will create a JSON file.
This JSON file will be downloaded by my iOS app. (Some kind of authentication is an added bonus)
How would I go about doing this? Should I create a "Mobile Service" or should I create a "Website" or something else like "Cloud Services"?
As far as I have researched, I think the only way to do this would be the old school website way. Any input on this will be really helpful. Thanks.
Mobile services are great if you want to create a quick CRUD layer for an app with a backend cloud storage such as Azure SQL DB. It also provides support for scheduled tasks and push notification. But for what you're after (producing a JSON file), you may find it easier to go with Azure Web Sites or Azure Cloud Services (PaaS). Azure Web Sites has a model that you'll likely find easier and with the free/shared tiers, provides a lower cost point for many models. If you want something that gives you a bit more control, then Cloud Services might be a good alternative as well. But given the simple example you've provided, you should be able to accomplish this fairly quickly using Web Sites.

FileMaker: integrating with Magento

I would like to write a Magento web-app working with Filemaker database.
Could I overwrite the database core files with code using filemaker php api?
What other options are there?
I wanted to do an interface between Filemaker and Magento database but cause of the EAV it's a nightmare to bind the Magento database with a filemaker database. If you want to do that you really need to use PHP in Filemaker and use the SOAP API of Magento if they are separated hosted.
You could too integrate the Magento core API into a PHP script with Filemaker API too if you host your Magento on the same web server or by installing a new Magento instance pointing to an availalble external database. You could do a local replication of the mysql database too on the Filemaker server.
To integrate Magento Core APi it's easy in a PHP file, you set the following:
<?php
require_once 'yourmagentoinstallation/path/app/Mage.php';
Mage::app('default'); // default can be replaced by your default store code
// You can use Magento code (model, EAV, singleton, block, etc)
...
?>
It's possible, there are different ways but I didn't find when I needed an out of the box solution.
It depends on what you mean by "integrate". I doubt you'll need to do something in the lines of "overwrite database core files". Most likely you'll need to update FileMaker when an order is placed and do the same thing to Magento when they get a stock update. It's quite likely that these two scenarios would have to be implemented in vastly different manner.
Here's what FileMaker can do. Its XML backend can readily accept GET and POST requests to the server. Their syntax is fairly advanced and you can find records, add, delete, and duplicate them, run FileMaker scripts, etc. It's nowhere near SQL, especially searching, but quite logical. The server responds in XML. Here's the manual (PDF).
The server can also accepts arbitrary requests sent to its PHP API. (It also has a XSLT API, but it's deprecated and is going to be removed.) The API then reshapes the request as it pleases, talks with the XML backend, and returns back the result. As I'm not a PHP expert, I'm not quite sure where the API is explained, but it must be somewhere here.
FileMaker itself (i.e. its desktop client or even the server) can use plug-ins to talk to web services. E.g. as the stock updates the desktop client can prepare and send requests to Magento API.
And FileMaker can access certain 'big' SQL databases directly. E.g. it can connect to a MySQL database and work with its tables very much like with its own. Maybe it would be unwise to allow free work with core Magento tables, but a carefully scripted updates look like a viable option.
The plug-in and direct connection are better left to FileMaker developers, while the XML and PHP (XSLT) APIs are pretty standard web stuff.
Productive Computing has done some work with Magento. It sounds like they are using external datasources to connect which would make for an overly excessive integration.
Productive Computing Blog
Our NRGship products use the Magento PHP API to pull order data and update order status post-shipment. In order to mirror this, you would need some PHP code server-side, and then use a plugin like Troi URL to invoke http requests to query and update record status.
Providing more information on your needs would allow for a more detailed response.
I use the JDBC driver that comes with Filemaker Pro and I have built a server app in Java that connects to filemaker through JDBC to auto insert data such as orders etc and have background tasks automate updates such as product updates and order status updates by getting data from filemaker through JDBC. The java server app then sends SOAP API requests off to Magento to handle the data exchange.
We have extended this further by having the server app listen for XML messages/commands on a socket so I can have real time integration to filemaker where needed. I then have a simple filemaker plugin I wrote using 24U Filemaker Plugin Template that sends small XML messages to the java server application which then issues an API call to magento accordingly. Filemaker waits for the server app response which gets returned and then filemaker continues the rest of the script that called the method.
It's a lot more elaborate than this in the sense it has a queue of tasks to perform so not to overload magento API, and we have a DB connection pool for the filemaker JDBC connections to save the overload of opening and closing connections. This works really really well, and we literally have the entirety of Magento integrated with filemaker and have produced many custom API modules for magento to achieve additional functionality which magento does not provide.
I was reading it's possible to create Java Plugins for java so in theory you could do away with the server app and simply create a filemaker plugin which has the magento API function calls built into it. If using V2 WSI Compliance mode for magento soap calls you could generate all the stub classes and methods using the JAXB web services plugin which is part of Netbeans which will save you days and days of work.

Categories