2015-04-07 189 views
3

我使用beanstalk部署在aws ec2上。 我的項目使用鮑爾管理庫的依賴。 (但我的項目的主要語言是python - flask。)涼亭安裝豆稈

據我所知,我可以通過.ebextensions config安裝其他軟件包。 我用它安裝了redis。

packages: 
    yum: 
    gcc-c++: [] 
    make: [] 
sources: 
    /home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz 
commands: 
    redis_build: 
    command: make 
    cwd: /home/ec2-user/redis-2.8.4 
    redis_config_001: 
    command: sed -i -e "s/daemonize no/daemonize yes/" redis.conf 
    cwd: /home/ec2-user/redis-2.8.4 
    redis_config_002: 
    command: sed -i -e "s/# maxmemory <bytes>/maxmemory 500MB/" redis.conf 
    cwd: /home/ec2-user/redis-2.8.4 
    redis_config_003: 
    command: sed -i -e "s/# maxmemory-policy volatile-lru/maxmemory-policy allkeys-lru/" redis.conf 
    cwd: /home/ec2-user/redis-2.8.4 
    redis_server: 
    command: src/redis-server redis].conf 
    cwd: /home/ec2-user/redis-2.8.4 

我添加了npm和bower,但它不起作用。

packages: 
    yum: 
    gcc-c++: [] 
    make: [] 
sources: 
    /home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz 
commands: 
    redis_build: 
    command: make 
    cwd: /home/ec2-user/redis-2.8.4 
    redis_config_001: 
    command: sed -i -e "s/daemonize no/daemonize yes/" redis.conf 
    cwd: /home/ec2-user/redis-2.8.4 
    redis_config_002: 
    command: sed -i -e "s/# maxmemory <bytes>/maxmemory 500MB/" redis.conf 
    cwd: /home/ec2-user/redis-2.8.4 
    redis_config_003: 
    command: sed -i -e "s/# maxmemory-policy volatile-lru/maxmemory-policy allkeys-lru/" redis.conf 
    cwd: /home/ec2-user/redis-2.8.4 
    redis_server: 
    command: src/redis-server redis].conf 
    cwd: /home/ec2-user/redis-2.8.4 
    npm_install: 
    command: "yum install -y npm" 
    bower_install: 
    command: "npm install -g bower" 
    bower_install_packages: 
    command: bower install 

我總是面對這樣的錯誤。

Upload Complete. 
INFO: Environment update is starting.        
INFO: Deploying new version to instance(s).       
ERROR: [Instance: i-41397fb2 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] command failed with error code 1: Error occurred during build: Command bower_install failed. 
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1]. 

我該如何解決這個問題?

+0

尋找相同!你有沒有找到解決方案? – theChinmay

+0

@theChinmay https://gist.github.com/growingdever/8eb2ae8e5793b9c1cd09 試着用這個。 –

回答

1

我也有這個問題,最後AWS支持爲我解決了它。 分辨率爲:

1)添加下面的腳本.ebestensions:

container_commands: 
    01_bower_install: 
    command: "export PATH=$PATH; $NODE_HOME/bin/node ./node_modules/bowe/bin/bower -V install --allow-root -F > /tmp/01_bower_install.log" 

2)添加以下行來的package.json(腳本元素)

"scripts": { 
    "postInstall": "bower install" 
}, 

這一切