Troubleshooting Deploying a Django Application With Elastic Beanstalk: Difference between revisions
(Created page with "Category:AWS Category:Django == Overview == An ongoing list of issues, with solutions as they are found, that I have encountered while deploying a Django web applicat...") |
No edit summary |
||
| Line 46: | Line 46: | ||
(Where `namekey_pair.pem` is the actual name of a `.pem` file, and `public_dns` is the actual address of the public dns from the EC2 console.) | (Where `namekey_pair.pem` is the actual name of a `.pem` file, and `public_dns` is the actual address of the public dns from the EC2 console.) | ||
== `eb deploy` errors where EB environment doesn't match == | |||
'''Use case''' | |||
Attempting to update `.ebextensions/01-packages.config` to list Git and PostgreSQL as packages to install, then running `eb deploy` to install the packages, the deploy process quits with errors to the effect that the YAML is malformed in the `.config` file. Editing the file makes it evident that the errors are originating in another environment. | |||
'''Cause''' | |||
Logged into wrong EC2 instance. | |||
You can log into an EC2 instance and run `eb init` and `eb create` commands to create new Elastic Beanstalk applications and environments. The new app will spawn a new EC2 instance, ''that is separate from the current EC2 instance''. | |||
'''Fix''' | |||
It's necessary to `ssh` to the correct EC2 instance to run `eb deploy`. Go back to the AWS EC2 console, find the EC2 instance corresponding to the new EB environment, and `ssh` to its public DNS. | |||
Revision as of 21:42, 9 February 2016
Overview
An ongoing list of issues, with solutions as they are found, that I have encountered while deploying a Django web application using Elastic Beanstalk.
"No environment found" error with aws eb cli
Use case
Almost all eb commands result in an error the effect of No Environment found for EnvironmentName = 'name-ev'.
Cause
An EB environment was created, but then not deleted entirely.
Fix
Delete the environment through the AWS console, and then delete the .elasticbeanstalk/ and .ebextensions/ directories.
Zip file errors while installing a custom Django module
Use case
pip install path/to/my-custom-package.0.1.zip results in error: BadZipFile: File is not a zip file.
Cause
This happened after using wget to retrieve a .zip archive off GitHub.
Despite the .zip extension, the file type can register as HTML on Linux.
Fix
Test the file type:
$ file myzipfile.zip myzipfile.zip: HTML document, UTF-8 Unicode txt, with very long lines
Upload the zip file to the server using scp:
`scp -i path/to/namekey_pair.pem path/to/source.zip ec2-user@public_dns.us-west-2.compute.amazonaws.com:path/to/dest.zip`
(Where namekey_pair.pem is the actual name of a .pem file, and public_dns is the actual address of the public dns from the EC2 console.)
eb deploy errors where EB environment doesn't match
Use case
Attempting to update .ebextensions/01-packages.config to list Git and PostgreSQL as packages to install, then running eb deploy to install the packages, the deploy process quits with errors to the effect that the YAML is malformed in the .config file. Editing the file makes it evident that the errors are originating in another environment.
Cause
Logged into wrong EC2 instance.
You can log into an EC2 instance and run eb init and eb create commands to create new Elastic Beanstalk applications and environments. The new app will spawn a new EC2 instance, that is separate from the current EC2 instance.
Fix
It's necessary to ssh to the correct EC2 instance to run eb deploy. Go back to the AWS EC2 console, find the EC2 instance corresponding to the new EB environment, and ssh to its public DNS.