| 305 | == Setting up an EC2 instance as a master node == |
| 306 | |
| 307 | Once you've registered for Amazon's Web Services, login to the EC2 Management Console. You'll be greeted with the EC2 dashboard as in the picture below |
| 308 | |
| 309 | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/Dashboard.png, 75%)]] |
| 310 | |
| 311 | Next, click on Launch Instance. This new instance will act as a master node for future deployments. We'll use Debian as the OS since the bootstrapping scripts support it. In the "Select your Amazon Machine Image" pane, select "AWS Marketplace" from the left sidebar. Scroll down, click on "Operating Systems" and select "Debian GNU/Linux" |
| 312 | |
| 313 | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/SelectAMI.png, 75%)]] |
| 314 | |
| 315 | In the next step, select the instance of your choice. The t1.micro instance is a good choice if you're eligible for Free Tier. |
| 316 | |
| 317 | Next, in the Configure Instance pane, expand the Advanced Details tab and enter the following script in the User-Data field |
| 318 | {{{ |
| 319 | #!/bin/bash |
| 320 | exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 |
| 321 | |
| 322 | # Update |
| 323 | sudo apt-get update |
| 324 | |
| 325 | # Install git |
| 326 | sudo apt-get install git-core |
| 327 | |
| 328 | # Install ansible dependencies |
| 329 | sudo apt-get install python-pip python-dev git -y |
| 330 | sudo pip install PyYAML jinja2 paramiko |
| 331 | |
| 332 | # Install Ansible |
| 333 | sudo pip install ansible |
| 334 | |
| 335 | # Clone bootstrap scripts |
| 336 | git clone https://github.com/gnarula/eden_deploy |
| 337 | |
| 338 | # Run the install |
| 339 | cd eden_deploy |
| 340 | |
| 341 | echo "Running install script" |
| 342 | bash install-eden-cherokee-postgis.sh |
| 343 | |
| 344 | # Run PostgreSQL optimisations for micro instance |
| 345 | pg512 |
| 346 | |
| 347 | echo "Running configuration script" |
| 348 | bash configure-eden-cherokee-postgis.sh -h <hostname> -d <domain> -t <template> |
| 349 | |
| 350 | # Run uWSGI |
| 351 | sudo /etc/init.d/uwsgi-prod start |
| 352 | }}} |
| 353 | |
| 354 | The configure-eden-cherokee-postgis.sh script takes in three optional parameters. Please replace the placeholders with the appropriate values or remove them from the command in case you'd like to proceed with the default values (domain name being your Instance public dns and opting for the "default" template). |
| 355 | |
| 356 | Note: You may want to change `pg512` to pg1024 if you're running a configuration than what a micro instance has to offer. |
| 357 | |
| 358 | Moving on to Step 6, create a new security group with a rule for SSH and HTTP as shown in the screenshot below. |
| 359 | |
| 360 | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/SecurityGroup.png, 75%)]] |
| 361 | |
| 362 | Finally, review the configuration and launch the instance. You'll be prompted to select an existing key pair or generate a new one. In case you're a new user or you don't have access to your key, generate a new keypair, save it and proceed. |
| 363 | |
| 364 | That's it! Your new instance will have Eden Installed and set up for it to be used as a master node in future deployments. Do note that the deployment takes some time even after the Web UI states the instance as "Running". Logs for the process may be found by sshing into the newly created instance with your key and viewing /var/log/user-data.log |
| 365 | |
| 366 | It's important to note that the log file contains a randomly generated password to your PostgreSQL database. We advice you to memorize it and remove it from the logs thereafter. |
| 367 | |