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

mock agent to call service scripts #35

Merged
merged 1 commit into from
Jul 25, 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
2 changes: 2 additions & 0 deletions all-in-one.sh
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ function install_nebula_graph_br {
fi
cd nebula-up && git stash 1>/dev/null 2>/dev/null && git pull 1>/dev/null 2>/dev/null
cd backup_restore
chmod +x scripts/nebula.service
ln -s ../../nebula-docker-compose/data data
docker-compose pull || logger_error "Failed to pull docker images for backup_restore env"
docker-compose up -d

Expand Down
2 changes: 1 addition & 1 deletion backup_restore/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BR_VERSION=0.6.0
BR_VERSION=0.6.1
AGENT_VERSION="0.1.1"
1 change: 1 addition & 0 deletions backup_restore/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data
3 changes: 2 additions & 1 deletion backup_restore/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM alpine
WORKDIR /root
ENV BR_VERSION=0.6.0
ENV BR_VERSION=0.6.1
ENV AGENT_VERSION=0.1.1
RUN wget https://github.com/vesoft-inc/nebula-br/releases/download/v$BR_VERSION/br-$BR_VERSION-linux-amd64 -O br && chmod +x br && mv br /usr/local/bin/br && \
wget https://github.com/vesoft-inc/nebula-agent/releases/download/v$AGENT_VERSION/agent-$AGENT_VERSION-linux-amd64 -O agent && chmod +x agent && mv agent /usr/local/bin/agent
RUN apk add --no-cache bash docker && rm -rf /var/cache/apk/*

ENTRYPOINT ["/usr/local/bin/agent"]
51 changes: 42 additions & 9 deletions backup_restore/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,80 @@ services:

metad0-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="metad0:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
- ./data/meta0:/data/meta
command: --agent="metad0:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_metad0_1'

metad1-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="metad1:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
- ./data/meta1:/data/meta
command: --agent="metad1:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_metad1_1'

metad2-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="metad2:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
- ./data/meta2:/data/meta
command: --agent="metad2:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_metad2_1'

storaged0-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="storaged0:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
- ./data/storage0:/data/storage
command: --agent="storaged0:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_storaged0_1'

storaged1-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="storaged1:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
- ./data/storage1:/data/storage
command: --agent="storaged1:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_storaged1_1'

storaged2-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="storaged2:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
- ./data/storage2:/data/storage
command: --agent="storaged2:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_storaged2_1'

graphd-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="graphd:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
command: --agent="graphd:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_graphd_1'

graphd1-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="graphd1:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
command: --agent="graphd1:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_graphd1_1'

graphd2-agent:
image: weygu/nebula-br:${BR_VERSION}
command: --agent="graphd2:8888" --meta="metad0:9559"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./scripts:/usr/local/nebula/scripts
command: --agent="graphd2:8888" --meta="metad0:9559" --debug
network_mode: 'container:nebula-docker-compose_graphd2_1'

minio-client:
Expand Down
15 changes: 15 additions & 0 deletions backup_restore/scripts/nebula.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
case "$1" in
"start")
# as we cannot stop services, we use restart to make restore work, it's not for production use
docker restart ${HOSTNAME}
;;
"status")
status=$(docker inspect -f '{{.State.Status}}' ${HOSTNAME});echo "${status^}" || echo "Exit"
;;
"stop")
# stop container will cause agent to exit, too, this is just a hack to prevent it, not for production use
# we use start instead of stop here
docker start ${HOSTNAME}
;;
esac