Skip to content

Commit

Permalink
update README, rm old doc
Browse files Browse the repository at this point in the history
  • Loading branch information
adwski committed May 17, 2024
1 parent 9e58a2d commit 5a887f1
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 110 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ e2e/cert.pem
e2e/key.pem

dist/

tapes/frames/
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,36 @@ mock:
docker-dev:
cd docker/compose ;\
docker compose up -d
docker ps

.PHONY: docker-infra
docker-infra:
cd docker/compose ;\
docker compose -f docker-compose.infra.yml -f docker-compose.nginx.yml up -d
docker ps

.PHONY: docker-infra-clean
docker-infra-clean:
cd docker/compose ;\
docker compose -f docker-compose.infra.yml -f docker-compose.nginx.yml down -v
docker ps

.PHONY: docker-dev-build
docker-dev-build:
cd docker/compose ;\
docker compose up -d --build
docker ps

.PHONY: docker-dev-build-svc
docker-dev-build-svc:
cd docker/compose ;\
docker compose up -d --no-deps --build $$SVC
docker ps

.PHONY: docker-dev-clean
docker-dev-clean:
cd docker/compose ;\
docker compose down -v

.PHONY: docker-ps
docker-ps:
docker ps --format="table {{.Image}}\t{{.Status}}\t{{.Names}}"

.PHONY: goimports
goimports:
goimports -w .
Expand Down
70 changes: 58 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,75 @@

WIP

This is a final project for Yandex Practicum's Go Course.
## Overview

Vidi is a media server that supports:
- simple user registration
- video uploading by registered users
- On-demand streaming of uploaded videos using MPEG-DASH
Vidi is a video service (or platform). Features include:
- simple user registration and login
- mp4 files upload (with h.264 AVC and mp4a AAC codecs)
- resuming of interrupted upload
- upload quotas per user
- on-demand streaming of uploaded videos with MPEG-DASH

Uploaded mp4 files are pre-processed, so they could be streamed to dash clients. Preprocessing includes:
- Segmentation (using awesome [Eyevinn/mp4ff](https://github.com/Eyevinn/mp4ff) package)
- MPD generation (with [Eyevinn/dash-mpd](https://github.com/Eyevinn/dash-mpd))

Also project uses:
- PostgreSQL for video object storage and user storage
- S3 compatible storage for video data (compose project uses minio)
- S3 compatible storage for video content
- Redis for media sessions storage

This is my pet project and is very far from being production-ready. Nice and shiny web UI is not even planned.

## Architecture

Vidi consists of several services

### Userapi

Simple user registration and login service. Made with `labstack/echo`.

### Videoapi

Main API that implements the most of the business logic, like video object CRUD operations. It is also an entry point for upload and watch flows.

Video API has service-side (for back2back comms) and user-side (user->api comms) parts. User-side is served as http with `labstack/echo` and as grpc. Service-side has only grpc.

Both Userapi and Videoapi are considered as API-domain.

### Uploader

This service is responsible for media content upload. It uses upload sessions created by videoapi to identify and validate upload requests. Made with `valyala/fasthttp`.

### Streamer

This service serves DASH segments to users. It uses watch sessions created by videoapi to identify and validate download requests. Made with `valyala/fasthttp`.

### Processor

This is worker-style service that processes uploaded videos to DASH-format. Uses `Eyevinn/mp4ff` in its core.

Processor, uploader and streamer are considered as Media-domain.

### Vidit

This is client-side tool, that provides TUI to interact with Vidi. It supports almost every operation, excluding video playback: at the moment it can generate watch url which can be used with DASH reference player (included in compose project). Made with `charmbracelet/bubbletea`.

## Development

`./docker` dir contains reference all-in-one deployment with docker-compose. Nginx is used as gateway. It also has simple web page with DASH reference client to test video playback. Minio is used as self-hosted s3.

### Docker

```bash
# generate certificates
make tls
# start compose project
make docker-dev
make docker-dev
# or
make docker-dev-build # to rebuild images

# stop compose project and cleanup volumes
# stop compose project and remove volumes
make docker-dev-clean
```

Expand All @@ -38,11 +82,13 @@ make docker-dev-clean
# run unit tests
make unittests

# run unit and end2end tests
# docker compose project should be stopped (it will be ran by the command)
# run unit and e2e tests
# docker compose project should be stopped (it will be started by the command)
make test-all
```

### Happy Path
### Showcase

Showcase of project startup and some features

User interaction flow is described [here](./docs/happy_path.md).
![showcase](tapes/showcase.gif)
93 changes: 0 additions & 93 deletions docs/happy_path.md

This file was deleted.

Binary file added tapes/showcase.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 126 additions & 0 deletions tapes/showcase.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Output tapes/showcase.gif
Output tapes/frames/

Set Theme Atom
Set Shell zsh
Set Width 1600
Set Height 900
Set TypingSpeed 250ms

Set Margin 10
Set MarginFill "#6B50FF"
Set BorderRadius 10
Set Framerate 24

Set PlaybackSpeed 1.0

# prepare
Enter@2
Type "echo 'Generating certificates'"
Enter@1

Type "make tls"
Sleep 1
Enter@4
Enter
Type "echo 'Starting compose project'"
Enter@1

# images better be pre-built
Type "make docker-dev"
Sleep 1
Enter@5
Type "make docker-ps"
Enter@5

# start vidit
Type "clear"
Enter@1
Type "echo 'Starting vidit tool'"
Enter@1
Type "echo '-d sets starting directory for file picker'"
Enter@1
Type "go run cmd/vidit/main.go -d $(pwd)/testfiles"
Enter@5

# config screen
Type "http://localhost"
Enter@3

# new user screen
# select register
Down@1
Enter@2

# enter creds
Type "JaneDoe"
Enter@2
Type "password"
Enter@2
Left@1
Enter@5

# show empty videos screen
Enter@3
Backspace@1

# show quotas screen
Down@1
Down@1
Enter@1
Down@1
Down@3
Backspace@2

# goto uploads screen
Down@2
Enter@2
# select file
Down@1
Enter@1

# enter name
Type "test video"
Sleep 1
Enter@1
# confirm
Left@1
Enter@7
Enter@2

# show quotas screen
Down@1
Down@1
Enter@1
Down@1
Down@3
Backspace@2

# show videos screen
Enter@2
Type@6 w
Backspace@5
Ctrl+c
Sleep 3

# show state
Type "echo 'Vidit persists its state into home dir'"
Enter@1
Type "ls $HOME/.vidi"
Enter@2

Type "cat $HOME/.vidi/state.json"
Enter@2

Type "echo 'Next run will reuse endpoint config and user info'"
Enter@1

# start again
Type "go run cmd/vidit/main.go"
Enter@5

# show videos screen
Enter@3
Backspace@5
Ctrl+c
Sleep 3

0 comments on commit 5a887f1

Please sign in to comment.