-
Notifications
You must be signed in to change notification settings - Fork 1
Using ssh to access instances
============================== This section will show you how to ssh into an instance and set up the environment so you can run commands with manage.py
You will need to add your public SSH key to ssh_keys, located in the root folder of the SecondFunnel project.
If you do not have an SSH key, you'll need to create one.
To add your public SSH key, just run the following command:
cat ~/.ssh/id_rsa.pub >> ssh_keys
The deployment process automatically appends ssh keys to the authorized keys file on the instance, which will allow you to SSH onto the machine.
In the AWS Console, go to the EC2 page (at the top of the screen: Services -> EC2), click instances on the left navigation bar, then click your instance. Find the instance's public DNS from the options pane that appears.
Now open a terminal and type in ssh ec2-user@<public_dns_from_above> You should now be on the instance.
Our code is stored in /opt/python/bundle/#/app/ where # is the highest numbered directory inside bundle (eg. /opt/python/bundle/7/app/). It's also linked from /opt/python/current/. Once in that directory:
cd /opt/python/current/app
source ../../../run/venv/bin/activate
source ../env
The first source is to setup the virtual environment, and the second sets up RDS environment variables. You can now run commands with manage.py.
- Create an Elastic Beanstalk environment from
Oregon->secondfunnel. - Either upload a zip (in project dir,
rm -f latest.zip && git archive -o latest.zip HEAD) to deploy your version, or do so from git if you have the alias set up. - When deployment fails for the first time (
Apache isn't running, but it should be, blah blah blah), restart the app server from Actions -> Restart the App Server(s). - Make sure EBS health check url is
/healthcheck/. You can set this in Overview -> Edit Configuration. - Optional: edit the instances' security group to have port 80 open to anyone.
- Remove the instance(s) from the load balancer. Re-add the instance(s) to the load balancer. You should now have instances running live.