Giter VIP home page Giter VIP logo

simple-sqsd's Introduction

Go Report Card

simple-sqsd

A simple version of the AWS Elastic Beanstalk Worker Environment SQS daemon (sqsd).

Getting Started

$ SQSD_QUEUE_REGION=us-east-1 SQSD_QUEUE_URL=http://queue.url SQSD_HTTP_URL=http://service.url/endpoint go run cmd/simplesqsd/simplesqsd.go

Docker (uses a GitHub Container Registry):

$ docker run -e AWS_ACCESS_KEY_ID=your-access-id -e AWS_SECRET_ACCESS_KEY=your-secret-key -e SQSD_QUEUE_REGION=us-east-1 -e SQSD_QUEUE_URL=http://queue.url -e SQSD_HTTP_URL=http://service.url/endpoint ghcr.io/fterrag/simple-sqsd:latest

Configuration

Environment Variable Default Value Required Description
SQSD_QUEUE_REGION yes The region of the SQS queue.
SQSD_QUEUE_URL yes The URL of the SQS queue.
SQSD_QUEUE_MAX_MSGS 10 no Max number of messages a worker should try to receive from the SQS queue.
SQSD_QUEUE_WAIT_TIME 10 no The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. Setting this to 0 disables long polling. Maximum of 20 seconds.
SQSD_HTTP_MAX_CONNS 25 no Maximum number of concurrent HTTP requests to make to SQSD_HTTP_URL.
SQSD_HTTP_URL yes The URL of your service to make a request to.
SQSD_HTTP_CONTENT_TYPE no The value to send for the HTTP header Content-Type when making a request to your service.
SQSD_HTTP_USER_AGENT no The value to send for the HTTP header User-Agent when making a request to your service.
SQSD_AWS_ENDPOINT no Sets the AWS endpoint.
SQSD_HTTP_HMAC_HEADER no The name of the HTTP header to send the HMAC hash with.
SQSD_HMAC_SECRET_KEY no Secret key to use when generating HMAC hash send to SQSD_HTTP_URL.
SQSD_HTTP_HEALTH_PATH no The path to a health check endpoint of your service. When provided, messages will not be processed until the health check returns a 200 for HTTPHealthInterval times
SQSD_HTTP_HEALTH_WAIT 5 no How long to wait before starting health checks
SQSD_HTTP_HEALTH_INTERVAL 5 no How often to wait between health checks
SQSD_HTTP_HEALTH_SUCCESS_COUNT 1 no How many successful health checks required in a row
SQSD_HTTP_TIMEOUT 15 no Number of seconds to wait for a response from the worker
SQSD_SQS_HTTP_TIMEOUT 15 no Number of seconds to wait for a response from sqs
SQSD_HTTP_SSL_VERIFY true no Enable SSL Verification on the URL of your service to make a request to (if you're using self-signed certificate)
SQSD_HTTP_AUTHORIZATION_HEADER no A simple feature to add a jwt/simple token to Authorization header for basic auth on SQSD_HTTP_URL
SQSD_HTTP_AUTHORIZATION_HEADER_NAME no override the http header name (defaults to Authorization) in SQSD_HTTP_AUTHORIZATION_HEADER
SQSD_CRON_FILE no The elastic beanstalk cron.yaml file to load
SQSD_CRON_ENDPOINT SQSD_HTTP_URL without path/query yes if SQSD_CRON_FILE The base URL to call (e.g. http://localhost:3000). cron.yaml url will be appended to this
SQSD_CRON_TIMEOUT 15 no Duration (in seconds) To wait for the cron endpoint to response

HMAC

Optionally (when SQSD_HTTP_HMAC_HEADER and SQSD_HMAC_SECRET_KEY are set), HMAC hashes are generated using SHA-256 with the signature made up of the following:

POST {SQSD_HTTP_URL}\n
<SQS message body>

Support 429 Status codes with Retry-After

  • SQSD will attempt to change the message visibility when the service responds with 429 status code.
  • Retry-After response header should contain an integer with the amount of senconds to wait.

Todo

  • More Tests
  • Documentation

Contributing

  • Submit a PR
  • Add or improve documentation
  • Report issues
  • Suggest new features or enhancements

simple-sqsd's People

Contributors

bdashrad avatar bluntelk avatar c-goosen avatar carsonoid avatar flindskog avatar fterrag avatar jenriquejr avatar joeystevens00 avatar jsainthilaire avatar julienbornstein avatar kamirendawkins avatar mhmiles avatar mikejestes avatar spoonscen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

simple-sqsd's Issues

Client Timeout not working

Hej,

we are using the daemon in a project where we define the terrag/simple-sqsd:latest image in docker-compose as service:

    specter-sqsd:
        image: fterrag/simple-sqsd:latest
        container_name: specter-sqsd
        environment:
            SQSD_AWS_ENDPOINT: 'http://specter-sqs:9324'
            AWS_ACCESS_KEY_ID: 'foo'
            AWS_SECRET_ACCESS_KEY: 'bar'
            SQSD_HMAC_SECRET_KEY: 'a secret key'
            SQSD_HTTP_HMAC_HEADER: 'MAC'
            SQSD_QUEUE_REGION: 'elasticmq'
            SQSD_QUEUE_URL: 'http://specter-sqs:9324/queue/specter'
            SQSD_HTTP_URL: 'http://specter-app/messages'
            SQSD_HTTP_TIMEOUT: 20
            SQSD_HTTP_CONTENT_TYPE: 'application/json'
        networks:
            starweb:
                aliases:
                    - specter-sqsd

I need to change the client timout setting, but I had not luck so far and I think this is an error in the daemon.

Even without setting SQSD_HTTP_TIMEOUT the messages will be resent to the url configured in SQSD_HTTP_URL after 10 seconds. If I set a break point in our application at the urls endpoint the messages will be sent in total for three times.

Bildschirmfoto 2020-10-09 um 14 23 05

Thank you for the project

It worked from first attempt and the way I wanted. Thank you!
I created a test pipeline with multiple docker images and your project helped to connect those components that talked via SQS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.