I want to host an Azure Website and I need to run a PHP script on the site every hour. Usually I would do something like this using cron jobs. Is Azure WebJobs via Azure Scheduler the only option to accomplish this?
Using PHP or a REST API via PHP cURL, how do I create and deploy an Azure cloud service worker role to run some back-end PHP software independent of the website?
How would pricing work for the cloud service? Would I only be paying while it is deployed, or would I be paying when it is created also? E.g. Could I create the service via Azure portal and deploy via PHP to get same pricing with less coding?
How do I stop a cloud service once it is done processing?
You can use the Azure WebJobs under the website as you pointed out. You can also use the Azure scheduler direct and have it fire a call to another website or even an external system somewhere to kick something off. There is also a scheduler in the Azure Marketplace you could look at. Another option is the Azure Automation, which allows you to run a script separate from a web site or other deployment, though is PowerShell.
You can create deployments using the Azure Management REST API. Here is some documentation on how to use the API from PHP. As for running this independent from the website, you'd either need to run this from an external system, or from a VM running within Azure.
You pay for the Cloud Service from time it starts its deployment until the deployment is deleted. You pay only when something is deployed to the Cloud Service. If you create a cloud service via the portal or script, but don't deploy anything, then you aren't charged anything. When you deploy something into the cloud service you will be charged for as long as the deployment is there.
Based on this question I'm assuming you mean the cloud service is some sort of back end processing. You could have the cloud service use the management api to shut itself down, but that would require that the management certificate be deployed with the cloud service, which some people don't like to do for security reasons. Other folks would have the worker roles push messages to an external system, or another service running in Azure, to say that they are done and it would then reach out and shut them down. There are really several options here depending on if you want it all managed in the cloud or have resources elsewhere that would perform the shutdown. The link to the management APIs above will give you "how to" shut them down, but the decision on what does that is really pretty open.
Related
I have Laravel application runs on an azure VM and I would like to send app logs to Azure Monitoring Logs instead of use the traditional log file.
I have checked this documentation https://learn.microsoft.com/en-us/azure/azure-monitor/agents/data-sources-custom-logs but it also depends on custom log file.
Is there any other solutions to send logs directly to azure?
For monitoring application data, we use azure application insights service. However, currently the instrumentation is available only few languages as stated
in this document (https://learn.microsoft.com/en-us/azure/azure-monitor/app/platforms#unsupported-community-sdks)
Alternatively, you can use Open Telemetry in PHP which is a observability framework – an API, SDK, and tools that are designed to aid in the generation and collection of application telemetry data such as metrics, logs, and traces which is not currently in production.
You can also leverage the below SDK to write your custom log messages to application insights.
https://github.com/Microsoft/ApplicationInsights-PHP
https://github.com/provisions-group/ms-application-insights-laravel
I am using microsoft azure as a hosting.It is using Microsoft-IIS/8.0 server for running my Codeigniter website.
How can I setup my website few url's as a cron?
Per my understanding, you want to leverage an Azure Service or feature to make your several Url endpoints as schedule jobs.
You can leverage Azure Scheduler to achieve your requirement. For step by step guide, please refer to https://learn.microsoft.com/en-us/azure/scheduler/scheduler-get-started-portal.
Additionally, if you want to make your internal PHP scripts as schedule jobs, you can leverage App Services' build-in feature, WebJobs. For more info, please refer to https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-create-web-jobs#a-namecreatescheduledacreate-a-scheduled-webjob-using-the-azure-scheduler.
Any further concern or if I have any misunderstanding, please feel free to let me know.
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 have 2 questions:
First, what's the difference between a web application and a cloud application? Are there any differences at all? If I'm developing a web application (a site with many interactive features), can I call it a cloud application?
Second, if there's a difference between a cloud and web application, what languages can cloud applications be developed in? Would a scripting language like PHP be useful for that?
Thanks.
UPDATE: I have watched the video in one of the answers, but I am still a little confused. Taking Google Docs as a example, all I see is a user interface that can be created with html and JS, along with a server script, and the data is stored in a database, which is basically the same thing a web application does. Or is it different?
Thanks
Web applications can run on "the cloud". The cloud is basically a collection of dynamic computational resources (cpu, ram, storage etc) that can be used by web applications.
This allows apps running on the cloud to scale well because they are allocated resources dynamically.
You can use public clouds such as Amazon's EC2 - or build your own private clouds.
A web app running on a cloud isn't exactly a "cloud app" - but the app is simply hosted on a cloud.
I find the first half of this video explains it very well (if a little annoying).
Also see this quesiton which has some good answers.
A web application is an just an application deployed on a web server.
The user accesses this application knowing that it is accessing a remote application and this application has a specific purpose.I.e. implements a specific functionality.
When you start talking about the cloud, you have a different concept alltogether.
The idea is that you want to access a service that you have no idea where the service actually is being deployed.
The main benefit is that a company can save resources.
For example a company can have e.g. their own CRM and have to pay money for servers, for IT personel etc. or just access a service in a "cloud" where the company providing the cloud is responsible for the servers etc.
So to answer your question, to build the cloud you use web applications as "modules" to provide the cloud.
But a web application by itself (separate of this context) can not be considered as cloud application (unless it runs as part of the cloud).
Anything that runs locally can run in a "cloud". Cloud computing is the inevitable movement of traditional applications/processes to a dedicated provider. Analogous to the Walmart syndrome, where little mom and pop shops have fallen by the wayside.
The difference between a cloud and web application is where it sits.
Web and cloud apps both are distributed applications having server and client parts. They store data on a server side, but can have local data cache for offline cases.
Web applications performed/run by browsers. Normally, they are written on HTMP/CSS/JavaScript. Adobe had another vision of client parts. They proposed special Flex language for Abobe Flash as client run-time environment (prior it has been killed this year).
Cloud apps are very similar to web apps, but their client parts are native applications specially developed to run on selected target platforms (OS X, Win, iOS, etc.)