Free and Open-source video streaming suite. https://miracle-tv.live
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Dale f192b1cb08
feat: Update frontend version in module
преди 1 месец
.vscode feat: Move types into shared package преди 2 месеца
bin feat: Working nix build преди 2 месеца
config feat: Migrate on launch преди 2 месеца
migrations feat: Move types into shared package преди 2 месеца
scripts feat: nix? преди 2 месеца
src/server misc: Migrations in module преди 2 месеца
test feat: Tests for basic activity преди 2 месеца
.envrc feat: Add roadmap преди 2 месеца
.gitignore misc: additions to .gitignore преди 2 месеца
README.md misc: Add streaming backbone description and links преди 2 месеца
ROADMAP.md misc: Added misc section преди 2 месеца
default.nix feat: Add shell.nix for faster development преди 1 месец
knexfile.js feat: Sessions, access control преди 1 година
module.nix feat: Update frontend version in module преди 1 месец
package.json feat: Add shell.nix for faster development преди 1 месец
shell.nix feat: Add shell.nix for faster development преди 1 месец
tsconfig.json feat: Working nix build преди 2 месеца
tslint.json feat: Stream Keys, Channels, Activities преди 1 година
yarn.lock nix? преди 2 месеца
yarn.nix feat: nix? преди 2 месеца

README.md

Miracle TV

MIRACLE IS CURRENTLY NOT PRODUCTION READY (as I hope is evident from this repository)
CONSULT ROADMAP.md (link below) FOR MORE INFO

Backend portion of the MiracleTV Streaming Suite.

Uses PostgreSQL, TypeScript, Express and Nix

Streaming is supported by Nginx RTMP and OSSRS

This package is intended to work with

MiracleTV Frontend and

MiracleTV Shared

Roadmap

v1.0.0 Coming when it's done

Running in produciton

Nix / NixOS

You can run this with nix / nixos as a package

As a user package

  1. Download default.nix and save it, i.e. as miracle-tv.nix;
  2. Run nix-env -i -f miracle-tv.nix to install locally;
  3. Use miracle-tv-server binary, i.e. miracle-tv-server --configPath=/path/to/your/config.json (See /config/local.json for examples)

As a system module

  1. Import a module declaration into your configuration.nix from git or using fetchfile, i.e.
    imports = [
        "${builtins.fetchurl {
            url = "https://code.gensokyo.social/Gensokyo.social/miracle-tv/raw/commit/493c80142637b6fc47c864dfb51a1cba2f391150/module.nix";
            sha256 = "0k04z1w6yrr3f9g7g5dpdrdkx9lazf273nsb23zq1zp0mgd4dd71";
        }}"
    ];

(

[Be mindful!] This example uses a version of the module fixed to a commit.

While this is a good practice, this particular example might be outdated.

It is recommended to find a more recent commit and use nix-prefetch-url to get sha256 value;

$ nix-prefetch-url https://code.gensokyo.social/Gensokyo.social/miracle-tv/raw/commit/e0a86cfa6a0a52de49dc5e1680338c286cc929dd/module.nix

path is '/nix/store/zvsjjia6ppb35icywvgl9ljcn41q7svh-module.nix'
10vjfy581mnnv20a7biv8cm4zqj26irz7lq339449dzgqmh771bl

)

  1. In your config further, enable miracle-tv service
  services.miracle-tv = {
    enable = true;
    settings = {
      database.connection = {
        database = "miracle";
        user = "miracle";
      };
    };
  };
  1. Run nixos-rebuild switch (or sudo nixos-rebuild switch) to rebuild your system and start the service.
  2. Check local connection availability with curl http://localhost:8080/api/v1/channels, if response is {"data":[], "status": "ok"}, then you're all set!

Other Distros

  1. Have node > 14.0 installed and yarn
  2. Checkout project dir
  3. yarn && yarn build:server
  4. node ./dist/server/server.js --configPath=/path/to/config.json (check /config/local.json for examples)
  5. (Optional) Use process manager of your choice (Built-in process manager coming some time later!)

Development

NixOS

Simply use nix-shell inside project folder (or use a tool like direnv) to drop into development environment already set up

  1. nix-build in project folder builds default derivation and dumps it into result/. Make sure to check the executable before pushing final commits and do not commit result/ in!
  2. Make sure to run rm yarn.nix && yarn2nix > yarn.nix after adding new yarn packages before you commit

Other Distos

Make sure you have node >14.0 and yarn installed, as well as all necessary tools to build node packages.

Common procedure

  1. Install dependencies with yarn
  2. Use yarn watch:server to continously watch and restart yarn
  3. Use yarn build:server to produce a working build into dist/ directory
  4. Use yarn test to run a test suite on the server

Contribution Checklist

Nix / NixOS

  • Make sure that nix-build produces usable output.
    1. An output is considered usable if it's runnable via ./result/bin/miracle-tv-server --configPath=./config/local.json
  • If adding a new package, do not forget to generate new yarn.nix by running yarn2nix > yarn.nix
    1. yarn2nix should be available inside nix-shell
    2. A good idea is to run nix-collect-garbage && nix-build after that to make sure project builds

Other Distros

  • Make sure that yarn build:server produces usable output
    1. An output is considered usable if it's runnable via node ./dist/server/server.js --configPath=./config/local.json;
  • If adding a new package, mention that you cannot update yarn.nix when opening a pull-request
    1. Somebody should be able to update it and commit it into your pull-request or otherwise help you out