360 likes | 471 Views
Using Cold Fusion with Open Source Software “ Making the Marriage Work”. Stephan Greene Senior Systems Specialist, VA Linux Systems Consultant, Washington Square Associates, Inc. sgreene@patriot.net. Why Give This Talk?.
E N D
Using Cold Fusion with Open Source Software“Making the Marriage Work” Stephan Greene Senior Systems Specialist, VA Linux Systems Consultant, Washington Square Associates, Inc. sgreene@patriot.net
Why Give This Talk? • Share our experience using Cold Fusion with several “Open Source” products • Benefits and Challenges • Contrast two different approaches to software
WSA • About WSA: • IT Integrator and Engineering Services • #17 on Washington Technology “Fast 50” • http://www.washsq.com • Cold Fusion Experience: • Data-driven Business Applications using Web Browser Clients, Dynamic Web Sites • Started Using Cold Fusion in 1996 (Version 1!)
Project Background • We weren’t trying to “prove” anything • Client Wanted a CF-based system on Solaris platform • Our Challenge: Apply NT-based CF experience to a new platform • Experience with other *nix (Linux)
What Is Open Source Software? • Software with publicly available source code • See: www.fsf.org, www.opensource.org • Users contribute fixes and enhancements back to the community • May incorporate into commercial products and services per license • License terms govern reuse, resale • GPL, LGPL, BSD, “artistic”, Netscape/Mozilla, Sun “Community”, public-domain,...
Open Source Software Examples • Operating Systems • Linux, FreeBSD • Internet Servers/Daemons • BIND, Sendmail, Apache, Samba • Developer Tools & Languages • gcc, emacs, Perl, Python, Tcl/Tk, XFree86 • Applications • Mozilla, KDE, Gnome, MySQL, Postgres
Characteristics of Open Source • Rapid Development Cycles • Very frequent code releases • Users and Developers are responsive to bugs and new features • Worldwide scope • Often Standards-based • Amount of “polish” varies widely
Example Project • Data-Driven Web Site • Replace A “Static” site • Dynamic Page Content based on User Inputs • Non-Webmasters Maintain Content • Integrate with other dynamic elements
Project Architecture • Solaris platform (Sparc CPU) • Solaris 2.5.1 Operating System • Web Server • Cold Fusion Application Server • Back-End Database stores content • Supporting scripts and utilities • Other project elements
Project Architecture Browser Browser Users Developers & Client Apache Browser CF Server Content & Admin MyODBC CF Studio MS Access MySQL MyODBC Solaris Win 9x/NT Legend Development Server Open Source Developers Netscape Closed Source Other App CF Server External MyODBC Doesn’t Matter Other DB MySQL MySQL Solaris Server O/S* (* Solaris, Linux, *nix, NT,...) Production Server “Scaling”
Why Use Open Source Software? • It solved several problems threatening the success of the project! • Budget - Apache web server met all our needs • Feasibility - The commercial database we started with did not work with Cold Fusion • Support - Responsiveness of the community was vital to getting the database backend integrated and working
Getting CF Running on Solaris • Straightforward Installation • Solaris pkgadd tool • Web Server Integration • Netscape - handled by installation • Apache - recompile with Cold Fusion libraries • ODBC + Databases • This was the trickiest part! • Differences between CF on Solaris and NT • Some developer training required
Backend Databases • Cold Fusion supports ODBC! • Database must run on Solaris, support ODBC • Candidates • Open Source: Msql, MySQL, PostgreSQL • Commercial: SQL Anywhere • Our pick: MySQL • Sufficient features for this project • Another user had successfully used it with Cold Fusion and released the driver source code so we could use it ourselves.
More Tweaking...More Open Source • MySQL Installation • build / install binary • Getting the ODBC Driver built • Scott Weikart patch, FSF “GNU” Tools: • gcc, egcs, make, gnuzip, g-tar • Debugging ODBC • odbctool • Learning the tricks • Thank heaven for mailing lists!
CF Startup #!/bin/sh # # start - setup environment and run Cold Fusion servers ... ODBCHOME=/opt/coldfusion/odbc ODBCINI=/opt/coldfusion/odbc/odbc.ini ... #MySQL MYSQL_HOST=xyz.foo.bar #MYSQL_LOG="d:t:S:O,/tmp/myodbc.log" #uncomment for debugging ... VAR_LIST="LD_LIBRARY_PATH CFHOME CFUSER ODBCHOME ODBCINI SYBASE SQLANY SATMP ORACLE_HOME INFORMIXDIR INFORMIXSERVER II_SYSTEM MYSQL_HOSTMYSQL_PWDMYSQL_LOGMYSQL_HOMEMYSQLHOME” ...
ODBC Configuration [ODBC Data Sources] ... PROJECT1=MySQL ... [ODBC] Trace=0 TraceFile=/tmp/odbctrace.out TraceDll=/opt/coldfusion/lib/odbctrac.so InstallDir=/opt/coldfusion/odbc ... [PROJECT1] Description=PROJECT1 Driver=/usr/local/mysql/lib/libmyodbc_mysql.so SERVER=localhost ...
CF on Solaris Tips ‘n Tricks • File Permissions • Learn new switches in CF tags - CFFILE Upload, Create • File Permissions! • Migrating Data from Access to MySQL • File Permissions!! • CF 3.1 bugs and work-arounds • FILE PERMISSIONS !!!
File Naming and Permissions on Solaris • Unix handles file names and permissions differently than NT: • Names are case sensitive • Files must be readable (sometimes writeable) by the web and CF server processes • Directories must be readable, executable (sometimes writeable) by web and CF server processes • Enforce Coding Conventions • Useful commands: chmod, chown, chgrp
<CFFILE ACTION="Upload”|”Write”> Use CFFILE with the Upload action to upload a file specified in a form field to a directory on the Web server. Note that the MODE attribute applies only to ColdFusion on Solaris. Syntax <CFFILE ACTION="Upload" FILEFIELD="formfield" DESTINATION="directory" NAMECONFLICT="behavior" ACCEPT="file_extension" MODE="permission" ATTRIBUTES="file_attributes">
Migrating Database from Access to MySQL • Developers use Access to design and prototype database tables • Use exportsql VBA script to export table definitions and text content • Modify defaults to support our data structures • Import from Unix command line mysql -p<pwd> <database> < project.sql • “Export Tables” via ODBC
CF 3.1 Problems and Workarounds • Cfserver lockups and core dumps • “Watchdog” script detects lockup, restarts server without requiring root access by users • Upgrade to CF 4 is the real fix! • Cannot create MySQL data sources in CF admin screens • Edit odbc.ini manually • Transactions & Table Locking • Use CFLOCK tag in applications
What’s Great About CF on Solaris? • Good application on Great server platform • CF Studio • Cross-platform CF coding • Excellent remote administration via admin web page and ssh/telnet • CF Studio works with NT and Solaris servers • CF Server 4.0 is MUCH Better than 3.1
What’s Not So Great About CF on Solaris? • It’s a port • Windows Registry Emulator • Allaire’s documentation and support is better for NT but improving • Add-on packages work better on NT • Verity • Bugs and Memory Leaks?
What’s Great About CF with Open Source Software? • Integration using Standards-Based Software • HTTP, ODBC, SQL • Extends Capabilities of Each Product • Cold Fusion Developers Pre-Disposed to Share • Custom CF Tags and Libraries • Contributions to Various Forums and on-line “Communities”
What’s Not So Great About CF with Open Source Software? • Limited Allaire Support • Other than Apache, Open Source Software generally “Not Supported” by Allaire • Allaire and Allaire Partners Unaccustomed to Open Source Business Models • CF Server, Studio Are Not Open Source • Don’t Expect To Change, But It Doesn’t Matter! • Allaire is beginning to support Open Source platforms (Linux)
Looking Towards the Future • Better support for Unix • Linux Port • Native code without Registry Emulation, etc...? • Competition - the Application Server space is heating up • Acceptance in Unix Community • Cost • “Religious” opinions • Development tools and cross-platform coding
Cold Fusion and Open Source • It Works! • Combining Cold Fusion and Open Source software • Met our needs • Met our customer’s needs
Packages and Tools We Used • Apache • MySQL • MyODBC, iodbc • GNU/FSF: gcc, egcs, make, gtar, etc... • Linux: Open Source concept and MySQL test bed
Links • Open Source: http://www.opensource.org • GNU/FSF: http://www.fsf.org • MySQL: http://www.mysql.com • Scott Weikart’s libmysqlodbc driver: ftp://ftp.igc.org/pub/myodbc • Apache: http://www.apache.org • Open Source Software for Solaris: http://www.sunfreeware.com • General Sun Help: http://www.sunhelp.com • Allaire: http://www.allaire.com • Washington Square Associates, Inc.: http://www.washsq.com • Me: http://ww2.washsq.com/~sgreene/ sgreene@patriot.net
Cold Fusion and Linux • Allaire working on Linux port of CF Server • Part of CF 5.0 release (Fall 1999?) • Probably a native port • No registry emulator! • Today - Linux “stub” • Allows a Linux box running Apache to link to a NT or Solaris CF Server
Cold Fusion Linux Stub • Allaire provides an Apache dynamic module to connect to a Cold Fusion server • Requires • RedHat 5.2 • Apache 1.3.x with mod_so enabled • libstdc++ • An accessible CF 4.x server (NT or Solaris) • http://forums.allaire.com/devconf/Index.cfm?Message_ID=256760
Installing the Linux Cold Fusion Stub • Build and install mod_coldfusion.so per instructions in README • httpd.conf: LoadModule coldfusion_module libexec/mod_coldfusion.so • Edit /opt/coldfusion/cfremote.ini • Edit <CF Server>:/opt/coldfusion/cfdist.ini and run /opt/coldfusion/bin/cfdist • Check logs for success|error messages
Using the Linux Cold Fusion Stub • Need an exact mirror of ALL .cfm, .html, images, etc. from the back-end CF server on the Linux system • Easiest via NFS export • Windows File Sharing (smbmount) • ftp, mirror, rsync • Apache hands off Cold Fusion calls to the “real” CF Server using cfdist
Observations on the Linux Cold Fusion Stub • For Now - Limited Practical Use • Might make sense to integrate a Linux-based web site with a back-end fielded database on a Solaris or NT system. • If most/all of site is on Cold Fusion, there may be less reason to front it with a Linux web server • Gets Cold Fusion in front of community • Especially businesses considering using Linux
Using Open Source Software in Commercial Environment • Skepticism on practicality, performance, support, value • Open Source software rapidly gaining “mind share” • Strong business value IF IT WORKS • Have a respected champion • Be prepared to do plenty of integration, testing, and repeat selling
Predictions on Cold Fusion’s Future in the Linux World • IMHO: • Cold Fusion’s real strength is the developer tool (CF Studio) and it’s integration with CF Server. • Linux port is for Server, not Studio • A Linux port of CF Server is likely to appeal to business users who want a powerful, stable, cost-effective web server • CF is less likely to compete with Perl and PHP among “traditional” Linux web developers