Skip to content

Commit

Permalink
enhance: use docker compose instead of docker-compose (milvus-io#35208)
Browse files Browse the repository at this point in the history
milvus-io#35209

---------

Signed-off-by: Yellow Shine <[email protected]>
Signed-off-by: Sumit Dubey <[email protected]>
  • Loading branch information
yellow-shine authored and sumitd2 committed Aug 6, 2024
1 parent 5e047af commit be48b2c
Show file tree
Hide file tree
Showing 23 changed files with 117 additions and 97 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/deploy-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ jobs:
wget https://github.com/milvus-io/milvus/releases/download/${{ env.PREVIOUS_RELEASE_VERSION }}/milvus-${{ matrix.mode }}-docker-compose.yml -O docker-compose.yml;
replace_image_tag ${{ env.OLD_IMAGE_REPO }} ${{ env.OLD_IMAGE_TAG }};
fi
docker-compose up -d
docker compose up -d
bash ../check_healthy.sh
docker-compose ps -a
docker compose ps -a
sleep 10s
- name: Run first test
timeout-minutes: 15
Expand All @@ -130,7 +130,7 @@ jobs:
shell: bash
working-directory: tests/python_client/deploy/${{ matrix.mode }}
run: |
docker-compose ps -a || true
docker compose ps -a || true
mkdir -p logs/first_deploy
bash ../../../scripts/export_log_docker.sh ./logs/first_deploy || echo "export logs failed"
- name: Second Milvus deployment
Expand All @@ -140,15 +140,15 @@ jobs:
run: |
source ../utils.sh
if [ ${{ matrix.task }} == "reinstall" ]; then
docker-compose restart
docker compose restart
fi
if [ ${{ matrix.task }} == "upgrade" ]; then
wget https://raw.githubusercontent.com/milvus-io/milvus/master/deployments/docker/${{ matrix.mode }}/docker-compose.yml -O docker-compose.yml;
replace_image_tag ${{ env.NEW_IMAGE_REPO }} ${{ env.NEW_IMAGE_TAG }};
docker-compose up -d;
docker compose up -d;
fi
bash ../check_healthy.sh
docker-compose ps -a
docker compose ps -a
echo "sleep 120s for the second deployment to be ready"
sleep 120s
Expand All @@ -169,7 +169,7 @@ jobs:
shell: bash
working-directory: tests/python_client/deploy/${{ matrix.mode }}
run: |
docker-compose ps -a || true
docker compose ps -a || true
mkdir -p logs/second_deploy
bash ../../../scripts/export_log_docker.sh ./logs/second_deploy || echo "export logs failed"
Expand All @@ -181,9 +181,9 @@ jobs:
echo "restart docker service"
sudo systemctl restart docker
sleep 20s
docker-compose up -d
docker compose up -d
bash ../check_healthy.sh
docker-compose ps -a
docker compose ps -a
echo "sleep 120s for the deployment to be ready after docker restart"
sleep 120s
Expand All @@ -206,7 +206,7 @@ jobs:
shell: bash
working-directory: tests/python_client/deploy/${{ matrix.mode }}
run: |
docker-compose ps -a || true
docker compose ps -a || true
mkdir -p logs/second_deploy
bash ../../../scripts/export_log_docker.sh ./logs/third_deploy || echo "export logs failed"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
- name: Start Service
shell: bash
run: |
docker-compose up -d azurite
docker compose up -d azurite
- name: UT
run: |
chmod +x build/builder.sh
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
- name: Start Service
shell: bash
run: |
docker-compose up -d pulsar etcd minio azurite
docker compose up -d pulsar etcd minio azurite
- name: UT
run: |
chmod +x build/builder.sh
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
- name: Start Service
shell: bash
run: |
docker-compose up -d pulsar etcd minio
docker compose up -d pulsar etcd minio
- name: IntegrationTest
run: |
chmod +x build/builder.sh
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish-test-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ jobs:
shell: bash
working-directory: tests/docker
run: |
docker-compose pull --ignore-pull-failures pytest
docker compose pull pytest
- name: Docker Build
shell: bash
working-directory: tests/docker
run: |
IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose build pytest
IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker compose build pytest
export LATEST_IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}
IMAGE_TAG=latest docker-compose build pytest
IMAGE_TAG=latest docker compose build pytest
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
continue-on-error: true
Expand All @@ -55,8 +55,8 @@ jobs:
run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose push pytest
IMAGE_TAG=latest docker-compose push pytest
IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker compose push pytest
IMAGE_TAG=latest docker compose push pytest
echo "Push pytest image Succeeded"
- name: Update Pytest Image Changes
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
Expand Down
8 changes: 4 additions & 4 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ For Apple Silicon users (Apple M1):

```shell
$ cd deployments/docker/dev
$ docker-compose -f docker-compose-apple-silicon.yml up -d
$ docker compose -f docker-compose-apple-silicon.yml up -d
$ cd ../../../
$ make unittest
```
Expand All @@ -398,7 +398,7 @@ For others:

```shell
$ cd deployments/docker/dev
$ docker-compose up -d
$ docker compose up -d
$ cd ../../../
$ make unittest
```
Expand Down Expand Up @@ -467,13 +467,13 @@ Milvus Cluster includes further component — Pulsar, to be distributed through
```shell
# Running Milvus cluster
$ cd deployments/docker/dev
$ docker-compose up -d
$ docker compose up -d
$ cd ../../../
$ ./scripts/start_cluster.sh

# Or running Milvus standalone
$ cd deployments/docker/dev
$ docker-compose up -d
$ docker compose up -d
$ cd ../../../
$ ./scripts/start_standalone.sh
```
Expand Down
8 changes: 4 additions & 4 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Creating milvus_builder_1 ... done
Check running state of Dev Container:

```shell
$ docker-compose -f docker-compose-devcontainer.yml ps
$ docker compose -f docker-compose-devcontainer.yml ps

Name Command State Ports
---------------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -135,7 +135,7 @@ Milvus uses Python SDK to write test cases to verify the correctness of Milvus f

```shell
cd deployments/docker/dev
docker-compose up -d
docker compose up -d
cd ../../../
build/builder.sh /bin/bash -c "export ROCKSMQ_PATH='/tmp/milvus/rdb_data' && ./scripts/start_standalone.sh && cat"
```
Expand All @@ -149,9 +149,9 @@ build/builder.sh /bin/bash -c "./scripts/start_cluster.sh && cat"
To run E2E tests, use these commands:

```shell
MILVUS_SERVICE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker-compose ps -q builder))
MILVUS_SERVICE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker compose ps -q builder))
cd tests/docker
docker-compose run --rm pytest /bin/bash -c "pytest --host ${MILVUS_SERVICE_IP}"
docker compose run --rm pytest /bin/bash -c "pytest --host ${MILVUS_SERVICE_IP}"
```

## Basic Flow
Expand Down
12 changes: 7 additions & 5 deletions build/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -eo pipefail

source ./build/util.sh

# Absolute path to the toplevel milvus directory.
toplevel=$(dirname "$(cd "$(dirname "${0}")"; pwd)")

Expand All @@ -18,12 +20,12 @@ fi
pushd "${toplevel}"

if [[ "${1-}" == "pull" ]]; then
docker-compose pull --ignore-pull-failures builder
$DOCKER_COMPOSE_COMMAND pull builder
exit 0
fi

if [[ "${1-}" == "down" ]]; then
docker-compose down
$DOCKER_COMPOSE_COMMAND down
exit 0
fi

Expand All @@ -37,11 +39,11 @@ mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/${IMAGE_ARCH}-${OS_NAME}-vscode-ex
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/${IMAGE_ARCH}-${OS_NAME}-conan"
chmod -R 777 "${DOCKER_VOLUME_DIRECTORY:-.docker}"

docker-compose pull --ignore-pull-failures builder
$DOCKER_COMPOSE_COMMAND pull builder
if [[ "${CHECK_BUILDER:-}" == "1" ]]; then
docker-compose build builder
$DOCKER_COMPOSE_COMMAND build builder
fi

docker-compose run --no-deps --rm builder "$@"
$DOCKER_COMPOSE_COMMAND run --no-deps --rm builder "$@"

popd
14 changes: 8 additions & 6 deletions build/builder_gpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -euo pipefail

source ./build/util.sh

# Absolute path to the toplevel milvus directory.
toplevel=$(dirname "$(cd "$(dirname "${0}")"; pwd)")

Expand All @@ -14,12 +16,12 @@ export OS_NAME="${OS_NAME:-ubuntu22.04}"
pushd "${toplevel}"

if [[ "${1-}" == "pull" ]]; then
docker-compose pull --ignore-pull-failures gpubuilder
$DOCKER_COMPOSE_COMMAND pull gpubuilder
exit 0
fi

if [[ "${1-}" == "down" ]]; then
docker-compose down
$DOCKER_COMPOSE_COMMAND down
exit 0
fi

Expand All @@ -42,15 +44,15 @@ mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker-gpu}/amd64-${OS_NAME}-vscode-extens
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker-gpu}/amd64-${OS_NAME}-conan"
chmod -R 777 "${DOCKER_VOLUME_DIRECTORY:-.docker-gpu}"

docker-compose pull --ignore-pull-failures gpubuilder
docker compose pull gpubuilder
if [[ "${CHECK_BUILDER:-}" == "1" ]]; then
docker-compose build gpubuilder
$DOCKER_COMPOSE_COMMAND build gpubuilder
fi

if [[ "$(id -u)" != "0" ]]; then
docker-compose run --no-deps --rm -u "$uid:$gid" gpubuilder "$@"
$DOCKER_COMPOSE_COMMAND run --no-deps --rm -u "$uid:$gid" gpubuilder "$@"
else
docker-compose run --no-deps --rm gpubuilder "$@"
$DOCKER_COMPOSE_COMMAND run --no-deps --rm gpubuilder "$@"
fi

popd
14 changes: 14 additions & 0 deletions build/util.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Check if docker-compose exists
if command_exists docker-compose; then
echo "Using docker-compose"
DOCKER_COMPOSE_COMMAND="docker-compose"
else
echo "Using docker compose"
DOCKER_COMPOSE_COMMAND="docker compose"
fi
2 changes: 1 addition & 1 deletion deployments/export-log/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ For better tracking and debugging Milvus, the script `export-milvus-log.sh` is p
>
>For milvus installed with helm-chart, if `log.persistence.enabled` is set to true (default false), the tool cannot be used to export milvus logs and the log files can be found directly under the path specified by `log.persistence.mountPath`.
>
> For Milvus installed with docker-compose, you can use `docker-compose logs > milvus.log` to export the logs.
> For Milvus installed with docker-compose, you can use `docker compose logs > milvus.log` to export the logs.
## Parameter Description

Expand Down
4 changes: 2 additions & 2 deletions deployments/offline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ $ for image in $(find . -type f -wholename "./images/*.tar.gz") ; do gunzip -c $
### With Docker Compose

```shell
$ docker-compose -f docker-compose.yml up -d
$ docker compose -f docker-compose.yml up -d
```

### On Kubernetes
Expand All @@ -85,7 +85,7 @@ $ kubectl apply -f milvus_manifest.yaml
### With Docker Compose

```shell
$ docker-compose -f docker-compose.yml down
$ docker compose -f docker-compose.yml down
```

### On Kubernetes
Expand Down
2 changes: 2 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ $ sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docke
$ sudo chmod +x /usr/local/bin/docker-compose
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
$ docker-compose --version
$ docker compose --version
```

## Start service
Expand All @@ -76,6 +77,7 @@ Start third-party service:
```shell
$ cd [milvus project path]/deployments/docker/cluster
$ docker-compose up -d
$ docker compose up -d
```

Start milvus cluster:
Expand Down
12 changes: 6 additions & 6 deletions scripts/devcontainer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,20 @@ mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/amd64-${OS_NAME}-conan"
chmod -R 777 "${DOCKER_VOLUME_DIRECTORY:-.docker}"

if [ "${1-}" = "build" ];then
docker-compose -f $ROOT_DIR/docker-compose-devcontainer.yml pull --ignore-pull-failures builder
docker-compose -f $ROOT_DIR/docker-compose-devcontainer.yml build builder
docker compose -f $ROOT_DIR/docker-compose-devcontainer.yml pull builder
docker compose -f $ROOT_DIR/docker-compose-devcontainer.yml build builder
fi

if [ "${1-}" = "up" ]; then
docker-compose -f $ROOT_DIR/docker-compose-devcontainer.yml up -d $(docker-compose config --services | grep -wv "gpubuilder")
docker compose -f $ROOT_DIR/docker-compose-devcontainer.yml up -d $(docker compose config --services | grep -wv "gpubuilder")
fi

if [ "${1-}" = "down" ]; then
docker-compose -f $ROOT_DIR/docker-compose-devcontainer.yml down
docker compose -f $ROOT_DIR/docker-compose-devcontainer.yml down
fi

if [ "${1-}" = "gpu" -a "${2-}" = "up" ]; then
docker-compose -f $ROOT_DIR/docker-compose-devcontainer.yml up -d $(docker-compose config --services | grep -wv "builder")
docker compose -f $ROOT_DIR/docker-compose-devcontainer.yml up -d $(docker compose config --services | grep -wv "builder")
fi

popd
popd
18 changes: 9 additions & 9 deletions scripts/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
cd ../build/docker/deploy/

echo "starting rootcoord docker"
nohup docker-compose -p milvus up rootcoord > ~/rootcoord_docker.log 2>&1 &
nohup docker compose -p milvus up rootcoord > ~/rootcoord_docker.log 2>&1 &

echo "starting proxy docker"
nohup docker-compose -p milvus up proxy > ~/proxy_docker.log 2>&1 &
nohup docker compose -p milvus up proxy > ~/proxy_docker.log 2>&1 &

echo "starting indexcoord docker"
nohup docker-compose -p milvus up indexcoord > ~/indexcoord_docker.log 2>&1 &
nohup docker compose -p milvus up indexcoord > ~/indexcoord_docker.log 2>&1 &

echo "starting indexnode docker"
nohup docker-compose -p milvus up indexnode > ~/indexnode_docker.log 2>&1 &
nohup docker compose -p milvus up indexnode > ~/indexnode_docker.log 2>&1 &

echo "starting querycoord docker"
nohup docker-compose -p milvus up querycoord > ~/querycoord_docker.log 2>&1 &
nohup docker compose -p milvus up querycoord > ~/querycoord_docker.log 2>&1 &

echo "starting datacoord docker"
nohup docker-compose -p milvus up datacoord > ~/datacoord_docker.log 2>&1 &
nohup docker compose -p milvus up datacoord > ~/datacoord_docker.log 2>&1 &

echo "starting querynode1 docker"
nohup docker-compose -p milvus run -e QUERY_NODE_ID=1 querynode > ~/querynode1_docker.log 2>&1 &
nohup docker compose -p milvus run -e QUERY_NODE_ID=1 querynode > ~/querynode1_docker.log 2>&1 &

echo "starting querynode2 docker"
nohup docker-compose -p milvus run -e QUERY_NODE_ID=2 querynode > ~/querynode2_docker.log 2>&1 &
nohup docker compose -p milvus run -e QUERY_NODE_ID=2 querynode > ~/querynode2_docker.log 2>&1 &

echo "starting datanode docker"
nohup docker-compose -p milvus run -e DATA_NODE_ID=3 datanode > ~/datanode_docker.log 2>&1 &
nohup docker compose -p milvus run -e DATA_NODE_ID=3 datanode > ~/datanode_docker.log 2>&1 &
Loading

0 comments on commit be48b2c

Please sign in to comment.