Code Monkey home page Code Monkey logo

serverless-framework-video-example's Introduction

serverless-framework-video-example

Join the chat at https://gitter.im/ACloudGuru/serverless-framework-video-example A serverless video sharing application example using Serverless Framework

Disclaimer

These steps are for linux or OSX systems. All of this is achievable using Windows but those instructions have not been provided. Please feel free to issue a pull request with windows instructions. Most if not all the shell script steps should have a direct translation to powershell or batch scripts in Windows.

This is not a production ready video transcoding pipeline. Variables are stored unencrypted in the Lambda configuration, many configuration steps are still manual due to limitations with how Serverless Framework and CloudFormation interact, and services that are missing from CloudFormation. Most of these issues can be resolved by using Ansible to orchestrate the entire project deployment

Setup

Dependencies

Configuration Steps

  1. Install the dependencies listed above.
  2. In the same directory as this README run the following shell command
    ./setup.sh
    
  3. Create an IAM user in your AWS account with the following inline policy where YOUR_UPLOAD_BUCKET_NAME matches the one you will be using in step 4. Save the new user's ACCESS_KEY_ID and SECRET_ACCESS_KEY for use in step 4.
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "s3:ListBucket"
                ],
                "Resource": [
                    "arn:aws:s3:::YOUR_UPLOAD_BUCKET_NAME"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "s3:PutObject"
                ],
                "Resource": [
                    "arn:aws:s3:::YOUR_UPLOAD_BUCKET_NAME/*"
                ]
            }
        ]
    }
    
  4. Create a configuration file for your stage in the backend directory based on the example config config-stage.example.yml. The name of the file should be in the format config-<your-stage-name>.yml. You can ignore the variable ELASTIC_TRANSCODER_PIPELINE_ID until a later step. The steps to fetch most of the variables required for this config file are given in the workshop handouts you should already have. Step 3 covers the ACCESS_KEY and SECRET_ACCESS_KEY variables. *Note that ACCESS_KEY in this step is the ACCESS_KEY_ID from step 3.
  5. In the website/js directory create a config.js file based on the config.example.js file given and also copy your firebase config object into line 66 of the file video-controller.js.

Deployment Steps

  1. Change into the backend directory.
    cd backend
    
  2. Deploy the serverless project. <your-aws-profile> should be the name of the profile in your ~/.aws/credentials file that you want to use to deploy this service.
    sls -s <your-stage-name> deploy --aws-profile <your-aws-profile>
    
  3. Login to your AWS console and configure an Elastic Transcoder Pipeline with the upload and transcoded buckets set to the same ones in your serverless project.
  4. Copy the Elastic Transcoder Pipeline ID into your stage configuration file in the backend directory.
  5. Copy the API gateway base url into your website/js/config.js file.
  6. Run step 2. again to deploy your serverless framework project once more with the pipeline ID included this time.

Run

  1. cd website
  2. npm run start
  3. Open your browser to http://localhost:8100

Support

For help, please ask a question in the project's gitter community

serverless-framework-video-example's People

Contributors

generalistdev avatar jjanczyszyn avatar gitter-badger avatar

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.