简体   繁体   中英

Upgrade pip via .ebextensions

I'm trying to upgrade pip to possibly resolve a dist-info directory not found error, but my deployment appears to just totally ignore any attempts to. Is it possible that installation of requirements happens before any .ebextensions scripts & that's why I'm seeing no progress? If so at what point could I upgrade pip?

I understand I could SSH in, but I don't want to do this for every deploy.

01_upgrade_pip.config

commands:
  01_upgrade_pip:
    command: /opt/python/run/venv/bin/pip install --upgrade pip
    ignoreErrors: false

Is everything correct here or have the resources I've been following since been deprecated or something?

I have tried including the command in my packages.config as well hoping that'd allow the upgrade to occur first, but still just no indication that it was even acknowledged.

packages:
  yum:
    git: []

commands:
  01_upgrade_pip:
    command: /opt/python/run/venv/bin/pip install --upgrade pip
    ignoreErrors: false

I won't include logs for now unless someone requests something specific. Currently all that's relevant there is the same dist-info directory not found error alongside the alert that I'm using pip version 9 when 19 is available (confirming no upgrade is occurring).

Update for Answer Below The solution as mentioned below was to use a preinit script.

In /opt/elasticbeanstalk/hooks/preinit/08upgradepip.sh :

python3 -m pip install --upgrade pip

Did you try to use the preinit hook?

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platform-hooks.html

When an instance is launched, Elastic Beanstalk runs preinit, appdeploy, and postinit, in this order. On subsequent deployments to running instances, Elastic Beanstalk runs appdeploy hooks. configdeploy hooks are run when a user updates instance software configuration settings. restartappserver hooks are run only when the user initiates an application server restart.

According to the documentation:

Place scripts that you want hooks to trigger in one of the subfolders of the /opt/elasticbeanstalk/hooks/ folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM