genie88 / s3-proxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

S3 Proxy voor VRT

  1. VRT will do an S3 put request with a media file. This is stored on our 100TB cache before saving to tape. We store the ID given from VRT together with the file path in redis.

  2. When later a S3 Get is send it's immediately returned from this cache using redis lookup (if file is present). If file lookup fails it means the file has been moved to tape. We do a restore request to media haven and return an xml with url + status busy. VRT will keep requesting until file is present (protocol S3 if possible, if not something custom/similar to what they use internally).

  3. Once the file is retrieved from tape we again store the path in the redis cache and also return it in previous request on 2.

Optionally a lookup table with postgres can be kept as backup which couples VRT id's to Mediahaven ids for the files (and spec for video or audio)

Usefull links and reference material

Installation

Just run bundle install then rake to run the automated tests. Most test currently fail and need to be adjusted to wanted specs as we're TDD'ing. Added some initial views, app skeleton, gemfile and test files to start working on initial version (work in progress...).

To test and run the minio S3 server just use the start_minio_server.sh helper script. Then visit http://localhost:9999 enter key and pass specified in script file (TOPSECRET, ...) The minio_config and minio_data are mounted to this docker container and data can contain our video and audio data. Example minio startup output:

➜  viaa-s3proxy git:(development) ✗ ./start_minio_server.sh
Using default tag: latest
latest: Pulling from minio/minio
Digest: sha256:14723eeb475edc7bd1ed1ffab87977a47112bec3ee18e2abeb579a2a19771705
Status: Image is up to date for minio/minio:latest
minio1
minio1

Endpoint:  http://172.17.0.2:9000  http://127.0.0.1:9000

Browser Access:
   http://172.17.0.2:9000  http://127.0.0.1:9000

Object API (Amazon S3 compatible):
   Go:         https://docs.minio.io/docs/golang-client-quickstart-guide
   Java:       https://docs.minio.io/docs/java-client-quickstart-guide
   Python:     https://docs.minio.io/docs/python-client-quickstart-guide
   JavaScript: https://docs.minio.io/docs/javascript-client-quickstart-guide
   .NET:       https://docs.minio.io/docs/dotnet-client-quickstart-guide

Our own sinatra app will expose some calls to interact with the minio instance (in this case, it can be any other s3 service later on). On local machine run it with ./start_server.sh

➜  viaa-s3proxy git:(development) ✗ ./start_server.sh 
[7666] Puma starting in cluster mode...
[7666] * Version 3.12.0 (ruby 2.5.3-p105), codename: Llamas in Pajamas
[7666] * Min threads: 10, max threads: 10
[7666] * Environment: production
[7666] * Process workers: 2
[7666] * Phased restart available
[7666] * Listening on tcp://0.0.0.0:3000
[7666] Use Ctrl-C to stop
[7666] - Worker 0 (pid: 7681) booted, phase: 0
[7666] - Worker 1 (pid: 7682) booted, phase: 0

Openshift deployment note

The app uses the X-Forwarded-Host header to determine the s3 domain. This header is set by the meemoo nginx proxy. In its default configuration, the OKD router adds the hostname of the router to this header which confuses the app. Therefore the okd route associated with this app must have the following annotation set:

  annotations:
   haproxy.router.openshift.io/set-forwarded-headers: if-none

About


Languages

Language:Ruby 82.2%Language:HTML 10.2%Language:Shell 3.6%Language:CSS 1.8%Language:Dockerfile 1.7%Language:Makefile 0.4%