Skip to content

Setting up External Services

Vangelis Tsoumenis edited this page May 6, 2014 · 16 revisions

Setting up External Services

Pageflow uses three external Services to deal with the content for the presentations.

  • Amazon S3 to host its Videos, Pictures and Audios.
  • Zencoder to encode the content to fit the different formats needed.
  • (In production environment) Amazon Cloudfront. A CDN to speed up access to the content.

Please create accounts for Amazon AWS and Zencoder.

Files that are uploaded to be used in Pageflow will be stored in an S3 bucket. Zencoder takes them from there, encodes the files and stores them in a second bucket. The website displays the content from this second bucket via Cloudfront.

Amazon S3

Thus, two Amazon S3 buckets are needed are needed for each environment.

  • Main bucket for paperclip attachments and Zencoder to read from.
  • Output bucket for Zencoder to write encoded files to.

For example:

  • de-mycompany-pageflow-production
  • de-mycompany-pageflow-production-out
  • de-mycompany-pageflow-development
  • de-mycompany-pageflow-development-out

You can add buckets for staging or other deployment environments. Multiple developers can share the same development buckets because files in this buckets are namespaced by the hostname of the developer's machine.

Hint: Its better to use dashes - than dots .. Dots can cause trouble when using https.

Bucket Configuration

  • Add the permissions Open/Download for Everyone for both buckets.
  • Configure static website hosting for each bucket.
  • Add a list permisson for Everyone to allow public access.
  • Grant Zencoder access to the buckets by add the Zencoder Bucket Policies.

Bandwidth Detection

Pageflow measures the download times of some static files to detect the bandwidth of the client.

The following files have to be placed in the Output (.out) bucket:

  • https://raw.githubusercontent.com/codevise/pageflow/master/app/assets/images/pageflow/bandwidth_probe_large.png
  • https://raw.githubusercontent.com/codevise/pageflow/master/app/assets/images/pageflow/bandwidth_probe_small.png.

Zencoder

Get your API Key from Zencoder and make sure it is used in the zencoder_options in config/initializers/pageflow.rb.

Note that Zencoder offers a special "Integration API Key" that can be used free of charge during development. Encoded files are cropped at five seconds.

Amazon Cloudfront

Create three distributions:

  • one for each of the two S3 buckets
  • one for which has the rails app itself as origin

Configure CNAMES and make sure they are used in config/initializers/pageflow.rb as s3_host_alias in production mode. Please see the inline docs and examples in config/initializers/pageflow.rb.