• No results found

Assembling Web Development Environments with Perforce. Stephen Vance Perforce User Conference 2001

N/A
N/A
Protected

Academic year: 2021

Share "Assembling Web Development Environments with Perforce. Stephen Vance Perforce User Conference 2001"

Copied!
36
0
0

Loading.... (view fulltext now)

Full text

(1)

Assembling Web

Development Environments

with Perforce

Stephen Vance

(2)

Once Upon A Time …

n Experiences from

G Consulting for Web companies

G Involvement with Internet Start-up

G Problem-solving from personal interest

n Internet start-up is main storyline. n Of course, names changed.

(3)

The Characters

n Me: “I can’t let chaos ruin us”

n The CFO: “We’re on a tight venture budget” n The CTO: “I can develop that in two hacks”

n The Marketing Guy: “I can’t live without my Mac” n The Sub-contractor: “We do what we do”

(4)

The Case for SCM in Web

Development

n Many disciplines converging in one medium q Programmers

q HTML designers

q Advertising executives q Marketers

n Many skill levels from novice to expert

n Large-scale sites are still driven by custom-coded

(5)

In The Beginning …

n There was the void.

G a.k.a. a start-up with funding and no developers

n And then he said, “Let them have options”

and product development commenced.

n Against better judgment we started hacking

(6)

Aaaarrrrgh!

n And as one might expect, some code was

irretrievably flattened at 3:00 a.m. by two people working on the same file.

n After some “discussions” with the CTO and

(7)

The Web Site Conundrum

n Each developer has his own workspace n But there is still only one Web server

n Although source changes are safe against

multiple authors, there is only one testing environment

(8)

Virtual Hosts

n IP- or name-based

n IP-based virtual hosting has shortcomings

n Name-based virtual hosting addresses these

(9)

Name-based Virtual Hosts

n Server distinguishes Web

sites based on name in Host header

n DNS wildcards avoid need

for DNS reconfiguration

n Apache configuration

handles the rest

GET / HTTP/1.1

Host: www.vance.com

*.dev.vance.com. CNAME 86400 devhost.vance.com.

NameVirtualHost * <VirtualHost *> DocumentRoot /usr/local/apache/htdocs ServerName www.vance.com </VirtualHost> <VirtualHost *> DocumentRoot /usr/local/dev/site1/htdocs ServerName site1.dev.vance.com </VirtualHost>

(10)

Visualizing Virtual Hosts

http://site1.dev.vance.com/test.html

*.dev.vance.com. CNAME 86400 devhost.vance.com. devhost.vance.com. A 86400 192.168.1.1 DNS devhost.vance.com site1.dev.vance.com? Apache (devhost.vance.com) GET /test.html HTTP/1.1 Host: site1.dev.vance.com /usr/local/dev/site1/htdocs/test.html Gets file Returns page Displays page

(11)

Enter The Marketing Guy

n Technically savvy, but non-developer n Rejected disk sharing technologies n No Mac solution for non-developers n Used Windows, but

G Hated it

G Required logging in to sync virtual host

(12)

P4Web to the Rescue

n P4Web is a Perforce-specialized Web server n Provides GUI on any platform with a browser n Runs on almost any platform supported by

Perforce

n Allows management and viewing of Web

(13)

P4Web Configurations

Browser P4Web Client Machine Client P4D Depot Perforce Server Browser P4Web Client P4D Depot Development Host

(14)

The Next Challenge

n The Marketing Guy is happy.

n Then he announces that he has hired a

sub-contractor to do the Web design.

n Quite reasonably, the sub-contractor doesn’t

feel he needs to learn Perforce to fulfill the contract.

(15)

Easy FTP Integration

n Web design tools support ftp

n Put sub-contractor work on its own branch n Create a client with “allwrite” option

n Create virtual host with document root of <client

root>/htdocs

n Tell sub-contractor to set ftp location to <client

root>/htdocs

n Populate /cgi-bin if necessary

n Use Tech Note #2 techniques when sub-contractor

(16)

Improved Integration Using P4FTP

n P4FTP is Perforce FTP server where session

is a submission

n Isolate work to a branch

n Excellent solution, but two drawbacks

G Content only transiently populates disk, so not fit

to work with virtual host for viewing

G Each ftp user consumes a Perforce license and

(17)

Where We Are

n Virtual hosting allows multiple Web servers

on minimal hardware

n P4Web allows browser-based use of

Perforce client functionality with viewing of static content

n FTP and P4FTP allow smooth integration

with Web design tools

n However, we still have to sync a Unix client to

(18)

Viewing Content with WebKeeper

n What?

q Apache module allowing direct viewing of content from Perforce depot

q Open source project in the Perforce public depot q Recently enhanced

n Who?

q Originally authored through Perforce q I was recently designated curator n Where?

q Info at

http://public.perforce.com/public/perforce/webkeeper/index. html

(19)

How WebKeeper Works

Browser Apache Client Machine P4D Depot Perforce Server Browser P4D Depot Web Server WebKeeper Apache Client WebKeeper Simplest Most Capable

(20)

WebKeeper Installation

n Instructions in README.WEBKEEP in Perforce

public depot

n Builds either statically or as loadable module n Builds either using full Apache source tree or

using apxs with Red Hat apache-devel.

n Built and tested on FreeBSD and Linux. n Other platforms on request

n Plan to add binary loadable modules for

(21)

Basic WebKeeper Configuration

<VirtualHost *> ServerName site1.dev.vance.com <IfModule mod_webkeep.c> WebKeepPort perforce.vance.com:1666 WebKeepUser steve WebKeepPasswd mypassword WebKeepDirectoryIndex index.html WebKeepAlias / //depot/dev/site1/htdocs/ </IfModule> </VirtualHost> n WebKeep directives replace DocumentRoot n WebKeepDirector yIndex should correspond to Apache DirectoryIndex n WebKeepAlias

maps Web root to Perforce depot

n IfModule makes configuration

(22)

Why Do We Need More?

n In two words, “Dynamic Content” q Text-based

n Server-side includes (SSI)

n PHP n Perl n ASP n JSP n Server-processed XML and XSLT q Binary n C/C++ CGI n EJB n Servlets

(23)

Text-based Dynamic Content

<IfModule mod_webkeep.c> WebKeepPort perforce:1666 WebKeepUser perforce_user WebKeepDirectoryIndex index.html WebKeepAlias / //my_client/htdocs/ WebKeepClient my_client WebKeepSync On WebKeepRefresh //my_client/include/… </IfModule> n WebKeepClient

gives a client spec

n WebKeepSync tells

WebKeeper to sync the files to the client for Apache

n WebKeepRefresh

(added after paper) always refreshes include directory

(24)

Adding CGI Support

<VirtualHost *>

ServerAdmin [email protected] ServerName site1.dev.vance.com

DocumentRoot /usr/local/dev/steve/htdocs

ScriptAlias /cgi-bin /usr/local/dev/steve/cgi-bin <IfModule mod_webkeep.c>

WebKeepPort perforce.vance.com:1666 WebKeepUser steve

WebKeepDirectoryIndex index.html

WebKeepAlias /cgi-bin/ //depot/dev/steve/cgi-bin/ WebKeepAlias / //depot/dev/steve/htdocs/ WebKeepClient my_client WebKeepSync On </IfModule> </VirtualHost> n DocumentRoot re-introduced for file access n ScriptAlias tells Apache which content to treat as CGI scripts n New WebKeepAlias tells WebKeeper how to populate the CGI directory

n WebKeeper handles aliases in the order presented in the configuration, so the CGI alias must come first

(25)

Compiled Web Elements

n Web elements that

G Require compilation before being sent to browser G Require compilation before executing on server

n Examples

G Java applets G C/C++ CGIs G Java Servlets

(26)

Compiled Element Issues

n Platform dependence

G C/C++ and Java with JNI are platform-dependent G Java without JNI and scripts are independent

G Impacts location of development workspaces

n Deployment location

(27)

Supporting Compiled Elements

n C/C++ CGIs

q Compile on server or like platform

q Target or copy to /cgi-bin on virtual host n Java applets

q Compile on any platform (JNI usually non-issue) q Target or copy to virtual host

n EJBs and Servlets

q Compile on any platform q JRE compatibility

q Target or copy to server’s <app-path>/WEB-INF/classes

n java –d <app-path>/WEB-INF/classes Some.class

n Manually update deployment descriptors if necessary

(28)

Web Site Deployment

n Perforce can be used to deploy Web sites n WebKeeper not advised for production sites

G Additional DNS lookups and network requests G Potential security hole through firewall

G Large Perforce operations result in Web site

unavailability

(29)

Deployment Techniques

n Check in binaries

n Maintain two document trees

G Ensures atomicity of deployment

G Reduces timing demands for deployment G Method

n One is live

n Deploy to the non-live n Switch

(30)

Web Site Double-Buffering

Apache

Copy 1 Copy 2

Web Server Perforce Server

p4d

Depot

httpd.conf

(31)

Advanced Deployment

n Coordinating deployment to and switchover in

server farm

n Deploying to multiple hosting centers n Sub-dividing content space for partial

deployment

n See P4UC00 presentation by David Markley

and Scott Money of Lycos, Inc. for ideas on large-scale deployment

(32)

Branching for Web Content

n Different from branching for traditional

software products

G Shorter cycles

G Smaller functional change sets G More evolutionary

G More continuous

n Typically two- or three-tiered approach

G Development mainline G QA codeline

(33)

WCM Branching

Development Mainline QA Codeline

Release Codeline

•Central for ongoing enhancements and fixes •Project branches originate here

•Prevents “code freeze” delays •Allows selective integration •Allows direct fixes of QA defects •Possible simple release codeline

•Prevents QA stall waiting for release •Encapsulates final release configuration •Allows selective integration of

independent components

•Allows final release transformations •Deployment master

(34)

For More Info

n Additional info in paper on

G Installing WebKeeper

G Whether and when to archive binaries

G Handling shared resources like databases G Managing Apache configurations

(35)

Future Directions

n Expand application server integration

G J2EE servers

G Zope

n Expand large-scale deployment strategies n Enhance WebKeeper

G See

http://public.perforce.com/public/perforce/webkeeper/index.html

G Started basic authentication before conference based on Chris

Seiwald’s work

G Mass virtual hosting support

G Add binary modules to depot

G Support Apache 2.0

(36)

Conclusion

n Perforce + Open-Source Software + Best

Practices = Effective Web Development Management

n As always, consider the needs when

implementing solutions

n Hopefully, this material gives you the

References

Related documents

integration of detailed and global spectral information with other remote sensing data and rapidly growing in situ biological information points to an array of transformative

Digital technology to support all Information Governance Business Planning Performance Contracting Clinical Care Operations Information &amp; Business Intelligence

Poster presented at the annual meeting of the National Association of School Psychologists, San Francisco, CA.

Although many different therapeutic techniques (e.g., group counseling, bibliotherapy, or play therapy) have been used to help neurotypical adolescents who are grieving, there is

experiences (i.e., dating relationship, sexual relations, cohabitation, engagement, marriage) and how these vary by age, gender, and nativity; and (b) to examine longitudinally, the

In community rated type schemes premiums are set at the average cost of the wide age group, so that younger people typically pay more than their average risk and older

The exact estimation of quantization effects requires numerical simulation and is not amenable to exact analytical methods.. But an approach that has proven useful is to treat

In memory of Harold Taub, beloved husband of Paula Taub by: Karen &amp; Charles Rosen.. Honouring Maria Belenkova-Buford on her marriage by: Karen &amp;