4433ebb4e588507acca01ba08147e4da.ppt
- Количество слайдов: 30
Tcl/Tk 2003
Using Starkits for Easy Deployment of Server Applications Mark Roseman courseforum TECHNOLOGIES
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 }
That was easy! On to the next application…. n Ummm…. forgetting something? n Oh yeah, better post it on Source. Forge so others can take advantage of my brilliance!
“If it was hard to develop, it should be hard to install!” Download the latest source n Unpack in Sites directory of your home dir n Configure Apache n ¨ Open Terminal. app, type “sudo vi /etc/httpd. conf” ¨ Remove the leading “#” from these lines: n n Load. Module php 4_module libexec/httpd/libphp 4. so Add. Module mod_php 4. c ¨ Modify the Directory. Index line to read: n Directory. Index index. html index. php index. htm index. php 3 index. cgi
And so on… n Keep configuring Apache… ¨ Add. Type application/x-httpd-php. php Add. Type application/x-httpd-php-source. phps ¨ Then ‘sudo apachectl restart’ n Install My. SQL (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
Oh, but the fun has just begun! n n n Better set up My. SQL 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…. …. Tell PHP about it…. . Hack hack… Modify the Wiki code to include the database… hack….
Glad we spent all that time developing our application.
A New Breed of Server Apps Personal / Small Group Server Apps n SOHO market adopting: n ¨ Broadband, Wi. Fi, Bluetooth… ¨ Windows XP, Mac OS X Weblog, Wiki, webmail, file sharing, calendars, MP 3 streaming, document management… n Normal users, not network admins n
Deploying Tcl Server Apps The Starkit story so far n Deployment Requirements n Dependencies n Installation / Configuration n Starting and Stopping n Platform Issues n ¨ particularly n Mac and Windows Miscellaneous Issues - packaging, builds, obfuscation, integration…
The Starkit story so far Tclkit: Tcl, Tk, incr Tcl, Metakit, Tcl. VFS n Starkits and Starpacks n ¨ Platform-neutral or platform-specific ¨ Package up your whole development tree ¨ Way beyond simple code wrapping Jean-Claude Wippler [Tcl’ 2000] n Steve Landers [Tcl’ 2002] n Gets you pretty far (e. g. wikit)… n
Course. Forum / Project. Forum Wiki-like app n Non-tech users n ¨ Education ¨ Business n Cross-platform ¨ Unix, Win, OS X ¨ Web Browser Easy to use tool n Try before you buy n
Dependencies n Typical Wiki: Apache/IIS, scripting engine, other libraries, external database, CVS, … ¨ Trend n is towards more layers (app servers) Barriers to entry ¨ Initial install (don’t screw up!) ¨ Upgrade can break your app n Tradeoffs must be taken into account early! ¨ Developer benefit from external packages ¨ Increased complexity for end users ¨ Understand the context you’re running in
Reducing Dependencies n Solution #1: bundle everything ¨ Setup script to automate install ¨ Can make sense for larger systems n Solution #2: roll your own (subsets): ¨ Tcl. Httpd (or mini-variants) ¨ Metakit (or SQLite) ¨ Build subset libraries (e. g. version control) n CF/PF: one file, no externals, < 2 mb
Installation Install = copy n Uninstall = delete n n Well maybe…
Configuration Get rid of the text based configuration files! n Web-based configuration n
Starting and Stopping Start the application, stop the application n Consider a simple GUI for this — yes, even for a server! n New Users ¨ Feedback ¨ Choosing ports ¨
Running as a Daemon Different than initial use n Unix: rc. d / inittab n Windows: services n Mac OS X: Startup. Item n more later… n
Unix Platform Issues Not a lot of extra issues here n Running as ‘setuid’ n
Windows Platform Issues Start / Stop GUI n Installers / Uninstallers n Windows Services n ¨ Tcl. Svc ¨ Tcl Dev Kit Service Mgr ¨ Fire. Daemon
Mac OS X “Unix for the Masses” n Opportunity for smaller developers n ¨ Rewards innovation ¨ Culture of supporting small shops ¨ Actually pay for software ¨ Easy to get the word out ¨ Free High-Quality Developer Tools and Docs n Beware — “port” is a four letter word!
Mac OS X GUI Tk not quite there yet (sniff!) n Small Cocoa app n ¨ ~200 lines Obj. C ¨ Interface. Builder ¨ A few hours to develop
Mac OS X Application Bundles App is a directory n Cocoa launcher n Starpack “guts” n Communicate via Unix pipes (!) n Setuid n
Mac OS X Packaging Application Bundles n Disk Images n Installers if needed n Startup. Item n ¨ Known location ¨ Shell scripts ¨ Run (Unix-style) executable 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!!!
Other Issues n Integration ¨ Avoiding ¨ Firewalls port conflicts ¨ Proxy / Virtual Hosting ¨ Branding n Development Process ¨ Builds ¨ Testing ¨ Code obfuscation (procomp / tbcload)
Course. Forum / Project. Forum Full power of Tcl, Metakit, etc. n With Starkit, drop development tree on user’s machine n Small app, quick to download, code protected n Runs like native apps, easy to setup n
Remember that O’Reilly Article? “I’ve got one of those if-only-I’dknown-that-before sort of feelings… Nice work. You're right, it couldn't be simpler. ”
Deployment is a Tcl Strength Cross platform n Easy to embed/extend n Code hiding when needed n Starkit goes way beyond simple wrapping n Network server apps run by end users n ¨ Important new niche ¨ Tips here to ease deployment further ¨ Start thinking about deployment early!
Thanks! www. markroseman. com/tcl www. courseforum. com And announcing… tcl. projectforum. com Free, powerful collaborative workspaces for Tcl/Tk based open source projects and their teams. Yes it’s easy to install — but we do hosting too!


