presentation source

Download Report

Transcript presentation source

WASHINGTON SQUARE
Stephan Greene
Senior Systems Specialist, VA Linux Systems
Consultant, Washington Square Associates, Inc.
[email protected]
June 26, 1999
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Using Cold Fusion with Open Source
Software
“Making the Marriage Work”
WASHINGTON SQUARE

Share our experience using Cold Fusion
with several “Open Source” products

Benefits and Challenges

Contrast two different approaches to
software
2
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Why Give This Talk?
WASHINGTON SQUARE

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!)
3
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
WSA
WASHINGTON SQUARE

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)
4
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Project Background
WASHINGTON SQUARE

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,...
5
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
What Is Open Source Software?
WASHINGTON SQUARE

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
6
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Open Source Software Examples
WASHINGTON SQUARE

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
7
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Characteristics of Open Source
WASHINGTON SQUARE

Data-Driven Web Site
 Replace A “Static” site
 Dynamic Page Content based on User Inputs
 Non-Webmasters Maintain Content
 Integrate with other dynamic elements
8
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Example Project
WASHINGTON SQUARE

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
9
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Project Architecture
WASHINGTON SQUARE
Browser
Browser
Users
Developers
& Client
Apache
Browser
CF Server
Content
& Admin
CF Studio
Legend
Open Source
MyODBC
MyODBC
MySQL
Win 9x/NT
Solaris
Developers
Development
Server
Netscape
Closed Source
External
MS Access
Other App
Doesn’t Matter
Other DB
CF Server
MyODBC
MySQL
MySQL
Solaris
Server O/S*
Production Server
“Scaling”
10
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Project Architecture
(* Solaris, Linux, *nix, NT,...)
WASHINGTON SQUARE

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
11
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Why Use Open Source Software?
WASHINGTON SQUARE

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
12
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Getting CF Running on Solaris
WASHINGTON SQUARE

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.
13
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Backend Databases
WASHINGTON SQUARE

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!
14
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
More Tweaking...More Open Source
WASHINGTON SQUARE
#!/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_HOST MYSQL_PWD MYSQL_LOG
MYSQL_HOME MYSQLHOME”
...
15
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
CF Startup
WASHINGTON SQUARE
[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
...
16
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
ODBC Configuration
WASHINGTON SQUARE

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 !!!
17
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
CF on Solaris Tips ‘n Tricks
WASHINGTON SQUARE

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
18
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
File Naming and Permissions
on Solaris
WASHINGTON SQUARE
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">
19
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
<CFFILE ACTION="Upload”|”Write”>
WASHINGTON SQUARE

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
20
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Migrating Database from Access to
MySQL
WASHINGTON SQUARE

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
21
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
CF 3.1 Problems and Workarounds
WASHINGTON SQUARE

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
22
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
What’s Great About CF on Solaris?
WASHINGTON SQUARE

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?
23
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
What’s Not So Great About CF on
Solaris?
WASHINGTON SQUARE

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”
24
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
What’s Great About CF with Open
Source Software?
WASHINGTON SQUARE

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)
25
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
What’s Not So Great About CF with
Open Source Software?
WASHINGTON SQUARE

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
26
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Looking Towards the Future
WASHINGTON SQUARE

It Works!

Combining Cold Fusion and Open Source
software
 Met our needs
 Met our customer’s needs
27
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Cold Fusion and Open Source
WASHINGTON SQUARE

Apache

MySQL

MyODBC, iodbc

GNU/FSF: gcc, egcs, make, gtar, etc...

Linux: Open Source concept and MySQL
test bed
28
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Packages and Tools We Used
WASHINGTON SQUARE

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/
[email protected]
29
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Links
WASHINGTON SQUARE

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
30
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Cold Fusion and Linux
WASHINGTON SQUARE

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_ID=256760
31
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Cold Fusion Linux Stub
WASHINGTON SQUARE

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
32
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Installing the Linux Cold Fusion
Stub
WASHINGTON SQUARE

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
33
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Using the Linux Cold Fusion Stub
WASHINGTON SQUARE

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
34
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Observations on the Linux Cold
Fusion Stub
WASHINGTON SQUARE

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
35
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Using Open Source Software in
Commercial Environment
WASHINGTON SQUARE

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
36
TECHNOLOGY SIMPLIFIEDSM
ASSOCIATES, INC.
Predictions on Cold Fusion’s
Future in the Linux World