Azure Windows App Service files not available across nodes - azure-web-app-service

Our application has the ability to request a generation of a file that are then downloaded by the client. We are seeing issues that when our app service has more than one node that the files generated are not available across the other nodes.
E.g.:
POST request to generate file and save to d:\home\site\wwwroot\app_data is send by user from machine-1 and is successful.
GET request from user to download this file is received by machine-2, this fails because the file cannot be found.
My reading of the microsoft docs is that anything in d:\home is backed by azure storage and is not local to the machine: https://learn.microsoft.com/en-us/azure/app-service/operating-system-functionality#file-access
File access across multiple instances The home directory contains an
app's content, and application code can write to it. If an app runs on
multiple instances, the home directory is shared among all instances
so that all instances see the same directory. So, for example, if an
app saves uploaded files to the home directory, those files are
immediately available to all instances.
But this doesn't seem to be happening, is there something else that needs configuring?

Related

Where are files downloaded in Google App Engine?

I have a backend Nodejs application and I am fetching and streaming files in the background when a certain event happens in the client.
I have deployed the backend to Google App Engine.
The file downloading is working fine but I am a bit confused where the files are downloaded and stored ? In the app I am creating a folder relative to the deployed app folder and storing them there with createWriteStream. I also init a git repository where the files are (using simple-git npm module)
It seems the files are not accessible via the cloud shell since I can not find them there
Can I for example create a storage bucket and use "normal" file operations command there (and init the repo there)
-Jani
To store data downloaded you want to store it in Cloud Storage, you can find a complete guide in this Using Cloud Storage documentation.
Under almost any circumstances you want to download files into the App Engine Deployment since the instances doesn't have much memory to store data, and also when the deployment scales up and down you are prone to lost data

I wonder if its possible to store the image upload to server store outside jar, and how to find the direction

I created a spring-boot web project and uploaded it to server already(centOS7).
currently the img upload to jar file on server is stored inside the static package in jar file
this makes the jar file very large and hard to edit.
can some one give me a idea to store the img somewhere else on server and how to find the position of picture out of jar inside html.
First of all, you have to decide, in which directory you are going to store your files and create it:
mkdir /path/to/your/dir
Then assign a newly created directory to your application user:chown <your user>:<users group> /path/to/your/dir
Then, don't forget to give read/write permissions for the user, under which you run your app - to the already created directory.
chmod 600 /path/to/your/dir - this will allow your app to only read/write to the directory and prevent the execution of files within it (for security reasons).
Then just replace the path you already have - with the new one (to the newly created directory).
Please, be aware that there is a lot of security stuff to consider when you're going to store files on your server.
By the way, please consider reading about different storage options like AWS S3, Google Cloud Storage and Ceph.
Please, take into account - that if you're going to store your files on your server - then you should take care about them (for example: keep eyes on space, make sure you have mirroring across discs and so on so forth). With AWS S3, for example, you don't need to care about all of that stuff and it's very cheap.

Possible to set local folder for automatic file uploads

Bit of a loose question so if it gets marked down I'll remove it.. but..
I'm using Primefaces/Spring/Hibernate for Java server.
My application knows a load of file names I need to upload. Those files are on my local computer. Is it possible to tell the application the root directory of these files, for it to then setup uploads for each of these files without me needing to browse for each file individually?
I assume this is a browser security issue, i.e. the user needs to explicitly state which file the application is allowed to know about etc?
If not I'll have to do it in a local application but I was hoping there was a way a mass upload could be kicked off from the browser by just setting the local directory of the files.
I decided to use the Primefaces uploader, upload all the files in the directory and let the application sort them out once it has them on the server.

Custom logs in Azure website file system combined into single log file

My Azure web app (App Service) writes a log file mywebapp.log to the d:\LogFiles directory of the VM that hosts the website. When the log file gets to a certain size I rename it to mywebapp1.log, mywebapp2.log, and so on so and a new log file is created. (I do this manually - stop the website, rename the file and restart the site.)
One day I inspected the directory through the Kudu (SCM) portal and saw just a lone mywebapp.log that was much larger than normal. The file included all of the individual logs that previously existed (included the contents of mywebapp1.log + mywebapp2.log and so on).
My app has no which combines the files. Is there an Azure process that does this or did I do it in my sleep and have no recollection?
There really is no logic in Azure that would do this. Azure knows nothing about your log files, and would not be doing anything with them, especially something as complex as combining several existing files into one.
So I'll go with the sleep theory on this one :)
The problem was that I had swapped deployment slots at some point and failed to realize that the d:\LogFiles directory (the entire d: drive I believe) travels with the slot. The missing log files were sitting in my staging slot's LogFiles directory.

IIS Webdeploy: copy files to client

I am trying to copy some files to a destination Folder (which should be no problem with Webdeploy) and after that process I would like to get these files on the client (the computer which is starting the msdeploy process).
There seem to be a lot of examples on how to copy files to a server, but I could not find any about geting files from the server.
What you are describing is not currently supported by MSDeploy. Workarounds that I can think of include:
Defining a postSync argument that copies files to a directory accessible via FTP
Install MSDeploy on the client and have the server trigger a separate deployment back to the client (this would require that the client be publically accessible)

Resources