I'd like to run a grunt command to build my html pages after cloning/pulling my code into my App Service webapp.
Doing it manually is one thing (better than nothing), but ideally I could run it automatically. Right now I have a git hook configured to deploy the code to my app service when pushing to a specific branch. This won't update my page unless I can run my grunt command. I can't figure out how to run a script or custom command that would allow me to do this.
How can I do this?
Per my understanding, I assumed that you could leverage Continuous Deployment to Azure App Service and build your custom deployment script for running grunt command. Here are some tutorials, you could refer to them:
Kudu development
Kudu development hooks
Grunt
Additionally, here is a similar issue about deployment script, you could refer to it.
Related
We are running a GitLab with CI and want to deploy our application onto a Windows server. This will be just a demo system so we are quite open how we run the app later.
Currently we build and test the application. Now we need to stop the old app at the server, bring the new build onto server and start the new app.
I want to use at best the tools from GitLab but this isn't a must and as you can assume I am not so used to GitLab Deploy stuff.
Docker would be also an option.
Do you have some ideas?
Thank you
Nico
If you aren’t precious about the actual deployment of your web app then the easiest thing to do would just be install a gitlab runner on your test windows host. You should use a shell runner, so it can operate as a “fake user”. You’ll also need to ensure the user the runner is installed as has the right creds to install your app.
Tag this runner so it will run for a particular job, then within your gitlab ci you can take a copy of your build as an artifact (see gitlab ci artifacts).
Artifacts are automatically copied between runners so long as they are within the same pipeline run so you will have accsess to your built web app and can then install it how you like.
Problem: I have a project with a server (Express Server that handles file uploading and deleting) and client (Front End Create-React-App). The project structure looks like follows:
Root Folder With Server
Client Folder
Each folder has it's own package.json. Server Package.json. Client package.json
I'm trying to build and deploy onto azure however the pipeline hangs on "npm install and build".
It seems like the build succeeds but this phase just hangs. Here is my server.js (the routes are not included) file and yaml file just in case.
I'd appreciate any kind of help. Thank you!
Troubleshooting suggestions:
In the case of ensuring that the code in github is consistent with the local code, if an exception occurs, it is recommended to replace the linux platform and redeploy.
It is recommended to use my suggestion to recreate the repository, and then check the Action status in github.
Sum up:
In general, it is more appropriate to use Linux in azure than windows. For example, Linux supports npx, and may also support other packages and commands.
When the local code can run normally, there is generally no problem when deploying to github, unless there may be modifications, which we have ignored. So make sure the code is consistent.
General correct deployment steps:
First in the portal, make sure to create a web app application (not a static web app), and select the node environment.
Make sure that the sever program can run normally locally. Create a new repository in github.
->git init
->git add.
->git commit -m'init'
->git remote add origin https://github.com/{your name}/newAppname.git
->git push -u origin master
Connect in the Portal's Deployment center.
Then check the status of Action in github.
This question feels so simple that I'm confused why I can't find an answer!
We have an Azure web app, typically running on 2 to 5 instances.
At the moment we manually run a quite intensive PHP script a few times a day on a local computer to generate a folder of files. (The resulting folder isn't huge - typically about 10MB in size and a few hundred files in total.) We then sync them via Github and they deploy to the website. Easy.
That process is fine, but we want to move the PHP script to Azure so we can remove the dependency on running it locally and instead run it as a chron job.
How can we reliably sync the outputted folder from our script into our web app?
One option is to use a triggered WebJob with a cron schedule. Your WebJob can contain just your PHP script. Or if it needs a special command line to run, include a run.cmd batch file with the full PHP command line.
In your PHP script, do whatever you need to gather the right set of files, and then just copy them to %home%\site\wwwroot\json-data.
For this to work, everything you need to do within your PHP script needs to be runnable within the App Service sandbox. You should first try this directly from Kudu Console before moving it to a WebJob, to make sure everything can run.
Set your web app deployment source to Local Git. After that push your code to WebApp by Git Push . I am not sure about PHP build process but when you push your code to AzureWeb app via LocalGit method it builds and restores all dependencies and deploy it . For custom build script you can refer https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script.
https://medium.com/#trstringer/custom-build-logic-post-git-push-with-azure-app-service-and-kudu-for-a-node-js-web-app-1b2719598916
i've an application Mean that will deployed on Azure in a continuous delivery.
We have define on VSTS a build script that build typescript to JS file, clean up unuseful files, a gulp task that zip files and finally copy zip files on drop folder.
After on release level we will have a script for IT environment, staging environment.
We have an Azure Web App Deployment task, it takes the zip files and decompress the files rightly.
But if i let the node-modules folder it takes more that 2 hours ...
i search a solution to launch an 'npm instal' after this task.
I know that's possible to go to Kudu and launch the npm install.
I've tested solution with a deploy.sh (see on the net) but task not launch automatically like i see.
I've try to launch a power shell script but it's failed ...
I've the feeling that's not possible except manual intervention via kudu or other .
There is a way to do this, in the Azure Portal go to your Web App then select "Deployment Options". In there you will see ways to load your app automatically from github, Visual Studio Team Services, OneDrive, and more.
It's all automatic, from the copying of the code to the npm install. Works great for us for development, test, and production environments using VSTS and we have a node/express/angular app.
Here are the docs for setting up automatic deployment:
https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-deploy
My problem is that I need to run a custom cmd file after the build.
Instead of modifying the deployment scripts I just want to run few MSDOS commands to my deployment easily.
The task I need to do is to run a cmd at the repository located at /source/copyextrafiles.cmd after the build succeeded.
How can I achieve that?
At the azure portal on the CONFIGURE tab of your website add a "app settings" entry called POST_DEPLOYMENT_ACTION with the value of source/copyextrafiles.cmd
Save and the next deploy will run the cmd for you after the deploy.
Here the picture:
An alternative in addition to the solutions already provided is to copy the script in to a specific folder provided for post deployment action hooks.
So after creating a new directory in "D:\home\site\deployments\tools\" named "PostDeploymentActions", you could just add script files (.bat, .cmd or .ps1) into the directory and they will all run, one by one, after each deployment.