add curl or equivalent to docker
im trying to do healthcheck on ECS but the image doesn't have curl/wget/nc. i dont want to have to create my own dockerfile, so having curl in the image would be useful. right now i am doing this
// ... existing code ...
containerDefinitions: $jsonStringify([
{
name: "restate",
image: "restatedev/restate:latest",
portMappings: [{ containerPort: 8080 }, { containerPort: 9070 }],
healthCheck: {
retries: 3,
command: [
"CMD-SHELL",
`
function simple_curl() {
local host="$1"
local port="$2"
local path="$3"
exec 3<>/dev/tcp/$host/$port
echo -e "GET $path HTTP/1.1\\r\\nHost: $host\\r\\nConnection: close\\r\\n\\r\\n" >&3
while IFS= read -r line <&3; do
if [[ "$line" =~ ^HTTP/1\\.1[[:space:]]([0-9]{3}) ]]; then
echo "${BASH_REMATCH[1]}"
break
fi
done
exec 3>&-
}
status=$(simple_curl localhost 8080 /restate/health)
if [[ "$status" == "200" ]]; then
echo "Health check passed"
exit 0
else
echo "Health check failed with status $status"
exit 1
fi
`.trim()
],
timeout: 5,
interval: 30,
startPeriod: 30,
},
// ... rest of the container definition ...
},
]),
// ... existing code ...
Thanks for reporting this issue @ryanleecode. The original idea was to keep the Restate container image as lean as possible because we didn't know what tools people would like to use. We also thought that there was the option to extend the container image yourself.
What other tools would you expect to be present on the available Restate container image (apart from wget/curl/nc)?
Hey @ryanleecode - tangential to your comment, but how are you handling persistence of the restate-data state on ECS? We did some testing when AWS released EBS support and found the integration to be lacking - at the moment there isn't a way to associate a long-lived persistent volume with a task, which makes it unsuitable for running stateful services like Restate.
Fixed in #2006 :)