This microservice provides audio file conversion, where a public URL is provided and converted to the desired format before being uploaded to an S3 bucket. The converted audio is persisted for 24h, during which the user can request a presigned GET url to the object.
Its still a work in progress - see next section.
- Ability to convert full files from public URL
- Ability to retrieve status updates and presigned URL when complete
- Containerized environment
- Limited concurrency
The list is going to be a lot bigger shortly once I update the ProtoBuff. Currently supported encodings are:
- WAV
- MP3
- FLAC
- MP4
Again, since audio conversion is done through the FFMPEG tool, this list will get longer shortly (or become a link to the FFMPEG docs).
The audio conversion microservice uses gRPC and Protocol Buffers for communication. gRPC provides a convenient and performant interface for communication between microservices. Protocol Buffers allow for a language-agnostic interface to facilitate gRPC. Right now I've compiled them for Go, but they can be compiled for different languages.
A REST interface was provided, primarily for local testing. The endpoints are listed below.
Query Params:
src
: The encoding of the source filedest
: The desired converted encoding
Body:
{
"sourceUrl": "<string>"
}
where:
sourceUrl
is a URL string to download the audio file Returns:202
and the ID of your request on successful call
Query params:
id
: The ID of the job Returns:200
{
"id": "<string>",
"status": "<string>",
"url": "<string>"
}
where:
id
: job ID stringstatus
: current job status, one ofCONVERTING
|COMPLETED
|FAILED
QUEUED
status will becoming soon
url
: URL string to dwonload the converted audio - this is a presigned URL that is valid for 24h from the time of conversion
You will need the following installed:
- Docker
- Docker-compose
- Terraform CLI
A dev and prod deployment have been created. The dev deployment runs entirely locally, and does not make use of AWS. The prod deployment creates an S3 storage bucket.
Begin by cloning the repo. Once complete, continue with the following steps.
Setup:
- Create the
.env
file in the project root directory:- Locate your
AWS_ACCESS_KEY
and add it to the.env
. Alternatively, you may omit this if you only intend to deploy locally. - Locate
AWS_SECRET_KEY
and add it to the.env
. Alternatively, you may omit this if you only intend to deploy locally. - Create a username for the database, and add it to the
.env
file with the keyPOSTGRES_USER
- Create a password for the database, and add it to the
.env
file under the keyPOSTGRES_PASSWORD
- Locate your
cd
to the project root directory- Run
./run
- Select option (4) to build and run dev
To close, ctrl+c
. Then select option (6) to remove the images from your docker.
cd
to the project- If you dont have the AWS CLI installed, then you should create a
terraform.tfvars
file and addAWS_ACCESS_KEY
andAWS_SECRET_KEY
to the file - The default region is
us-west-2
. You can change this interraform.tfvars
- Run
./run
- Select option (1) to deploy a new S3 bucket for the microservice
- Select (3) to build and run grpc-audio-converter
To close, ctrl+c
. Then select option (5) to remove the images. Select option (2) to fully delete the
S3 bucket (including any data that is in the bucket).