When trying to deploy my django app using eb deploy I am getting the following error. It is totally unseful and does not let me knwo what to do. Please help.
I am following the tutorial here : http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html
sh-3.2# eb deploy
Creating application version archive "app-ca0a-151123_205119".
Uploading learningsite/app-ca0a-151123_205119.zip to S3. This may take a while.
Upload Complete.
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
ERROR: Your requirements.txt is invalid. Snapshot your logs for details.
ERROR: [Instance: i-18ee63c1] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
ERROR: Unsuccessful command execution on instance id(s) 'i-18ee63c1'. Aborting the operation.
ERROR: Failed to deploy application.
ERROR: Failed to deploy application.
sh-3.2#
welcome to EB! You'll get plenty of hard to decrypt error messages.
The important line here is ERROR: Your requirements.txt is invalid. Snapshot your logs for details. There is something wrong with your requirements.txt file and EB is not able to install.
Locally if you run pip install -r requirements.txt you might be able to see the error.
Related
I am trying to deploy A django app to beanstalk and I get some errors related to python and requirements.txt and I can't figure out what to do, Any help is appreciated.
here are the errors I get: (the logs are in pastebin bellow)
ERROR
[Instance: i-0e7826c4558b1d21a] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2022-04-28 15:13:52 UTC+0000
ERROR
Your requirements.txt is invalid. Snapshot your logs for details.
logs:
https://pastebin.com/g1uZLqur
here is my requirements.txt
Django==2.2.6
django-environ==0.4.5
pytz==2019.3
sqlparse==0.3.0
django-paypal==1.0.0
https://github.com/darklow/django-suit/tarball/v2
git+https://github.com/nn3un/reportlab-mirror#egg=reportlab
boto3==1.4.4
django-storages==1.8
psycopg2
django-guardian
bokeh==1.4.0
django-ses==2.0.0
mock
I'm simply adopting the Eventbridge ETL design pattern and it gives me this error when I deploy:
[100%] fail: docker login --username AWS --password-stdin https://315997497220.dkr.ecr.us-west-2.amazonaws.com exited with error code 1:
❌ the-eventbridge-etl failed: Error: Failed to publish one or more
assets. See the error messages above for more information. at
Object.publishAssets
(/home/mubashir/.nvm/versions/node/v16.3.0/lib/node_modules/aws-cdk/lib/util/asset-publishing.ts:25:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Object.deployStack
(/home/mubashir/.nvm/versions/node/v16.3.0/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:237:3)
at CdkToolkit.deploy
(/home/mubashir/.nvm/versions/node/v16.3.0/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:194:24)
at initCommandLine
(/home/mubashir/.nvm/versions/node/v16.3.0/lib/node_modules/aws-cdk/bin/cdk.ts:267:9)
Failed to publish one or more assets. See the error messages above for
more information.
The steps I took. Github repo has a video I followed
npx cdkp init the-eventbridge-etl --lang=python
cd the-eventbridge-etl
python3 -m venv .env
source .env/bin/activate
pip install -r requirements.txt
cdk synth
cdk deploy
The first error I get is related to bootstrapping. So I bootstrap.
export CDK_NEW_BOOTSTRAP=1
npx cdk bootstrap aws://315997497220/us-east-2 --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --trust 315997497220 aws://315997497220/us-east-2
I've naturally updated the cdk.json file for using the above bootstrapping technique. I've tried all bootstrap techniques, with and without a qualifier, and with its subsequent changes to cdk.json. I don't think it's a bootstrap issue.
I get the above error and I don't know what the issue is. I have not made any changes to the code.
I geuss you need to get and pipe a password first as you use the --password-stdin flag. Try:
aws ecr get-login-password | docker login --username AWS --password-stdin https://315997497220.dkr.ecr.us-west-2.amazonaws.com
I followed this tutorial: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html
I was able to stand up my Django project on my local MacBook pro, but when deploying to AWS EB, it failed, logs below:
2021/02/03 23:50:45.548154 [INFO] Executing instruction: StageApplication
2021/02/03 23:50:45.807282 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2021/02/03 23:50:45.807307 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2021/02/03 23:50:46.552599 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2021/02/03 23:50:46.553257 [ERROR] An error occurred during execution of command [app-deploy] - [StageApplication]. Stop running the command. Error: chown /var/app/staging/bin/python: no such file or directory
2021/02/03 23:50:46.553265 [INFO] Executing cleanup logic
2021/02/03 23:50:46.553350 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1612396246,"severity":"ERROR"}]}]}
My research led me to this post: AWS Elastic Beanstalk chown PythonPath error, but when I tried the suggested command: git rm -r --cached venv in my project directory, it returned:
fatal: pathspec 'venv' did not match any files
If you type eb logs into the command line and look for the eb-engine.log section you might be able to get more details.
Also maybe verify that you set up you eb cli correctly. Here is the link to setting it up, look at section 2.3 and make sure you have all the requirements installed appropriately.
https://github.com/aws/aws-elastic-beanstalk-cli-setup
Finally double check your python version(s) you have installed. the tutorial is calling python-3.6 but you may not have that version installed.
[Instance: i-*****************] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
i'm getting this error, can anyone give some picture of what and why it is coming.
And my requirements.txt is
Django==1.11.4, djangorestframework==3.5.1, psycopg2==2.7.3.1, gunicorn==19.7.0, django-cors-headers==2.1.0, whitenoise==3.3.1, coreapi==2.3.1, sendgrid==5.2.0, awsebcli==3.5.1, pystan==2.17.0.0
Your requirements.txt should look like this:
Django==1.11.4
djangorestframework==3.5.1
psycopg2==2.7.3.1
gunicorn==19.7.0
django-cors-headers==2.1.0
whitenoise==3.3.1
coreapi==2.3.1
sendgrid==5.2.0
awsebcli==3.5.1
pystan==2.17.0.0
if you connect to your instance using
eb ssh
And then run
source /opt/python/run/venv/bin/activate
source /opt/python/current/env
pip install -r /opt/python/current/app/requirements.txt
You should get to see the errors.
Tom.
I just spin up some environment using EB with python 3.4 and Django but it keeps failing, looks like the error occurs when installing using pip install -r requirements.txt this are the events from the web console:
Time Type Details
2017-10-06 20:22:39 UTC-0600 WARN Environment health has transitioned from Pending to Degraded. Command failed on all instances. Initialization completed 69 seconds ago and took 14 minutes.
2017-10-06 20:22:20 UTC-0600 ERROR Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
2017-10-06 20:21:17 UTC-0600 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2017-10-06 20:21:17 UTC-0600 ERROR [Instance: i-0b46caf0e3099458c] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2017-10-06 20:21:14 UTC-0600 ERROR Your requirements.txt is invalid. Snapshot your logs for details.
I followed this tutorial: django-elastic-beanstalk-django and deploying-a-django-app-and-postgresql-to-aws-elastic-beanstalk on both I'm stuck at the same step
I had an exact same problem. Here is the solution I found:
Go to your env's configuration
Click the conf button of Instances
Under Server section, check your Custom AMI ID
For now, leave the page and go to AWS EC2 Console page
Press Launch Instance
You will now be on Step 1: Choose an Amazon Machine Image (AMI)
Tada! You will see these ami ids that you can choose from:
Go back to no.3 and fill up the Custom AMI ID, refer from no.6
(FYI, I used amazon linux, but it is up to you to decide)
Click Apply and wait till the configuration is done
Re-follow the deploying django app
DONE!