I have to create an API (JSON REST) for a project that has recently moved onto AWS, with a PHP CodeIgniter code-base, and an RDS database.
I have a bit of a dilemma, because I'm unsure what route to take to create the API. My two options seem to be:
Create an API with CodeIgniter Rest Server
Use AWS, using a combination of Lambda and the API Gateway to GET and POST to my RDS database.
The paramount priority is security, so that points towards using AWS, as far as I understand, but after failing in my attempt to make a small scale mock-up on AWS, I'm left a bit confused.
I wondered if anybody had any input as this is somewhat of a niche question, and I've had no interaction with AWS or CodeIgniter Rest Server.
Thank you for your time!
I can help you in a bit since I've experience with deploying Codeigniter base web system onto AWS.
First of all, the security in questions... AWS wont help much. Yes, it is by default have more security layer. But it is no use if your application itself is not secured.
So here goes:
If you want to deploy fast, I'd suggest go through EC2, install one of the image that have LAMP configured (from market, should've free image that you can use)
Upload to the server, configure the right config
Then it should work as per what it is intended.
But if you want to utilized auto scaling features
Setup the Elastic Beanstalk (EB) for PHP environment
ZIP up the codeigniter source code with all setting configured as below
Database setting point to RDS
Session to use database driver and create the needed table in the RDS
Upload and deploy to the EB
Then hopefully everything is working fine
Then, if to use API Gateway & Lambda, you will actually need to learn a bit more things.
How to configure API Gateway, to get familiar with how to use it
How to "link" it to lambda
How Lambda need to read request & response back etc
Also on Lambda no PHP support yet, so need to learn nodejs/python etc in order to use it
Basically if want to use API Gateway & Lambda you might need to start the development from scratch.
Related
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.
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
I am trying to add my application to amazon aws using the Beanstalk API.
I have a few webpages along with a backend in php and database in MYSQL which is called from the webpages using AJAX.
I want to deploy this on Amazon aws using the Beanstalk API and loadbalance it using the LoadBalancing API. I don't seem to find any tutorial online which would help me host my application.
Can someone guide me to how I should go about deploying my application ?
Amazon Elastic Beanstalk for PHP is somehow documented here.
As for your setup, here are the basic steps:
1. create an RDS instance manually. don't set Elastic Beanstalk do it for you as it poorly manages it. in the Beanstalk setup wizard make sure you use your preset RDS and not let the wizard create one.
2. start the Elastic Beanstalk wizard, define it as a web server and ensure the Environment type is Load Balancing, autoscaling. This will automatically create the load balancing configuration so don't worry about that.
3. from there I'd recommend continuing with the sample application just to make sure everything is setup correctly.
4. After the application launches and you're able to access it from the web, you should go ahead and git aws.push your own application. some doc here.
A fair warning - Amazon Elastic Beanstalk isn't easy to set up. If you are signed up to their support - use it. a lot :)
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.
I am currently starting on a project for school where we are to make a prototype for an application that uses PHP and SOAP to access a Dynamics CRM server.
So far I've gotten my apache server up and running and a project set up in Netbeans, simple .php files work just fine...
Now I'd need a similar database as is used in a MS Dynamics CRM system that I can run locally (so no network connection or configuration is required). Connection to the actual database (of the company we make the prototype for) is impossible.
An SQL server would be the easiest option I know of (according to a post here MySQL is incompatible with the dynamics database so that's not an option) since we have used this in class already, but is this a comparable database to the one used in Dynamics CRM?
This assignment is slightly out of my league since I have had no experience with PHP or SOAP coding, but then again we only need to simulate a couple of simple insert/update/delete/... statements - only problem being I have no idea how I should simulate their database.
Thanks in advance for you help, feel free to ask any extra questions if you need more information
Just having a database isn't going to be enough here. Dynamics CRM is the application which has the SOAP web service endpoint and then performs any actions on the database.
You cannot just run SOAP calls directly against the database and you should not be directly editing the CRM database - its not supported by Microsoft.
What you really need is a full development environment - CRM, SQL, AD the whole setup.
So traditionally you might go for a local server with CRM On-Premise, SQL and all their prerequisites installed, not a cheap option and it sounds like it might be beyond your current resources.
So my suggestion would be to go for CRM Online - basically Microsoft host everything and you access CRM via the web. CRM Online is basically the same as CRM On-Premise, there are some key differences but you will be able to perform all your SOAP calls against a real working CRM.
Even better CRM Online has a 30-Day free trial, after that its a $44 a month per user, but as I understand you can just keep creating more free trials.
Also you then need to get your clients customisations installed on the environment. You can export those from CRM and import them into your development environment. You can do this without taking an live data - which is probably why the client doesn't want to give you their database. The reason this is important is so you have the correct data model which is very important for the SOAP web service calls.
In regards to the PHP SOAP bits you might want to have a look at: PHP MSCRM, I haven't used it myself but it looks useful.
As a side, you may want to look at the OData endpoint of MSCRM you may find it more straightforward to use from PHP.