You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The notification-test script is missing the call of the function get_container_id.
When you run this script you always get:
"notification container is not running. Please start it first"
I noticed the script never calls get_container_id to get the container_id after the function was declared. Also, localhost is wrong since swarm isn't exposing locally on the host(at least wasnt for me). It should be the container name of the microservice, which changes every time it's restarted:
I think if you were to add another function which gets that name and passes to the docker exec, should fix this:
function get_container_name() {
CONTAINER_NAME=$(docker ps --filter "name=voinetwork_notify" --format "{{.Names}}")
}
docker exec -it "${CONTAINER_ID}" bash -c "curl -sS -X POST --data '{"title": "Voi Participation Key Notification Test", "body": "Notification test for Voi Network"}' ${CONTAINER_NAME}:5000 >> /dev/null && echo "Notification sent""
So something similar could be added
#!/bin/bash
source "${HOME}/voi/bin/.helpers/util.sh"
CONTAINER_ID=""
CONTAINER_NAME=""
function get_container_id() {
CONTAINER_ID=$(docker ps -q -f name=voinetwork_algod)
}
function get_container_name() {
CONTAINER_NAME=$(docker ps --filter "name=voinetwork_notify" --format "{{.Names}}")
}
function validate_supported_node_type() {
if [[ ${VOINETWORK_PROFILE} != "participation" ]]; then
util_abort "This operation is only supported for participation nodes. Exiting the program."
fi
}
validate_supported_node_type
get_container_id
get_container_name
if [ -z "${CONTAINER_ID}" ]; then
echo "notification container is not running. Please start it first."
exit 1
fi
echo "Sending notification"
docker exec -it "${CONTAINER_ID}" bash -c "curl -sS -X POST --data '{\"title\": \"Voi Participation Key Notification Test\", \"body\": \"Notification test for Voi Network\"}' ${CONTAINER_NAME}:5000 >> /dev/null && echo \"Notification sent\""
echo "Note: After making changes to your notification.yml settings file, make sure to rerun the install script."
The text was updated successfully, but these errors were encountered:
The notification-test script is missing the call of the function get_container_id.
When you run this script you always get:
"notification container is not running. Please start it first"
I noticed the script never calls get_container_id to get the container_id after the function was declared. Also, localhost is wrong since swarm isn't exposing locally on the host(at least wasnt for me). It should be the container name of the microservice, which changes every time it's restarted:
I think if you were to add another function which gets that name and passes to the docker exec, should fix this:
function get_container_name() {
CONTAINER_NAME=$(docker ps --filter "name=voinetwork_notify" --format "{{.Names}}")
}
docker exec -it "${CONTAINER_ID}" bash -c "curl -sS -X POST --data '{"title": "Voi Participation Key Notification Test", "body": "Notification test for Voi Network"}' ${CONTAINER_NAME}:5000 >> /dev/null && echo "Notification sent""
So something similar could be added
The text was updated successfully, but these errors were encountered: