Quick Start

This tutorial is meant to familiarize you with how Bakery works as a proxy to be able to filter your manifest.

Local Development Requirements:

  • Docker app
  • Postgres
  • Redis
  • go 1.18
  • atlas db tool:
    • curl -sSf https://atlasgo.sh | sh;
  • git client
  • github account

Setup Steps:

  • Bakery access
    • Generate 4096-bit RSA keypair, add to ssh-agent
    • Add public part to Github profile (not covered here)
    • Ensure github user has access to Bakery (not covered here)
  • Fetch Bakery repo:
    • git clone git@github.com:cbsinteractive/bakery.git
    • cd bakery
  • Build
    • make build
  • Create bakery database
    • psql -c "CREATE DATABASE bakery;"
  • Start Redis Server
    • brew services start redis
  • Run migrations
    • atlas migrate apply --dir "file://./db/atlas_migrations" --url "$BAKERY_POSTGRES_URL"
  • Setup environment (via .env file or shell variables)
    • REDIS_HOST – FQDN of Redis host. Default “localhost”
    • REDIS_PORT – port of Redis host. Default “6379”
    • REDIS_USERNAME – Redis host username. Default “”
    • REDIS_PASSWORD – Redis host password. Default “”
    • REDIS_DB_ID – Redis database ID. Default: “0”
    • DB_HOST – FQDN of postgres DB host. Default: “localhost”
    • DB_NAME – postgres DB name: Default: “bakery”
    • DB_PORT – postgres DB port. Default: “5432”
    • DB_USER – postgres DB user-name
    • DB_PASSWORD – postgres DB password
    • ORIGIN_HOST – FQDN of default content Origin
    • HTTP_PORT – Bakery host port, preceded by colon. Default “:8080”
    • LOG_LEVEL – Default: “debug”
    • HOSTNAME – FQDN of Bakery host , i.e. “localhost” or “bakery.vtg.paramount.tech”
    • ENABLE_AUTH – enables authentication by means of origin-token
    • ORIGIN_KEY – Name of X-header which contains the auth-token
    • ORIGIN_TOKEN – secret auth-token for Bakery-host
    • ENABLE_JWT – enables JWT authentication for API endpoints
    • AUTH_CERT_URL – URL of public key used from JWT validation
  • Run local “origin” server using docker-compose:
    • docker-compose --file ./docker-composer-origin.yaml up –detach
    • Note: this mounts the directory test-manifests as the origin-root.
  • Run server
    • ORIGIN_HOST="http://localhost:8000/" go run ./cmd/http &

Working with Propeller as your Origin

Bakery can act as a proxy to serve your Propeller channels!

You can find more information here for managing Propeller channels via Bakery.

Applying Filters

If you want to apply filters, they should be placed right after the Bakery hostname and before the path. Your requests should match the following schema:

http://bakery.dev.vtg.paramount.tech/[filters]/path/to/master/manifest.m3u8

If working with a Propeller origin:

http://bakery.dev.vtg.paramount.tech/[filters]/propeller/<org-id>/<channel-id>.m3u8

Following the examples above you can start applying filters like so:

  1. Single Filter
    To apply a single filter such as an audio codec filter where AC-3 audio is removed from the manifest, you can make a request to Bakery as so:

     http://bakery.dev.vtg.paramount.tech/a(ac-3)/star_trek_discovery/S01/E01.m3u8
    

    for a Propeller channel:

     http://bakery.dev.vtg.paramount.tech/a(ac-3)/propeller/<org-id>/<channel-id>.m3u8
    
  2. Multiple Values
    You can supply multiple values to each filter as you would like simply by using , as your delimiter for each value.

    The following example will filter out AC-3 audio and Enhanced AC-3 audio from the manifest:

     http://bakery.dev.vtg.paramount.tech/a(ac-3,ec-3)/star_trek_discovery/S01/E01.m3u8
    

    for a Propeller channel:

     http://bakery.dev.vtg.paramount.tech/a(ac-3,ec-3)/propeller/<org-id>/<channel-id>.m3u8
    
  3. Multiple Filters
    Multiple Filters can be passed in. All that is needed is the / delimiter in between each filter. For example, if you wanted to remove AVC (H.264) video and AAC (MPEG-4) audio, you could make the following request to Bakery:

     http://bakery.dev.vtg.paramount.tech/a(mp4a)/v(avc)/star_trek_discovery/S01/E01.m3u8
    

    for a Propeller channel:

     http://bakery.dev.vtg.paramount.tech/a(mp4a)/v(avc)/propeller/<org-id>/<channel-id>.m3u8
    
  4. Nested Filters
    Some filters can be nested as a way to target assets of a specific content type. For example, if you wanted to remove AAC (MPEG-4) audio and filter the results within 500 Kbps and 1MB, you could make the following request to Bakery:

     http://bakery.dev.vtg.paramount.tech/a(co(mp4a),b(500000,1000000))/star_trek_discovery/S01/E01.m3u8
    

    for a Propeller channel:

     http://bakery.dev.vtg.paramount.tech/a(co(mp4a),b(500000,1000000))/propeller/<org-id>/<channel-id>.m3u8
    

    For more information on working with nested filters and targeting content types, check out the documentation!

For more specific details and usage examples on specific filters and the values accepted by each, check out our documentation for filters here!

What’s Next?

Thank you for choosing Bakery! Stay tuned for more tutorials and other content, as new features become available.

Stuck or confused? Want to say hi? Reach out to us in Slack and we’ll help you out!