Deploying MediaWiki on IBM DB2 in the Cloud   Leons Petrazickis



1.1 Sign up for Rightscale
Go to http://www.rightscale....
Deploying MediaWiki on IBM DB2 in the Cloud                         Leons Petrazickis




Don't do anything at this step f...
Deploying MediaWiki on IBM DB2 in the Cloud                                                 Leons Petrazickis




1.2 Crea...
Deploying MediaWiki on IBM DB2 in the Cloud   Leons Petrazickis




And some more account details:




Accept their agreem...
Deploying MediaWiki on IBM DB2 in the Cloud    Leons Petrazickis




Click on Amazon Elastic Compute Cloud (EC2):




Clic...
Deploying MediaWiki on IBM DB2 in the Cloud   Leons Petrazickis




Choose the billing address:




Confirm your telephone...
Deploying MediaWiki on IBM DB2 in the Cloud   Leons Petrazickis


It worked:




Complete the sign up:




CASCON 2009    ...
Deploying MediaWiki on IBM DB2 in the Cloud        Leons Petrazickis




1.3 Generate keys and certificates
Go into the re...
Deploying MediaWiki on IBM DB2 in the Cloud                Leons Petrazickis




Switch to the X.509 Certificates tab:



...
Deploying MediaWiki on IBM DB2 in the Cloud         Leons Petrazickis




Take a note of where they are on your hard drive...
Deploying MediaWiki on IBM DB2 in the Cloud                                           Leons Petrazickis




1.4 Use the in...
Deploying MediaWiki on IBM DB2 in the Cloud         Leons Petrazickis




X.509 Certificate:

-----BEGIN CERTIFICATE-----
...
Deploying MediaWiki on IBM DB2 in the Cloud                                              Leons Petrazickis


I will disabl...
Deploying MediaWiki on IBM DB2 in the Cloud   Leons Petrazickis




1.5 Finish signing up for Rightscale
Go back to the Ri...
Deploying MediaWiki on IBM DB2 in the Cloud     Leons Petrazickis




You just want the dashboard:




Make the giant help...
Deploying MediaWiki on IBM DB2 in the Cloud                  Leons Petrazickis




2.1 Start using Rightscale
Go to Clouds...
Deploying MediaWiki on IBM DB2 in the Cloud        Leons Petrazickis




Paste in the private key and certificate values:
...
Deploying MediaWiki on IBM DB2 in the Cloud                                      Leons Petrazickis




We need some Server...
Deploying MediaWiki on IBM DB2 in the Cloud                                         Leons Petrazickis




Let's create web...
Deploying MediaWiki on IBM DB2 in the Cloud   Leons Petrazickis


Name it and save:




CASCON 2009                       ...
Deploying MediaWiki on IBM DB2 in the Cloud                                              Leons Petrazickis




2.2 Customi...
Deploying MediaWiki on IBM DB2 in the Cloud             Leons Petrazickis




After a few steps, you'll have it on your ha...
Deploying MediaWiki on IBM DB2 in the Cloud                          Leons Petrazickis




Here's the script:

#!/bin/bash...
Deploying MediaWiki on IBM DB2 in the Cloud                                             Leons Petrazickis


The script ins...
Deploying MediaWiki on IBM DB2 in the Cloud           Leons Petrazickis




Enter an appropriate name and paste in the scr...
Deploying MediaWiki on IBM DB2 in the Cloud                         Leons Petrazickis




Now we can add it to our MediaWi...
Deploying MediaWiki on IBM DB2 in the Cloud      Leons Petrazickis




Select your PHP extension installation script:




...
Deploying MediaWiki on IBM DB2 in the Cloud                                             Leons Petrazickis




2.2.2 Create...
Deploying MediaWiki on IBM DB2 in the Cloud                                                Leons Petrazickis




Name it a...
Deploying MediaWiki on IBM DB2 in the Cloud                       Leons Petrazickis




Back to our MediaWiki app server t...
Deploying MediaWiki on IBM DB2 in the Cloud                                             Leons Petrazickis




2.2.3 Create...
Deploying MediaWiki on IBM DB2 in the Cloud                                  Leons Petrazickis




Create the RightScript:...
Deploying MediaWiki on IBM DB2 in the Cloud   Leons Petrazickis




Add the script you've just created:




Good:




CASC...
Deploying MediaWiki on IBM DB2 in the Cloud                                       Leons Petrazickis




2.3 Add servers to...
Deploying MediaWiki on IBM DB2 in the Cloud             Leons Petrazickis




Add a MediaWiki server in the default securi...
Deploying MediaWiki on IBM DB2 in the Cloud                             Leons Petrazickis




Speaking of security groups,...
Deploying MediaWiki on IBM DB2 in the Cloud   Leons Petrazickis




Unblock port 22 (SSH):




Unblock port 80 (HTTP):



...
Deploying MediaWiki on IBM DB2 in the Cloud                                         Leons Petrazickis




2.4 Start the se...
Deploying MediaWiki on IBM DB2 in the Cloud                                                 Leons Petrazickis




Start th...
Deploying MediaWiki on IBM DB2 in the Cloud                                           Leons Petrazickis




3.1 Configure ...
Deploying MediaWiki on IBM DB2 in the Cloud              Leons Petrazickis




3.1.2 Run through the configuration wizard
...
Deploying MediaWiki on IBM DB2 in the Cloud                                           Leons Petrazickis


Set hostname to ...
Deploying MediaWiki on IBM DB2 in the Cloud           Leons Petrazickis




3.1.3 Move LocalSettings.php
Go to your MediaW...
Deploying MediaWiki on IBM DB2 in the Cloud               Leons Petrazickis




Change directories to /var/www/mediawiki:
...
Deploying MediaWiki on IBM DB2 in the Cloud                                            Leons Petrazickis




4.0 Report bu...
Upcoming SlideShare
Loading in...5
×

Deploying MediaWiki On IBM DB2 in the Cloud

2,324

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,324
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Deploying MediaWiki On IBM DB2 in the Cloud

  1. 1. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 1.1 Sign up for Rightscale Go to http://www.rightscale.com/ Click on the Try It button: Enter your new account details: Choose a password: CASCON 2009 1
  2. 2. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Don't do anything at this step for now. Just leave the page open. CASCON 2009 2
  3. 3. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 1.2 Create an Amazon Web Services (AWS) Account This will require a credit card. If you are not comfortable with this, please skip to step 1.4 instead. Open a new tab in your browser and go to http://aws.amazon.com Click on Sign Up Now: Enter your email address and state that you are a new user: Enter your account details: CASCON 2009 3
  4. 4. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis And some more account details: Accept their agreement: CASCON 2009 4
  5. 5. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Click on Amazon Elastic Compute Cloud (EC2): Click on Sign Up for EC2: Enter your credit card info: CASCON 2009 5
  6. 6. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Choose the billing address: Confirm your telephone number Enter your PIN when they call you: CASCON 2009 6
  7. 7. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis It worked: Complete the sign up: CASCON 2009 7
  8. 8. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 1.3 Generate keys and certificates Go into the resource center: Go to the Security Credentials for your account: Take note of your access number: Take note of your access key: Take note of your secret access key: CASCON 2009 8
  9. 9. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Switch to the X.509 Certificates tab: Create a new certificate: Download both the private key and the X.509 certificate: CASCON 2009 9
  10. 10. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Take a note of where they are on your hard drive: CASCON 2009 10
  11. 11. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 1.4 Use the instructor's AWS account (Optional) If you were uncomfortable with registering for AWS, you can optionally use my credentials instead. They will work through until the end of the workshop. Account number: 2772-2146-6967 Access key: AKIAIIANWKFFFEZZFBDA Secret access key: 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 Private key: -----BEGIN PRIVATE KEY----- MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAKyjmdNA7X7t9za8ZADSH1n5HPOt P4Z//2xgJqWI93zFXfYOAqMouH7EPs3lOTadgOi0vWS81dR6rLLSEV1/kSpI8pN1/j5N7noLTOa8 60hU4M3G67sLuDxNX/f1GI5/tkDgT8Tuu7uWXmHt0VILWscAS+XASJQhyqbeDF+0RGCTAgMBAAEC gYAP0YnFvpxEVh+hx09Od/Jhdx79APHiLBZGYuUHo+4xY5BBfHUnaBLHosmyaf99Dp+CMxVrhpX9 OyRZ2j+3FnpBg/IdEy2RnF48Q7oSeYos4oU/Hjl/SsmKo5/j6btfqBGr4S6X8oCr7UJbQjss82Zd 62zFoXNsn5REUAxYXMt5EQJBAOW9tYzNSEOheRhGgkr7NB3feJP40ZCizvuwh06ykNHXLJiKhnb1 83G2khlRUcxrCqRyOHK8J3c1lkRDkErDrokCQQDAXxIfIoSk40tMtN9+vfgiR+ca9sT59ghGtN+4 YGPDC4uySRi8Njl1r2u1BQuEwLMztHUl8R22m+Pz1gIjIC87AkAotaYfDh05Brrrh0r9OGgyxu+Z 4ORZqc/dn5lKY6/vzx4y5ZEQMWLzCnP3EobZHzqiiy7ffeHMaO14qTQ/W09pAkAkcR4etcxI7CH0 mwMHoHckD1jxW7P+4iO5OUR0ShY7+bDyCjTcWq1R5PRTa2w+Lr8D2XijwmRtlmR9aZooC03HAkB2 0dyZj9ftY7faUrvJXsAps4uwac8ToKVW8n8Euyo9SyddXrtMZ2D8JDJ3MIevJDFZkdMQpVzjWJ2d XPym0nfV -----END PRIVATE KEY----- CASCON 2009 11
  12. 12. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis X.509 Certificate: -----BEGIN CERTIFICATE----- MIICeDCCAeGgAwIBAgIGAJo4EST/MA0GCSqGSIb3DQEBBQUAMFMxCzAJ BgNVBAYT AlVTMRMwEQYDVQQKEwpBbWF6b24uY29tMQwwCgYDVQQLEwNBV1MxI TAfBgNVBAMT GEFXUyBMaW1pdGVkLUFzc3VyYW5jZSBDQTAeFw0wOTExMDMyMDI1NDF aFw0xMDEx MDMyMDI1NDFaMFMxCzAJBgNVBAYTAlVTMRMwEQYDVQQKEwpBbWF6b 24uY29tMRcw FQYDVQQLEw5BV1MtRGV2ZWxvcGVyczEWMBQGA1UEAxMNMWNocnJ4d WRsZm9peTCB nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArKOZ00Dtfu33NrxkANIfWfk c860/ hn//bGAmpYj3fMVd9g4Coyi4fsQ+zeU5Np2A6LS9ZLzV1HqsstIRXX+RKkjyk3 X+ Pk3uegtM5rzrSFTgzcbruwu4PE1f9/UYjn+2QOBPxO67u5ZeYe3RUgtaxwBL 5cBI lCHKpt4MX7REYJMCAwEAAaNXMFUwDgYDVR0PAQH/BAQDAgWgMBYG A1UdJQEB/wQM MAoGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFG WcnWlSTeUK/sSP W949IvvBK5OtMA0GCSqGSIb3DQEBBQUAA4GBAC+0n3ABeImXubo0m4L y7b4sNJNW AlJJeQuHMEw2GEDXaJGaWrvUwa0gX8+oeLkXnaFWCvJU90JR6YbWAl2k Bo/txGsq nvggCHliiEjJ+YvwO2SIgzh4kFDwpUmm0441J+l4R2SWKsqHO/H48fx60luX+ 9Yt 0BA4ek/v7F0isnG4 -----END CERTIFICATE----- CASCON 2009 12
  13. 13. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis I will disable these credentials after the workshop is over and delete any running instances. CASCON 2009 13
  14. 14. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 1.5 Finish signing up for Rightscale Go back to the RightScale tab: Click on Enter Credentials: Enter your credentials: Create a new SSH key pair: CASCON 2009 14
  15. 15. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis You just want the dashboard: Make the giant help pane go away if you like: CASCON 2009 15
  16. 16. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 2.1 Start using Rightscale Go to Clouds > AWS Global > Credentials: Click Edit: Open the private key file in a text editor (e.g. Notepad): Open the certificate file in a text editor (e.g Notepad): CASCON 2009 16
  17. 17. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Paste in the private key and certificate values: Go to Manage > Deployments > New: Call it something relevant and Save: CASCON 2009 17
  18. 18. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis We need some Server Templates before we can add any Servers. Go to Design >ServerTemplates > Library: Go to Partners: Search for DB2: Import the Ubuntu-based template: CASCON 2009 18
  19. 19. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Let's create web server template for running MediaWiki. Go to Design > ServerTemplates > New: Choose a base image: Select the Ubuntu RightImage: CASCON 2009 19
  20. 20. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Name it and save: CASCON 2009 20
  21. 21. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 2.2 Customize your Righscale deployment 2.2.1 Create a RightScript for installing the PHP extension You'll need the PHP extension for DB2. It's pretty easy to get, but you'll need DB2 headers to install it. Those come with either DB2 (such as the free DB2 Express-C edition) or with the IBM Data Server Driver for ODBC and CLI. Go to http://www.ibm.com/db2/9/download.html Click on Data Server Client Packages: Click on IBM Data Server Driver for ODBC and CLI: Grab the "Linux 32-bit AMD and x86" one: CASCON 2009 21
  22. 22. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis After a few steps, you'll have it on your hard drive: Go to Design > RightScripts > New: CASCON 2009 22
  23. 23. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Here's the script: #!/bin/bash echo "Installing packages" apt-get update && apt-get -y install libstdc++5 libaio1 php-pear php5-dev php5 libapache2-mod-php5 TAR1=${ATTACH_DIR}/v9.7_linuxia32_odbc_cli.tar.gz TAR2=$ {ATTACH_DIR}/ibm_data_server_driver_for_odbc_cli_32_linuxia32_v97.tar.gz echo "Unzipping" if [ -f ${TAR1} ]; then tar --index-file /tmp/odbc_cli.tar.log -xvvf ${TAR1} -C /tmp/ elif [ -f ${TAR2} ]; then tar --index-file /tmp/odbc_cli.tar.log -xvvf ${TAR2} -C /tmp/ else echo "File not found" fi echo "Deploying unzipped DB2 libraries" cd /tmp cp -ru odbc_cli/clidriver/* /usr echo "Installing php extension" pecl install ibm_db2 << COMMANDS 1 /usr COMMANDS echo "Updating php.ini" echo "extension=ibm_db2.so" >> /etc/php5/apache2/php.ini echo "Restarting the web server" /etc/init.d/apache2 restart exit 0 CASCON 2009 23
  24. 24. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis The script installs several Ubuntu Linux packages using apt-get, deploys the Data Server Client for ODBC libraries, and then installs the IBM DB2 extension for PHP from the PECL repository. CASCON 2009 24
  25. 25. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Enter an appropriate name and paste in the script: Click on the Attachments tab: Attach the IBM Data Server Driver for ODBC and CLI: Upload it: CASCON 2009 25
  26. 26. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Now we can add it to our MediaWiki server image as a boot script. Go to Design > ServerTemplates > MediaWiki app server: Click on the Scripts tab: Add a boot script: A private one: CASCON 2009 26
  27. 27. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Select your PHP extension installation script: CASCON 2009 27
  28. 28. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 2.2.2 Create a RightScript for deploying MediaWiki You'll also want MediaWiki on the box. You could use SSH and SCP to manually place it after the server is up and running, but we want to script everything in the cloud. Let's write a script for deploying MediaWiki. Create another RightScript: Here's the script: #!/bin/bash mkdir /var/www/mediawiki -m 777 chown www-data:www-data /var/www/mediawiki tar --index-file /tmp/MediaWiki.tar.log -xvvf $ {ATTACH_DIR}/MediaWiki.tar.gz -C /var/www/mediawiki exit 0 The script unzips the MediaWiki archive into the directory that Apache serves to the world. CASCON 2009 28
  29. 29. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Name it appropriately and paste in the code: Let's grab the archive that the script relies on. MediaWiki is always distributed as a gzipped tar archive, but the forthcoming 1.16 release with improved DB2 support is not out yet. Let's grab a custom build: http://lpetr.org/mediawiki/MediaWiki.tar.gz Let's attach it: And upload: CASCON 2009 29
  30. 30. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Back to our MediaWiki app server template: Add the new RightScript following the same procedure as before: CASCON 2009 30
  31. 31. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 2.2.3 Create a RightScript for preparing a DB2 database for MediaWiki Before we can use the MediaWiki install wizard, we need to have a database created on our database server. Let's add a script which will do it for us automatically. Here's the script: #!/bin/bash echo "Creating database" su - db2inst1 -c "db2 CREATE DATABASE wikidb AUTOMATIC STORAGE YES USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM PAGESIZE 32768" echo "Enable the Statement Concentrator" su - db2inst1 -c "db2 CONNECT TO wikidb && db2 UPDATE DATABASE CONFIGURATION USING STMT_CONC LITERALS IMMEDIATE" echo "Restarting DB2" su - db2inst1 -c "db2stop force" su - db2inst1 -c "db2start" exit 0 This will create a DB2 database with a 32K pagesize, rather than the default 4K pagesize. A 32K pagesize allows for more data to be placed inline in a single row. It also enables the Statement Concentrator, which optimizes repeated queries. CASCON 2009 31
  32. 32. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Create the RightScript: There are no attachments. This script needs to be added to the DB2 template (not the MediaWiki one). Go to the DB2 ServerTemplate: Clone it so you can change the scripts: CASCON 2009 32
  33. 33. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Add the script you've just created: Good: CASCON 2009 33
  34. 34. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 2.3 Add servers to your deployment Go back to the deployment you created earlier via Manage > Deployments > Dashboard: Click on the one you created: Add a server: Add a DB2 server and place it in the default security group: CASCON 2009 34
  35. 35. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Add a MediaWiki server in the default security group: CASCON 2009 35
  36. 36. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Speaking of security groups, go to Clouds > AWS US > Security Groups: Click on the default group: CASCON 2009 36
  37. 37. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Unblock port 22 (SSH): Unblock port 80 (HTTP): Unblock port 50000 (DB2): CASCON 2009 37
  38. 38. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 2.4 Start the servers Go back to your deployment: Start the DB2 server: Set MON_PROCESS to db2sysc and USE_LOCAL_STORAGE to YES. Local storage means that the databases will go on the virtual machine image directly, rather than on a mounted Amazon EBS volume: CASCON 2009 38
  39. 39. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Start the MediaWiki server: If you like, you can look at the boot logs by going to MediaWiki app server > Audit Entries. Wait for both servers to finish booting. When they do, you will see a stop icon for both: CASCON 2009 39
  40. 40. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 3.1 Configure MediaWiki 3.1.1 Find out the hostnames While looking at your MediaWiki and DB2 deployment, click on the icon to the right of the server count to customize the view: Add Public DNS and Private DNS columns to the view: Those are effectively the internal hostname (used for free server-to-server communication) and the external hostname visible to the outside world. Jot down the Private DNS of the DB2 server and the Public DNS of the MediaWiki server: Go to http://hostname/mediawiki where hostname is the Public DNS of the MediaWiki server e.g. http://ec2-174-129-184-151.compute-1.amazonaws.com/mediawiki/ CASCON 2009 40
  41. 41. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 3.1.2 Run through the configuration wizard Go to http://Public-DNS-of-MediaWiki-server/mediawiki/ Click to set up the wiki: Name it: Set the admin password: Choose DB2 as the database type: CASCON 2009 41
  42. 42. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Set hostname to the Private DNS of the DB2 server: For the next section: • "wikidb" is the default wiki name in our boot RightScript • "db2inst1" is the DB2 instance owner • "password" is the default password for the DB2 ServerTemplate There is no local copy of the DB2 catalog on the MediaWiki server – rather, we want an uncataloged connection: Let's install: It's alive: CASCON 2009 42
  43. 43. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 3.1.3 Move LocalSettings.php Go to your MediaWiki and DB2 deployment: Open the SSH console for your MediaWiki app server: Use MindTerm: CASCON 2009 43
  44. 44. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis Change directories to /var/www/mediawiki: Move config/LocalSettings.php to the current directory: 3.1.4 Use MediaWiki Feel free to follow the link now: We now have MediaWiki running on DB2 in the Cloud: CASCON 2009 44
  45. 45. Deploying MediaWiki on IBM DB2 in the Cloud Leons Petrazickis 4.0 Report bugs Report any bugs you see to leons.petrazickis@gmail.com Acknowledgements A big thank you goes to Bradley Steinfeld and Leon Katsnelson for advising and helping to prepare for this workshop. CASCON 2009 45

×