Skip to content

Commit

Permalink
feat: add log collection command (#55)
Browse files Browse the repository at this point in the history
Signed-off-by: Radek Ježek <radek.jezek@ibm.com>
  • Loading branch information
jezekra1 authored Nov 28, 2024
1 parent 72ff19c commit 88ebb9f
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/run_stack_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Issue running bee-stack
about: Create a report to help us improve bee-stack
title: ""
labels: debug
assignees: ""
---

**Tasks**

- [ ] I have run through the
[troubleshooting guide](https://github.com/i-am-bee/bee-stack/blob/main/docs/troubleshooting.md)
- [ ] My container provider (docker / podman / rancher) and the compose extension are up to date
(`docker compose version` or `podman compose version` returns a version >= `2.26`)


**Description**
<!--
Describe the issue you have
-->

**Logs**
<!--
Please upload logs by running `./bee-stack.sh logs` and uploading the resulting file here. The log
will be located in `./logs`, for example `./logs/2024-11-27_1549S.zip`
-->
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Once started you can find use the following URLs:
## ⛓️‍💥 Troubleshooting
Please see our [troubleshoting guide](docs/troubleshooting.md) for help with the most common issues.

> If you run through the troubleshooting guide and bee-stack is still crashing, please collect
> the logs using `./bee-stack.sh logs` and submit them to a new issue at:
> https://github.com/i-am-bee/bee-agent-framework/issues/new?template=run_stack_issue.md
## 👷 Advanced

### Custom models
Expand Down
26 changes: 25 additions & 1 deletion bee-stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ print_error() {
printf "${ORANGE}❗ERROR: %s${NC}\n" "$1"
shift
[ -n "$1" ] && printf "${ORANGE}❗ %s${NC}\n" "$@"
true
printf "❗\n${ORANGE}❗Visit the troubleshooting guide:\n"
printf "${BLUE}https://github.com/i-am-bee/bee-stack/blob/main/docs/troubleshooting.md${NC}\n"
}

print_header() {
Expand Down Expand Up @@ -205,10 +206,12 @@ start_stack() {
fi

${RUNTIME} compose --profile all up -d
printf "Done. You can visit the UI at ${BLUE}http://localhost:3000${NC}\n"
}

stop_stack() {
${RUNTIME} compose --profile all down
${RUNTIME} compose --profile infra down
}

clean_stack() {
Expand All @@ -223,6 +226,26 @@ start_infra() {
${RUNTIME} compose --profile infra up -d
}

dump_logs() {
timestamp=$(date +"%Y-%m-%d_%H%MS")
folder="./logs/${timestamp}"
mkdir -p "${folder}"

for component in $(${RUNTIME} compose --profile all config --services); do
${RUNTIME} compose logs "${component}" > "${folder}/${component}.log"
done

${RUNTIME} version > "${folder}/${RUNTIME}.log"
${RUNTIME} compose version > "${folder}/${RUNTIME}.log"

zip -r "${folder}.zip" "${folder}/"|| echo "Zip is not installed, please upload individual logs"

printf "${ORANGE}Logs were created in ${folder}${NC}.\n"
printf "If you have issues running bee-stack, please create an issue "
printf "and attach the file ${ORANGE}${folder}.zip${NC} at:\n"
printf "${BLUE}https://github.com/i-am-bee/bee-stack/issues/new?template=run_stack_issue.md${NC}\n"
}

# Main
check_docker
command=$(trim "$1" | tr '[:upper:]' '[:lower:]')
Expand All @@ -233,5 +256,6 @@ elif [ "$command" = 'start:infra' ]; then start_infra
elif [ "$command" = 'stop' ]; then stop_stack
elif [ "$command" = 'clean' ]; then clean_stack
elif [ "$command" = 'check' ]; then check_docker
elif [ "$command" = 'logs' ]; then dump_logs
else print_error "Unknown command $1"
fi
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ services:
MILVUS_URL: milvus:19530
ports:
- 19531:3000
profiles: [ all, infra ]
profiles: [ infra ]
volumes:
etcd:
minio:
Expand Down
4 changes: 4 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Common issues

> If you run through the troubleshooting guide and bee-stack is still crashing, please collect
> the logs using `./bee-stack.sh logs` and submit them to a new issue at:
> https://github.com/i-am-bee/bee-agent-framework/issues/new?template=run_stack_issue.md
### ERROR: None of compose command versions meets the required version

If you get this error message, you have a compose provider installed, but it's not the correct version.
Expand Down

0 comments on commit 88ebb9f

Please sign in to comment.