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

add curl or equivalent to docker #1902

Closed
ryanleecode opened this issue Aug 28, 2024 · 3 comments
Closed

add curl or equivalent to docker #1902

ryanleecode opened this issue Aug 28, 2024 · 3 comments

Comments

@ryanleecode
Copy link

ryanleecode commented Aug 28, 2024

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 ...
@tillrohrmann
Copy link
Contributor

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)?

@pcholakov
Copy link
Contributor

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.

@jackkleeman
Copy link
Contributor

Fixed in #2006 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants