Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compose): Docker Compose plugin #4662

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

feat(compose): Docker Compose plugin #4662

wants to merge 15 commits into from

Conversation

edvald
Copy link
Collaborator

@edvald edvald commented Jun 19, 2023

Still a bunch to be done, and currently branched off the plugin-sdk-pt2.
Just putting here for safe keeping and early review if anyone is particularly interested .)

@thsig thsig marked this pull request as ready for review July 25, 2023 21:59
@thsig thsig changed the title Docker compose integration (WIP) feat(compose): Docker Compose plugin Jul 25, 2023
@thsig
Copy link
Collaborator

thsig commented Jul 25, 2023

This is now ready for review.

From the guide:

This plugin allows you to integrate Docker Compose projects into your Garden project.

It works by parsing the Docker Compose projects, and creating Build and Deploy actions for each service in the project.

You can then easily add Run and Test actions to complement your Compose project.

This can be very useful e.g. for running tests against a Docker Compose stack in CI (and locally), and to wrap various scripts you use during development (e.g. a Run for seeding a database with test data, or a Run for generating a database migration inside a container that you're developing).

The provided action types are (links point to the corresponding reference docs):

  • docker-compose-service (Build and Deploy): These wrap the build and deploy (service) steps defined in a Compose project.
    • The docker-compose-service Build action calls docker compose build <service-name> under the hood.
    • The docker-compose-service Deploy action calls docker compose up <service-name> under the hood.
  • docker-compose-exec (Run and Test): These use docker compose exec to execute the specified command in an already running Docker Compose service.
  • docker-compose-run (Run and Test): These use docker compose run to run the specified command in a new container based on the Docker Compose service.
  • docker-run (Run and Test): Like docker-compose-run, but these are independent of the Docker Compose project, and simply reference a Docker image tag to run (uses docker run under the hood).

Here's a screenshot and a screencap of the plugin in action:

Screenshot 2023-07-25 at 21 17 52
docker-compose-readme-recording.mov

@thsig thsig force-pushed the docker-compose branch 3 times, most recently from 2e41f45 to 59af236 Compare July 31, 2023 12:17
@thsig
Copy link
Collaborator

thsig commented Aug 21, 2023

How do we feel about this one, @edvald?

I think it should be good for merging (would be good to get it on main and do any further work on this from there to close this long-lived PR).

@edvald edvald force-pushed the docker-compose branch 2 times, most recently from 4ffe559 to 01a8265 Compare October 11, 2023 16:22
edvald and others added 15 commits October 11, 2023 18:44
Also wrote getStatus handler for Compose, and finished various
other TODOs in the plugin code.

Also added an async lock around network creation to avoid race
conditions when deploying when one or more Docker networks
don't exist yet.
This is a more general term and feels less jargony .)
Also: Prune unused Docker networks in the `cleanupEnvironment` handler.
The Docker Compose plugin is now ready for general use. We're still
labelling it as experimental.

Tests were added for the main action handlers and flows, and several
things fixed and improved along the way. Also added an initial usage
guide and improved the docstrings.
@vvagaytsev vvagaytsev marked this pull request as draft June 3, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants