Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider: add a AWS Elemental MediaConvert provider #223

Merged
merged 8 commits into from
Jul 14, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ providers:
- [Encoding.com](http://encoding.com)
- [Hybrik](https://www.hybrik.com)
- [Zencoder](http://zencoder.com)
- [MediaConvert](https://aws.amazon.com/mediaconvert)

## Setting Up

Expand Down Expand Up @@ -94,6 +95,18 @@ export ZENCODER_API_KEY=your.api.key
export ZENCODER_DESTINATION=http://access.key.id:[email protected]/
```

#### For [MediaConvert](https://aws.amazon.com/mediaconvert/)

```
export MEDIACONVERT_AWS_ACCESS_KEY_ID=your.access.key.id
export MEDIACONVERT_AWS_SECRET_ACCESS_KEY=your.secret.access.key
fsouza marked this conversation as resolved.
Show resolved Hide resolved
export MEDIACONVERT_AWS_REGION="us-east-1"
export MEDIACONVERT_ENDPOINT=your.mediaconvert.endpoint
export MEDIACONVERT_QUEUE_ARN=your.queue.arn
export MEDIACONVERT_ROLE_ARN=your.iam.role.arn
export MEDIACONVERT_DESTINATION=s3://your-s3-bucket
```

### Database configuration

In order to store preset maps and job statuses we need a Redis instance
Expand Down
13 changes: 13 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Config struct {
Hybrik *Hybrik
Zencoder *Zencoder
Bitmovin *Bitmovin
MediaConvert *MediaConvert
Log *logging.Config
}

Expand Down Expand Up @@ -88,6 +89,18 @@ type Hybrik struct {
PresetPath string `envconfig:"HYBRIK_PRESET_PATH" default:"transcoding-api-presets"`
}

// MediaConvert represents the set of configurations for the MediaConvert
// provider.
type MediaConvert struct {
AccessKeyID string `envconfig:"MEDIACONVERT_AWS_ACCESS_KEY_ID"`
SecretAccessKey string `envconfig:"MEDIACONVERT_AWS_SECRET_ACCESS_KEY"`
Region string `envconfig:"MEDIACONVERT_AWS_REGION"`
Endpoint string `envconfig:"MEDIACONVERT_ENDPOINT"`
Queue string `envconfig:"MEDIACONVERT_QUEUE_ARN"`
Role string `envconfig:"MEDIACONVERT_ROLE_ARN"`
Destination string `envconfig:"MEDIACONVERT_DESTINATION"`
}

// LoadConfig loads the configuration of the API using environment variables.
func LoadConfig() *Config {
var cfg Config
Expand Down
17 changes: 17 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ func TestLoadConfigFromEnv(t *testing.T) {
"BITMOVIN_AWS_STORAGE_REGION": "US_WEST_1",
"BITMOVIN_ENCODING_REGION": "GOOGLE_EUROPE_WEST_1",
"BITMOVIN_ENCODING_VERSION": "notstable",
"MEDIACONVERT_AWS_ACCESS_KEY_ID": "mc-aws-access-key-id",
"MEDIACONVERT_AWS_SECRET_ACCESS_KEY": "mc-aws-secret-access-key",
"MEDIACONVERT_AWS_REGION": "mc-aws-region",
"MEDIACONVERT_ENDPOINT": "http://mc-endpoint.tld",
"MEDIACONVERT_QUEUE_ARN": "arn:aws:mediaconvert:us-east-1:some-queue:queues/Default",
"MEDIACONVERT_ROLE_ARN": "arn:aws:iam::some-account:role/some-role",
"MEDIACONVERT_DESTINATION": "s3://mc-destination/",
"SWAGGER_MANIFEST_PATH": "/opt/video-transcoding-api-swagger.json",
"HTTP_ACCESS_LOG": accessLog,
"HTTP_PORT": "8080",
Expand Down Expand Up @@ -102,6 +109,15 @@ func TestLoadConfigFromEnv(t *testing.T) {
EncodingRegion: "GOOGLE_EUROPE_WEST_1",
EncodingVersion: "notstable",
},
MediaConvert: &MediaConvert{
AccessKeyID: "mc-aws-access-key-id",
SecretAccessKey: "mc-aws-secret-access-key",
Region: "mc-aws-region",
Endpoint: "http://mc-endpoint.tld",
Queue: "arn:aws:mediaconvert:us-east-1:some-queue:queues/Default",
Role: "arn:aws:iam::some-account:role/some-role",
Destination: "s3://mc-destination/",
},
Server: &server.Config{
HTTPPort: 8080,
HTTPAccessLog: &accessLog,
Expand Down Expand Up @@ -202,6 +218,7 @@ func TestLoadConfigFromEnvWithDefaults(t *testing.T) {
EncodingRegion: "AWS_US_EAST_1",
EncodingVersion: "STABLE",
},
MediaConvert: &MediaConvert{},
Server: &server.Config{
HTTPPort: 8080,
HTTPAccessLog: &accessLog,
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require (
github.com/NYTimes/gizmo v1.2.8
github.com/NYTimes/gziphandler v1.1.1
github.com/aws/aws-sdk-go v1.20.19
github.com/aws/aws-sdk-go-v2 v0.9.0
github.com/bitmovin/bitmovin-go v1.29.0
github.com/flavioribeiro/zencoder v0.0.0-20161215190743-745874544382
github.com/fsouza/ctxlogger v1.5.5
Expand All @@ -18,6 +19,7 @@ require (
github.com/kr/pretty v0.1.0
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/pkg/errors v0.8.1
github.com/sirupsen/logrus v1.4.2
)

Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ github.com/aws/aws-sdk-go v1.20.17 h1:ZQ0cM9FpuufVDHlNViD8vD68IkEQL/VUOMwJPBqkaa
github.com/aws/aws-sdk-go v1.20.17/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.20.18 h1:k8y5kuh6w8Jw8AOoXAZBygCTDmGNMqfkZK5/OffOB0E=
github.com/aws/aws-sdk-go v1.20.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go-v2 v0.9.0 h1:dWtJKGRFv3UZkMBQaIzMsF0/y4ge3iQPWTzeC4r/vl4=
github.com/aws/aws-sdk-go-v2 v0.9.0/go.mod h1:sa1GePZ/LfBGI4dSq30f6uR4Tthll8axxtEPvlpXZ8U=
github.com/aws/aws-sdk-go v1.20.19 h1:RQDLGGlcffQzAceEXGdMu+uGGPGhNu+vNG3BrUZAMPI=
github.com/aws/aws-sdk-go v1.20.19/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
Expand Down Expand Up @@ -90,6 +92,7 @@ github.com/go-redis/redis v6.15.1+incompatible h1:BZ9s4/vHrIqwOb0OPtTQ5uABxETJ3N
github.com/go-redis/redis v6.15.1+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-redis/redis v6.15.2+incompatible h1:9SpNVG76gr6InJGxoZ6IuuxaCOQwDAhzyXg+Bs+0Sb4=
github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
Expand Down Expand Up @@ -183,6 +186,8 @@ github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTm
github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ=
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
_ "github.com/NYTimes/video-transcoding-api/provider/elementalconductor"
_ "github.com/NYTimes/video-transcoding-api/provider/encodingcom"
_ "github.com/NYTimes/video-transcoding-api/provider/hybrik"
_ "github.com/NYTimes/video-transcoding-api/provider/mediaconvert"
_ "github.com/NYTimes/video-transcoding-api/provider/zencoder"
"github.com/NYTimes/video-transcoding-api/service"
"github.com/google/gops/agent"
Expand Down
Loading