Failing node modules through azure devops CICD
Hello,
About a month ago, i was able to deploy through Azure Devops to a Linux WebApp In build pipeline, i build a package and then i release that package. In the package i include node_modules compressed as node_modules.tar.gz I set the following value in Application Settings:
compressedNodeModulesFile : node_modules.tar.gz
In this way, in the deployment process, Oryx decompress that file into /node_modules and it worked great.
However, now.. has stopped working.
Doing a bit of research, also i've tried to define another parameter in application settings without success:
compress_node_modules : tar-gz
In the log oryx is not trying to discover if "node_modules" is compressed.
A month ago, the log was something like:
echo "Checking if node_modules was compressed..." case $compressedNodeModulesFile in *".zip") echo "Found zip-based node_modules." extractionCommand="unzip -q $compressedNodeModulesFile -d /node_modules" ;; *".tar.gz") echo "Found tar.gz based node_modules." extractionCommand="tar -xzf $compressedNodeModulesFile -C
Right now... doesnt do the same (logs does not show the same message either)
Regards
Hi @mohakevin, the compression/extraction of node_modules is an internal implementation used by Oryx which we did not intend for users to explicitly use; therefore, things might change behind the scenes without us notifying users.
It stopped working because we had a change where we now no longer get values from app settings but rather inspect the build properties from a file that Oryx creates in the build output folder called oryx-manifest.toml. You'd have to manually create this file with the line compressedNodeModulesFile=node_modules.tar.gz to make oryx extract node_modules for you.
To understand your scenario better and further improve our product, I have a few questions for you: i) What was the reason behind compressing node_modules from your DevOps build? ii) Have you decided to run your build in DevOps because Oryx failed to build your app?
Thanks
Hello @gpcastro and thanks for the answer.
It stopped working because we had a change where we now no longer get values from app settings but rather inspect the build properties from a file that Oryx creates in the build output folder called oryx-manifest.toml. You'd have to manually create this file with the line compressedNodeModulesFile=node_modules.tar.gz to make oryx extract node_modules for you.
I've discovered that tip saturday, but, i fear that it would change in the future too. How sure can i be that it's not going to change?
To understand your scenario better and further improve our product, I have a few questions for you: i) What was the reason behind compressing node_modules from your DevOps build? ii) Have you decided to run your build in DevOps because Oryx failed to build your app?
i) i found out the compressed node_modules uploading a node app through az webapp up and i feel it was a great way to do it.
So, i tried (and got it) to achieve the same process through Azure Devops.
ii) It's not about Oryx. It's because in my company we trust in Azure Devops to do all the CICD integrations. Is there a way to deploy with Oryx to WebApp (Linux App) from Azure Devops? It would be great a release task with that purpose. Now, we use Deploy Azure App Service.
Regards and thank you again!
Thanks for your responses. We don't have any plans to change the behavior of the node_modules compression in the near future, so for now you can keep using it.
We'll look into your suggestion of creating a DevOps task to run Oryx, I agree it is a great use case.
I will close this issue since your problem has been solved. Let us know if there's anything else we can help!
We just encountered this issue in our project today. We don't have an npm build step, instead node simply runs the index.js file to start a server process.
The deployment process completes and on the server everything is fine except that node_modules is missing for some reason. In it's place is a gzipped node_modules.tar.gz
On the Azure App Services side of things the system never attempts to decompress this folder if it's present (as seen in kudu). We then attempted to zip the deployment directory ahead of time hoping that it would avoid being compressed, but it seems to happen regardless
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy Apollo Server to Azure Web App
on:
push:
branches:
- development
workflow_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: npm install
run: |
cd server
npm install
npm run build --if-present
- name: 'Compress /server'
run: zip -rq server.zip ./server
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: '2dmetric-gql'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_e000bf13e0bfb0f3e2cbe8cdd5cdee92 }}
package: ./server.zip
Same here as @Oskenso ...
Creating an empty file named oryx-manifest.toml with compressedNodeModulesFile=node_modules.tar.gz as content worked and redeploy worked for me after the second try (I guess first try will place the file in the server and second one use it on run).
You may also try uncompress the node manually (I didn't test this)
- Connect to bash : https://
.scm.azurewebsites.net/kududebug - then run:
- cd site
- cd wwwroot
- rm -fr /node_modules
- mkdir -p /node_modules
- tar -xzf node_modules.tar.gz -C /node_modules