11 | | |
12 | | If you haven't already, create an Amazon AWS account through [http://aws.amazon.com/free/?sc_channel=PS&sc_campaign=AWS_Free_Tier_2013&sc_category=aws_cloud_computing&sc_publisher=Google&sc_medium=Brand_Core_AWS_E&sc_content=31496064882&sc_detail=Amazon%20-%20aws&sc_matchtype=e&trk=AWS_Free_Tier_2013/ their site].[[BR]] |
13 | | After creating your account, head to the [https://console.aws.amazon.com/console/home?#/ management console] and set up an instance of EC2. Instructions to do this can be found in the [http://aws.amazon.com/documentation/ec2/ Amazon EC2 Documentation]. |
14 | | |
15 | | === Regions & Zones === |
| 10 | If you haven't already, create an Amazon AWS account through [http://aws.amazon.com/free/ their site]. |
| 11 | |
| 12 | == 2. Create Instance == |
| 13 | === Step 1: Log in to the Management Console === |
| 14 | * https://console.aws.amazon.com |
| 15 | |
| 16 | === Step 2: Select a Region === |
36 | | === Step 4: Add Storage === |
37 | | Instance Persistence: |
38 | | * EBS-backed instances have persistent storage even whilst powered down, which is very useful. |
39 | | * For DB I/O performance increase can stripe multiple EBS |
40 | | * monitoring data available to see if this is the issue |
41 | | |
42 | | === Step 5: Tag Instance === |
43 | | Default settings are fine |
44 | | |
45 | | === Step 6: Configure Security Group === |
46 | | You will need to set the following Inbound Rules: |
47 | | * SSH | TCP | 22 |
48 | | * HTTP | TCP |80 |
49 | | Restricting the source will add further security |
50 | | |
51 | | You can either create a '''new''' security group or Select an '''existing''' security group. With the existing security group, you may have to set the inbound rules via the EC2 dashboard: NETWORK & SECURITY > Security Groups |
52 | | |
53 | | |
54 | | |
55 | | == 2. Associate Elastic IP == |
| 37 | === Step 6: Create !KeyPair === |
| 38 | Ensure that you keep the generated private key safe...save as {{{private.pem}}} |
| 39 | |
| 40 | === Step 7: Associate Elastic IP === |
62 | | * Remember to set up Reverse DNS for your Elastic IP to be able to send emails reliably: |
63 | | * https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request |
64 | | * If you have a free EC2 instance, be sure to release your Elastic IP if you shut down your instance. |
65 | | IPv4 addresses are a "scarce resource" so Amazon will charge you for wasting one if you keep it assigned |
66 | | to your instance while you are not using it. |
67 | | |
68 | | == 3. Download SSH Keys == |
69 | | This can provide an early stumbling block. |
70 | | * Each instance created needs to start with a unique SSH keypair |
71 | | * When setting up an instance, be sure to safely download the private key. |
72 | | * In order to get the public key (needed by SecureCRT for instance) then you need to login using CLI & retrieve it (username 'admin' for the AWS !MarketPlace Debian, username 'root' for some other Images): |
| 47 | Remember to set up Reverse DNS for your Elastic IP to be able to send emails reliably: |
| 48 | * https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request |
| 49 | |
| 50 | NB If you have a free EC2 instance, be sure to release your Elastic IP if you shut down your instance. IPv4 addresses are a "scarce resource" so Amazon will charge you for wasting one if you keep it assigned to your instance while you are not using it. |
| 51 | |
| 52 | === Step 8: Configure Security Group === |
| 53 | NETWORK & SECURITY > Security Groups |
| 54 | |
| 55 | You will need to set the following Inbound Rules: |
| 56 | * HTTP | TCP |80 |
| 57 | * SSH | TCP | 22 |
| 58 | Restricting the source will add further security, but obviously also restricts your ability to administer |
| 59 | |
| 60 | === Step 9: Gain SSH access === |
| 61 | In order to get the public key (needed by SecureCRT for instance) then you need to login using CLI & retrieve it (username 'admin' for the AWS !MarketPlace Debian, username 'root' for some other Images): |
113 | | === Add Swap partition (Optional) === |
| 102 | == 3. Install Sahana == |
| 103 | * Copy the installation and configuration scripts into the launched instance (assuming [wiki:InstallationGuidelines/Linux/Server/CherokeePostgreSQL Cherokee & PostgreSQL]): |
| 104 | {{{ |
| 105 | wget http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Linux/Server/CherokeePostgreSQL/install-eden-cherokee-postgis.sh |
| 106 | chmod a+x install-eden-cherokee-postgis.sh |
| 107 | wget http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Linux/Server/CherokeePostgreSQL/configure-eden-cherokee-postgis.sh |
| 108 | chmod a+x configure-eden-cherokee-postgis.sh |
| 109 | |
| 110 | }}} |
| 111 | |
| 112 | * Run the install-eden-cherokee-postgis.sh script. [Note: This step takes about 10min - grab a coffee] |
| 113 | {{{ |
| 114 | sudo su - |
| 115 | ./install-eden-cherokee-postgis.sh |
| 116 | |
| 117 | }}} |
| 118 | |
| 119 | If you wish to update your site from an alternate github repo this can be done using: |
| 120 | * ConfigurationGuidelines#SwitchtoanalternateGitHubrepo |
| 121 | |
| 122 | == 4. Configure Sahana == |
| 123 | Run configure-eden-cherokee-postgis.sh to configure the instance: |
| 124 | {{{ |
| 125 | sudo su - |
| 126 | ./configure-eden-cherokee-postgis.sh |
| 127 | |
| 128 | }}} |
| 129 | |
| 130 | * Add your FQDN to {{{/etc/hosts}}} to ensure emails are accepted by all remote mailers: |
| 131 | {{{ |
| 132 | vim /etc/hosts |
| 133 | 127.0.0.1 host.domain host localhost |
| 134 | |
| 135 | /etc/init.d/exim4 restart |
| 136 | }}} |
| 137 | |
| 138 | See [UserGuidelines/Admin/Configuration Admin Guide] - especially read how to set the sender & approver emails |
| 139 | |
| 140 | == 5. Add a Test site (Optional) == |
| 141 | This script requires at least 4Gb on the main disk |
| 142 | |
| 143 | {{{ |
| 144 | sudo su - |
| 145 | wget http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Linux/Server/CherokeePostgreSQL/add_test_site.sh |
| 146 | chmod a+x add_test_site.sh |
| 147 | ./add_test_site.sh |
| 148 | |
| 149 | }}} |
| 150 | |
| 151 | NB This script has an issue & the file /etc/cherokee/cherokee.conf needs to be manually edited to fix the lines wrapping for Source 1 (fix welcomed!) |
| 152 | |
| 153 | == 6. Add a Demo site (Optional) == |
| 154 | This script requires at least 6Gb on the main disk. |
| 155 | |
| 156 | This script assumes that a Test site has already been installed |
| 157 | |
| 158 | {{{ |
| 159 | sudo su - |
| 160 | wget http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Linux/Server/CherokeePostgreSQL/add_demo_site.sh |
| 161 | chmod a+x add_demo_site.sh |
| 162 | ./add_demo_site.sh |
| 163 | |
| 164 | }}} |
| 165 | |
| 166 | NB This script has an issue & the file /etc/cherokee/cherokee.conf needs to be manually edited to fix the lines wrapping for Source 1 (fix welcomed!) |
| 167 | |
| 168 | == Optional Instance Adjustments == |
| 169 | === Add Swap partition === |
145 | | == 5. Install Sahana == |
146 | | * Copy the installation and configuration scripts into the launched instance (assuming [wiki:InstallationGuidelines/Linux/Server/CherokeePostgreSQL Cherokee & PostgreSQL]): |
147 | | {{{ |
148 | | wget http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Linux/Server/CherokeePostgreSQL/install-eden-cherokee-postgis.sh |
149 | | chmod a+x install-eden-cherokee-postgis.sh |
150 | | wget http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Linux/Server/CherokeePostgreSQL/configure-eden-cherokee-postgis.sh |
151 | | chmod a+x configure-eden-cherokee-postgis.sh |
152 | | |
153 | | }}} |
154 | | |
155 | | * Run the install-eden-cherokee-postgis.sh script. [Note: This step takes about 10min - grab a coffee] |
156 | | {{{ |
157 | | sudo su - |
158 | | ./install-eden-cherokee-postgis.sh |
159 | | |
160 | | }}} |
161 | | |
162 | | If you wish to update your site from an alternate github repo this can be done using: |
163 | | * ConfigurationGuidelines#SwitchtoanalternateGitHubrepo |
164 | | == 6. Configure Sahana == |
165 | | Run configure-eden-cherokee-postgis.sh to configure the instance: |
166 | | {{{ |
167 | | sudo su - |
168 | | ./configure-eden-cherokee-postgis.sh |
169 | | |
170 | | }}} |
171 | | |
172 | | * Add your FQDN to /etc/hosts to ensure emails are accepted by all remote mailers: |
173 | | {{{ |
174 | | vim /etc/hosts |
175 | | 127.0.0.1 host.domain host localhost |
176 | | |
177 | | /etc/init.d/exim4 restart |
178 | | }}} |
179 | | |
180 | | [UserGuidelines/Admin/Configuration Admin Guide] - especially read how to set the sender & approver emails |
181 | | |
182 | | == 7. Add a Test site (Optional) == |
183 | | This script requires at least 4Gb on the main disk |
184 | | |
185 | | {{{ |
186 | | sudo su - |
187 | | wget http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Linux/Server/CherokeePostgreSQL/add_test_site.sh |
188 | | chmod a+x add_test_site.sh |
189 | | ./add_test_site.sh |
190 | | |
191 | | }}} |
192 | | |
193 | | NB This script has an issue & the file /etc/cherokee/cherokee.conf needs to be manually edited to fix the lines wrapping for Source 1 (fix welcomed!) |
194 | | |
195 | | |
196 | | == 8. Add a Demo site (Optional) == |
197 | | This script requires at least 6Gb on the main disk. |
198 | | |
199 | | This script assumes that a Test site has already been installed |
200 | | |
201 | | {{{ |
202 | | sudo su - |
203 | | wget http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Linux/Server/CherokeePostgreSQL/add_demo_site.sh |
204 | | chmod a+x add_demo_site.sh |
205 | | ./add_demo_site.sh |
206 | | |
207 | | }}} |
208 | | |
209 | | NB This script has an issue & the file /etc/cherokee/cherokee.conf needs to be manually edited to fix the lines wrapping for Source 1 (fix welcomed!) |
210 | | |
211 | | |
212 | | == 9. Grow the Diskspace (Optional) == |
213 | | The initial disk space on some images is just 1GB. If you have this, then this should be grown to 4Gb (don't just size the volume to 4Gb to start with as the image only uses 1Gb of it!) |
214 | | * this is still within the 10Gb free tier. |
215 | | * 4Gb is needed for Prod & Test instances. If you just need a test then 3Gb is sufficient. |
| 207 | |
| 208 | === Disk Striping (Optional) === |
| 209 | For DB I/O performance increase can stripe multiple EBS |
| 210 | * monitoring data is available to see if this is the issue |
| 211 | |
| 212 | == Installing Deployment Coapp on EC2 == |
| 213 | See: InstallationGuidelines/Amazon/Setup |
308 | | If your region doesn't yet have a Sahana AMI in, then it is easy to create one which allows easier deployment of future instances for both you & others. The only cost to you is a small amount of time to publish it & then using up your 1Gb Snapshot allowance within the free tier. |
309 | | |
310 | | * Install the instance as-above |
311 | | * Don't run the configure script |
312 | | * Shutdown the EBS instance. |
313 | | {{{ |
314 | | shutdown -h now |
315 | | |
316 | | }}} |
317 | | |
318 | | * Go to your aws console for the current region at [https://console.aws.amazon.com/ec2/home | EC2 Console] |
319 | | |
320 | | * Select the debian instance you just prepared in the "Instances" |
321 | | |
322 | | * Select " Create Image (EBS AMI) " in the "Instance Actions" drop down. |
323 | | |
324 | | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/create-image.png, 75%)]] |
325 | | |
326 | | * Choose an Image name - Lets say - "Sahana Eden" and fill in a description. |
327 | | |
328 | | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/create-image-config.png, 75%)]] |
329 | | |
330 | | * Click "Create this Image" |
331 | | |
332 | | * Go to the "AMIS" menu and select "Owned by me" and "All Platforms" in the Viewing dropdown. |
333 | | |
334 | | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/ami-built.png, 75%)]] |
335 | | |
336 | | * Wait for about 5 minutes and hit refresh for the AMI you just built to appear. |
337 | | |
338 | | * Select the AMI and click the Permissions button - Select public, to make the image public. |
339 | | |
340 | | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/ami-permissions.2.png, 75%)]] |
341 | | |
342 | | Keep Templates as EBS Volumes as this is cheaper than Snapshots |
| 306 | See: InstallationGuidelines/Amazon/AMI |
345 | | To troubleshoot any errors in installation of EC2 visit its [http://aws.amazon.com/documentation/ec2/ documentation]. If you encounter problems installing eden on the EC2 instance, you can contact us via [http://webchat.freenode.net/?channels=sahana-eden&uio=d4/ IRC] or the [https://groups.google.com/forum/#!forum/sahana-eden/ mailing list]. |
346 | | |
347 | | == Installing Deployment Coapp on EC2 == |
348 | | |
349 | | * Once you've registered for Amazon's Web Services, login to the [https://console.aws.amazon.com/ec2/v2/home EC2 Management Console]. You'll be greeted with the EC2 dashboard as in the picture below |
350 | | |
351 | | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/Dashboard.png, 75%)]] |
352 | | |
353 | | * Next, click on Launch Instance. This new instance will act as a master node for future deployments. We'll use Debian as the OS but other distributions may be supported in the future. 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" |
354 | | |
355 | | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/SelectAMI.png, 75%)]] |
356 | | |
357 | | * In the next step, select the instance depending on your requirements. |
358 | | |
359 | | * Next, in the Configure Instance pane, expand the Advanced Details tab and enter the contents of https://github.com/gnarula/eden_playbook/blob/master/user-data.sh in the User-Data field. |
360 | | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/UserData.png, 75%)]] |
361 | | |
362 | | * Create a new security group with a rule for SSH and HTTP as shown in the screenshot below. |
363 | | |
364 | | [[Image(http://eden.sahanafoundation.org/raw-attachment/wiki/InstallationGuidelines/Amazon/SecurityGroup.png, 75%)]] |
365 | | |
366 | | * 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. |
367 | | |
368 | | That's it! The instance will have Deployment Coapp Installed and may be used to install Eden on that instance or any other remote servers. Do note that the installation takes some time (~5 minutes) even after the EC2 Web UI states the instance as "Running". The Coapp may be accessed by browsing to http://instance-public-ip/ or http://<public-dns> |
369 | | |
370 | | Logs for the process may be found by sshing into the newly created instance with your key and viewing /var/log/user-data.log and /var/log/syslog |
371 | | |
372 | | |
373 | | == Next == |
374 | | [wiki:UserGuidelines/Admin Administration Guide] |
| 309 | To troubleshoot any errors in installation of EC2 visit its [http://aws.amazon.com/documentation/ec2/ documentation]. If you encounter problems installing eden on the EC2 instance, you can contact us via [wiki:Chat IRC] or the [Wiki:MailingList mailing list]. |
| 310 | |