Running Python Worker on Heroku - Push Failed - python-3.x

my scope is to run a python script (it does scrap text from websites and save it in csv files) in the cloud through cron job.
For this I chose Heroku.
I am stuck because when I try to deploy the worker I get a Push rejection.
Here is what i do:
I put my scrapit.py and Procfile ('worker: node scrapit.py') in a directory.
Then after I create an app in heroku, I send the following commands from the directory of above:
$ heroku login
$ git init
$ heroku git:remote -a app-name-on-heroku
$ git add .
$ git commit -am "nth time :("
$ git push heroku master
I get the following message:
Counting objects: 41, done. Delta compression using up to 4 threads.
Compressing objects: 100% (36/36), done. Writing objects: 100%
(41/41), 12.97 KiB | 0 bytes/s, done. Total 41 (delta 6), reused 0
(delta 0) remote: Compressing source files... done. remote: Building
source: remote: remote: -----> App not compatible with buildpack:
https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info:
https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: remote: ! Push failed remote: Verifying deploy...
remote: remote: ! Push rejected to app-name-on-heroku. remote: To
https://git.heroku.com/app-name-on-heroku.git ! [remote rejected]
master -> master (pre-receive hook declined) error: failed to push
some refs to 'https://git.heroku.com/app-name-on-heroku.git'
after the error I sent this command:
heroku buildpacks:set heroku/python
but still the push gets rejected

Every Heroku buildpack specifies a bin/detect file, which lets the platform know if that buildpack can be used with that app or not.
The python buildpack requires either: requirements.txt, setup.py or Pipfile to be present.
You need to create (and properly configure) one of those files to be able to have your python app built.

Related

Unable to push code to fresh Dokku container: unable to apply apparmor profile: apparmor failed to apply profile

On my server I installed dokku and created a new App: myNodeApp
$ dokku apps:create myNodeApp
On my local repo I added the dokku remote and want now to push the existing code to my container, after git add . :
$ git push dokku main
Enumerating objects: 1119, done.
Counting objects: 100% (1119/1119), done.
Delta compression using up to 20 threads
Compressing objects: 100% (760/760), done.
Writing objects: 100% (1119/1119), 92.80 MiB | 11.25 MiB/s, done.
Total 1119 (delta 577), reused 727 (delta 310), pack-reused 0
remote: Resolving deltas: 100% (577/577), done.
-----> Set main to DOKKU_DEPLOY_BRANCH.
-----> Cleaning up...
-----> Building myNodeApp from herokuish
remote: time="2023-02-18T21:02:28Z" level=error msg="error waiting for container: "
remote: docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: unable to apply apparmor profile: apparmor failed to apply profile: write /proc/self/attr/apparmor/exec: no such file or directory: unknown.
remote: ! Failure extracting app code
remote: ! Removing invalid image tag dokku/myNodeApp:latest
remote: ! App build failed
To serversIP:myNodeApp
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'serversIP:myNodeApp'
(base)
This is a Docker issue. Docker v23 accidentally added a hard dependency on AppArmor, and v23.0.1 implemented an incorrect fix, changing the error message to the one you encountered.
For the moment, the fix is one of:
a) Downgrade Docker to below v23
b) Install the apparmor package (I also had to reboot)
c) Wait for the issue for the new error to get fixed

App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz at deploying project on heroku server

Django project deploy on heroku server, at the time fetch an error at push a project on heroku.
Enumerating objects: 63, done.
Counting objects: 100% (63/63), done.
Delta compression using up to 4 threads
Compressing objects: 100% (60/60), done.
Writing objects: 100% (63/63), 335.77 KiB | 11.19 MiB/s, done.
Total 63 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to youtube-to-mp3converter.
remote:
To https://git.heroku.com/youtube-to-mp3converter.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/youtube-to-mp3converter.git'
How can solve it.

Deployment on heroku failed

I want to deploy my exiting project on heroku, but it gives me an error.
structure of my file:
___instagram
__backend
_controllers
_images
_middleware
_models
_node_modules
_routes
_utiles
.gitignore
app.js
package-lock.json
package.json
Procfile
__ui
...
commands:
E:\Coding\projects\instagram>git add .
E:\Coding\projects\instagram>git commit -m "update controllers"
[master 086d891] update controllers
1 file changed, 1 insertion(+), 1 deletion(-)
E:\Coding\projects\instagram>cd backend
E:\Coding\projects\instagram\backend>git push -f heroku master
after the last command (git push -f heroku master) i got this error:
E:\Coding\projects\instagram\backend>git push -f heroku master
Enumerating objects: 16, done.
Counting objects: 100% (16/16), done.
Delta compression using up to 4 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (10/10), 956 bytes | 956.00 KiB/s, done.
Total 10 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz
remote:
remote: ! ERROR: Application not supported by 'heroku/nodejs' buildpack
remote: !
remote: ! The 'heroku/nodejs' buildpack is set on this application, but was
remote: ! unable to detect a Node.js codebase.
remote: ! A Node.js app on Heroku requires a 'package.json' at the root of
remote: ! the directory structure.
remote: !
remote: ! If you are trying to deploy a Node.js application, ensure that this
remote: ! file is present at the top level directory. This directory has the
remote: ! following files:
remote: !
remote: ! backend/
remote: ! ui/
remote: !
remote: ! If you are trying to deploy an application written in another
remote: ! language, you need to change the list of buildpacks set on your
remote: ! Heroku app using the 'heroku buildpacks' command.
remote: !
remote: ! For more information, refer to the following documentation:
remote: ! https://devcenter.heroku.com/articles/buildpacks
remote: ! https://devcenter.heroku.com/articles/nodejs-support#activation
remote:
remote:
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to ins-app-clone.
remote:
To https://git.heroku.com/ins-app-clone.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/ins-app-clone.git'
Heroku buildpack looks at the top-level (root) for package.json.
The solution here is to use git sub-trees. I too was facing this issue where I had a Monorepo MERN codebase in which I wanted to deploy my server using Heroku and client via Vercel.
I have written a blog post regarding this, I'm sure you'll get an idea regarding a solution to this.
Link to Blog Post

"No default language could be detected for this app" while using multiple Buildpacks for an app on Heroku

I deploy to Heroku two nodejs projects each one in own folder -
NodejsExpressApp1 and NodejsConsoleApp1.
I have added to the app root the Procfile file with the following content -
web: node NodejsExpressApp1/app.js
worker: node NodejsConsoleApp1/app.js
Also I have set the BUILD_DIR config var to the NodejsExpressApp1 folder.
Locally everything works fine.
Below shown what I get while deploying -
c:\ExpressMultiProjectApp2>git push heroku master
Counting objects: 1506, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1401/1401), done.
Writing objects: 100% (1506/1506), 4.85 MiB | 92.00 KiB/s, done.
Total 1506 (delta 269), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to sheltered-mesa-74202.
remote:
To https://git.heroku.com/sheltered-mesa-74202.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sheltered-mesa-74202.git'`
Thanks!
The issue was fixed after creation in the app root the package.json file -
{
"name": "nodejs-express-app1",
"version": "0.0.0",
"description": "Multiple Buildpacks App",
"author": { "name": "SimonBor" },
"dependencies": {
"express": "~4.9.0"
}
}
Setting variable BUILD_DIR is not necessary step.
Of course it is not the best practice solution but it allowed me to continue development.
I will be more then happy for a better solution.
Best regards!

Git push - node.js failed to push some refs

I am trying to push a node.js application, but I run into following issue:
Total 226 (delta 25), reused 0 (delta 0)
remote: /usr/share/gems/gems/openshift-origin-node-1.18.0.1/lib/openshift-origin-node/model/application_repository.rb:50:
warning: Insecure world writable dir /var/lib/openshift/532aba62493209b14e000001 in PATH, mode 040777
remote: Stopping NodeJS cartridge
remote: Permission denied - /var/lib/openshift/532aba62493209b14e000001/app-deployments/2014-03-20_02-52-39.976/dependencies/nodejs/node_modules/express
To ssh://532aba62493209b14e000001#myapp-test.openshift.local/~/git/myapp.git/
! [remote rejected] master -> master
(pre-receive hook declined)
error: failed to push some refs to 'ssh://532aba62493209b14e000001#myapp-test.openshift.local/~/git/myapp.git/'
Found that could be a known issue https://bugzilla.redhat.com/show_bug.cgi?id=1054421.
Can anyone help me here?
Thanks.

Resources