Create composition

How to create environment configurations in Codefresh

Compositions can be launched as part of a unit test step, integration test step or for running an image for manual testing. You can create compositions from scratch or import an existing docker-compose.yml file.

1. Add a composition

From the left sidebar expand the Docker Swarm menu and click the Compositions sub menu. Then click the ADD COMPOSITION button.

codefresh_add_composition_first.png

2. Enter the name of composition

In the Composition Name text box, type a name for your composition and click NEXT

codefresh_name_composition.png

3. Select Composition Starting Point

On this screen you can choose: What type of composition would you like to create?

Click NEXT for chosen way.

codefresh_method_compose.png

3.1 From file in repo

Start a new composition from a docker compose file in your repository.

  1. In the search box, type the name of the repository.

codefresh_compose_add.png

Can’t find your repository?

Try the ADD BY URL option.

codefresh_compose_by_url.png

  1. From the drop-down menu, select a branch for the first build.
  1. Click NEXT.
  1. Enter the path to docker-compose.yml By default, Codefresh searches for your docker-compose.yml at the root level of your repository, by the name docker-compose.yml. If your docker-compose.yml is in sub-directory, provide the path as well (./foo/bar/docker-compose.yml).

codefresh_path_docker_compose.png

  1. Click NEXT

We don’t support the build property of Docker compose. We will replace it with images automatically by a pipeline that is automatically created.

codefresh_replace_build.png

  1. Click CREATE

Composition list

Your composition is now ready and should appear in the Compositions list.

3.2 From template

If your repository doesn’t include a docker-compose.yml file , you can use one of our templates to see how it works!

  1. Choose the template
  1. Click CREATE

codefresh_template_composition.png

You will see the Composition editor where you can change something and then launch this composition to see results.

codefresh_template_compose_edit.png

Click on the rocket icon to launch this composition.

3.3 Empty composition

If you chose the Empty composition you can now create a composition from scratch. You will see the following screen with an empty composition.

  1. To add a service, click the Add Service button. You can add existing built services, or provide the name for Docker image that will be pulled from Docker registry.
  1. (Optional) Click the Edit button to edit the content based on Docker Compose YAML .

codefresh_empty_compose.png

  1. Click the Save icon on the upper right corner.

Working with existing compositions

You can edit each composition you created (regardless of the original creation method) by clicking on its name from the compositions list. You will see a yaml editor that allows you to edit the details of the composition.

codefresh_first_composition.png

Once you are ready click the small “rocket” button to launch your composition. This will create create a temporary test environment in your Codefresh account that you can use to inspect your application.