Skip to content

Quick Setup Guide [for development]

Alfred Gutierrez edited this page Dec 22, 2019 · 1 revision

Welcome to the openencoder setup guide. This guide will step through the process of building and running the project for development.

openencoder is made of 3 components:

  • Server: HTTP API and worker queue for submitting and managing encode jobs, and other operations.
  • Worker: A background process listening and running jobs on the worker queue.
  • Web: A web UI for monitoring and managing encode jobs. Optional, but recommended for this setup guide.

It also has 2 storage components:

  • PostgreSQL - Relational database system.
  • Redis - Key/value database used as a message broker for the worker.

Development Setup

Requirements

  • Docker
  • Go 1.11+
  • FFmpeg
  • Postgres
  • S3 API Credentials & Bucket (AWS or Digital Ocean)
  • Digital Ocean API Key (only required for Machines API)

Docker is optional, but highly recommended for this setup. This guide assumes you are using Docker.

Setup

  1. Start Redis and Postgres in Docker:
docker-compose up -d redis
docker-compose up -d db

When the database container runs for the first time, it will create a persistent volume as /var/lib/postgresql/data. It will also run the scripts in scripts/ to create the database, schema, settings and presets.

  1. Set environment variables in docker-compose.yml.

Environment variables will override defaults set in config/default.yml.

  1. Build & start API server:
$ go build -v && ./openencoder server

Starting server...
Running with 8 CPUs
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)
  1. Build & start worker as another process:
$ go build -v && ./openencoder worker

Starting worker...
  1. Install web dependencies and start Web Dashboard as another process:
$ cd static && npm install && npm run serve

  App running at:
  - Local:   http://localhost:8081/dashboard/
  - Network: http://192.168.1.25:8081/dashboard/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

You should now have a Server API, Worker and Web Dashboard running. Next we need to create an admin user.

Create an admin user

  1. Load http://localhost:8081/dashboard/register in the browser: Create a username and password

  2. Grant the user admin privileges via DB:

UPDATE "public"."users" SET "role" = 'admin' WHERE "username" LIKE 'user@email.com';
  1. Login with user at http://localhost:8081/dashboard/register. You should see all tabs including settings.

Next we configure settings.

Configure Settings

In order to run encode jobs, you will need your S3 credentials, region and buckets. If you plan to run the Machines API, you'll also need a Digital Ocean API key.

  1. Go to http://localhost:8081/dashboard/settings in the web dashboard.
  2. Configure all necessary settings for S3.

Run an Encode Job

Once you have settings configured, you can now run an encode job.

  1. Go to http://localhost:8081/dashboard/encode in the web dashboard.
  2. Select a pre-configured preset, such as h264_baseline_360p_600.
  3. Select a file by clicking the input field. This should load your configured inbound S3 path.
  4. Destination should auto-populate the output folder in your outbound S3 path.
  5. Submit the job.
  6. Monitor the job status at http://localhost:8081/dashboard/jobs
  7. Verify your encode job by checking your outbound path in S3. 🎉