Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Git deploy into site folder not wwwroot

This would seem to be an easy task although I can't find the solution. I've recently started a Laravel 4 project which needs to be hosted on Azure. I've linked Azure to deploy from bitbucket when a change is made. This however pushes the files into "wwwroot" folder in Azure (the public folder). Some of the framework files shouldn't be in the public folder therefore I would like to push to the parent folder "site".

After some research I discovered you can use .deployment file to config deployment options (https://github.com/projectkudu/kudu/wiki/Deployment-hooks)

So I tried .deployment file:

[config]
DEPLOYMENT_TARGET = C:\DWASFiles\Sites\SITENAME\VirtualDirectory0\site

Unfortunately this causes an error:

Source and destination directories cannot be sub-directories of each other

This would be due to the fact the repository folder sits in the site folder aswell. If I change the deployment file to:

[config]
DEPLOYMENT_SOURCE = C:\DWASFiles\Sites\SITENAME\VirtualDirectory0\repo
DEPLOYMENT_TARGET = C:\DWASFiles\Sites\SITENAME\VirtualDirectory0\site

It runs without errors but it pushes nothing as the repo folder is empty, I guess if I could get Azure to put the files into \repo instead \site\repository everything would be fine.

Maybe I'm over complicating things and I'd really appreciate any advice. Worst case I can just push to the "wwwroot" folder and use a web.config to fix things.

like image 997
dciso Avatar asked Sep 16 '13 21:09

dciso


People also ask

How do I deploy a repository to Azure on GitHub?

In the Azure portal, navigate to your app's management page. From the left menu, select Deployment Center > Settings. Select Local Git in Source, then click Save. In the Local Git section, copy the Git Clone Uri for later.

What is the recommended way to deploy a custom code solution in Azure?

Navigate to your app in the Azure portal and select Deployment Center under Deployment. Follow the instructions to select your repository and branch. This will configure a DevOps build and release pipeline to automatically build, tag, and deploy your container when new commits are pushed to your selected branch.


1 Answers

This is not very well supported today, but you may be able to make it work by setting a couple things in the app settings:

SCM_REPOSITORY_PATH=..\repository
SCM_TARGET_PATH=..

This basically tells it to put the repo directly in VirtualDirectory0 (as opposed to VirtualDirectory0\site), and then to deploy to VirtualDirectory0\site (as opposed to VirtualDirectory0\site\wwwroot).

This assumes that your repo contains a folder named wwwroot.

Some info on these paths here

like image 89
David Ebbo Avatar answered Oct 07 '22 20:10

David Ebbo