Tutorials

Basics: Importing a Project

You can import a project from source code repository (Git/GitHub) or as a ZIP. The project configuration wizard will guide you.

Step 1: Dealing With Project Types

Having imported source code to your Codenvy workspace, you need to tell the system how it should be treated, i.e. choose a project type. Project types are provided by plugins and may or may not be associated with a particular build system. Plugins may also change the UI (introducing additional panels), add project-specific functionality (like Angular generators), disable existing menus or toolbar buttons.

Interpreted Languages

Project types are based on programming languages and build systems like Maven (for compiled languages). Interpreted languages such as Ruby, Python, PHP and JavaScript don’t require a builder. Our AngularJS project type offers additional functionality – Angular Generators and installation of Bower components from the Build menu.

Compiled Languages

If you have a Java project, you can choose between Maven and Ant build systems (Maven is the default). When choosing any of these project types, you set up the following project build and run cycle:

>> Project is built and packaged on a separate builder node >> artifacts are injected into a Docker image on a runner node >> output is piped into builder/runner console in a workspace

Blank Project Type

It is possible that none of the available project type suits your project. If this is the case, choose the Blank Project type which allows you to set the runtime later or create your own custom runtime with a Dockerfile.

Note that for compiled languages, choosing Blank project type will disable build commands so it’s recommended to choose an Ant or Maven project instead.

Step 2: Choosing Runtime

Having configured project type (you may go through additional project configuration, for example, changing GroupID or packaging in Maven’s pom.xml), it’s time to choose runtime environment for your project. You will see categories with environments and their descriptions:

run_env

You may want to check the runtime recipe for the environment you are about to choose – you can visit our Dockerfiles project on GitHub. When there, you will find folders with names that are identical to the environment categories in our wizard’s configuration page. So, if you want to choose a java > web > tomcat7 environment, its recipe is available at https://github.com/codenvy/dockerfiles/blob/master/java/web/tomcat7/Dockerfile

We use Dockerfiles to create our environments. If you are interested in the underlying base images, you may want to browse /base directory – https://github.com/codenvy/dockerfiles/tree/master/base

Tips and shortcuts:

  • if you have a Java web project, head to java > web category and pick an application server
  • if your project is packaged as JAR, choose java > standalone > simple – cli. This environment injects a jar into a Docker image and executes it (java – jar application.jar)
  • if you have a desktop Java project, java > standalone > simple – gui. This environment injects a jar into a Docker image and executes it, while a client connects to a VNC server, which makes it possible for a user to connect to this environment.
  • if your Java project creates a db in the runtime, java > standalone > db should be your destination
  • if you have a Python GAE project, your environment should be python > web > python27_gae199

This way, you can analyze the particular environment to make sure it fits your project. Odds are that the environment itself is OK (it has all the tools/software installed), but some Docker instructions are missing, or vice versa, there are unnecessary instructions that cause image build failure. If you have run into such a situation you will need to provide your own Docker recipe. See: Custom Dockerfile.

If resources permit, you can set recommended RAM for a project. This property will be tied up to Run button, i.e. each time you hit Run, the app will be allocated the exact amount of RAM specified in configuration wizard.

Summary

To sum it up, let’s go through all the steps once again:

import_configure

Basics: Reconfiguring a Project

Made a wrong choice? Or failed to make any choice at all? You can re-configure your project anytime at File > Project Configuration.

You will see the same project configuration wizard that you have seen the first time you imported your project. Steps are identical to steps you have previously taken.

If you have created your own custom environment, you will find it in the list of available environments under project category. Project means that the environment is provided by the project, not system like all the rest.

runtime_environment

See: Dealing With Project Type and Choosing Runtime sections.

Basics: Correcting Config Mistakes

Runner Not Set

Name of runner environment is not specified, be sure corresponded property of project is set. You may see this error if you have not chosen any runtime environment for your application. This is easy to fix – choose one fo the pre-built environment or create a custom one.

Masters: Working with Codenvy JSON

Each time you re-configure the project, all the configuration settings are stored in a special configuration JSON file. You can download this file at File > Export Config. Let’s take a look at a typical JSON configuration file:

In the source, you can see location of the project, type of version control system and commit ID. Then comes the project section with essential info on project name, privacy, default runner and builder. system:/java/web/tomcat7 means that system provided environment is used (pre-built env). If you create a new environment in your project, call it custom, add it as a default runtime environment and set recommended RAM – 2048, this is how the runners section will look like:

{"configs":{"project://custom":{"options":{},"variables":{},"ram":2048}},"default":"project://custom"}

As you can see, system scope has been replaced with project, and there’s 2GB RAM allocation.

Any reconfiguration changes are saved into this file, which you can share with other people who will be able to recreate the same project in their workspaces.