mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-29 18:38:44 +08:00
Connect to multiple containers at once with VSCode
Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
This commit is contained in:
parent
215c4d357a
commit
6bcca0a9b7
@ -1,11 +1,10 @@
|
||||
{
|
||||
"name": "Milvus Distributed Dev Container Definition",
|
||||
"image": "milvusdb/milvus-distributed-dev:amd64-ubuntu18.04-20201209-104246",
|
||||
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
|
||||
"dockerComposeFile": ["./docker-compose-vscode.yml"],
|
||||
"service": "ubuntu",
|
||||
"initializeCommand": "scripts/init_devcontainer.sh && docker-compose -f docker-compose-vscode.yml down all -v || true && docker-compose -f docker-compose-vscode.yml pull --ignore-pull-failures ubuntu",
|
||||
"workspaceFolder": "/go/src/github.com/zilliztech/milvus-distributed",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/go/src/github.com/zilliztech/milvus-distributed,type=bind,consistency=cached",
|
||||
"remoteUser": "debugger",
|
||||
"remoteEnv": {"CCACHE_COMPILERCHECK":"content", "CCACHE_MAXSIZE": "2G", "CCACHE_COMPRESS": "1", "CCACHE_COMPRESSLEVEL": "5"},
|
||||
"shutdownAction": "stopCompose",
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools",
|
||||
"golang.go"
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,6 +10,8 @@ pulsar/client-cpp/build/*
|
||||
|
||||
# vscode generated files
|
||||
.vscode
|
||||
docker-compose-vscode.yml
|
||||
docker-compose-vscode.yml.bak
|
||||
|
||||
cmake-build-debug
|
||||
cmake-build-release
|
||||
|
@ -13,18 +13,18 @@ if [ "${1-}" = "pull" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${1-}" = "gdbserver" ]; then
|
||||
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/amd64-ubuntu18.04-gdbserver-home"
|
||||
chmod -R 777 "${DOCKER_VOLUME_DIRECTORY:-.docker}"
|
||||
|
||||
docker-compose pull --ignore-pull-failures gdbserver
|
||||
if [ "${CHECK_BUILDER:-}" == "1" ]; then
|
||||
DATE_VERSION=latest docker-compose pull --ignore-pull-failures gdbserver
|
||||
docker-compose build gdbserver
|
||||
fi
|
||||
docker-compose up -d gdbserver
|
||||
exit 0
|
||||
fi
|
||||
# if [ "${1-}" = "gdbserver" ]; then
|
||||
# mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/amd64-ubuntu18.04-gdbserver-home"
|
||||
# chmod -R 777 "${DOCKER_VOLUME_DIRECTORY:-.docker}"
|
||||
#
|
||||
# docker-compose pull --ignore-pull-failures gdbserver
|
||||
# if [ "${CHECK_BUILDER:-}" == "1" ]; then
|
||||
# DATE_VERSION=latest docker-compose pull --ignore-pull-failures gdbserver
|
||||
# docker-compose build gdbserver
|
||||
# fi
|
||||
# docker-compose up -d gdbserver
|
||||
# exit 0
|
||||
# fi
|
||||
|
||||
if [ "${1-}" = "down" ]; then
|
||||
docker-compose down
|
||||
|
@ -10,11 +10,13 @@ x-ccache: &ccache
|
||||
services:
|
||||
ubuntu:
|
||||
image: ${REPO}:${ARCH}-ubuntu${UBUNTU}-${DATE_VERSION}
|
||||
# Build devcontainer
|
||||
build:
|
||||
context: .
|
||||
dockerfile: build/docker/env/cpu/ubuntu${UBUNTU}/Dockerfile
|
||||
cache_from:
|
||||
- ${REPO}:${ARCH}-ubuntu${UBUNTU}-${LATEST_DATE_VERSION}
|
||||
# user: {{ CURRENT_ID }}
|
||||
shm_size: 2G
|
||||
environment:
|
||||
<<: *ccache
|
||||
@ -26,36 +28,37 @@ services:
|
||||
- ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-ubuntu${UBUNTU}-ccache:/ccache:delegated
|
||||
- ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-ubuntu${UBUNTU}-go-mod:/go/pkg/mod:delegated
|
||||
working_dir: "/go/src/github.com/zilliztech/milvus-distributed"
|
||||
# Command
|
||||
command: &ubuntu-command >
|
||||
/bin/bash -c "
|
||||
make check-proto-product && make verifiers && make unittest"
|
||||
networks:
|
||||
- milvus
|
||||
|
||||
gdbserver:
|
||||
image: ${REPO}:${ARCH}-ubuntu${UBUNTU}-${DATE_VERSION}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: build/docker/env/cpu/ubuntu${UBUNTU}/Dockerfile
|
||||
cache_from:
|
||||
- ${REPO}:${ARCH}-ubuntu${UBUNTU}-${LATEST_DATE_VERSION}
|
||||
security_opt: # options needed for gdb debugging
|
||||
- seccomp:unconfined
|
||||
- apparmor:unconfined
|
||||
environment:
|
||||
PULSAR_ADDRESS: ${PULSAR_ADDRESS}
|
||||
ETCD_ADDRESS: ${ETCD_ADDRESS}
|
||||
MINIO_ADDRESS: ${MINIO_ADDRESS}
|
||||
volumes:
|
||||
- .:/go/src/github.com/zilliztech/milvus-distributed:delegated
|
||||
- ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-ubuntu${UBUNTU}-gdbserver-home:/home/debugger:delegated
|
||||
container_name: debugger
|
||||
entrypoint: ["/usr/sbin/sshd", "-D"]
|
||||
ports:
|
||||
- "7776:22"
|
||||
- "7777:7777"
|
||||
networks:
|
||||
- milvus
|
||||
# gdbserver:
|
||||
# image: ${REPO}:${ARCH}-ubuntu${UBUNTU}-${DATE_VERSION}
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: build/docker/env/cpu/ubuntu${UBUNTU}/Dockerfile
|
||||
# cache_from:
|
||||
# - ${REPO}:${ARCH}-ubuntu${UBUNTU}-${LATEST_DATE_VERSION}
|
||||
# security_opt: # options needed for gdb debugging
|
||||
# - seccomp:unconfined
|
||||
# - apparmor:unconfined
|
||||
# environment:
|
||||
# PULSAR_ADDRESS: ${PULSAR_ADDRESS}
|
||||
# ETCD_ADDRESS: ${ETCD_ADDRESS}
|
||||
# MINIO_ADDRESS: ${MINIO_ADDRESS}
|
||||
# volumes:
|
||||
# - .:/go/src/github.com/zilliztech/milvus-distributed:delegated
|
||||
# - ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-ubuntu${UBUNTU}-gdbserver-home:/home/debugger:delegated
|
||||
# container_name: debugger
|
||||
# entrypoint: ["/usr/sbin/sshd", "-D"]
|
||||
# ports:
|
||||
# - "7776:22"
|
||||
# - "7777:7777"
|
||||
# networks:
|
||||
# - milvus
|
||||
|
||||
etcd:
|
||||
image: quay.io/coreos/etcd:v3.4.13
|
||||
|
28
scripts/init_devcontainer.sh
Executable file
28
scripts/init_devcontainer.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
ROOT_DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
|
||||
|
||||
# Attempt to run in the container with the same UID/GID as we have on the host,
|
||||
# as this results in the correct permissions on files created in the shared
|
||||
# volumes. This isn't always possible, however, as IDs less than 100 are
|
||||
# reserved by Debian, and IDs in the low 100s are dynamically assigned to
|
||||
# various system users and groups. To be safe, if we see a UID/GID less than
|
||||
# 500, promote it to 501. This is notably necessary on macOS Lion and later,
|
||||
# where administrator accounts are created with a GID of 20. This solution is
|
||||
# not foolproof, but it works well in practice.
|
||||
uid=$(id -u)
|
||||
gid=$(id -g)
|
||||
[ "$uid" -lt 500 ] && uid=501
|
||||
[ "$gid" -lt 500 ] && gid=$uid
|
||||
|
||||
awk 'c&&c--{sub(/^/,"#")} /# Build devcontainer/{c=5} 1' $ROOT_DIR/docker-compose.yml > $ROOT_DIR/docker-compose-vscode.yml.bak
|
||||
|
||||
awk 'c&&c--{sub(/^/,"#")} /# Command/{c=3} 1' $ROOT_DIR/docker-compose-vscode.yml.bak > $ROOT_DIR/docker-compose-vscode.yml
|
||||
|
||||
sed -i '.bak' "s/# user: {{ CURRENT_ID }}/user: \"$uid:$gid\"/g" $ROOT_DIR/docker-compose-vscode.yml
|
Loading…
Reference in New Issue
Block a user