简体   繁体   English

如何在 Elastic Beanstalk 上添加 PATH

[英]How can I add PATH on Elastic Beanstalk

I want to add PATH to packages on eb deploy .我想将 PATH 添加到eb deploy上的包中。 Packages are Installed to /var/www/html/vendor/bin软件包安装到/var/www/html/vendor/bin

It can be add by manually through SSH, but how can I add PATH with config file.可以通过 SSH 手动添加,但是如何使用配置文件添加 PATH。

I have config file like this .ebextensions/ec2.config .我有这样的配置文件.ebextensions/ec2.config 01-set_timezone works fine 02-set_path dosen't 01-set_timezone工作正常02-set_path dosen't

commands:
  01-set_timezone:
    command: cp /usr/share/zoneinfo/Japan /etc/localtime
  02-set_path:
    command: export PATH=$PATH:/var/www/html/vendor/bin

each command is performed in its own shell. 每个命令都在自己的shell中执行。 so the export won't work. 所以出口不起作用。 you'd need to put it into ~/.bash_profile to ensure it's executed with every new command. 你需要将它放入~/.bash_profile以确保它在每个新命令中执行。

commands:
  set_path:
    test: test ! -f /opt/elasticbeanstalk/.post-provisioning-complete
    command: echo 'export PATH=$PATH:/var/www/html/vendor/bin' >> /root/.bash_profile

to make it run only once, add the following file: 要使它只运行一次,添加以下文件:

.ebextensions/99_finalize_setup.config: .ebextensions / 99_finalize_setup.config:

commands:
  99_write_post_provisioning_complete_file:
    command: touch /opt/elasticbeanstalk/.post-provisioning-complete

To have the PATH available during setup you can do the following.要在安装过程中使用 PATH,您可以执行以下操作。

Create a config file .ebextensions/set_path.conf创建配置文件.ebextensions/set_path.conf

option_settings:
  "aws:elasticbeanstalk:application:environment":
    "PATH": "/var/www/html/vendor/bin:$PATH"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 AWS Elastic Beanstalk 中指定 Procfile 的路径? - How to specify the path for Procfile in AWS Elastic Beanstalk? Amazon Elastic Beanstalk:如何设置 wsgi 路径? - Amazon Elastic Beanstalk : how to set the wsgi path? 如何在AWS Elastic Beanstalk上运行Rails后台作业? - How can I run Rails background jobs on AWS Elastic Beanstalk? 如何从命令行“上传和部署”到Elastic Beanstalk? - How can I “upload and deploy” to Elastic Beanstalk from the command line? 如何为AWS Elastic Beanstalk应用程序安装matplotlib? - How can I install matplotlib for my AWS Elastic Beanstalk application? 如何获得弹性 beanstalk 以允许上传大文件? - How can I get elastic beanstalk to allow large files to be uploaded? 如何在 AWS Elastic Beanstalk 中使用 select 特定平台? - How I can select specific platform in AWS Elastic Beanstalk? 部署后如何在弹性 beantalk 上创建目录? - How can I create a directory on elastic beanstalk after deploying? 如何确定Elastic Beanstalk是否正在运行我的配置文件? - How can I tell if Elastic Beanstalk is running my config files? 如何为弹性 beanstalk Windows 应用程序设置文件夹权限? - How can I set folder permissions for elastic beanstalk windows application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM