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 click on the Compositions menu. Then click the ADD COMPOSITION button.
2. Enter the name of composition
In the Composition Name text box, type a name for your composition and click NEXT.
3. Select Composition Starting Point
On this screen you can choose: What type of composition would you like to create?
- From file in repo
- From template
- Empty composition (Advanced)
Click NEXT for chosen way.
3.1 From file in repo
Start a new composition from a docker compose file in your repository.
- In the search box, type the name of the repository.
Can’t find your repository?
Try the ADD BY URL option.
- From the drop-down menu, select a branch for the first build.
- Click NEXT.
- 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).
- 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.
- Click CREATE.
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!
- Choose the template.
- Click CREATE.
You will see the Composition editor where you can change something and then launch this composition to see results.
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.
- 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.
- (Optional) Click the Edit button to edit the content based on Docker Compose YAML .
- 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.
Manually launching compositions
Once you are ready click the small “rocket” button to launch your composition. This will create a temporary test environment in your Codefresh account that you can use to inspect your application.
- From the left sidebar click on the Compositions menu. Then select a composition.
- Click the Launch icon button.
- Review the log to verify that the launch completed successfully.
Sharing the environment URL
After you successfully spin up a composition, click the Running compositions tab from the Compositions item in the left pane, to view a record for the running environment and all containers for the environment.
Click the Hashtag icon to share your environment with your team.