getlarge / nx-heroku

Nx plugin to quickly deploy and promote your Nx apps on Heroku
MIT License
3 stars 0 forks source link

Question About Procfile Location #22

Open chuckurbis opened 4 months ago

chuckurbis commented 4 months ago

Hello,

Finally getting a chance to try and implement this library again (which I am grateful for you writing. Thank you!)

I'm not sure if i am missing a configureation or what, but when I try to deploy, I am getting the following error: ENOENT: no such file or directory, open '/Users/chuck/repos/swivl-mono/apps/server/Procfile' The problem is that file is not hosted in the apps folder but in the folder: /Users/chuck/repos/swivl-mono/servers/server/Procfile

i.e. I have those files in a directory other that /apps

Is there a setting to modify this?

This is my full deploy config:

"deploy": { "executor": "@getlarge/nx-heroku:deploy", "options": { "appNamePrefix": "swivl-mono-test", "procfile": "web: node dist/servers/server/main.js", "buildPacks": [ "heroku/nodejs", "heroku-community/multi-procfile" ], "variables": { "NGINX_APP_ROOT": "dist/servers/server", "YARN2_SKIP_PRUNING": "true", "HD_PROCFILE": "/servers/server/Procfile" }, "useForce": true, "debug": true } },

Thanks for any help!

getlarge commented 3 months ago

Hi,

As you noticed, the executor's implementation assumes that the Procfile is located under the app being deployed. At the moment, there is no way to modify this behavior.

One potential solution to this issue could be for the executor to check for the PROCFILE and/or HD_PROCFILE environment variables. If these variables are present, they could be used to override the default procfile location. What do you think?

chuckurbis commented 3 months ago

First off, thanks for getting back to me! (also sorry I didn't realize Github formatted my config like that!) The problem I'm seeing is not that it isn't looking for the profile in the project directory. I would actually like it to do that. But my project directory isn't in the /app directory. Instead it lives in a /servers directory. I think nx-heroku is looking in /app regardless of the actual directory. Does that make sense?

getlarge commented 3 months ago

You mean the /apps directory, right? If you look at the executor's code here, appsDir infer the applications folder location from your Nx configuration. Maybe you can make that setting explicitly in your nx.json?

  "workspaceLayout": {
    "appsDir": "servers",
    "libsDir": "<your_libs_folder>"
  },
chuckurbis commented 3 months ago

Got it. I didn't realize nx had tooling specific to that directory. I will move my servers to within the apps directory.

getlarge commented 3 months ago

Let me know if it solves your issue.