I'm working with an AngularJS app that I am hosting on Azure as a Web App.
My repository is on Bitbucket, connected as a deployment slot. I use TortoiseGit as a Windows shell for commit/pull/push. Grunt is my task runner.
Problem: I am not managing to replace the build folder after a push has been made. This is what is being exposed on Azure (see picture):
What I've tried:
Batch file using Windows ftp.exe replacing the folder after push using mput
Following this guide by taking advantages of Azure's engine for git deployment(s) that is behind every web app.
WebHook on Bitbucket calling URL with simple PHP script doing a FTP upload
Currently my solution is that after a push I'm building using grunt build and connecting through FTP with FileZilla and replacing build folder manually.
How can I automate this?
Thanks in advance.
I solved this by refactor my initial batch script that calls:
npm install
bower install
grunt clean
grunt build
winscp.com /script=azureBuildScript.txt
and my azureBuildScript.txt:
option batch abort
option confirm off
open ftps://xxx\xxx:xxx#waws-prod-db3-023.ftp.azurewebsites.windows.net/
cd site/wwwroot
rmdir %existingFolder%
put %myFolder%
exit
This is being triggered Post-Push as a Hook job in TortoiseGit.
It turns out ftp.exe is restricted regarding passive mode and can't interpret a session whilst WinSCP does this with ease.
Related
I am working on development of a web app (for learning) in Laravel and I`m using Bitbucket for source control. It will be deployed on couple servers (20 or so, perhaps more over time), and I would like to be able to update all of them as the app changes over time.
The problem is that I will not have SSH access to most of those servers so I wont be able to use a simple "git pull" (a server we test on does not even have git installed so shell_exec is not an option also).
My plan was to make a script that will download latest zip from Bitbucket server, unpack it overwriting the old code, and then running a Laravel script to run migrate (for eventual database changes).
Is there maybe a more sensible way of doing this?
What are you looking for is CI/CD, i.e. Continues Integration/ Continues Delivery. There are so many ways to automatically deploy or pull a code over server. You can use following methods
Automating Deployment to EC2 Instance With Git
Using Bitbucket for Automated Deployments
CI\CD workflow with BitBucket Cloud, Bamboo, AWS CodeDeploy
Bitbucket - Manage Web Hooks
Apart from this you can find so many articles on this, but if you wants to automate the process at laravel level then use Laravel Envoy
what my aim here is to, upload my project that is basically a controller returning a twig template its as simple as that, i just cant figure out how to get it on the hosting.
I have been using symfony for a few months now, so still new to it all. and all the hosting/details stuff is new too me.
Whats throwing me off is my understanding of a hosting web/ folder
and how azures its wwwroot/
i used this website
http://symfony.com/doc/current/cookbook/deployment/azure-website.html
but i'm finding it rather difficult to follow it..
does anyone have any better sites with more clear steps on how to deploy? i've read a lot about a public_html folder but i've never heard/used it before
If someone could explain how the www.domain.com/web/app.php works that would help, i know that, that is the file that is called, but not too sure if i need to say call this file "app.php" or if its done kinda like the way a standard websites looks for 'index.php'
any kinda help or pointers would be much appreciated here as i'm kinda lost
Generally, we can build our project and test on local, then deploy on Azure Web Apps via Git or FTP tools.
Here is my test steps:
Build Symfony project on local, referring Using the Symfony full-stack framework
Login to Azure preview Portal, click NEW=> Web+Mobile=> Marketplace, in Web Apps section click Web app + MySQL, then click create.
When finishing creating Web app service, we can find MySQL connection string in Settings=>Application settings=>Connection strings click show connection string.
then click Set up continuous deployment in Deployment section. Select Local Git Repository for the source. Then in Essentials section, we can find there added a Git URL. Copy it.
In your local symfony project, make sure your Symfony repository has a .gitignore file at its root directory with at least the following contents:
/app/bootstrap.php.cache
/app/cache/*
/app/config/parameters.yml
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
/app/SymfonyRequirements.php
/build/
/vendor/
/bin/
/composer.phar
/web/app_dev.php
/web/bundles/
/web/config.php
run the following commands to init git repo and first-time push to Azure:
`
git init
git add .
git commit -m "initial commit"
git remote add azure [URL for remote repository]
git push azure master
Sign on Kudu console of your Azure web site, at https://<your-website-name>.scm.azurewebsites.net/DebugConsole, run following commands:
cd site\wwwroot
curl -sS https://getcomposer.org/installer | php
php composer.phar install
Now visit http://<your-website-name>.azurewebsites.net/web/app.php in browser, we should see the project.
Now we need to configure URL rewrite to remove /web/app.php pattern of the url. Add a file named web.config with the content shown in Deploying to Microsoft Azure Website Cloud in the root directory which is /site/wwwroot on Azure. Click restart on Azure portal, now we can visit the site at http://<your-website-name>.azurewebsites.net .
By the way, for deploying a PHP-MySQL application on Azure Web Apps, we can get more information at Create a PHP-MySQL web app in Azure App Service and deploy using Git. And specifically for Symfony project, the Symfony guide is still useful, and we can ignore section Enabling the PHP intl Extension .
If you can't change the name of the "wwwroot" directory to "web", you have to change the configuration of symfony to use "wwwroot" instead.
Have a look at this page!
I think the easiest solution is the one with the symlink:
Some shared hosts have a public_html web directory root. Renaming your web directory from web to public_html is one way to make your Symfony project work on your shared host. Another way is to deploy your application to a directory outside of your web root, delete your public_html directory, and then replace it with a symbolic link to the web in your project.
I have a PHP website that is automatically being deployed to Azure, this works well.
However, I would like to use a custom deployment script to automate moving certain files to Azure Storage/CDN on deploy. I've set up azure-cli using npm and created a deployment script using azure site deploymentscript --php. The deployment scripts were created and I've added my own script at the end of deploy.cmd.
My problem is that, the generated deployscript does not appear to be used. In the azure deploylog it says this:
Generating deployment script
Using cached version of deployment script (command: 'azure -y --no-dot-deployment -r "D:\home\site\repository" -o "D:\home\site\deployments\tools" --basic --sitePath "D:\home\site\repository"').
Running deployment command...
Command: "D:\home\site\deployments\tools\deploy.cmd"
etc...
That deploy.cmd is not the one it should be using- not the one I can change.
So, how do I get it to stop using a cached deploymentscript, or to use my custom deployment script?
Try to add the .deployment in the root folder, and then the deployment.cmd inside the specific project. This way I got azure to do the non cache deployment. Just ensure that you update the path to the .cmd file inside the .deployment file.
I am running a PHP Project (Drupal-Multisite-Enviroment) on Azure web-role with WindowsAzurePHP SDK. Everything works pretty fine. Now I want to implement continuous-integration with TFS and i am wondering, if anybody has ever done it before, because i can't find any documentation about it.
I understand that the deployment process on Azure is connected to the build process on TFS. But what is the output of that azure-specific build-process? The deployment package *.cspkg and ServiceConfiguration.cscfg?
If so, do i just have to make a custom Build, that moves PHP files to a temp folder, calls the Azure SDK package-batch and pushes the package to Azure cloud afterwards?
I would appreciate it if you would share your experiences with me.
I have not done it before but yes... If you set your solution to build in Team Build you should get the Azure specific output only.
The easiest to get your PHP into the right place is with a pre or post build PowerShell.
https://github.com/tfsbuildextensions/CustomActivities/blob/master/Source/Scripts/GatherItemsForDrop.ps1
You should be able to use this PowerShell after build to put together your PHP with your azure bits that just got built.
Then create a post test PowerShell to deploy to Azure.
You can set PowerShell scripts to run by editing the build definitions and on the process tab opening the "advanced" sections.
Note: Make sure that you are using DefaulTemplate.12.xaml.
We are trying to automatically deploy our web application using Git, GitHub, and PHP on a Cpanel/WHM server.
I've tried, using the information in the article below, to set up a deploy script on our server that GitHub posts to when we push to the repo.
https://gist.github.com/1809044
Unfortunately, it seems that the fact that apache is running scripts as "nobody" is preventing the script from running. We created SSH keys as the account's user, and the git pull command is not running.
Is there any way to successfully pull a git repo from GitHub on a deploy hook and have it update without installing something complex like Jenkins?
Do you have control over how apache runs? I'm dealing with some e-mail/spam issues. I've also been reading that if you run suPHP, your apache will run as the user of that account. Sounds like that might be what you need.