Title: Using Cold Fusion with Open Source Software
1Using Cold Fusion with Open Source
SoftwareMaking the Marriage Work
- Stephan Greene
- Senior Systems Specialist, VA Linux Systems
- Consultant, Washington Square Associates, Inc.
- sgreene_at_patriot.net
2Why Give This Talk?
- Share our experience using Cold Fusion with
several Open Source products - Benefits and Challenges
- Contrast two different approaches to software
3WSA
- 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!)
4Project Background
- We werent 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)
5What 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,...
6Open 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
7Characteristics 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
8Example 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
9Project 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
10Project 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
Developers
Open Source
Netscape
Closed Source
CF Server
Other App
External
MyODBC
Doesnt Matter
MySQL
Other DB
MySQL
Solaris
Server O/S
( Solaris, Linux, nix, NT,...)
Production Server
Scaling
11Why 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
12Getting 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
13Backend 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.
14More 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!
15CF Startup
- !/bin/sh
-
- start - setup environment and run Cold Fusion
servers - ...
- ODBCHOME/opt/coldfusion/odbc
- ODBCINI/opt/coldfusion/odbc/odbc.ini
- ...
- MySQL
- MYSQL_HOSTxyz.foo.bar
- MYSQL_LOG"dtSO,/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_HOST
MYSQL_PWD MYSQL_LOG MYSQL_HOME MYSQLHOME - ...
16ODBC Configuration
- ODBC Data Sources
- ...
- PROJECT1MySQL
- ...
- ODBC
- Trace0
- TraceFile/tmp/odbctrace.out
- TraceDll/opt/coldfusion/lib/odbctrac.so
- InstallDir/opt/coldfusion/odbc
- ...
- PROJECT1
- DescriptionPROJECT1
- Driver/usr/local/mysql/lib/libmyodbc_mysql.so
- SERVERlocalhost
- ...
17CF 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 !!!
18File 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
19ltCFFILE ACTION"UploadWritegt
- 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
- ltCFFILE ACTION"Upload"
- FILEFIELD"formfield"
- DESTINATION"directory"
- NAMECONFLICT"behavior"
- ACCEPT"file_extension"
- MODE"permission"
- ATTRIBUTES"file_attributes"gt
20Migrating 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 -pltpwdgt ltdatabasegt lt project.sql
- Export Tables via ODBC
21CF 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
22Whats 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
23Whats Not So Great About CF on Solaris?
- Its a port
- Windows Registry Emulator
- Allaires documentation and support is better for
NT but improving - Add-on packages work better on NT
- Verity
- Bugs and Memory Leaks?
24Whats 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
25Whats 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
- Dont Expect To Change, But It Doesnt Matter!
- Allaire is beginning to support Open Source
platforms (Linux)
26Looking 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
27Cold Fusion and Open Source
- It Works!
- Combining Cold Fusion and Open Source software
- Met our needs
- Met our customers needs
28Packages and Tools We Used
- Apache
- MySQL
- MyODBC, iodbc
- GNU/FSF gcc, egcs, make, gtar, etc...
- Linux Open Source concept and MySQL test bed
29Links
- Open Source http//www.opensource.org
- GNU/FSF http//www.fsf.org
- MySQL http//www.mysql.com
- Scott Weikarts 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_at_patriot.net
30Cold 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
31Cold 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?Messag
e_ID256760
32Installing the Linux Cold Fusion Stub
- Build and install mod_coldfusion.so per
instructions in README - httpd.conf
- LoadModule coldfusion_module libexec/mod_coldfusio
n.so - Edit /opt/coldfusion/cfremote.ini
- Edit ltCF Servergt/opt/coldfusion/cfdist.ini and
run /opt/coldfusion/bin/cfdist - Check logs for successerror messages
33Using 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
34Observations 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
35Using 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
36Predictions on Cold Fusions Future in the Linux
World
- IMHO
- Cold Fusions real strength is the developer tool
(CF Studio) and its 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