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

fix: use compose v2 syntax #79

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kahnwong
Copy link

In docker compose v2, the command docker-compose has been updated to docker compose. Ref: https://docs.docker.com/compose/releases/migrate/.

In this pr, in addition to existing check for availability of docker-compose, it also sees if docker compose exists.

Previously, if your system has compose v2, the launch script would fail. With this pr, systems using compose v2 will not result in an exit code.

@kahnwong
Copy link
Author

forgot to update the actual compose command, will create a commit for it

@xunliu
Copy link
Member

xunliu commented Sep 26, 2024

hi @kahnwong Thank you for your contribution to this PR.
@unknowntpo Please help review this PR If you have time, Thanks.

Copy link

@ryankert01 ryankert01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thank you for the patch, some nits left.

docker-compose down
isComposeV1=`which docker-compose`
if [ $? -eq 0 ]; then
docker-compose up ${components}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should prioritize docker compose since it's newer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @ryankert01 , since recent version of docker shipped with docker compose, it's better to use recent version of docker to eliminate potential bugs.

@kahnwong
Copy link
Author

Thank you both for the comments.

I agree that it should be docker compose syntax, in that case I will do following:

  1. rename this pr to fix: use compose v2 syntax
  2. Checkout code from main/master and replace docker-compose with docker compose

Is there anything I'm missing?

@kahnwong
Copy link
Author

I propose this version of launch-playground.sh

# redacted shebang and license

playground_dir="$(dirname "${BASH_SOURCE-$0}")"
playground_dir="$(cd "${playground_dir}">/dev/null; pwd)"

# check for `docker compose`
isExist=`docker --help | grep compose`
if [ $? -eq 0 ]; then
    true # Placeholder, do nothing
else
  echo "ERROR: No docker service environment found, please install compose plugin first."
  exit
fi

components=""
case "${1}" in
  *)
    components=$@
esac

cd ${playground_dir}
docker compose up ${components}

# Clean Docker containers when you quit this script
docker compose down

In which if everyone approves, I will then:

  1. Create a new commit with this version of launch-playground.sh
  2. Rename this pr to: fix: use compose v2 syntax

Please let me know if I missed anything.

@ryankert01
Copy link

Hi @kahnwong, it looks good! Could you commit it to the PR branch?

@kahnwong kahnwong force-pushed the fix/support-check-docker-compose branch from ace4325 to 992e72a Compare October 4, 2024 01:55
@kahnwong kahnwong changed the title fix: support check for docker compose fix: use compose v2 syntax Oct 4, 2024
Copy link

@ryankert01 ryankert01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ryankert01
Copy link

ryankert01 commented Oct 4, 2024

cc @unknowntpo @xunliu for final review

@unknowntpo
Copy link
Contributor

LGTM

@jhchee
Copy link
Contributor

jhchee commented Dec 27, 2024

Hihi @kahnwong Are you still working on this? This will be QoL improvement for users that use docker compose v2.

@kahnwong
Copy link
Author

Hihi @kahnwong Are you still working on this? This will be QoL improvement for users that use docker compose v2.

I'm still working on this. I noticed from the latest commit, the file I've worked on has been renamed to another file.

Will create a commit for compose syntax upgrade.

@kahnwong kahnwong force-pushed the fix/support-check-docker-compose branch from 992e72a to f4a7879 Compare December 28, 2024 16:05
@kahnwong
Copy link
Author

@jhchee rebased the pr and apply compose syntax migration. Please kindly review this PR.

@jhchee
Copy link
Contributor

jhchee commented Dec 28, 2024

Thanks @kahnwong, I can attest your change is working! However, I'm not a contributor of this project, so will likely need other to approve this PR.
Gentle ping @unknowntpo if you have the time to review this 🙏

@unknowntpo
Copy link
Contributor

LGTM, ping @xunliu

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.

5 participants