Giter VIP home page Giter VIP logo

basic-ruby's People

Contributors

edgenard avatar

Watchers

 avatar

basic-ruby's Issues

Create Infrastructure for Image Processing

This is a ticket to create the infrastructure for image processing

  • Add a function(CreateThumbnialFunction) that is invoked when a file is uploaded to the basic-ruby-process-form bucket( set timeout to 600)
  • Create Thumbnail needs access to the basic-ruby-process-form bucket
  • Add a bucket, basic-ruby-thumbnails that store the processed images
  • Download the File from the bucket to a temp directory
  • Create a thumbnail for the image(Right now just copy the file to another file)
  • Save the thumbnail in a temp directory
  • Upload the thumbnail with the same key it was as in basic-ruby-process-form to the basic-ruby-thumbnails bucket
  • Delete both temp files
  • Change the ConfirmUploadFunction to point download url to basic-ruby-thumbnails bucket
  • Add SNS resource to be notified when CreateThumbnailsFunction fails called NotifyAdmin
  • Add Dead Letter Queue to CreateThumbnailsFunction properties referring to SNS topic created above
  • Add a contact emails stack parameter
  • Add a condition to check whether or not the stack parameter email is set
  • Add an SNS subscription resource that is only created when the contact email stack parameter is set. Subscribe it to NotifyAdmin topic

Process form submission

Write a function that processes the post request when form is submitted.

  • It should be at the same path as the show_form function but use the HTTP method "POST"
  • It should save the data in an S3 bucket
  • The data should not be URL encoded or in Base64. It should be a plain string It's in JSON.
  • The key pointing to each saved form submission should be unique
  • Update the template stack outputs to reflect the changes made to the stack
  • Show a page thanking the user for their submission

Running Serverless Chapter 10 Task list

  • Add a Parameter in the template for ThumbnailWidth. Make it a number, with a default of 300, a minimum value of 10 and a maximum value of 1000.
  • Add an image processing Severless Application Component that is compatible with Ruby(ImageMagick, Vips, etc). The application must be published as a layer.
  • Refer to the image processing application as a Lambda Layer in the properties of the CreateThumbnailsFunction.
  • Install Gem that wraps native image processing binary
  • Deploy function with Layer. This will require adding CAPABILITY_AUTO_EXPAND to the deployment command.
  • Add code to actually resize images to Thumbnails

Note

The thumbnail will not be immediately available, this will be addressed in the next chapter

Failed Form Submission

When the form submission fails the user should be returned to the form with an error message at the top explaining why it failed.

Error in ConfirmUploadFunction

When there is an error in the ConfirmUpload Function it should return an HTML page apologizing for the error and showing an error message

Add a function to convert uploaded images and saves the conversion to a new bucket

When a user successfully uploads an image to a bucket, that bucket should trigger a Lambda function that downloads the file and moves it to another bucket.

  • Create a new function(ConvertImage) which is triggered by a PUT to the basic-ruby-process-form bucket
  • The ConvertImage function should download the file from basic-ruby-process-form bucket and upload it to a new bucket(basic-ruby-converted-image). It will need access to download from basic-ruby-process-form and access to write to the basic-ruby-converted-image
  • The Confirm Upload function should update the download link to download files from the basic-ruby-converted-image bucket instead of the basic-ruby-process-form bucket.
  • The ConvertImage function should have dead letter queue attached that sends an email if any of the conversions fail.

Save Form Submission Directly to S3

Add the ability for the user to post their submission directly to S3

  • Update show_form function to be name spaced under UserForm module
  • Update the form to be a file upload form
  • Update HTML form served by the show_form function so that it makes the submission directly to S3. (show_form function will need permission to access the bucket and know the name of the bucket)
  • Requirements for the pre-signed upload URL
    • Users should have a unique so they can't overwrite each others files
    • Link should expire after 10 minutes
    • Limit File size to 5 MB
    • File should be private
    • Make the expiration and file size requirements configurable through environment variables in the lambda and stack parameters when deploying
  • Tell the S3 bucket that receives the form submission to redirect to a URL.
  • That URL should invoke a confirm_upload function
  • The confirm_upload function should return an HTML page that thanks the user for their submission
  • The thank you page should show a link to download the file that was uploaded
  • Update the template to encrypt the data at rest
  • Update template outputs to reflect changes in the stack.

Error ShowFormFunction

When there is an error processing a request to the ShowFormFunction Lambda it should return an HTML page that apologies for the error and shows the error message.

Multi-environment deployments

Add capability to deploy to a staging environment when making a PR

When PR is merged that environment should be destroyed

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.