The Webgui Runtime Environment
Total Page:16
File Type:pdf, Size:1020Kb
The WebGUI Runtime Environment Roy Johnson Plain Black Corporation What is the WRE? • All the supporting software required to host WebGUI • Apache 2 / Mod_Perl 2 • MySQL 5 • Supporting Perl Modules • AWStats • Utilities for administering WebGUI Sites Benefits • Easier Installation • Download • Unzip • Run Setup • Done! Benefits • Standardization • Site Database Names • Filenames • Paths • Templated Configuration Files Benefits • Performance • Pre-tuned Configuration • Reverse Proxy by Default • Mod_deflate Benefits • Easier Administration • 30 Seconds to create a site • Automated Log Rotation / Backups / WebGUI Upgrades • Service Monitoring and Automated Recovery with Notifications • Demo ready (your own demo.plainblack.com) Binary Distributions Available • Red Hat Enterprise Linux / Fedora Core 3/4 • Debian • Mac OS X (PPC and i686) • SuSe 9.3 • You can compile from source (and contribute it!) Installing with a WRE Binary • Download for your OS and Unzip • Create a data folder on / and copy wre folder to it • Add a mysql user, make it own /data/wre/prereqs/mysql recursively • Shutdown and disable any prexisting Apache or Mysql from your distro. • Remove or rename /etc/my.cnf if it exists • Run Setup • Start the WRE! What did Setup just do? • Optionally setup a demo site for you • Optionally setup a development environment for you • Optionally Setup web statistics • Downloaded and installed WebGUI Finishing up a Binary Install • Setup your cron jobs • Log Rotator • Service Monitors • Web Stats • Demo Cleanup • Use addsite script to setup a WebGUI website • Let’s install the WRE! Installing WRE From Source • Ninjas Only • Make sure you have the standard GNU build tools • GCC/glibc/tar/gzip/binutils/bash/make/automake/autoconf • Download wre-prereqs and wre-source to your home directory • Unzip wre-source and wre-prereqs • Move the prereqs folder into the wrebuild folder Installing WRE From Source • Create a /data folder and make sure you have +rw to it • Run build.sh • Compiles all the dependencies • Apache / MySQL / Perl / Perl Modules, etc • Copies all scripts into place • Can run one or more build manually (see --help for options) • ./build.sh --perl --apache Installing WRE From Source • Go watch a DVD or two =) • When the build script finishes, zip up your build • tar -cv /data/wre | gzip -c > wre-0.7.1-mydistro.tar.gz • You want this for a few reasons • Backup, you don’t want to build again if you have to setup a new server • You can contribute this build so others can use it • Don’t run setup until after you zip up your build! Finishing up a Source Install • Same as finishing up a Binary Install • Run setup • Setup cron jobs • Run addsite Upgrading the WRE • You need a WRE Binary to upgrade • Download the latest WRE Binary for your distro • If you built from source, you have to build the latest version • Can’t do this on your production machine! • You have a binary when you finish the zip step of a source build • Contribute it! Upgrading the WRE • Unzip the latest WRE Binary in /tmp • Checkout the upgrade, install, and changelog documentation • Disable WRE Monitor from crontab • Shut down WRE (rc.webgui stop) • Copy the new wre folder over the old one • Run setup • Update templates, config files as needed. Setup will tell you which ones. Upgrading the WRE • Start the WRE • Enable WRE Monitor in Cron • Done! SSL with the WRE • SSL Support is built into the WRE • All you have to do is configure it for the domain you want to secure • Step 1 -- Create a folder for your cert files • Step 2 -- Generate a Certificate Signing Request (CSR) for the domain • Step 3 -- Give your CSR to a trusted Certificate Authority (CA) for a cert • sign your own cert if you don’t mind getting security errors in browser • Step 4 -- Add a virtual host entry to the sites modproxy config file SSL with the WRE • Step 5 -- Restart modproxy (rc.webgui restartmodproxy) • Step 6 -- Goto https://www.yourdomain.com! • Questions? PHP with the WRE • Install mod_php module into modperl instance of apache • Two common configurations • 1 -- User needs to serve a PHP based application on it’s own domain • 2 -- User needs to serve PHP content on a WebGUI domain PHP with the WRE • Serving PHP on it’s own domain (No Reverse Proxy) • Install mod_php and enable it in httpd.modproxy.conf • Add a virtualhost entry to /data/wre/etc • www.sitename.com.modproxy • Normal Apache Virtual Host • Setup PHP to handle content as you wish PHP with the WRE • Serving PHP on it’s own domain (with Reverse Proxy) • Install mod_php and enable it in httpd.modperl.conf • Add two virtualhost entries to /data/wre/etc • www.sitename.com.modproxy • Will handle initial request and static content • Will Proxy everything else to modperl instance (running mod_php) PHP with the WRE • Serving PHP on it’s own domain (with Reverse Proxy) • www.sitename.com.modperl • Will contain PHP configuration • Will handle PHP content and send it back to modproxy instance • This works in exactly the same way as WebGUI/MP2 site setup PHP with the WRE • Serving PHP content in a WebGUI Domain • Basic Setup is the same a PHP on it’s own domain with Reverse Proxy • Differences: • WebGUI passthru URLs allow the request to be served by PHP • You don’t add vhost files to /data/wre/etc • Use Alias directives to specify where the content is served from (on the FS) PHP with the WRE • Questions? Load Balancing with the WRE • Basic Idea • Use a load balancer to split up the requests • Hardware, Round Robin DNS, etc • Apache on two or more servers • Receives request from balancer • Databases run on their own server(s) • Apache Servers pull static content from a file server (or SAN) Load Balancing with the WRE • Keeping it all in Sync • Multiple DB Servers use MySQL Replication • File Store is Centralized so it stays synchronized • Use FibreChannel, NFS, or SMB to mount /data on your apache servers Questions? • Let’s setup the WRE.