Force.com is a great place to build enterprise applications!

In my precious articles, I’ve outlined the value proposition for the Force.com PaaS, as well as shared my thoughts regarding org strategy and development methodology.

Building on this content, I wanted to share a reference architecture, covering environments, code management and deployments.

This reference architecture is specific for enterprise organisations who are looking to leverage Force.com as an application platform as a service. This means you are looking to simultaneously build multiple applications, across multiple development teams, that will be hosted in a single Salesforce.com production org.

NOTE: Enterprise development can be complex. This post will only provide a summary of the reference architecture, although where possible I will post follow-up articles providing more detail on specific areas.

There are many ways to deploy code to Force.com, however for enterprise organisations I only ever recommend the Force.com Migration Tool (e.g. Ant) and Continuous Integration (CI).

Continuous integration is not unique to Force.com, it’s a practice in software engineering, of continuously merging all developer working copies with a shared mainline. This methodology demands a high level of automation, which helps to reduce errors by frequently testing small pieces of effort and providing constant feedback to the developer.

To help explain the reference architecture, let’s start with a diagram:

Force.com - CI

At the top of the diagram I’ve highlighted two capabilities:

Git, which is a distributed source code management system with an emphasis on speed and data integrity. Git is used to manage all source code (including meta-data) for all of the projects that are being developed for Force.com. Every project team should have their own private repository, which enables them to manage their code via different branches. There are plenty of Git services available, however the most popular are GitHub and BitBucket.

Jenkins, which is the industry standard for continuous integration. Jenkins automates code deployments across different environments, as well as facilitates the testing process. You can host your own Jenkins instance, but I would recommend a cloud-based service such as CloudBees.

These two capabilities facilitate the entire development process, making the end-to-end application lifecycle management significantly simpler to manage and support.

Next we have the different environments. Every production Force.com org comes with a suite of development sandboxes (the exact number depends on your agreement with Salesforce.com). These sandboxes can be created ad-hoc and are a direct replica of production (however do not include any data). There are also different sizes of sandboxes (e.g. DEV, DEV Pro, etc.)

To ensure you leverage these environments efficiently, the reference architecture is split into two halves.

Developer Owned (Left Side)

On the left side of the diagram, we have the developer tracks, these are fully owned by the development teams, providing complete autonomy. Every development team (which could be working on multiple apps) will be provisioned three sandboxes:

DEV = Main development environment.
CI = Continues integration merge / build test environment.
TEST = Formal user testing environment.

A traditional development pattern would be:

  1. All development will occur in the DEV environment, leveraging an IDE (e.g. Eclipse or MavensMate) and Git.
  2. With every commit to Git, Jenkins will automatically build the code in the CI environment. This will confirm that the development has not broken the build or created any conflicts. In the event of a failure, the development team will immediately be notified (via e-mail or even social tools such as Chatter or Slack).
  3. Finally, any code positioned for a release to production will be moved into the TEST environment where formal testing (including UAT) can occur. This is also managed by Jenkins, but triggered by the development team by selecting a specific tag from Git.

In a perfect world, every developer would have their own DEV sandbox, however, at the time of writing, Salesforce.com only offer a restricted number of DEV Sandboxes to their customers. As a result, developers within a specific development team would share the environments (DEV, CI, TEST). This actually works fine, but obviously requires some level of coordination, which is where development methodologies such as SCRUM Agile are key!

Production Org Owned (Right Side)

On the right side of the diagram, we have another set of environments, specifically:

CI = Used to test / merge code from the different development tracks.
PRE-PRD = An exact replica of PRD, including the full data set.
PRD = The production environment, where the live users will access the applications.

These environments are used to merge and test all code from the different development tracks, ready for a specific production release. The actual process remains consistent, leveraging Git and Jenkins to automate the deployment between environments.

Production releases can be as frequent as required, however it is common for enterprises to start with monthly releases and progress to weekly as they gain confidence. The good news is that the reference architecture is highly scalable and could easily manage multiple production releases per-day, should this become a requirement.

The two sides of the reference architecture are important as they provide a clear control point for the team that is accountable for the production Force.com org, ensuring that no unapproved code is deployed into production.

Conclusion

Hopefully this information provides a good overview as to how Force.com can be leveraged as an enterprise application platform as a service.

The key is to recognise that the reference architecture provides autonomy for the development teams, whilst providing a consistent control point that protects the production environment. Thanks to the high levels of automation, it also enables high levels of agility, without negatively impacting quality.