I am working on a project that needs pdf files created based on a webpage, and went with wkhtmltopdf. The project consists of a python-based web app that runs in an Ubuntu 20 environment. An Azure pipeline is used to deploy the project to a Linux-based Azure app service that uses Python 3. The project runs on a localhost, but deploying it to an Azure app service has been causing issues.
After searching and trial and error, I came up with deploying my project to the Azure pipeline in Ubuntu, and then once the project has been uploaded to the Azure app service, I go into Azure, navigate to the SSH for the app service, and manually install wkhtmltopdf. For some reason, the app service runs on Debian 9, so I cannot create a script in the .yml file for the pipeline. The wkhtmltopdf package that is installed by the pipeline doesn't work with Debian.
I was wondering if there is a way to automatically have the debian app service install wkhtmltopdf. It can be done manually via the SSH in Azure, but with a lot of builds, it would be very time consuming.
Another option is changing the yml file to Debian 9 (which appears not to be supported here), or changing the app service OS to Ubuntu, which I could not find out how to do after hours of searching. It appears that it is automatically Debian 9 based on here
Here is a screenshot of the SSH on Azure
I was able to get wkhtmltopdf to install in the Debian environment by creating a script in the /home directory. I then set the Startup Command in Azure to point to this script.
I don't think Azure runs any auto scripts if you give it a startup command, thus I start the application myself at the end of the script.
Here is the script:
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.stretch_amd64.deb
apt-get install -y ./wkhtmltox_0.12.6-1.stretch_amd64.deb
rm wkhtmltox_0.12.6-1.stretch_amd64.deb
gunicorn --bind=0.0.0.0 --timeout 600 app:app
Note that I also had to add a pip install python-dotenv above pip install requirements.txt in the .yml file. Not sure why, as dotenv is in the requirements file, but I would get a dependency exception without this line in the yml.
Related
I am building a web application that makes use of the Pulumi automation SDK. The application is to be deployed within a linux docker container, so I added the following lines to the Dockerfile:
RUN curl -fsSL https://get.pulumi.com | sh
ENV PATH="/root/.pulumi/bin:${PATH}"
However, it looks like the Pulumi CLI is not available in bash after the image is built. I have validated that the Pulumi executables were indeed installed into /root/.pulumi/bin
I suspect that the cause is pulumi installed into the /root folder rather than to ~/ but I am not sure how to fix it.
Thanks
I successfully have created an Azure Time Trigger in Visual Studio Code.
I tested it in VSC before uploading onto Azure portal and it ran ok
When I run it in Azure though, it gives me an error no module named;
I have gone back to try and install modules in the.venv and the modules exist.
How can I have this resolved?
The function on azure cloud will install the modules according to the requirements.txt. So when you deploy the function from local to azure portal, the modules which installed on local will not also be installed on azure cloud if you didn't add the modules to requirements.txt. You can run the command below to add all of the modules into requirements.txt automatically:
pip freeze > requirements.txt
And then run func azure functionapp publish <funciton app name on azure> --build remote to deploy the function from local to azure.
Running a python Azure function on Linux consumption plan. I have been able to successfully deploy the function to Azure using VS Code. All the packacges in requirements.txt are getting installed without a problem. But now i need to install tesseract which only can be installed through apt-get
You can use tasks.json in the Azure function project which allows you to configure tasks which would run. There is even a breakdown on an operating system level e.g. windows should run specific commands and Linux should run differently.
I have an .net core application hosted on an Azure App service running linux. After running into issues with libgdiplus not being found, I ran across the solution to use apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev && dotnet YourWebSite.dll as the startup command in Azure. Unfortunately whenever I push code, the command is overwritten with the default dotnet YourWebSite.dll. I've looked through the publish settings in Visual Studio, but I can't find anything that seems to relate to the startup command.
I do not think you can change the start up command from Visual Studio. But you can change the start up command in Azure portal instead.
Go to your app service, go to Configurations
Here you can change the start up command.
I have developed my application on a windows machine and have to deploy this on a standalone UNIX server and while running commands like: npm start, it says that package is not available but I checked and everything is available in the project's npm modules.
Do I need to use docker or how can I achieve that without any container such as docker or kubernete.
Can I try cloning my repo in some other Linux machine and npm install and then use the same folder to deploy on UNIX CentOS running on the server?