diff --git a/docs/processes/process-management.md b/docs/processes/process-management.md index 80c39e6b7..09f03563f 100644 --- a/docs/processes/process-management.md +++ b/docs/processes/process-management.md @@ -156,6 +156,32 @@ There are also a few other exceptions for the `web` process. - See the [nginx request proxying documentation](/docs/configuration/nginx.md#request-proxying) for more information on how nginx handles proxied requests. - Only the `web` process may be bound to an external port. +#### Changing the `Procfile` location + +When deploying a monorepo, it may be desirable to specify the specific path of the `Procfile` file to use for a given app. This can be done via the `ps:set` command. + +```shell +dokku ps:set node-js-app procfile-path Procfile2 +``` + +The default value may be set by passing an empty value for the option: + +```shell +dokku ps:set node-js-app procfile-path +``` + +The `procfile-path` property can also be set globally. The global default is `Procfile`, and the global value is used when no app-specific value is set. + +```shell +dokku ps:set --global procfile-path global-Procfile +``` + +The default value may be set by passing an empty value for the option. + +```shell +dokku ps:set --global procfile-path +``` + ### Stopping apps Deployed apps can be stopped using the `ps:stop` command. This turns off all running containers for an app, and will result in a **502 Bad Gateway** response for the default nginx proxy implementation. @@ -254,21 +280,30 @@ dokku ps:report Deployed: false Processes: 0 Ps can scale: true + Ps computed procfile path: Procfile2 + Ps global procfile path: Procfile Ps restart policy: on-failure:10 + Ps procfile path: Procfile2 Restore: true Running: false =====> python-sample ps information Deployed: false Processes: 0 Ps can scale: true + Ps computed procfile path: Procfile + Ps global procfile path: Procfile Ps restart policy: on-failure:10 + Ps procfile path: Restore: true Running: false =====> ruby-sample ps information Deployed: false Processes: 0 Ps can scale: true + Ps computed procfile path: Procfile + Ps global procfile path: Procfile Ps restart policy: on-failure:10 + Ps procfile path: Restore: true Running: false ``` diff --git a/plugins/ps/functions.go b/plugins/ps/functions.go index f6a47bbe8..713334abc 100644 --- a/plugins/ps/functions.go +++ b/plugins/ps/functions.go @@ -21,7 +21,7 @@ func canScaleApp(appName string) bool { func extractProcfile(appName, image string) error { destination := getProcfilePath(appName) - common.CopyFromImage(appName, image, "Procfile", destination) + common.CopyFromImage(appName, image, reportComputedProcfilePath(appName), destination) if !common.FileExists(destination) { common.LogInfo1Quiet("No Procfile found in app image") return nil diff --git a/plugins/ps/ps.go b/plugins/ps/ps.go index 7ca3dc5de..10699d9e5 100644 --- a/plugins/ps/ps.go +++ b/plugins/ps/ps.go @@ -15,10 +15,13 @@ var ( // DefaultProperties is a map of all valid ps properties with corresponding default property values DefaultProperties = map[string]string{ "restart-policy": "on-failure:10", + "procfile-path": "", } // GlobalProperties is a map of all valid global ps properties - GlobalProperties = map[string]bool{} + GlobalProperties = map[string]bool{ + "procfile-path": true, + } ) // Rebuild rebuilds app from base image diff --git a/plugins/ps/report.go b/plugins/ps/report.go index 6691b247b..af78b7263 100644 --- a/plugins/ps/report.go +++ b/plugins/ps/report.go @@ -15,12 +15,15 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { } flags := map[string]common.ReportFunc{ - "--deployed": reportDeployed, - "--processes": reportProcesses, - "--ps-can-scale": reportCanScale, - "--ps-restart-policy": reportRestartPolicy, - "--restore": reportRestore, - "--running": reportRunningState, + "--deployed": reportDeployed, + "--processes": reportProcesses, + "--ps-can-scale": reportCanScale, + "--ps-restart-policy": reportRestartPolicy, + "--ps-computed-procfile-path": reportComputedProcfilePath, + "--ps-global-procfile-path": reportGlobalProcfilePath, + "--ps-procfile-path": reportProcfilePath, + "--restore": reportRestore, + "--running": reportRunningState, } extraFlags := addStatusFlags(appName, infoFlag) @@ -81,6 +84,23 @@ func reportCanScale(appName string) string { return canScale } +func reportComputedProcfilePath(appName string) string { + value := reportProcfilePath(appName) + if value == "" { + value = reportGlobalProcfilePath(appName) + } + + return value +} + +func reportGlobalProcfilePath(appName string) string { + return common.PropertyGetDefault("ps", "--global", "procfile-path", "Procfile") +} + +func reportProcfilePath(appName string) string { + return common.PropertyGetDefault("ps", appName, "procfile-path", "") +} + func reportDeployed(appName string) string { deployed := "false" if common.IsDeployed(appName) { diff --git a/plugins/ps/triggers.go b/plugins/ps/triggers.go index 452b417a7..90e81ac7e 100644 --- a/plugins/ps/triggers.go +++ b/plugins/ps/triggers.go @@ -142,7 +142,7 @@ func TriggerPostDelete(appName string) error { // TriggerPostExtract validates a procfile func TriggerPostExtract(appName string, tempWorkDir string) error { - procfile := filepath.Join(tempWorkDir, "Procfile") + procfile := filepath.Join(tempWorkDir, reportComputedProcfilePath(appName)) if !common.FileExists(procfile) { return nil }