Python app uses old filed on EC2 instance - django

I have an interesting problem:
There is an EC2 instance, on which py3env is stored
I deploy my web app from pyCharm to EC2 and run the server (runserver 0.0.0.0)
Since last week the web app uses OLD files, which I have already deleted from EC2. I check app files on EC2 - they are correct, but still I have 'old' app running.
Maybe there is some EC2 cache problem or what?

There is nice documentation about your question.

Related

Running an ec2 instance from other server provider existing image

I have installed ressources on a scalway server scaleway.com (a frensh servers and cloud provider). This server uses ubuntu as os and runs a python app with many installations and configs.
In scalway, you can run a new server from a server image you had before installed or already existing. In ec2 too, you can surely launch an aws ec2 instances from an existing AMI https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html.
But, is there a way please to launch an ec2 instance with a scalway image. It will save much time in deployment of the app.
Thanks.
It seems that there is no way:
https://www.reddit.com/r/Scaleway/comments/jwha9q/is_there_a_way_to_download_an_image/

How to deploy django on AWS elastic beanstalk with postgresql

I tried a lot of tutorials including aws beanstalk official django deployment document. There is always some kind of error. eg:
none of my requirements.txt packages get installed on ec2. When i ssh to ec2 I see that Django==2.1.1 is not an available option that for installation.
Unable to connect to postgresql DB from ec2, but could connect from
my local machine, inspite of having added ec2 public IP4 to the
security group. It connects when I add ec2 security group ID to rds inbound though.
I spent many days trying to fix individual problem but still the overall attempt has been a frustrating failure. I know there must be lot of rookie aspiring django+AWS developers like me who would greatly appreciate a comprehensive tutorial that just works with python 3.6 instead of having to put pieces together or use third party services.
Thanks

How does Django deployments happen on Servers?

I learnt how to deploy the django projects to EC2 instances.
Basically 1st time when the django project is deployed to EC2, the instance will be configured with httpd.conf, wsgi, change permissions on files and folders and other stuff and the project will be cloned to the EC2 instance and server is restarted.
My question is how do they do future deployments? They in this context is anyone who deploys Django on EC2 instances.
Do they login to EC2 instances and manually clone the repository from VCS site and restart the server?
Do they have any other automated mechanism to pull the code, ensure permissions and restarting the apache server etc.
How is it done basically every time they go for a release?

running a docker loop device on aws

I'm new to aws and am having some issues with getting my mobile app back running again. Forgive me if this question seems vague.
For a school project we created a mobile app on aws and deployed using docker containers (another student managed these tasks). When trying to get my own key pair to ssh into my ec2 instance i detached the volume associated with my instance and reattached it after getting my own key pair. Now i can ssh into my instance but my front end cant talk to my web server.
So my question is, do i create a new application on elastic beanstalk to deploy my app? Even though when i run lsblk is shows a have a docker loop device and when i run docker images i see several that match the name of my application? or do i somehow get the container running again, docker run doesn't seem to be working.
No need, just upload a new update into Elastic Beanstalk. AWS will handle the rest.
FYI, Elastic Beanstalk - Single Docker Container update process (simple under the hood):
You upload the update into AWS.
AWS will put it on your S3.
Inside your EC2, there is an Elastic Beanstalk agent. It will check for a new update.
If there is an update, the agent will download the update file and extract it.
The agent will build a new Docker image.
If the build is success, it will generate a new config to tell Nginx (web proxy) the new web server container.
Nginx will be reloaded.
Your old docker container will be destroyed.
Don't change anything inside EC2 of Elastic Beanstalk, except you know what you do. Elastic Beanstalk is design for automate deployment and scaling. So, if you change something in your EC2 manually, it might be lost. Of course, you can modified your EC2 instance, but you need to automate it using .ebextensions or take an image.

Rebooting AWS EC2 instance restored my app to an old version

I have hosted a CakePHP app in EC2 using Elastic Beanstalk. Due to some performance issues I had to restart the server. Now I have lost all the files.
Did you reboot the instance or stop and start it?
If you rebooted it then it's certain your app and data are there.
If you stop and start an instance-store instance (not EBS-backed), then you will loose all your data on the ephemeral volume.
All this is well explained on the following link, take a look at it: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Storage.html.