Will the autorun autostart job work in an azure application?

I created one launch task for an Azure application containing an exe file (periodically executed with some time interval), and now I would like it to perform automatic configuration every week, as I asked before here

However, I will make some logic for replacing this file through this exe (startup task), and will also have no effect for the new file. I came to the conclusion that the new launch task will only take effect if we update / create an azure project with a new file. (Correct me if I understand something is wrong)

So, is there a way to perform my logical operations by reloading the instance (exe / startuptask)? I think he will also take the original file (added to startuptask during application update / creation) instead of the new file!

Is it possible?

+2
source share
2 answers

After I studied your problem, I can offer a very simple solution, as shown below, which I made earlier for the Tomcat / Java example:

Prepare the EXE to reboot the virtual machine along with the source code :

  • In your EXE, create a method to search for a specific XML file in Azure storage at a specific interval, also add retry logic to access the XML
  • Parse the XML for a specific value, and if a specific value is specified, restart Machine
  • Put your exe in zip format and put in your Azure Storage
  • Be sure to put the XML in the Cloud and set the value of reboot = false

What to do in the Startup Task:

  • Create a startup task and download the ZIP from Azure Storage, which contains the EXE
  • After downloading, unzip the file and place the EXE in a specific folder
  • run exe

What to do if you want to update the EXE:

  • Update your EXE package in ZIP and place it in the same place in Azure Storage with the same name
  • Update your XML to enable reload

How the update will happen:

  • EXE will search for XML after certain internal
  • After he installs the reboot, he will reboot the VM
  • After rebooting, the launch task starts and your new EXE will be uploaded to Azure VM and updated. Make sure that downloads and updates are performed in the same folder.

Take a look at the Startup tak in the example below, which uses a similar method: http://tomcatazure.codeplex.com/

+1
source

This is a very unreliable decision. If an Azure instance fails or is removed for an upgrade, you will have a new instance launched from the original service package. All state of the modified instance will be lost.

A more reliable way would be for the volatile executable to be stored somewhere like Azure Blob storage. You upload the new version to the blob repository, and the role somehow sees that (either by polling the repository or some operation called by the user) it doesn’t matter), downloads the new version and replaces the existing version with the new one.

Thus, if your role fails, it will reliably retrieve the latest version from the persistent storage at startup.

+3
source

All Articles