Friday, May 1, 2015

Deploy your Go app onto Azure App Services (Websites) in ease

Try it:

             Click this link, you will deploy a sample Go web app onto your Azure subscription

Details:

Azure App Services now supports Go 1.4.2 with continues deployment. Once continues deployment is setup, every time you push code to your continues deployment branch, a new deployment will be trigger.

if you read the deployment log detaily, you will notice that Azure will create a Go workspace in temp folder, then copy your code to src\azureapp, build against azureapp folder and produce an "azureapp.exe".

Last, it generate a web.config and use HttpPlatformHandler to run your Go app.

Restriction:

  • Have to place main package at the root of your app
  • Currently only support Go 1.4.2, no able to select a specific Go version yet


Sample Go app:
    https://github.com/shrimpy/gotry

Sample Deployment Log:


Handling Go deployment.
Prepare workspace
GOROOT D:\Program Files\go\1.4.2
Creating GOPATH\bin D:\local\Temp\30a88a27-1ce2-49ef-b1b8-6f32716c9652\gopath\bin
Creating GOPATH\pkg D:\local\Temp\30a88a27-1ce2-49ef-b1b8-6f32716c9652\gopath\pkg
Creating GOPATH\src D:\local\Temp\30a88a27-1ce2-49ef-b1b8-6f32716c9652\gopath\src
Creating D:\local\Temp\30a88a27-1ce2-49ef-b1b8-6f32716c9652\gopath\src\azureapp
Copy source code to Go workspace
 -------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------
   Started : Thursday, April 30, 2015 5:52:54 PM
   Source : D:\home\site\repository\
     Dest : D:\local\Temp\30a88a27-1ce2-49ef-b1b8-6f32716c9652\gopath\src\azureapp\
     Files : *.*
 Exc Files : .deployment
   deploy.cmd
  Exc Dirs : .git
   .hg
   Options : *.* /NDL /NFL /S /E /DCOPY:DA /COPY:DAT /NP /R:1000000 /W:30 
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------
                Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         3         1         1         0         0         0
   Files :        13        13         0         0         0         0
   Bytes :    19.4 k    19.4 k         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00
    Speed :              182743 Bytes/sec.
   Speed :              10.456 MegaBytes/min.
   Ended : Thursday, April 30, 2015 5:52:54 PM
 Resolving dependencies
Building Go app to produce exe file
Copy files for deployment
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Deleting file: 'hostingstart.html'
Copying file: 'azureapp.exe'
Copy web.config
        1 file(s) copied.
Finished successfully.