wubbl0rz-archiv-backend

command module
v1.2.1-0...-6b3618a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

README

wubbl0rz VOD Archiv

Stack: Go, Gin, Gorm, FFmpeg

🐳 Deploy

Copy .env.sample to .env and replace the required variables.

Example docker-compose.yml

version: '3'
services:
  api:
    container_name: archiv-api
    build: .
    restart: unless-stopped
    env_file: .env
    ports:
      - 127.0.0.1:5000:5000
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /path/to/media/:/var/www/media/
    depends_on:
      - db
  db:
    container_name: archiv-db
    image: postgres:15-alpine
    restart: unless-stopped
    env_file: .env
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /path/to/postgres/:/var/lib/postgresql/data
  meili:
    container_name: archiv-meili
    image: getmeili/meilisearch:v1.1
    env_file: .env
    ports:
      - 127.0.0.1:7700:7700
    volumes:
      - ./meili_data:/meili_data
    restart: unless-stopped

🚪 Reverse Proxy

The easiest way is to use caddy. Paste the following into a file called Caddyfile.

api.wubbl0rz.tv {
    reverse_proxy localhost:5000
    encode zstd gzip
    header Access-Control-Allow-Origin "*"
}

Backup and restore database

Required to upgrade major postgres versions.

Backup docker exec -t archiv-db pg_dumpall -c -U YOUR_DB_USER > /path/to/backup/dump_$(date +%Y-%m-%d"_"%H_%M_%S).sql

Restore docker exec -i archiv-db psql -d YOUR_DB_NAME -U YOUR_DB_USER < /path/to/backup/dump_<some-date>.sql

🔎 Meilisearch

Meilisearch index is filled with archiv-transcribe.

A custom config is required for our indexes. Use the api to patch the index settings like so:

PATCH http://localhost:7700/indexes/transcripts/settings/

{
  "displayedAttributes": ["*"],
  "searchableAttributes": ["text"],
  "filterableAttributes": [],
  "sortableAttributes": ["date", "duration", "viewcount"],
  "rankingRules": [
    "sort",
    "words",
    "typo",
    "proximity",
    "attribute",
    "exactness"
  ]
}

PATCH http://localhost:7700/indexes/vods/settings/

{
  "displayedAttributes": ["*"],
  "searchableAttributes": ["title"],
  "filterableAttributes": [],
  "sortableAttributes": ["date", "duration", "viewcount"],
  "rankingRules": [
    "sort",
    "words",
    "typo",
    "proximity",
    "attribute",
    "exactness"
  ]
}

PATCH http://localhost:7700/indexes/clips/settings/

{
  "displayedAttributes": ["*"],
  "searchableAttributes": ["*"],
  "filterableAttributes": [],
  "sortableAttributes": ["date", "duration", "viewcount"]
}

PATCH http://localhost:7700/indexes/transcripts

{
	"primaryKey": "id"
}

Documentation

Docs are generated with swagger. Install swag to build docs:

go install github.com/swaggo/swag/cmd/swag@latest

Then build:

swag i

Check out the swagger page for the build documentation.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL