Note: I recommend viewing this README on this link (images look bigger).
We have host and remote. Host is the machine this playbook will run from, and remote is the playbook will configure. You can have host == remote, which means you are configure the local machine. This means you can configure your local VM or EC2 VM locally with 127.0.0.1 as the ip.
Note: if you have not setup an EC2 instance, please scroll down and read the section EC2 Guide. If you are using Windows, and you want to use PuTTY, EC2 will have a guide on how to connect to EC2 with PuTTY. Just read the guide below.
Once you have an EC2 instance setup, you need to make sure host have installed the development tools:
sudo apt-get update sudo apt-get install build-essential mercurial git python-setuptools python-pip sudo pip install ansible
Next, you need to clone down this playbook to somewhere. Let's put it under home directory:
hg clone https://bitbucket.org/ideapiteam/playbooks cd playbooks cd playbooks
Now you should be inside playbooks/playbooks.
You can begin provisioning the machine by running:
ansible-playbook -i hosts main.yml --private-key /home/ubuntu/.ssh/ubuntu.pem
You need the private key on disk. Please refer to the EC2 guide if you haven't setup one yet.
Finally, for now, you can try running:
cd /opt/ideapis/ source envs/repoapi/bin/activate cd repoapi python setup.py develop cd repoapi/settings/ ./start.sh
Finally, you can visit http://IP/api and if you are getting 404 you are fine.
Assume you already signed up EC2, you can go to the EC2 console by visiting the following url:
Launch a new instance. You should choose Ubuntu 12.04.1 LTS 64-bit.
Before you can continue, you have to download the key. You need this later. Store it somewhere you remember.
Next, create a security group:
Make sure security group is created and applied.
Finally, continue with all the default settings and launch. It will take roughly 3-4 minutes to finish launching.
When it is running and is 2/2 checked, you can ssh into the machine.
Go to Instance, right click on the instance you just created, select Connect and you can get the full ssh command.
When you SSH, make sure the pem file you downloaded in step 1 is in the current directory. If you store it in /home/yeukhon/ide-tmp.pem (just an example), make sure you do:
cd /home/yeukhon/ide-tmp.pem ssh ....
You also have to remember the permission of the pem file must be set to 400.
Once you are able to connect to the EC2 machine from SSH, open the pem file on your local machine. Copy the file content.
Then go to your EC2 machine and create a new file called ubuntu.pem (let's call it that way) under /home/ubuntu/.ssh/. The file will contain the content you just copied from your local machine.
Finally, set the permission:
sudo chmod 400 /home/ubuntu/.ssh/ubuntu.pem
That should be it.