在节点应用程序的“cf push”期间,如何保留文件的执行位?(How can I preserve execute bits for files during 'cf push' for Node apps?)

我需要推送一个将执行bash脚本的节点应用程序,并且脚本文件需要设置执行位。 cf命令行实用程序是否允许我设置执行权限?

如果没有,我可以在我的应用程序的暂存周期中设置执行权限位吗?

I need to push a node application that will be executing a bash script and the script file needs to have the execute bit set. Can the cf command line utility allow me to set execute permission?

If it doesn't, can I do something during the staging cycle of my app to set execute permission bits?

最满意答案

设置了执行位的脚本也会在被推送时设置它。

如果您需要在暂存或推送应用程序时调用脚本,则有两个选项:

在暂存期间调用脚本

使用package.json scripts.preinstall stanza在登台期间运行脚本(在npm install期间,请参阅此处了解更多选项),并在您的应用程序中包含该脚本:

"scripts": { "start": "node app.js", "preinstall": "./configure" },

分段后调用脚本

如果脚本可以在应用程序启动之前运行,但在暂存之后 ,请使用.profile.d 。 在容器中启动应用程序之前(暂存后),bash shell将运行.profile.d文件夹中的所有脚本。

例如,我可以使用my_app/.profile.d/aScript.sh文件:

export key=value或chmod +x some_file

A script that has the execute bit set will also have it set when being pushed.

If you need to have a script invoked as part of staging or pushing the app, there are two options:

Invoke script during staging

Use scripts.preinstall stanza in package.json to run scripts during staging (during npm install, see here for more options), and include that script with your application:

"scripts": { "start": "node app.js", "preinstall": "./configure" },

Invoke script after staging

If the script can be run before app is started, but after staging, use .profile.d. Before your app is started in the container (after staging), a bash shell will run all scripts in your .profile.d folder.

For example, I could have a my_app/.profile.d/aScript.sh file with:

export key=value or chmod +x some_file

在节点应用程序的“cf push”期间,如何保留文件的执行位?(How can I preserve execute bits for files during 'cf push' for Node apps?)

我需要推送一个将执行bash脚本的节点应用程序,并且脚本文件需要设置执行位。 cf命令行实用程序是否允许我设置执行权限?

如果没有,我可以在我的应用程序的暂存周期中设置执行权限位吗?

I need to push a node application that will be executing a bash script and the script file needs to have the execute bit set. Can the cf command line utility allow me to set execute permission?

If it doesn't, can I do something during the staging cycle of my app to set execute permission bits?

最满意答案

设置了执行位的脚本也会在被推送时设置它。

如果您需要在暂存或推送应用程序时调用脚本,则有两个选项:

在暂存期间调用脚本

使用package.json scripts.preinstall stanza在登台期间运行脚本(在npm install期间,请参阅此处了解更多选项),并在您的应用程序中包含该脚本:

"scripts": { "start": "node app.js", "preinstall": "./configure" },

分段后调用脚本

如果脚本可以在应用程序启动之前运行,但在暂存之后 ,请使用.profile.d 。 在容器中启动应用程序之前(暂存后),bash shell将运行.profile.d文件夹中的所有脚本。

例如,我可以使用my_app/.profile.d/aScript.sh文件:

export key=value或chmod +x some_file

A script that has the execute bit set will also have it set when being pushed.

If you need to have a script invoked as part of staging or pushing the app, there are two options:

Invoke script during staging

Use scripts.preinstall stanza in package.json to run scripts during staging (during npm install, see here for more options), and include that script with your application:

"scripts": { "start": "node app.js", "preinstall": "./configure" },

Invoke script after staging

If the script can be run before app is started, but after staging, use .profile.d. Before your app is started in the container (after staging), a bash shell will run all scripts in your .profile.d folder.

For example, I could have a my_app/.profile.d/aScript.sh file with:

export key=value or chmod +x some_file