https://github.com/overbryd/s3_wait
Wait for S3 keys, then issue a redirect to a presigned url if they exist
https://github.com/overbryd/s3_wait
Last synced: 4 months ago
JSON representation
Wait for S3 keys, then issue a redirect to a presigned url if they exist
- Host: GitHub
- URL: https://github.com/overbryd/s3_wait
- Owner: Overbryd
- Created: 2017-04-12T08:18:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-12T08:37:36.000Z (over 8 years ago)
- Last Synced: 2025-03-28T07:27:27.704Z (7 months ago)
- Language: Ruby
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# s3_wait
Wait for S3 keys, then issue a redirect to a presigned url if they exist.
)
## Pattern
In your application you create S3 objects in the **background** instead of the request-cycle.
A request triggers a **background job** and issues an S3 URL pointed to **s3_wait**.
**s3_wait** will then take the request, and wait until the S3 object becomes available.
Granted things go allright, **s3_wait** will eventually issue a redirect to the S3 object.
In addition to that, it will respect max redirect and response wait timeout settings of common browsers.
If the max redirect setting is reached, it will eventually respond with **504 Gateway Timeout**.
## Usage
$ ruby server.rb
#### Settings available as environment variables
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_S3_BUCKET=
MAX_REDIRECTS=10
WAIT_TIMEOUT=30
PATH_PATTERN=.*
#### Endpoints
GET /healthcheck Healthcheck endpoint
GET /* the key to the S3 Object
## Implementation details
The server is designed to serve multiple requests at once, leveraging Celluiods actor pattern.
Waiting for S3 keys happens in the background.