how to create Heroku procfile for windows? - heroku

Im a newbie trying to make a django app, but unfortunately my os is windows.
Heroku docs is written for linux so I cant get sufficient information for app development on windows 7.
First how can I make procfile using window cmd?
Is there any command language translation docs?(linux->windows)

Regarding creation of text file in cmd shell:
echo web: run this thing >Procfile
this will create Procfile with web: run this thing inside (obviously).
Also You can use any text editor, notepad will fit perfectly.
And one thing, that wasn't obvious for me, therefore can also be helpfull to someone else.
Procfile should be a text file is a bit misleading, do NOT save Procfile as Procfile.txt or it will not be recognised. Just leave it plain and simple Procfile without any file format.

When you're using Windows for development, and your procfile contains for example $JAVA_OPTS (or anything else system dependent), then
besides of Procfile with Linux syntax (with for example: $JAVA_OPTS), for Heroku, you need
Procfile.windows with Windows syntax (where you can write for example" %JAVA_OPTS%), and you point to it while working with Heroku localy: heroku local web -f procfile.windows

A Procfile should be a text file, called Procfile, sitting in the root directory of your app.
It's the same for Windows or Linux or OS X.
It should specify the command Heroku should use to start your app - so it's not really about linux or windows.
So to answer your question: use a text editor. Any text editor.

Just create the file with name procfile. If your editor is intelligent enough as mine to understand the files like procfile have a Heroku icon

gunicorn doesn't work on Windows so you'll want a Procfile.windows that will locally host your app in a way that doesn't require gunicorn (such as the way you would normally do it).
web: ~what you would normally use to start your app~

web: gunicorn app_name.wsgi
write your own application name instead of app_name and file name just save without any Extention (Procfile).

A file named Procfile is required in the root of your Heroku project. The following is a basic example of the content to be created for a Django project:
web: gunicorn your_app_name.wsgi --log-file
Here the full docs from Heroku.

Related

Can't save a temporary csv file to /home/app directory on heroku using R shiny app [duplicate]

I published my first simple app on Heroku with a free dyno. This app writes a simple .txt file, that seems to be correctly written because my API services are working fine.
But if I try to check this file by entering in the file system using "heroku run bash -a MYAPP", I can't see that file in the folder I thought to see. It is like the file is not existing. Can someone tell me why?
Thanks.
I found this on https://devcenter.heroku.com/articles/active-storage-on-heroku:
In addition, any files stored on disk will not be visible from one-off dynos such as a heroku run bash instance or a scheduler task because these commands use new dynos.
It is still not so clear to me, but at least I know it is a normal (but strange) behaviour of Heroku!

How does Heroku knows which file use to deploy?

I always create a file called server.js as entry point of my Node.js app and I always deploy to Heroku with that file but... How does Heroku know that server.js the file that it should to execute?
What if my server file is called anotherName.js? How can I tell to Heroku to deploy anotherName.js?
If you have a Procfile, Heroku will look there first.
If no Procfile exists, Heroku will try to run the start sript defined in your package.json.
What if my server file is called anotherName.js? How can I tell to Heroku to deploy anotherName.js?
Either by modifying (or creating) your Procfile or by changing the start script in your package.json.

How to set Procfile in Heroku in PlayFramework

Now I am trying to deploy PlayApplication, but unfortunately my deploy failed. And the error code is H10, so probably I assume the problem is setting files because my database setting must be true as I can connect database by using the created username, password and URL.
And in my understanding, Procfile just shows a command to be run toward dynos and in tutorials, in terms of Java the procfile is like this:
web: java -jar target/helloworld.jar
However, in my application, the Procfile is web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -Dconfig.file=conf/application_prod.conf where conf/application_prod.conf is the path to the setting file. Is this Procfile right?
My play version is 2.2.1 and the official document says web: target/universal/stage/bin/retailos -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL} is good and I can also use the option -Dconfig.file= and then you can indicate where the setting file is. This means web: target/universal/stage/bin/retailos -Dhttp.port=${PORT} -DapplyEvolutions.default=trueBut -Dconfig.file=conf/application_prod.conf. But it does not work well.
And there are many candidates about the right way being also indicted by How to create play heroku procfile?.
I am really confused. I already have written all DB settings into application_prod.conf, so I prefer to use -Dconfig.file=.
What is exactly the true one?
Thanks.
Using -Dconfig.file and similar is definitely a good idea, you do not need to set all config parameters in your Procfile.
The reason it doesn't work is probably because you're using a file path for your config file, which to my knowledge doesn't work when the application is deployed as a jar. Try this instead:
-Dconfig.resource=application_prod.conf

Deploying Revel (Golang) Using Dokku

Has anyone tried deploying a Revel app using Dokku?
I tried "https://www.digitalocean.com/community/tutorials/how-to-use-the-dokku-one-click-digitalocean-image-to-run-a-go-app" and it deployed successfully.
However, when I try a new Revel app, it gives me this error
remote: mv: cannot stat `/build/app/.heroku/g/bin/*': No such file or directory
This is the .godir that I created:
myappname
This is the Procfile:
myappname
What am I doing wrong?
Thanks
Since Revel is a web app (receiving incoming HTTP traffic), you need to declare a web process type in your Procfile, i.e.:
web: myappname ## Procfile requires a Unix process declaration
This tells Dokku what command to run to start the web process on the server -- in this case myappname.go in your project root.
Leave off the .go file extension in the Procfile.
Dokku is a "Docker powered mini-Heroku" so Heroku's support docs are relevant:
The unix process model is a simple and powerful abstraction for running server-side programs. Applied to web apps, the process model gives us a unique way to think about dividing our workloads and scaling up over time. The Heroku Cedar stack uses the process model for web, worker and all other types of dynos.
-- from Process Types and the Procfile - Heroku Dev Center
Note that the standard Go Buildpack for Heroku/Dokku needs either a Godeps directory, or the deprecated method of including a .godir file.
You need to use the revel buildpack instead of the Go one. The buildpack will generate the Procfile for you.
Be sure to:
Add a .env file with this in your project: BUILDPACK_URL=https://github.com/revel/heroku-buildpack-go-revel.
Add a .godir file with the argument you use to run your app, e.g. github.com/yourcompany/yourrepo.

Heroku procfile "No such process type web defined in Procfile" error

This is the first time I've used Heroku, and the fact that I can't find anyone in Google with a similar error to this means I'm likely doing something way wrong:
I'm following the basic Heroku setup guide here to get my NodeJS application deployed to the web. I'm deployed and trying to check my dynos with:
heroku ps:scale web=1
However, when I do this I get the error:
Scaling web dynos... failed
! No such process type web defined in Procfile.
When I run heroku ps I get nothing returned.
In my app's root directory, I have a file named Procfile (with no extension) which contains:
web: node app.js
The app runs locally without any issues (using foreman start).
Question is why is this occurring, how do I remedy it, should I even care?
Processes to be run on Heroku are defined in a simple text file called: Procfile
The Profile contains a line that defines how each of the processes in your application will run. This will be language specific and examples can be seen on the Heroku Devcenter Procfile article
Please note that the Procfile must be spelt exactly, with the first letter capitalized an all others lower case. There is no file extension for the Procfile. This Procfile should be placed in the root of your project and committed to your local git repository before doing a git push heroku master.
Should you mis-type the filename after it has been added to git, you can rename it using git with the command
git mv ProcFile Procfile
The renamed file will be staged so you can commit the changed file with the command
git commit -m "corrected name of Procfile"
I found the solution myself, from here: https://stackoverflow.com/a/7641259/556006
I had the same problem and I just now I found what was wrong. I first
accidently called the file ProcFile instead of Procfile. Simply
renaming that file did not get picked up by git. I had to do a git rm
ProcFile -f first and then add a new (correctly named) Procfile. After
that, it got pushed correctly by git and got picked up correctly by
Heroku.
I just had this issue myself, but in my case, I was missing a space between web: and the starting command in the Procfile.
For example, I had it wrong this way:
web:gunicorn run:app
Fixed it by adding a space after the colon:
web: gunicorn run:app
I am guessing you've never done git push heroku master -- that is, Heroku has never seen your code.

Resources