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

[#issue-460]Switch Docker Compose to v2 #466

Merged
merged 3 commits into from
Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,17 @@ doc: ##@Create local online documentation and start serve

# Use like "make log service=dashboard"
log: ##@Log tail special service log, Use like "make log service=dashboard"
docker-compose -f bootup/docker-compose-files/${COMPOSE_FILE} logs --tail=200 -f ${service}
docker compose -f bootup/docker-compose-files/${COMPOSE_FILE} logs --tail=200 -f ${service}

logs: ##@Log tail for all service log
docker-compose -f bootup/docker-compose-files/${COMPOSE_FILE} logs -f --tail=200
docker compose -f bootup/docker-compose-files/${COMPOSE_FILE} logs -f --tail=200

image-clean: clean ##@Clean all existing images to rebuild
echo "Clean all cello related images, may need to remove all containers before"
docker images | grep "cello-" | awk '{print $3}' | xargs docker rmi -f

start-docker-compose:
docker-compose -f bootup/docker-compose-files/${COMPOSE_FILE} up -d --force-recreate --remove-orphans
docker compose -f bootup/docker-compose-files/${COMPOSE_FILE} up -d --force-recreate --remove-orphans

start: ##@Service Start service
if [ "$(CONFIG_DOCKER_COMPOSE_DEPLOY)" = "y" ]; then \
Expand All @@ -223,7 +223,7 @@ start: ##@Service Start service

stop-docker-compose:
echo "Stop all services with bootup/docker-compose-files/${COMPOSE_FILE}..."
docker-compose -f bootup/docker-compose-files/${COMPOSE_FILE} stop
docker compose -f bootup/docker-compose-files/${COMPOSE_FILE} stop
echo "Stop all services successfully"


Expand All @@ -244,7 +244,7 @@ test-api:
@$(MAKE) -C tests/postman/ test-api

check-dashboard:
docker-compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1)
docker compose -f tests/dashboard/docker-compose.yml up --abort-on-container-exit || (echo "check dashboard failed $$?"; exit 1)

stop-k8s:
@$(MAKE) -C bootup/kubernetes stop
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ A typical usage scenario is illustrated as:
Environmental preparation:

1. docker [how install](https://get.docker.com)
2. docker-compose [how install](https://docs.docker.com/compose/install/)
2. docker compose(`we switched to` [Docker Compose V2](https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command)) [how install](https://docs.docker.com/compose/install/)
3. make `all script for cello service management is written in Makefile`
4. kubernetes (`optional`) [how install](https://kubernetes.io/docs/setup/)
5. node [how install](https://nodejs.org/en/download/)
Expand Down
6 changes: 3 additions & 3 deletions build_image/docker/cello-hlf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ RUN mkdir -p /var/hyperledger/production \

# Install development dependencies
RUN apt-get update \
&& apt-get install -y apt-utils python3-dev \
&& apt-get install -y apt-utils python3-dev docker-compose-plugin\
&& apt-get install -y libsnappy-dev zlib1g-dev libbz2-dev libyaml-dev libltdl-dev libtool \
&& apt-get install -y python3-pip \
&& apt-get install -y vim tree jq unzip \
&& pip3 install behave nose docker-compose \
&& pip3 install behave nose \
&& pip3 install pyinotify \
&& rm -rf /var/cache/apt

Expand All @@ -109,7 +109,7 @@ RUN cd $GOPATH/src/github.com/hyperledger \
&& unzip v${PROJECT_VERSION}.zip \
&& rm v${PROJECT_VERSION}.zip \
&& mv fabric-${PROJECT_VERSION} fabric \
&& echo "* hard nofile 65536" >> /etc/security/limits.conf \
&& echo "* hard nofile 65536" >> /etc/security/limits.conf \
&& echo "* soft nofile 8192" >> /etc/security/limits.conf \
&& cp -r $FABRIC_ROOT/sampleconfig/* $FABRIC_CFG_PATH/

Expand Down
8 changes: 5 additions & 3 deletions docs/setup/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

* Hardware: 4c8g100g
* Linux Kernel >= 3.0.0
* Docker engine: 17.15.5+
* docker-compose: 1.24.1+
* Docker engine: 20.10.17+
* docker compose: 2.6.1+

## 2. Setup Steps

Expand All @@ -16,11 +16,13 @@ $ git clone https://github.com/hyperledger/cello.git
### 2.2 Prepare environment

1. docker [how install](https://get.docker.com)
2. docker-compose [how install](https://docs.docker.com/compose/install/)
2. docker compose (`we switched to` [Docker Compose V2](https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command)) [how install](https://docs.docker.com/compose/install/)
3. make `all script for cello service management is written in Makefile`
4. kubernetes (`optional`) [how install](https://kubernetes.io/docs/setup/)
5. node [how install](https://nodejs.org/en/download/)

As Docker Compose V1 will reach its [end of life](https://www.docker.com/blog/announcing-compose-v2-general-availability/) in April 2023, we switched Docker Compose to V2. Please ensure that you install the correct version.

### 2.3 Build local images(optional)

* Because currently the dockerhub image auto build haven't ready, in the future you can ignore this step.
Expand Down
2 changes: 1 addition & 1 deletion scripts/master_node/build_js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi


echo_b "Start build js files..."
docker-compose -f bootup/docker-compose-files/docker-compose-build-js.yaml up --force-recreate
docker compose -f bootup/docker-compose-files/docker-compose-build-js.yaml up --force-recreate

#echo "Restarting mongo_express"
#[[ "$(docker ps -q --filter='name=mongo_express')" != "" ]] && docker restart mongo_express
4 changes: 2 additions & 2 deletions scripts/master_node/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ install_software() {
command -v curl >/dev/null 2>&1 || { echo_r >&2 "No curl found, try installing";sudo apt-get install -y curl; }
command -v pip >/dev/null 2>&1 || { echo_r >&2 "No pip found, try installing";sudo apt-get install -y python-pip; }
command -v docker >/dev/null 2>&1 || { echo_r >&2 "No docker-engine found, try installing"; curl -sSL https://get.docker.com/ | sh; sudo service docker restart; }
command -v docker-compose >/dev/null 2>&1 || { echo_r >&2 "No docker-compose found, try installing"; sudo pip install 'docker-compose>=1.17.0'; }
command -v docker compose >/dev/null 2>&1 || { echo_r >&2 "No docker compose found, try installing"; sudo apt-get install -y docker-compose-plugin; }
sudo apt-get install -y tox nfs-common;
;;
linuxmint)
Expand Down Expand Up @@ -114,7 +114,7 @@ install_software() {

echo_b "Make sure have installed: python-pip, tox, curl and docker-engine"
install_list=()
for software in pip tox curl docker docker-compose; do
for software in pip tox curl docker "docker compose"; do
command -v ${software} >/dev/null 2>&1 || { install_list+=($software); break; }
done
[ -z "$install_list" ] || install_software $install_list
Expand Down
2 changes: 1 addition & 1 deletion scripts/worker_node/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# This script will try setup a valid environment for the docker-compose running.
# This script will try setup a valid environment for the docker compose running.
# It should be triggered by the `make setup-worker`, and safe to repeat.
# 1) Install required softwares;
# 2) Download blockchain images.
Expand Down
4 changes: 2 additions & 2 deletions scripts/worker_node/setup_worker_node_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ fi
# Empty string means no need to setup NFS
MASTER_NODE=""

echo_b "Make sure docker and docker-compose are installed"
echo_b "Make sure docker and docker compose are installed"
command -v docker >/dev/null 2>&1 || { echo_r >&2 "No docker-engine found, try installing"; curl -sSL https://get.docker.com/ | sh; sudo dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --api-cors-header='*' --default-ulimit=nofile=8192:16384 --default-ulimit=nproc=8192:16384 -D & }
command -v docker-compose >/dev/null 2>&1 || { echo_r >&2 "No docker-compose found, try installing"; sudo pip install 'docker-compose>=1.17.0'; }
command -v docker compose >/dev/null 2>&1 || { echo_r >&2 "No docker compose found, try installing"; sudo apt-get install -y docker-compose-plugin; }


echo_b "Copy required fabric 1.0, 1.1 and 1.2 artifacts"
Expand Down
8 changes: 4 additions & 4 deletions src/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"analyze": "cross-env ANALYZE=1 umi build",
"build": "umi build",
"docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./",
"docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build",
"docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",
"docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build",
"docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
"docker-prod:build": "docker compose -f ./docker/docker-compose.yml build",
"docker-prod:dev": "docker compose -f ./docker/docker-compose.yml up",
"docker:build": "docker compose -f ./docker/docker-compose.dev.yml build",
"docker:dev": "docker compose -f ./docker/docker-compose.dev.yml up",
"docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro",
"docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro",
"functions:build": "npm run generateMock && netlify-lambda build ./lambda",
Expand Down
2 changes: 1 addition & 1 deletion tests/postman/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
# echo "API tests ${filename} passed";
# fi
#done
docker-compose up --abort-on-container-exit
docker compose up --abort-on-container-exit

cp ${ROOT_PATH}/tests/postman/junitResult.xml ${ROOT_PATH}/