Django with postgresql deployment on aws elastic beanstalk - django

I’ve been trying to deploy a django application with postgresql db on aws elastic beanstalk and i ran into many issues that i surfed and solved. Now the application uploads fine however the environment is still not green and I constantly am receiving 502 bad gateway nginx. I’ve checked nginx logs which say 111 connection refused etc. I’ve tried changed the port to 8001 from 8000 but didn’t work out. Somebody please guide me on how to deploy my application successfully.

Here are some of the common errors logfiles. Try checking them out
--- Common Dbug Errors ---
$ eb logs
--Files (after eb ssh):
$ eb ssh
1.sudo nano /var/log/cfn-init.log
2.sudo nano /var/log/cfn-init-cmd.log (see command output and error from config)
And are you using AWS RDS to for PostgreSQL?
Here is a detailed explanation and some common error fixes discuss in this blog

Related

Is there any way to get the DNS address of an instance of an aws ubuntu server if I do not have the login to the aws account, but the SSH key for it

I got a task to deploy a static website on an AWS Ubuntu Server, I was given the username and the SSH key for it. Using PuTTy I got access to the server, setup django, postgres nginx and gunicorn. However now I need to check the progress and whichever tutorial I looked up, I found them checking their deployment progress with a dns address, but since I have connected to the server remotely, I do not have that. So please help me check my deployment status. I am attaching some screenshots of the PuTTy terminal below
Image of the final Gunicorn command to finish the deployment

502 bad gateway django elastic beanstalk

I got the django app deployed with elastic beanstalk on aws, I setup postgresql for it as well to work with one on aws. Unfortunately, following
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html
I am getting 502 bad gateway after
eb open
I'm not really getting any errors, my app runs on local. I'm using the debug server, I also managed to run it on waitress. I was reading the oceans of info online and the only thing I can think of - do I need to actually deploy to a production server locally or can I just use EC2 for that? I'm learning about AWS as I go, so sorry if I'm not understanding something here :)
Thank you!

408 timeout error with postgraphile on AWS elastic beanstalk

I'm running postgraphile and apollo to get data for my react app. I am using npm concurrently to run the react server and to run postgraph using the CLI including --cors flag. Everything works fine when i run the app locally. When I upload everything to AWS elastic beanstalk, I can't access app.com:5000/graphiql and the app gives me a 408 timeout error code saying it is a problem with HTTPLink, then tells me there is a cross origin error. If i run the app on AWS and have it point to my localhost:5000/graphiql it works perfectly, but not when it is deployed to AWS. The part that confuses me is that it does not have a cross origin error when it is going from AWS to my localhost, but it does have a cross origin error when it's going from AWS to AWS.
By default PostGraphile binds to localhost; it sounds like you need it to bind to all interfaces. Try the --host 0.0.0.0 option documented here:
https://www.graphile.org/postgraphile/usage-cli/

Jenkins Error 503 on AWS EC2 Instance

I have created an AWS Ec2 instance using the following documentation:
https://d0.awsstatic.com/Projects/P5505030/aws-project_Jenkins-build-server.pdf
However, when I get to the stage where I connect from my web browser to Jenkins using http://:8080 I get HTTP Error: 503.
I originally taught it was down to my network settings/security group settings on my AWS EC2 instance but I have installed Apache and I can access the Apache test page from port 80. I have allowed traffic from HTTP, SSH and TCP and set the appropriate ports as per the guide.
I have tried curl http://localhost:8080 on the putty instance connected to my EC2 instance and I get the same error. Also, I have checked the /var/lib/jenkins folder and it is empty.
Any help or direction in the right path would be greatly appreciated,
Thank you.
If anyone runs into this problem in the future, the documentation installs the latest version of Jenkins.
I installed an older, stable Jenkins version and this worked perfectly using the "sudo yum install jenkins-2.47-1.1"
The problem is resolved by installing Java 8.
https://issues.jenkins-ci.org/browse/JENKINS-43609

Script timed out before returning headers: wsgi.py

I have a Django app deployed on Elastic Beanstalk. It was working fine when we were using sqlite during development. Once we added RDS/PostgreSQL it started making the error in the title and the app is now totally unresponsive on EB.
I've followed Script timed out before returning headers: wsgi.py on elastic beanstalk question and re-deployed many times with the same results.
I've done eb ssh and restarted the httpd service and got this error (Elastic Beanstalk not creating RDS Parameters).
I removed the os.environ references from settings.py and hardcoded the values from those I specified during eb create and from the data tier config page. This didn't help either as I was back to point zero again with the error in the title.
Here's the eb create command:
eb create --database --database-engine postgres -i t2.medium
What am I missing?