Difference between revisions of "OPS345 Assignment 1"

From CDOT Wiki
Jump to: navigation, search
(Sync files with www)
(Replaced content with "[http://wiki.littlesvr.ca/wiki/OPS345_Assignment_1 This page has moved.]")
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Overview =
+
[http://wiki.littlesvr.ca/wiki/OPS345_Assignment_1 This page has moved.]
 
 
In this assignment you'll use many of the skills you learned so far to set up several Apache web servers with a load balancer.
 
 
 
This assignment assumes that your www.youruserid.ops345.ca is a working web server. If you didn't complete that part of Lab 3: you'll need to do it first.
 
 
 
The format of the assignment is similar to a lab, but it's less specific about the exact steps you need to take. You're expected to show more independent learning abilities for an assignment than for a lab. The extra complicated parts are clarified for you here.
 
 
 
In short, a complete assignment will show that you can:
 
 
 
* Create AMIs from an existing VM and deploy new VMs based on that AMI.
 
* Use SSH keys, rsync, and cron to keep data on multiple servers synchronized.
 
* Use iptables as an Apache load balancer by directing traffic to a random slave.
 
 
 
This is the overview of your completed work in the form of a diagram:
 
 
 
[[File:AWSAsg1Overview.png|800px|border|center]]
 
 
 
= Part 1: first slave =
 
 
 
* Go to your www VM in the AWS Console and find the button to create an image from it.
 
** Name the image www-for-asg1-p1
 
** This will create an AMI with all the software configured the way you configured it.
 
* Deploy one new VM from the AMI you created above.
 
** Name it www-slave1
 
** With primary IP address 10.3.45.21
 
** In ops345wwsg
 
** Make sure the second virtual drive is named www-data-slave1
 
* Add the appropriate iptables rule on router and ops345routersg rule to allow yourself to SSH to www-data-slave1 via port 2221.
 
* Don't change the hostname of www-data-slave1, leave it as "www".
 
 
 
== Sync files with www ==
 
 
 
Each of your web servers (www and all the slaves) need to have the same data on them. That means you need to synchronize the contents of /var/www/html. You might recall this is mounted from a separate drive (/dev/xvdf) but that doesn't matter for this assignment.
 
 
 
You'll use rsync to do the synchronization, but first you need to set up your user on www-slave1 to be able to ssh to www without a password.
 
 
 
* Create an ssh key on www-slave1 as your regular user. Make sure the key is stored in /home/yourusername/.ssh/id_rsa_wwwsync
 
** On www edit /home/yourusername/.ssh/authorized_keys
 
** Paste the contents of /home/yourusername/.ssh/id_rsa_wwwsync.pub from www-slave1 to the end of that file as one line.
 
* Test your key authentication setup as yourusername on www-slave1 to confirm you can log in to yourusername@10.3.45.11 (www) without a password:<source>ssh -i /home/yourusername/.ssh/id_rsa_wwwsync yourusername@10.3.45.11</source>
 

Latest revision as of 02:42, 28 February 2022