Audio files not found after deployed to Heroku through node.js - javascript

My web contains some audio files in wav format. I have no problem in loading these wav files in local by running "foreman start". However, after I deploy to heroku, it says that all these audios files are not found. Actually, when I take a look at the sources, I do not see my audio files. I am using node.js. Do I need to do something in the package.json. Any suggestion?

Heroku does not store static assets like images, audio files, etc...
Use a third party service such as Amazon S3 to store your audio files.
https://devcenter.heroku.com/articles/s3

Related

How we get to know where our file in downloading if we are running tests on remote (Protractor+Javascript)

How we get to know where our file in downloading if we are running tests on remote (Protractor+Javascript)..
After clicking on a download button and running tests on remote, i have to save the downloaded file in specific folder in a project?
Project is in Protractor+Javascript
I tried adding the path in capabilities folder

Is there way to cleanup old unused filed on S3

I am using the s3 bucket to serve the frontend app. And I am syncing code in that s3 bucket from the Jenkins server. While building the code in every deployment. Some files get updated some files get renamed, some files get deleted as well in the new folder on the Jenkins server.
Now when we use the s3 sync command on that build folder which was just created and has all the new files created in it. It basically pushes all the code to s3 and doesn't touch the code for example:- the test-123.jpg image which was been pushed in an earlier build. But has been deleted in the recent build.
This kind of file is renamed and all are not getting synced so they are just staying on the server.
May I know which is the ideal way to deal with this kind of issue while pushing the code to S3. My main motive is that I should be able to automatically delete the files which are not getting used or served anymore in the angular app.

Heroku application file upload - file is deleted after some time?

So I have made an node.js based application with file upload and everything works fine,
I can upload files, browse uploaded files but after like 1 hour this file is I guess deleted from server? It's no longer available. So I have a question, is heroku deleting all non-application files after some time? Or what could be the reason of this?
Heroku file system is ephemeral so files are temporary and removed at every Dyno restart. It is likely that you have redeployed your application causing the restart of the Dyno.
Heroku also restarts a Dyno at least every 24 hours. See Heroku documentation
The good practise is to persist the files into an external storage (S3 for example). If you are interested in finding out which free options are available you can check this Git repo HerokuFiles

Run jar file with node js on Microsoft Azure

I make a node js web app for generating report. My idea is to use .jasper file (jasper report) to generate these reports. I've tried a bunch of node js library to do this, but nothing seems to work. And finally I proceed to make a .jar file (java) to solve this. The process is as follows:
Node js get request from user
Node js run .jar file by using child_process. It run something like "java -jar MyApp.jar arg1 arg2 arg3"
.jar file generate a pdf and save it to a folder
.jar file return the path of newly generated pdf file
Node js get the path and return pdf file to user
It run perfectly in my computer. Then I upload it to Microsoft Azure. It seems like the run .jar file step is failed, because no pdf file is created. Can anyone help me or suggest a better way to do this?
If you deployed the NodeJS webapp into MS Azure WebApps, the step 2 of the process could not spawn a child process for running a jar runnable file because the Java runtime environment not included your current Azure WebApp with NodeJS.
There are three suggested way to do this:
Using Azure VM to install NodeJS and Java, and deploy your app on the VM as the same as on the local computer. It's the simple way.
I searched an open source report software called jsreport. It can be install on MS Azure VM or Cloud Service. You can refer to the download page Run jar file with node js on Microsoft Azure to install it. And there is the jsreport sdk for NodeJS http://jsreport.net/learn/nodejs. If you want to use jsreport on Azure Cloud Service, you need to know how to build NodeJS App on Azure Cloud Service https://azure.microsoft.com/en-us/documentation/articles/cloud-services-nodejs-develop-deploy-express-app/.
Changing your process. NodeJS get request from user and send it with the specified file name and path to the ServiceBus; The jar runnable file modified as a Azure WebJob read the request from the ServiceBus and generate a pdf with the given file name and save it to the given file path on the Azure Blob Storage; NodeJS directly return pdf file to user from Blob Storage.
For Azure WebJob & Service Bus, you can refer to https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/ and https://azure.microsoft.com/en-us/documentation/articles/service-bus-nodejs-how-to-use-queues/.
I suspect that your Java PDF generation calls into APIs restricted by the App Service sandbox. Most PDF rendering engines use GDI+, which has most functionality restricted by the Azure App Service sandbox. However, this policy is relaxed on dedicated servers. Scaling up to a dedicated server should resolve this problem (i.e. not the Shared or Free SKU).

Problems with public directory when deploying Node.js app with Heroku

I've been working on an app which will feature a Timelinejs (open source js library) element on the client side. I copied the Timelinejs library into my public/javascripts/ directory of my app. Then I linked it in my html header. When I serve my app up locally everything works fine with the timeline. However, I noticed that when I deployed my app to Heroku it wasn't loading my timeline. Using chrome js console I discovered that it didn't find my files in the public/Javascripts/Timelinejs folder. Using the Heroku run bash command I discovered that none of my Timelinejs files were present in the file structure, although an empty Timelinejs directory was present. Is there any command or configuration I need to specify to get these files to my Heroku deployment?
Heroku has a readonly file system. The directory where you can write are ./tmp or ./log. You can't write inside the public folder.
That's because of how they manage their dynos and the way to scale them. If you want to store something, use the ./tmp or, recommended, a s3 bucket. (as I presume 'tmp' stands for 'temporary' :D)
More info here: https://devcenter.heroku.com/articles/read-only-filesystem

Categories

Resources