I am trying to deploy to Heroku. I keep getting an application error.
I created a ProcFile file without any extension, but Heroku doesn't seem to recognize it.
You're correct that the file doesn't have an extension, but it needs to be called Procfile, exactly. Your file is called ProcFile with a capital F.
Rename it to Procfile, commit, and redeploy.
The problem was solved by changing the ProcFile file to Procfile and there was more than one requirements.txt file It has been erased and create one requirements.txt file for all downloaded
Related
I'm trying to deploy a Google Cloud Function written in Go.
By doing some research I found out that vendor files are prefered over go.mod so I'm vendoring everything I use (which includes some local dependencies) and ignoring the go.mod/sum files in the .gcloudignore file.
The problem is that after trying to deploy, I get the following error:
go: nimbus#v0.0.0-00010101000000-000000000000: parsing /nimbus/go.mod: open /nimbus/go.mod: no such file or directory; Error ID: 03a1e2f7
nimbus is my local dependency and it has the following structure:
My Function repository has the following structrure:
and my go.mod file is:
module my_function
go 1.13
require nimbus v0.0.0-00010101000000-000000000000
replace nimbus => ../../../nimbus
I've tried this solution https://stackoverflow.com/questions/5441096 already. But it did not fix my issue.
I've tried everything to solve this issue, but nothing seems to work.
If you have a go.mod file and a vendor directory, the vendor directory will be ignored when you deploy your function.
https://cloud.google.com/functions/docs/writing/specifying-dependencies-go
I have used modules when deploying GCP functions in Go. Haven't had any problems. But I can't speak to the preference of using vendor/ instead. It should work, just without the go.mod file.
Turns out the problem was very complicated and I hope Google finds a solution for it asp.
By deploying my function using Cloud Build, It would read from my repository on Google Source, but, by reading from there it would bypass the .gcloudignore file and deploy both the go.mod/sum files and the vendor directory with my local code.
As said in https://stackoverflow.com/a/62050872/10316247:
If you have a go.mod file and a vendor directory, the vendor directory will be ignored when you deploy your function.
So the error would occur because of my go.mod not being able to find local repository.
My solution was to rename my go.mod/sum files so it would not be considered:
When you use golang 1.16 and specify golang 1.16 in the go.mod folder it will instead default to using the vendor files with the --mod=vendor flag set, which will solve this issue.
You'll just need to ensure your module name is formatted correctly (something like example.com/module).
I'm using this guide to build a small Go app:
https://codegangsta.gitbooks.io/building-web-apps-with-go/index.html
Folder structure looks like this:
go/src/fileserver/
main.go
fileserver.exe
public/
index.html
css/
bootstrap.min.css
The deployment instructions mention a "procfile" and a ".godir" file but it's a bit unclear what these are supposed to contain or where they are to be implemented. I'm not quite sure if my folder structure is correct either.
The error I'm getting is:
Failed to detect set buildpack https://github.com/kr/heroku-buildpack-go.git
Am going to be quoting the heroku documentation a lot.
Procfile
Define a Procfile
Use a Procfile, a text file in the root directory of your application, to explicitly declare what command should be executed to start your app.
The Procfile in the example app you deployed looks like this:
web: go-getting-started
This declares a single process type, web, and the command needed to run it. The name web is important here. It declares that this process type will be attached to the HTTP routing stack of Heroku, and receive web traffic when deployed. The command used here, go-getting-started is the compiled binary of the getting started app.
Procfiles can contain additional process types. For example, you might declare one for a background worker process that processes items off of a queue.
Define a Procfile
So in your example you would have a file named 'Procfile' in your root directory with contents being:
web: fileserver
.godir
The .godir file is simply a file that simply specifies the root directory of your go project. This is useful when you say have a number of modules for a web app in different languages. So for example given a repo with the following tree.
github.com
└──someuser
└── somerepo
├── .godir
├── go_module
└── node_module
Where the contents of your .godir file would be:
github.com/someuser/somerepo/go_module
A more verbose explanation of what .godir is for and when it is used can be found here.
I can not understand what I need to change to make it.
I created a demo project from this blogpost with app.json and Procfile:
web: fsharpi-heroku WebsahrperSuaveHerokuExample1.sln
Next, I tried to deploy it to Heroku in accordance with these recommendations:
heroku create websahrper-with-suave-example --buildpack https://github.com/SuaveIO/mono-script-buildpack.git
heroku git:remote -a websahrper-with-suave-example
git push heroku master
There was an error in Heroku when building the project:
...
Import process completed.
-----> packages.config found, installing dependencies with nuget
Cannot open assembly 'install': No such file or directory.
! Push rejected, failed to compile SuaveFramework app
Could you suggest me a solution if there is one?
Have you tried here:
https://github.com/SuaveIO/heroku-getting-started
Fork it and click the Deploy to Heroku button.
Don't have the rep to comment on the above, but ademar's solution should cover as well as long as you don't have a file named "app.fsx"
The heroku buildpack checks to see if there is a script, then checks for a solution:
https://github.com/SuaveIO/mono-script-buildpack/blob/master/bin/compile#L66
Just make sure there is a .sln file in the project directory (can be empty, just needs to be present) or fork the buildpack and just make it default run mono $YOURPROJECT in the compile step.
When using an sln instead of a script, you need to change your Procfile to:
web: mono Path/execName.exe
I'm experimenting with deploying a Gradle app on Heroku. Here is the code: https://github.com/sarbogast/spark-groovy-hello-world/tree/master
When I run 'gradle stage' and the command in Procfile locally, it works. But when I push to Heroku, the app crashes and the log says it can't find the script:
bash: build/install/spark-groovy-hello-world/bin/spark-groovy-hello-world: No such file or directory
I'm still a beginner with Heroku, so I don't understand everything about how it works.
I figured it out: I was missing a settings.gradle file in the root of my project, with the following line in it: rootProject.name = "spark-groovy-hello-world"
Now the app doesn't work yet, because I have a port problem, but that's another issue.
I'm trying to download a file from my app, when I'm running on localhost everything is fine and in using this path in order to download the file
../myapp/public/files/67784.pdf
But on Heroku I'm getting java.io.FileNotFoundException. How can I find location of the file on Heroku?
Thanks!
Public assets in Play are packaged in the Jar on compilation (makes it very convenient for moving everything around, and get them from a plugin or whatever). So you have to get them from you app Jar.
I think that you can use the Play's resource helper (http://www.playframework.com/documentation/2.2-SNAPSHOT/api/java/play/Application.html), but I haven't tried.
Play.Application.resource("public/filename")
Note that on Heroku, any file modification/addition on the server is lost whenever you redeploy, or restart or add an instance... The only files that persist are the ones in your Git repo.