-
Notifications
You must be signed in to change notification settings - Fork 21
Quick Setup Guide [for development]
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.
- 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.
- 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.
- Set environment variables in
docker-compose.yml
.
Environment variables will override defaults set in config/default.yml
.
- 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)
- Build & start worker as another process:
$ go build -v && ./openencoder worker
Starting worker...
- 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.
-
Load
http://localhost:8081/dashboard/register
in the browser: Create a username and password -
Grant the user
admin
privileges via DB:
UPDATE "public"."users" SET "role" = 'admin' WHERE "username" LIKE '[email protected]';
- Login with user at
http://localhost:8081/dashboard/register
. You should see all tabs includingsettings
.
Next we 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.
- Go to
http://localhost:8081/dashboard/settings
in the web dashboard. - Configure all necessary settings for S3.
Once you have settings configured, you can now run an encode job.
- Go to
http://localhost:8081/dashboard/encode
in the web dashboard. - Select a pre-configured preset, such as
h264_baseline_360p_600
. - Select a file by clicking the input field. This should load your configured
inbound
S3 path. - Destination should auto-populate the output folder in your
outbound
S3 path. - Submit the job.
- Monitor the job status at
http://localhost:8081/dashboard/jobs
- Verify your encode job by checking your
outbound
path in S3. 🎉