BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

27
Keeping Your Sanity Rapid Development & Deployment Tools October 26 th , 2011 Gary Cox – Blue Fish Development Group

description

There are many variations for deploying customizations into an Alfresco installation. Working as a global team on multiple projects, Blue Fish Development Group has created a set of processes, using standard tools such as Maven and Ant, to keep the development and deployment cycle sane. Working as a team presents challenges for maintaining source control and being able to quickly roll out the latest version of changes, and managing multiple projects requires the ability to quickly stand up a development environment and begin testing changes. You’ll learn Blue Fish’s procedures and walk away with a basic set of tools that will let you build your own development/ deployment framework that will reduce cycle time, improve repeatability and revert to a known/clean state.

Transcript of BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Page 1: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Keeping Your Sanity Rapid Development & Deployment Tools"

October 26th, 2011"

Gary Cox – Blue Fish Development Group"

Page 2: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Overview"Who is the Target Audience?

•  New Alfresco developers trying to get a better understanding of potential approaches to developing and deploying custom code"

•  Developers that currently have some components of a system in place, but need a more complete solution"

•  Developers looking to see “What else is out there?”"•  Some Java platform experience is assumed"

What will We Cover Today? •  Discussion of the overall approach and the open source tools that

we use"•  Solutions to tricky problems using these standard tools"•  Brief demonstration of using these tools against Alfresco

Community 4.0.a"•  Where to go to find more information"

Page 3: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Goals"Quick Overview of Alfresco Deployment Concepts

•  Review Alfresco deployment approaches"•  Developing in a team environment"

Understand the Challenges •  Choosing a deployment model"•  Developing and deploying in a team environment"•  Ramping up new developers"•  Quickly standing up new projects"

Tools and Processes to Make this Process Easier •  Use Open Source tools"•  More than just tools: Provide a process"•  Process should be adaptable to different tools"

Page 4: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Who is Blue Fish Development Group?"

Alfresco Platinum Partner"Focused on ECM for 12 years

•  Document Management and Collaboration"

•  Custom Application Development"

•  Content Migrations"Client Base

•  Global 2000"•  Growing Mid-Market Companies"

Key Offerings •  Alfresco Quick Starts"•  Turnkey ECM Solutions"•  Alfresco Projects in "Small Bites""

Page 5: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Guiding Principles"

What are the Guiding Principles for Our Development Tools and Processes?"

•  Improve repeatability"•  Controlled releases"•  Ability to quickly ramp up Developers"•  Ability to quickly stand up new Development environments"

•  Modularity"•  Keep customizations separate from Alfresco"•  Keep customizations in project-specific paths to support

multiple modules"•  Efficiency "•  Ability to develop against a variety of Alfresco versions"•  Reduce cycle time"•  Ability to revert to a known/clean state"

Page 6: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Review Potential Deployment Approaches"

Many Potential Approaches to Deploying Custom code

•  Overwrite existing files under the WEB-INF directory"

•  Deploy into /extension or /web-extension paths of the application"

•  Deploy code into the /shared path"

•  Package customizations into AMP files and deploy into /module path"

Page 7: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Points of Pain for These Approaches 1"

Overwrite existing files under the WEB-INF directory

• Disadvantages"• Nightmare for maintenance"• Can make every upgrade a difficult process"• No central location for customizations"

Page 8: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Points of Pain for These Approaches 2"

Deploy batch of customized files into the /extension or /web-extension paths of the application

• Advantages"• Overriding instead of replacing out of the box functionality, which is a good

thing"• Disadvantages"• How to handle packaging and versioning of content?"• Are you all on the same version of the files?"• What version is out there, anyway?"• How to integrate multiple packages?"

Page 9: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Points of Pain for These Approaches 3"

Deploy code into the /shared path

• Advantages"• Doesnʼt get overwritten by new deployments of WAR files"• Good for environment-specific files (like properties files)"

• Disadvantages"• This is typically where server specific properties files reside. May require

tweaking the set of deployed files"• Potential versioning issues"• Integrating multiple projects"

Page 10: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Points of Pain for These Approaches 4"

Package customizations into AMP files

• Advantages"• Quick to deploy a set of customizations"• Can group customizations into multiple AMPs if needed"• Provides a way to install a known version of an AMP (and an easy way to

check the installed version)"• Easier to avoid problems when integrating add-ons from multiple sources"

• Disadvantages"• Packaging into an amp can take longer"• Current deployment tool does not support uninstalling an AMP"• Typically still need a way to deploy environment-specific properties files"

Page 11: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Team Development Headaches"

What are the Considerations when Working as a Team? •  Coordinated modification of the source"

•  Source control"•  Continuous Integration"

•  Bringing new developers onto a project"•  Modularization"

•  Developers can focus on their areas of expertise"•  Can work on subset of project that you are focused on"

Page 12: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Blue Fishʼs Approach to Keeping Things Sane"

Developed a Set of Tools and Procedures to Meet our Needs •  Open source tools"•  Scripts to bootstrap development environments"•  Scripts to speed up development and deployment tasks"•  Integration with an Integrated Development Environment to let

developers get to work quickly.""•  Java developers may not even require extensive Alfresco knowledge to

work on specific tasks ""•  Development environments split Alfresco Repository and Share"

What Tools Do We Use? •  Subversion"•  Maven"•  Nexus"•  Ant"•  Eclipse"•  Bamboo for CI (not Open Source, but Hudson is another option)"

Page 13: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Process Overview 1"

Page 14: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Process Overview 2 (The Bigger Picture)"

Page 15: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Overview of Deployment Stack: Build"Maven"

•  Maven Benefits"•  Manage transitive

dependencies"•  Easy to modularize build"•  Standardization across

projects and build types"•  Share build elements (POM

inheritance)"•  Single point of project

configuration"•  Declarative: What needs to

be done? (versus ʻHow?ʼ)"•  Project Object Model

(POM) files define projects"•  Project dependencies"•  Project Modules"•  Required Plugins"

Page 16: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Overview of Deployment Stack: Artifact Repo"Nexus"

•  Used to maintain our corporate Maven repository"

•  Alfresco JAR files can be added to the repository as Artifacts"

•  Can maintain local repositories and point to public repositories on the Internet"

•  Developers donʼt need to know where artifacts come from… ʻone stop shopʼ"

•  At Blue Fish we maintain a repository for 3rd Party libraries and our own artifacts"

Page 17: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Overview of Deployment Stack: IDE"Eclipse •  We typically use Eclipse, but

other IDEs can be used"•  NetBeans"•  IntelliJ IDEA"

•  Maven can generate Eclipse projects"

•  mvn eclipse:eclipse"•  Import project"•  Point to Maven repository by

setting M2_REPO path"•  The Maven POM mappings

between source directories and target paths"

•  Rapid search across project source and Alfresco source/config files"

Page 18: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Overview of Deployment Stack: Deployment"Ant •  Ant scripts are used for deploying AMP files into Development

Environment"•  Pulls out of the box Alfresco WAR files from Maven Repo"•  Deploys AMP file(s) into the WAR"•  Removes old folder structure"•  Can ʻfast-deployʼ into Share"

•  Ant scripts can be configured to install multiple AMPs as dependencies as required (for example the Alfresco FDK AMP)"

•  Everything comes from the Maven Repo (Maven Ant Tasks)"

Page 19: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Overview of Deployment Stack: Source Control"

Subversion •  Broad platform and tools

support"•  For Continuous Integration

(CI), builds are performed on code check-in"

•  We use Atlassian Bamboo for CI, but other tools such as Hudson could be used"

Page 20: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Process Walkthrough"

You Have a New Project (or Projects!) or a New Team Member… How do You Get Started?

•  Need to stand up a development environment"•  Need the ability to get additional developers ramped up on the

project quickly (may have variety of skill sets)"•  Need to deal with task switching between multiple projects"•  Need self-contained stack to switch from project to project rapidly"

Demonstration of a Working Environment •  Developers can get started quickly"•  Can even hand this off to run ʻofflineʼ once Maven dependencies

have been downloaded"•  The tools handle packaging the AMP and setting the targets for

folders."•  Developers just need to know to write their code in a few source

folders"•  Developers donʼt need to know about other modules or

dependencies"

Page 21: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Standing Up a New Developer"

Step 1 •  Get a copy of a project folder"

•  Contains an Alfresco installation (Community, in this case)"

•  All required tools are in the “tools” folder"

•  Downloaded Maven dependencies are in “maven-repo”"

Page 22: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Standing Up a New Developer"

Step 2 •  Perform source code update

to get latest code"

Page 23: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Local Build/Deployment Cycle"

Step 1 •  Validate that it will

build:"•  ʻmvn clean installʼ"

Step 2 •  Create Eclipse project:"

•  ʻmvn eclipse:eclipseʼ"

Step 3 •  Launch Eclipse"

•  Import Existing Project into Workspace (trunk directory) to import Alfresco and Share"

•  If using Maven Eclipse plug-in, remember to set ʻM2_REPOʼ build path variable and point to ʻmaven-repoʼ (not required if using Eclipse M2Eclipse plug-in)"

Page 24: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Local Build/Deployment Cycle"

Step 4 •  Save custom code in Eclipse"•  Typically will use existing /src paths"

Step 5 •  Test building and deploying into local Alfresco environment:"

•  ʻmvn clean installʼ"•  ʻant clean-install-and-deployʼ"

•  We have a variety of convenience deployment targets"•  ʻant –projecthelpʼ provides a list of deployment targets"

Step 6 •  Start local Alfresco Repository and Share and review changes"•  We start the servers with BAT files"

•  Separate Tomcat instances for Alfresco Repository and Alfresco Share"•  BAT file starts the database"

Page 25: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Challenges that We Encountered"

Environmental •  Had issues with OpenOffice if it was nested too deeply"

Maven Challenges •  Alfresco Module Management Tool doesnʼt understand non-numeric

version numbers (e.g. 1.0.0-SNAPSHOT)"•  We use a plug-in to produce a version number to strip ʻSNAPSHOTʼ"

•  Eclipse integration: Neither the Maven Eclipse plug-in and the Eclipse M2Eclipse plug-in understand AMP packaging"

•  Declare ʻJARʼ packaging and explicitly package and include as AMP"ANT

•  Maven Ant Tasks"•  Donʼt understand redefining the Central Repository to point at corporate

repository."•  Have to explicitly declare a Remote Repository"

Page 26: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Interested in the Presentation Materials?"

•  We are hoping to be able to provide some portion of the examples and the slides on our FTP site"

•  We have a sign in sheet if youʼre interested in getting access to the materials when they are available."

•  Check for updates here:"•  http://bit.ly/toeD9Y"

Page 27: BP-10 Keeping Your Sanity – Rapid Development & Deployment Tools

Resources"Where to find the tools discussed in this presentation: •  Maven"

•  http://maven.apache.org/"•  Maven Ant Tasks"

•  http://maven.apache.org/ant-tasks/index.html"•  Nexus"

•  http://nexus.sonatype.org/"•  Hudson"

•  http://hudson-ci.org/"•  Eclipse"

•  http://www.eclipse.org/"•  Ant"

•  http://ant.apache.org/"•  Subversion"

•  http://subversion.apache.org/"•  Blue Fish Development Group"

•  http://www.bluefishgroup.com/"