Accurate Video AWS EC2

This guide covers the installation instructions for Accurate Video running using Docker Compose on a single AWS EC2 instance.

Launch an EC2 instance

Go to AWS EC2 and launch a new instance using the EC2 instance wizard.

For a detailed guide on how to launch an EC2 instance, please refer to the following guide: https://docs.aws.amazon.com/quickstarts/latest/vmlaunch/step-1-launch-instance.html

  1. Choose the Linux distribution to use, in this guide Ubuntu Server 18.04 LTS is used.
  2. Choose the desired instance type. For a POC/evaluation system, a t3.medium should be enough.
  3. It is recommended to increase the storage from 8 GB default to about 20 GB.
  4. In the security group section, make sure to add a rule for HTTP to allow inbound TCP port 80, and if you plan on using HTTPS allow inbound TCP port 443, as well.

Installing dependencies

A number of dependencies are required to install before moving forward with the Accurate Video installation.

Prerequisite: Install docker

Docker will be used to launch the Accurate Video containers. Please refer to its guide for installation instructions.

https://docs.docker.com/engine/install/

Also make sure you follow the post-install instructions, adding your user to the Docker group to run containers without sudo.

Prerequisite: Install docker-compose

Docker-compose is used to launch all Accurate Video containers at once. Please refer to the installation guide here.

https://docs.docker.com/compose/install/

Prerequisite: Install git

Unless the system comes with git pre-installed, make sure to install it before going further.

https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

Verify dependencies

Verify that Docker is installed by running the following command, it should download and run a small Hello World! application.

docker run hello-world

Very that Docker Compose is installed by running the following, it should report the version installed (which may differ).

docker-compose --version

Finally, verify that git is installed by running:

git --version

Clone Git repository

The git repository contains all the needed configuration files to start Accurate Video using Docker Compose. Note that this repository contains no actual binaries, it only has the configuration files required to download the Docker containers from the Codemill Docker registry.

git clone -b sales/trial --no-tags --single-branch https://gitlab.com/codmill/accurate-player/accurate-video-docker-compose.git

You will be prompted for a username and password. Enter the supplied deploy token & password. The deploy token is a special access key which gives read-only access to this git repository and is only valid for a limited period of time.

Username for 'https://gitlab.com': <username>

Password for 'https://<username>@gitlab.com': <password>

The git repository will be downloaded, which has some different configuration files and Docker Compose files. Let’s look at them closer:

  • frontend.yml - this file contains the Accurate Video frontend, the GUI.
  • backend.yml - this file contains the Accurate Video backend (REST API), an analysis service for analyzing video files, and an nginx web server.
  • runner.yml - this file contains the job system.

When running a Docker Compose command, all of these files need to be references like so:

docker-compose -f frontend.yml -f backend.yml -f runner.yml ...

Login to Codemill Docker registry

The Codemill Docker registry contains all the Docker containers specified in the Docker Compose configuration. You’ll need to first login or authenticate to the repository. Replace email and password with the given Docker registry credentials.

docker login -u <docker-username> -p <docker-password> codemill-docker.jfrog.io

Pull Docker Compose

After authentication to the Codemill repository, the latest Docker containers need to be downloaded locally. Use the docker-compose pull command to retrieve the latest versions.

docker-compose -f frontend.yml -f backend.yml -f runner.yml pull

Set the license

Accurate Video needs a license key to function properly. This license key is typically given to you and will need to be entered into the settings file. Edit the file config/settings-qc.js

licenseKey: "...",

Replace the value above with your given license key.

Install PostgreSQL

Accurate Video needs access to a PostgreSQL database to store asset metadata and other information. You can either run a local Postgres on the same EC2 machine or an external one using AWS RDS or similar. If you already have a PostgreSQL instance running, you can skip most of the steps in this section.

Please refer to the official installation instructions for more information: https://www.postgresql.org/download/linux/ubuntu/

On Ubuntu 18.04 LTS, we can install using the following command:

sudo apt install postgresql postgresql-contrib -y

After installation, change the password for the postgres user and the listen address:

sudo -u postgres psql -c "ALTER ROLE postgres WITH PASSWORD 'postgres'";

sudo -u postgres psql -c "ALTER SYSTEM SET listen_addresses TO '*'";

Feel free to change this to another password, just make sure the password in the .env file is matching.

Make sure Postgres is starting up at boot:

sudo systemctl enable postgresql

Create a database:

sudo -u postgres createdb accurate-player

Enable local access:

echo "host all all 0.0.0.0/0 md5" | sudo tee -a /etc/postgresql/10/main/pg_hba.conf

Restart postgresql:

sudo systemctl restart postgresql

Install nginx

Nginx is a web server and will be used as a reverse proxy in front of Accurate Video to expose it on the external EC2 IP. Here you can see instructions on how to install it based on your Linux distribution: https://www.nginx.com/resources/wiki/start/topics/tutorials/install/

Note that nginx installs per default on port 80, and may conflict with any current running web servers. Make sure that the port is available before proceeding with the installation.

Copy nginx config

The cloned Git repository contains a pre-made nginx configuration to work in front of Accurate Video. You’ll need to copy this file into the nginx sites directory as follows:

sudo cp -f config/nginx-root.conf /etc/nginx/sites-available/default

Note that this path is the default one for the Nginx version used in Ubuntu 18.04 LTS, and may differ depending on your exact distro and version.

Restart nginx

Restart nginx to make the changes take effect.

sudo systemctl restart nginx

Start Accurate Video

It’s time to start up Accurate Video! Start the backend and frontend services by using Docker Compose, this command will launch all required containers in the background:

docker-compose -f frontend.yml -f backend.yml -f runner.yml up -d

You should now be able to access the system on the IP of the machine if you’ve done everything correctly. Opening the IP in a browser should give you access to Accurate Video.

Troubleshooting

This section goes through a few ways to troubleshoot, in case there are issues with the configuration.

A good way to start is to check on the running Docker containers, using the command docker ps. It should look like the following:

~/accurate-video-docker-compose$ docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

48dad525aee1 nginx:alpine "nginx -g 'daemon of…" 4 days ago Up 4 days 0.0.0.0:82->80/tcp ap-nginx

9cc60be9f666 codemill-docker.jfrog.io/accurate-player/accurate-player-adapter-postgres:latest "java -jar -Dquarkus…" 4 days ago Up 4 days 0.0.0.0:8081->8080/tcp ap-backend

a3ab419acbf9 codemill-docker.jfrog.io/accurate-player/accurate-analyze:latest "java -jar accurate-…" 4 days ago Up 4 days 0.0.0.0:8090->8080/tcp ap-analyze

ef9fa619b444 codemill-docker.jfrog.io/accurate-player/accurate-player-qc:latest "nginx -g 'daemon of…" 4 days ago Up 4 days 0.0.0.0:81->80/tcp qc-web

The exact ports may differ depending on your setup.

To access the logs of the backend service, run docker logs ap-backend. Here you may see important stack traces which may give insight into what’s wrong.

In the case of a misconfigured nginx, you may be able to see the errors in the nginx access and/or error log.

tail -50 /var/log/nginx/access.log

tail -50 /var/log/nginx/error.log

Accurate Video S3 Storages Accurate Video AWS EC2 with Vidispine