Starting a Nuxeo Development Environment is now possible with just a click, thanks to the Codenvy-based Nuxeo Factory! This integration of Codenvy with the Nuxeo Platform allows Nuxeo Platform developers to manage their entire development cycle in the cloud without installing anything. Because we love to tell you how things work, we have brought in a guest blogger, Jesse Williams, Content Marketing Manager at Codenvy, to tell you the behind the scene story of how this integration came together.

Simplifying Contributions to Nuxeo

Nuxeo released a brand new Codenvy Factory for their open source content management system. This give Nuxeo’s developer community the simplest way to create a development environment - all you have to do is hit the link and start coding your application.

As developers we love to know how things work and in this case that template does a lot so I thought some of you might like to see more details.

Behind that magical link is the Codenvy Factory which encodes the edit, build and debug environments needed to start developing with Nuxeo in a single template. This template is assigned a URL to make it useable from a page, button, IM, email, or anything. When a developer hits that link they’re brought into an isolated Codenvy workspace based on that template with dedicated cloud resources. Developers setup and install nothing.

Making all this work are two files: a Factory.json file that defines the project type, language, builder, running environment, source code repo location and infrastructure setup; and a Dockerfile that defines the running (and optionally building) environment used.

Defining the Project Template: Factory.json

Nuxeo’s Factory.json file looks like this:

Nuxeo's factory.json]

First we give the project a name and visibility - public or private. Next we define how the project will be built - in this case Nuxeo uses Maven.

The Runners section works in conjunction with the Dockerfile which we’ll look at later. You can see that it tells Codenvy to allocate 2GB of RAM for each running instance of this Factory.

The project Type is also listed as Maven and is mapped to a larger set of defaults related to Java projects in Codenvy, for example Java syntax checking, highlighting and other features. Here we set the location of the Guided Tour JSON file as well which outlines the text, placement and behavior of the Guided Tour boxes that show up when the factory is loaded.

Finally, the Source section lists the Git location and commitID that will be used for the project. It’s also possible to have a Factory synced to the head of a branch.

For those who want more detail, you can find all the actions and parameters (>100) that can be used with a Codenvy Factory in the codenvy docs.

Setting Up the Running Machine

Codenvy uses Docker to create containers that can run nearly any stack. We allow users to write their own Dockerfiles for execution in the Codenvy cloud, as well as providing them access to the container through a terminal with root access.

The Dockerfile below uses a base image on DockerHub to speed loading, but many projects just use one of the out-of-the-box environments offered within Codenvy for Tomcat, TomEE, JBoss, Glassfish and others.

Here’s the Dockerfile:

FROM nuxeo/nuxeo-codenvy-docker:latest

# copy the jar to nuxeo folder
ADD $app$ $NUXEO_HOME/nxserver/plugins/$app$

# Add instance.clid
ADD $app_src$/src/main/resources/instance.clid $NUXEO_HOME/nxserver/data/instance.clid

CMD ["/var/lib/nuxeo/server/bin/nuxeoctl", "console"]

As you can see from the comments Codenvy uses Dockerfiles largely untouched. The only changes we require are the inclusion of the ADD $app$ command to put the compiled code into the container and the exposing of the relevant port(s). In this case the ports were exposed in the “nuxeo-codenvy-docker” image referenced in the first line and stored at DockerHub.

That’s it. With those two files in place Codenvy takes care of the rest so that when anyone clicks on the link, behind the scenes Codenvy:

  1. Creates an isolated workspace for every developer on our microservices infrastructure (no account required).
  2. Configures our microservices infrastructure to allocate the dedicated RAM for each developer’s editor, builder and runner nodes (this keeps your tasks parallelized and ensures there’s no thrashing).

Dedicated RAM

  1. Loads our online editor based on Eclipse Che and Codemirror.

Nuxeo Online Editor loaded

  1. Clones the Nuxeo source code repository so each developer has their own sandbox to modify, create or contribute code in.

Nuxeo custom welcome panel in codenvy

  1. Loads a custom welcome panel and a guided tour to help orient new developers.

Nuxeo custom welcome panel in codenvy

  1. Gathers and updates dependencies via the Maven builder.

Gather and update dependencies via the Maven builder

  1. Loads a Dockerfile [[]] that defines the Maven builder and Tomcat application server that Nuxeo needs to run.
  2. Injects the dependencies and sample source (with any changes you make) into the running Docker container.
  3. Builds the project automatically when the workspace is opened so that developers can immediately run the project to get oriented.

All that takes less than 30 seconds.

Nuxeo and Codenvy are excited about this enhancement because we know that developers are the lifeblood of any project and making life easy for them will bring more tested contributions. This, in turn, enriches the project and provides on-going value to everyone.

If you want to learn more about Codenvy or our Factories check out the Codenvy site, blog, or docs.

Jesse Williams, Content Marketing Manager at Codenvy