I'm going to deploy my web app soon on Heroku (standard). So can I simply start using Imagemagick right off the bat or not? I already have it installed locally on my computer and obviously have the module required as well in my app.
So will it work exactly as it's working on my machine? like resizing images and getting the src path of images from specific folders like I have on my computer (I'm a newbie at deployment sorry).
You have to add the imagemagick buildpack on heroku:
heroku buildpacks:add --index 1 https://github.com/ello/heroku-buildpack-imagemagick.git
And then you can use a library to call imagemagick
Related
We have just a single webpage with some links on clicking them it will redirect to different sources. As of now we are using "npm run build" to create the production package.
But because of the build files having dependencies with node, i cannot host it in a particular server.
Is there a way to create the Reactjs production build without using node ?
I suggest using Netlify to host your react app easily .
Below are some resources that can help you along the way.
https://www.netlify.com/with/react/
https://www.youtube.com/watch?v=sGBdp9r2GSg
You can have a build and upload it manually to your Netlify account,
You can use the CLI (netlify-cli) or you can your account to git .
Similar approach can be followed with git pages for example.
What packages do you have in your package.json file? Did you use a React project template that uses Node server-side features? It seems like you want to host your React project statically, not necessarily get rid of Node and npm.
For example, I've worked on lots of React projects using npm and create-react-app that we were able to host with a .NET backend and Microsoft IIS (instead of Node). The output is .html, .js, and other static files that you can host anywhere.
When you build a react app, the files at folder build contains everything it needs to run
If your hosting server hasn't integration with CI/CD, then you must deploy manually only the build folder, not the root folder (the folder that contains package.json).
I believe your issue is just a confusion/misunderstanding on how react works, how to deploy it, and how to run it.
React needs to be built on an environment where node, npm, and other tools are available. It can be on a build server or in your local machine.
After built, react app is just a folder with a bunch of html, css, js files which will run on the client browser, so, there's no dependency on NODE anymore.
These static files must be served with a simple static file server (apache, nginx, iis, etc),
I recommend you build the app locally on your machine and then deploy manually to your host through ftp, ssh or web interface.
If react is overkill to your needs, then don't use it.
The best approach is to host it in a cloud service that can do the full CI/CD integrated with git, all automated (Google GCP, AWS, Azure, Netlify, etc)
I am using pack cli to build docker image for my python flask app running with gunicorn.
Inside docker image, my whole code is exposed in workspace folder.
What shall i do to restrict user to access folder or obfuscate my code?
I am using Google Buildpack
pack set-default-builder gcr.io/buildpacks/builder:v1
I'm assuming you're using the Heroku Python Buildpack (and the heroku/buildpacks:18 builder).
You can create a bin/post_compile and use it to run compileall, and then run rm **/*.py
I have a Python app which words great via Localhost on my machine.
I am trying to deploy it to Heroku. However it does not seem possible to accomplish this (I have spent approx 30 hours trying now).
The problem is Tesseract OCR. I am using the pytesseract wrapper, and my code utilises this. However, no matter what I try, it does not seem to be possible to use pytesseract when it is uploaded to Heroku.
Could anyone either suggest how to go about deploying a Hello World Tesseract OCR Python app via pytesseract to Heroku, or if Heroku is not capable of this, suggest an alternative to Heroku?
For anyone else looking to deploy pytesseract on heroku, here are the steps:
Add apt buildpack to heroku
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
Create a file named Aptfile in the same directory as your app and these lines to it (for english)
tesseract-ocr
tesseract-ocr-eng
Set heroku config variable TESSDATA_PREFIX to the path of tessdata folder (it was /app/.apt/usr/share/tesseract-ocr/4.00/tessdata for me) which can be found out by running heroku shell using heroku run bash and run this command in the shell
find -iname tessdata
Set the config variable using
heroku config:set TESSDATA_PREFIX=/app/.apt/usr/share/tesseract-ocr/4.00/tessdata
replace the path with the path you got from the previous command
Tesseract should be installed in the heroku app when you build it. Make sure you have pytesseract in your requirements.txt file. Now you should be able import and use pytesseract on heroku
The Python buildpack likely doesn't have the tesseract binaries installed by default. Here’s a third-party buildpack that creates the appropriate environment. Follow the instructions there to make the binary available to your application.
I want to use gm package to generate thumbnail image (50x50) but I must install graphicsmagick in my Heroku server. So I googled it ,but haven't got a solution.
2021 Update:
I managed to install GraphicsMagick on my NodeJS Heroku project.
You just have to add heroku-buildpack-graphicsmagick
into your project.
Right now there are a lot of methods, but the fastest one is:
Go to your Heroku Dashboard > Your Project > Settings tab
Scroll down to your Buildpacks section.
Add the buildpack .git link:
https://github.com/xerpa/heroku-buildpack-graphicsmagick.git
Save and deploy your app again. Then it will be instaled.
Here's how it should look:
Now it should work.
If you're interested in my case:
I was trying to add a library to create barcodes into a pdf. For that I used a library called barcode and pdfkit. Then in order for the barcode library to work, I had to have a working installation of GraphicsMagick. Then I discovered that I had to install this 'gm' dependency into my Heroku project.
Also, this is how it looks when deploying your project:
GraphicsMagick app detected
+ install GraphicsMagick-1.3.19
I din't install anything on Heroku but It works I think GraphicsMagic is default
I want to deploy a node.js application onto the heroku through github, and I followed the instructions on heroku. but I stuck on the issue which says the push rejected because of the buildpacks are not set,however I did set the nodejs buildpack, I am a noob, I don't know what the problem it is.someone says package.json should contain engine:node version, is that the reason? because I have put the front-end folder and back-end folder separately. so what should the folder structure looks like?
heroku cli capture