Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Procfile start processes in their own working directory

Tags:

I have this simple Procfile

web: myapp 

myapp is in the path, but the processes home directory should be ./directory/. How can I specify in the Procfile where the process is to be started?

https://github.com/ddollar/foreman/pull/101 doesn't help because it assumes, that this working directory should be the same for every process specified by the Procfile

like image 769
JohnDoe Avatar asked Nov 08 '12 07:11

JohnDoe


People also ask

What does a Procfile do?

A Procfile is a mechanism for declaring what commands are run by your application's containers on the Deis platform. It follows the process model. You can use a Procfile to declare various process types, such as multiple types of workers, a singleton process like a clock, or a consumer of the Twitter streaming API.

Is Procfile necessary Heroku?

A Procfile is not technically required to deploy simple apps written in most Heroku-supported languages—the platform automatically detects the language and creates a default web process type to boot the application server.

Where do I put Procfile?

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.

Is Procfile case sensitive?

Procfile Naming and Location py . Note that naming the file procfile will not work either, as it is case sensitive.


2 Answers

The shell is the answer. It's as simple as

web: sh -c 'cd ./directory/ && exec appname' 
like image 51
JohnDoe Avatar answered Sep 28 '22 08:09

JohnDoe


You can chain a set of shell commands together. With the current version of Foreman, you do not need to wrap this in a shell command as in @JohnDoe's answer.

web: cd server_dir && start web_service clk: cd clock_tower && start timers 

These would start the necessary processes from their respective folders and track them independently.

like image 24
Igbanam Avatar answered Sep 28 '22 09:09

Igbanam