Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic Beanstalk unable to install packages

I'm trying to deploy my application on AWS Elastic Beanstalk. I am getting this error and totally unable to see where the problem is.

The below is the code present in .ebextensions/mysite-env.config

packages:
  yum:
    python-devel: []
    postgresql-devel: []

container_commands: 
  01_syncdb:
    command: "django-admin.py syncdb --noinput"
    leader_only: true
  02_createadmin: 
    command: "scripts/createadmin.py"
    leader_only: true

option_settings: 
  - option_name: WSGIPath
    namespace: "aws:elasticbeanstalk:container:python"
    value: "mysite/wsgi.py"
  - option_name: DJANGO_SETTINGS_MODULE
    value: "mysite.settings"

After several hit-and-try methods, I figured out few things

  1. The above config file seems to run after requirements.txt present in root
  2. Unable to install those packages (mentioned above) but I could get installed by getting into ssh of the EC2 instance (weird)

The issue with [1] is that, for psycopg2 to install, I need the above mentioned packages. So, how do I install them first?

When I run these settings, I am getting the below error:

[2014-11-19T09:45:19.819Z] INFO  [6703]  - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] : Activity execution failed, because: command failed with error code 1: Error occurred during build: Yum does not have postgresql-devel available for installation (Executor::NonZeroExitStatus)

Then, I used the below settings

packages: yum: python-devel: [] apt: postgresql-devel: []

Then I am getting the below error:

[2014-11-19T09:47:54.271Z] ERROR [6789]  : Command execution failed: [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] command failed with error code 1: Error occurred during build: [Errno 2] No such file or directory (ElasticBeanstalk::ActivityFatalError)
    at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.0/lib/elasticbeanstalk/activity.rb:189:in `rescue in exec'
    ...
caused by: command failed with error code 1: Error occurred during build: [Errno 2] No such file or directory (Executor::NonZeroExitStatus)

When I could install those packages directly from ssh, whats the problem with automation? What's wrong with my settings?

like image 321
Surya Avatar asked Nov 18 '14 14:11

Surya


3 Answers

Use postgresql93-devel in the yum statement as they have updated the package names

packages:
  yum:
    python26-devel: []
    postgresql93-devel: []
like image 153
Scott Rutherford Avatar answered Sep 27 '22 15:09

Scott Rutherford


I could not find another way than installing these packages by hand.

packages:
  yum:
    ...

commands:
  01_python_devel_install:
    command: 'yum install -y python34-devel'

  02_postgresql_install:
    command: 'yum install -y postgresql94 postgresql94-devel'

I am starting with elastic beanstalk and this does not give me a good first impression.

like image 42
linqu Avatar answered Sep 27 '22 15:09

linqu


Heres the correct way according to AWS.

Python 3

packages:
  yum:
    python34-devel: []
    postgresql94-devel: []

Python 2.7

packages:
  yum:
    python27-devel: []
    postgresql94-devel: []

Reference

like image 35
Renews Avatar answered Sep 27 '22 17:09

Renews