tcl/tk 2003. using starkits for easy deployment of server applications mark roseman courseforum t e...

30
Tcl/Tk 2003

Upload: adrian-watson

Post on 10-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Tcl/Tk 2003

Page 2: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Using Starkits for Easy Deployment of Server Applications

Mark Roseman

courseforumT E C H N O L O G I E S

Page 3: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

The Canonical Tcl Server App

socket -server Accept $portnum

proc Accept {sock args} {

fconfigure $sock -blocking 0

fileevent $sock readable “Readable $sock”

}

proc Readable {sock} {

# … do something interesting

}

Page 4: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

That was easy! On to the next application….

Ummm….forgetting something?

Oh yeah, better post it on SourceForge so others can take advantage of my brilliance!

Page 5: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

“If it was hard to develop, it should be hard to install!” Download the latest source Unpack in Sites directory of your home dir Configure Apache

Open Terminal.app, type “sudo vi /etc/httpd/httpd.conf” Remove the leading “#” from these lines:

LoadModule php4_module libexec/httpd/libphp4.so AddModule mod_php4.c

Modify the DirectoryIndex line to read: DirectoryIndex index.html index.php index.htm index.php3

index.cgi

Page 6: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

And so on…

Keep configuring Apache… AddType application/x-httpd-php .php AddType

application/x-httpd-php-source .phps Then ‘sudo apachectl restart’

Install MySQL (luckily someone packaged that up nicely.. Download it here…) Check if its running: /usr/local/mysql/bin/mysqladmin status Oh yeah and set a root password on it /usr/local/mysql/bin/mysqladmin -u root password sniggle

Page 7: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Oh, but the fun has just begun!

Better set up MySQL for your Wiki /usr/local/mysql/bin/mysql -uroot -p mysql > grant

select, insert, update, delete, lock tables on wiki.* to wiki@localhost identified by 'password'; > create database wiki; > \q

…. Hack hack hack hack hack…. …. Tell PHP about it….. Hack hack… Modify the Wiki code to include the database… hack

hack hack hack….

Page 8: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Glad we spent all that time developing our application.

QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.

Page 9: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

A New Breed of Server Apps

Personal / Small Group Server Apps SOHO market adopting:

Broadband, WiFi, Bluetooth… Windows XP, Mac OS X

Weblog, Wiki, webmail, file sharing, calendars, MP3 streaming, document management…

Normal users, not network admins

Page 10: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Deploying Tcl Server Apps The Starkit story so far Deployment Requirements Dependencies Installation / Configuration Starting and Stopping Platform Issues

particularly Mac and Windows Miscellaneous Issues

- packaging, builds, obfuscation, integration…

Page 11: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

The Starkit story so far

Tclkit: Tcl, Tk, incr Tcl, Metakit, TclVFS Starkits and Starpacks

Platform-neutral or platform-specific Package up your whole development tree Way beyond simple code wrapping

Jean-Claude Wippler [Tcl’2000] Steve Landers [Tcl’2002] Gets you pretty far (e.g. wikit)…

Page 12: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

CourseForum / ProjectForum

Wiki-like app Non-tech users

Education Business

Cross-platform Unix, Win, OS X Web Browser

Easy to use tool Try before you buy

Page 13: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S
Page 14: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Dependencies

Typical Wiki: Apache/IIS, scripting engine, other libraries, external database, CVS, … Trend is towards more layers (app servers)

Barriers to entry Initial install (don’t screw up!) Upgrade can break your app

Tradeoffs must be taken into account early! Developer benefit from external packages Increased complexity for end users Understand the context you’re running in

Page 15: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Reducing Dependencies

Solution #1: bundle everything Setup script to automate install Can make sense for larger systems

Solution #2: roll your own (subsets): TclHttpd (or mini-variants) Metakit (or SQLite) Build subset libraries (e.g. version control)

CF/PF: one file, no externals, < 2mb

Page 16: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Installation

Install = copy Uninstall = delete

Well maybe…

Page 17: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Configuration

Get rid of the text based configuration files!

Web-based configuration

Page 18: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Starting and Stopping

Start the application, stop the application

Consider a simple GUI for this — yes, even for a server! New Users Feedback Choosing ports

Page 19: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Running as a Daemon

Different than initial use Unix: rc.d / inittab Windows: services Mac OS X: StartupItem more later…

Page 20: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Unix Platform Issues

Not a lot of extra issues here Running as ‘setuid’

Page 21: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Windows Platform Issues

Start / Stop GUI Installers / Uninstallers Windows Services

TclSvc Tcl Dev Kit

Service Mgr FireDaemon

Page 22: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

“Unix for the Masses” Opportunity for

smaller developers Rewards innovation Culture of supporting

small shops Actually pay for software Easy to get the word out Free High-Quality Developer Tools and Docs

Beware — “port” is a four letter word!

QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.

Mac OS X

Page 23: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Mac OS X GUI

Tk not quite there yet (sniff!)

Small Cocoa app ~200 lines ObjC InterfaceBuilder A few hours

to develop

Page 24: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Mac OS X Application Bundles

App is a directory

Cocoa launcher Starpack “guts” Communicate via

Unix pipes (!) Setuid

Page 25: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Application Bundles Disk Images Installers if needed StartupItem

Known location Shell scripts Run (Unix-style)

executable

Mac OS X Packaging

So we have a Starpack [a virtual file system

in a file] in an Application Bundle [which looks like a file

system in a file], inside a Disk Image [a virtual

file system in a file] … yikes!!!

Page 26: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Other Issues

Integration Avoiding port conflicts Firewalls Proxy / Virtual Hosting Branding

Development Process Builds Testing Code obfuscation (procomp / tbcload)

Page 27: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

CourseForum / ProjectForum

Full power of Tcl, Metakit, etc.

With Starkit, drop development tree on user’s machine

Small app, quick to download, code protected

Runs like native apps, easy to setup and use

QuickTime™ and aTIFF (LZW) decompressorare needed to see this picture.

Page 28: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Remember that O’Reilly Article?

“I’ve got one of those if-only-I’d-known-that-before sort of feelings…

Nice work. You're right, it couldn't be simpler.”

Page 29: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Deployment is a Tcl Strength

Cross platform Easy to embed/extend Code hiding when needed Starkit goes way beyond simple wrapping Network server apps run by end users

Important new niche Tips here to ease deployment further Start thinking about deployment early!

Page 30: Tcl/Tk 2003. Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum T E C H N O L O G I E S

Thanks!

www.markroseman.com/tclwww.courseforum.com

And announcing…

tcl.projectforum.comFree, powerful collaborative workspaces

for Tcl/Tk based open source projects and their teams.

Yes it’s easy to install — but we do hosting too!