From 745bb322a3210b72a91baa584f4a9cacb3e4f5e1 Mon Sep 17 00:00:00 2001 From: Bertrand Moreau Date: Tue, 18 Aug 2020 17:18:45 +0200 Subject: [PATCH 01/15] Multi-target build Try to customize the MakeFile in order to be able to build an binary for any target system. --- .gitignore | 2 + Makefile | 7 +- readme.md | 349 +++++++++++++++++++++++++++-------------------------- 3 files changed, 184 insertions(+), 174 deletions(-) diff --git a/.gitignore b/.gitignore index d996f8d..7e1383f 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,5 @@ tags # channel and emote list from twitch subscribers.json +/.settings/ +/.project diff --git a/Makefile b/Makefile index e7fa083..f693306 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,13 @@ # For info on installing extra versions, see this page: # https://golang.org/doc/install#extra_versions +# goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows" +# goarchList = "386 amd64 amd64p32 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32leppc s390 s390x sparc sparc64" + TAGS= # Windows needs the .exe extension. -ifeq ($(OS),Windows_NT) +ifeq ($(TARGET),windows) EXT=.exe endif @@ -21,7 +24,7 @@ server: ServerMovieNight static/main.wasm # Bulid used for deploying to my server. ServerMovieNight: *.go common/*.go - GOOS=linux GOARCH=386 go$(GO_VERSION) build -o MovieNight $(TAGS) + GOOS=${TARGET} GOARCH=${ARCH} go$(GO_VERSION) build -o MovieNight $(TAGS) setdev: $(eval export TAGS=-tags "dev") diff --git a/readme.md b/readme.md index 7a95a42..c1ce743 100644 --- a/readme.md +++ b/readme.md @@ -1,172 +1,177 @@ - -**Table of Contents** - -- [MovieNight stream server](#movienight-stream-server) - - [Build requirements](#build-requirements) - - [Older Go Versions](#older-go-versions) - - [Compile and install](#compile-and-install) - - [Docker build](#docker-build) - - [Building the Container](#building-the-container) - - [Running the Container](#running-the-container) - - [docker-compose](#docker-compose) - - [Notes for Running Using docker-compose](#notes-for-running-using-docker-compose) - - [Usage](#usage) - - [Configuration](#configuration) - - -# MovieNight stream server - -[![Build status](https://api.travis-ci.org/zorchenhimer/MovieNight.svg?branch=master)](https://travis-ci.org/zorchenhimer/MovieNight) - -This is a single-instance streaming server with chat. Originally written to -replace Rabbit as the platform for watching movies with a group of people -online. - -## Build requirements - -- Go 1.13 or newer -- GNU Make - -### Older Go Versions - -You can install a newer version of Go alongside your OS's distribution by -following the guide here: [https://golang.org/doc/install#extra_versions](https://golang.org/doc/install#extra_versions) - -Once you have that setup add an enviromnent variable named `GO_VERSION` and -set it to the version you installed (eg, `1.14.1`). The Makefile will now use -the newer version. - -### Compile and install - -To just download and run: - -```bash -$ git clone https://github.com/zorchenhimer/MovieNight -$ cd MovieNight -$ make -$ ./MovieNight -``` - -### Docker build -MovieNight provides a Dockerfile and a docker-compose file to run MovieNight using Docker. - -#### Building the Container -Install Docker, clone the repository and build: - -```shell -docker build -t movienight . -``` - -#### Running the Container -Run the image once it's built: - -```shell -docker run -d -p 8089:8089 -p 1935:1935 [-v ./settings.json:/config/settings.json] movienight -``` - -Explanation: -- **-d** runs the container in the background. -- **-p 8089:8089** maps the MovieNight web interface to port 8089 on the server. -- **-p 1935:1935** maps the RTMP port for OBS to port 1935 (default RTMP port) on the server. -- **-v ./settings.json:/config/settings.json** maps the file *settings.json* into the container. [OPTIONAL] - -#### docker-compose -docker-compose will automatically build the image, no need to build it manually. - -Install Docker and docker-compose, clone the repository and change into the directory *./docker*. Then run: - -```shell -docker-compose up -d -``` - -This docker-compose file will create a volume called *movienight-config* and automatically add the standard *settings.json* file to it. It also maps port 8089 and 1935 to the same ports of the host. - -#### Notes for Running Using docker-compose -The container needs to be restarted to apply any changes you make to *settings.json*. - -## Usage - -Now you can use OBS to push a stream to the server. Set the stream URL to - -```text -rtmp://your.domain.host/live -``` - -and enter the stream key. - -Now you can view the stream at - -```text -http://your.domain.host:8089/ -``` - -There is a video only version at - -```text -http://your.domain.host:8089/video -``` - -and a chat only version at - -```text -http://your.domain.host:8089/chat -``` - -The default listen port is `:8089`. It can be changed by providing a new port -at startup: - -```text -Usage of .\MovieNight.exe: - -e bool - Whether or not to download approved emotes on startup (default "false") - -k string - Stream key, to protect your stream (default: "") - -l string - host:port of the MovieNight (default ":8089") - -r string - host:port of the RTMP server (default ":1935") -``` - -## Configuration - -MovieNight’s configuration is controlled by `settings.json`: - -- `AdminPassword`: users can enter `/auth ` into chat to grant themselves - admin privileges. This value is automatically regenerated unless - `RegenAdminPass` is false. -- `ApprovedEmotes`: list of Twitch users whose emotes can be imported into - MovieNight. Using `/addemotes ` in chat will add to this list. -- `Bans`: list of banned users. -- `LetThemLurk`: if false, announces when a user enters and leaves chat. -- `ListenAddress`: the port that MovieNight listens on, formatted as `:8089`. -- `LogFile`: the path of the MovieNight logfile, relative to the executable. -- `LogLevel`: the log level, defaults to `debug`. -- `MaxMessageCount`: the number of messages displayed in the chat window. -- `NewPin`: if true, regenerates `RoomAccessPin` when the server starts. -- `PageTitle`: The base string used in the `` element of the page. When - the stream title is set with `/playing`, it is appended; e.g., `Movie Night | The Man Who Killed Hitler and Then the Bigfoot` -- `RegenAdminPass`: if true, regenerates `AdminPassword` when the server starts. -- `RoomAccess`: the access policy of the chat room; this is managed by the - application and should not be edited manually. -- `RoomAccessPin`: if set, serves as the password required to enter the chatroom. -- `SessionKey`: key used for storing session data (cookies etc.) -- `StreamKey`: the key that OBS will use to connect to MovieNight. -- `StreamStats`: if true, prints statistics for the stream on server shutdown. -- `TitleLength`: the maximum allowed length for the stream title (set with `/playing`). -- `TwitchClientID`: OAuth client ID for the Twitch API, used for fetching emotes -- `TwitchClientSecret`: OAuth client secret for the Twitch API; [can be generated locally with curl](https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-client-credentials-flow). -- `WrappedEmotesOnly`: if true, requires that emote codes be wrapped in colons - or brackets; e.g., `:PogChamp:` -- `RateLimitChat`: the number of seconds between each message a non-privileged - user can post in chat. -- `RateLimitNick`: the number of seconds before a user can change their nick again. -- `RakeLimitColor`: the number of seconds before a user can change their color again. -- `RateLimitAuth`: the number of seconds between each allowed auth attempt -- `RateLimitDuplicate`: the numeber of seconds before a user can post a - duplicate message. -- `NoCache`: if true, set `Cache-Control: no-cache, must-revalidate` in the HTTP - header, to prevent caching responses. - -## License - -`flv.js` is Licensed under the Apache 2.0 license. This project is licened under the MIT license. +<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --> +**Table of Contents** + +- [MovieNight stream server](#movienight-stream-server) + - [Build requirements](#build-requirements) + - [Older Go Versions](#older-go-versions) + - [Compile and install](#compile-and-install) + - [Docker build](#docker-build) + - [Building the Container](#building-the-container) + - [Running the Container](#running-the-container) + - [docker-compose](#docker-compose) + - [Notes for Running Using docker-compose](#notes-for-running-using-docker-compose) + - [Usage](#usage) + - [Configuration](#configuration) + +<!-- markdown-toc end --> +# MovieNight stream server + +[![Build status](https://api.travis-ci.org/zorchenhimer/MovieNight.svg?branch=master)](https://travis-ci.org/zorchenhimer/MovieNight) + +This is a single-instance streaming server with chat. Originally written to +replace Rabbit as the platform for watching movies with a group of people +online. + +## Build requirements + +- Go 1.13 or newer +- GNU Make + +### Older Go Versions + +You can install a newer version of Go alongside your OS's distribution by +following the guide here: [https://golang.org/doc/install#extra_versions](https://golang.org/doc/install#extra_versions) + +Once you have that setup add an enviromnent variable named `GO_VERSION` and +set it to the version you installed (eg, `1.14.1`). The Makefile will now use +the newer version. + +### Compile and install +You have to : + - download ; + - choose your `TARGET` "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows" + ; + - choose you `ARCH` "386 amd64 amd64p32 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32leppc s390 s390x sparc sparc64" + ; + - and run ; + +```bash +$ git clone https://github.com/zorchenhimer/MovieNight +$ cd MovieNight +$ make TARGET=windows ARCH=386 +$ ./MovieNight +``` + +### Docker build +MovieNight provides a Dockerfile and a docker-compose file to run MovieNight using Docker. + +#### Building the Container +Install Docker, clone the repository and build: + +```shell +docker build -t movienight . +``` + +#### Running the Container +Run the image once it's built: + +```shell +docker run -d -p 8089:8089 -p 1935:1935 [-v ./settings.json:/config/settings.json] movienight +``` + +Explanation: +- **-d** runs the container in the background. +- **-p 8089:8089** maps the MovieNight web interface to port 8089 on the server. +- **-p 1935:1935** maps the RTMP port for OBS to port 1935 (default RTMP port) on the server. +- **-v ./settings.json:/config/settings.json** maps the file *settings.json* into the container. [OPTIONAL] + +#### docker-compose +docker-compose will automatically build the image, no need to build it manually. + +Install Docker and docker-compose, clone the repository and change into the directory *./docker*. Then run: + +```shell +docker-compose up -d +``` + +This docker-compose file will create a volume called *movienight-config* and automatically add the standard *settings.json* file to it. It also maps port 8089 and 1935 to the same ports of the host. + +#### Notes for Running Using docker-compose +The container needs to be restarted to apply any changes you make to *settings.json*. + +## Usage + +Now you can use OBS to push a stream to the server. Set the stream URL to + +```text +rtmp://your.domain.host/live +``` + +and enter the stream key. + +Now you can view the stream at + +```text +http://your.domain.host:8089/ +``` + +There is a video only version at + +```text +http://your.domain.host:8089/video +``` + +and a chat only version at + +```text +http://your.domain.host:8089/chat +``` + +The default listen port is `:8089`. It can be changed by providing a new port +at startup: + +```text +Usage of .\MovieNight.exe: + -e bool + Whether or not to download approved emotes on startup (default "false") + -k string + Stream key, to protect your stream (default: "") + -l string + host:port of the MovieNight (default ":8089") + -r string + host:port of the RTMP server (default ":1935") +``` + +## Configuration + +MovieNight’s configuration is controlled by `settings.json`: + +- `AdminPassword`: users can enter `/auth <value>` into chat to grant themselves + admin privileges. This value is automatically regenerated unless + `RegenAdminPass` is false. +- `ApprovedEmotes`: list of Twitch users whose emotes can be imported into + MovieNight. Using `/addemotes <username>` in chat will add to this list. +- `Bans`: list of banned users. +- `LetThemLurk`: if false, announces when a user enters and leaves chat. +- `ListenAddress`: the port that MovieNight listens on, formatted as `:8089`. +- `LogFile`: the path of the MovieNight logfile, relative to the executable. +- `LogLevel`: the log level, defaults to `debug`. +- `MaxMessageCount`: the number of messages displayed in the chat window. +- `NewPin`: if true, regenerates `RoomAccessPin` when the server starts. +- `PageTitle`: The base string used in the `<title>` element of the page. When + the stream title is set with `/playing`, it is appended; e.g., `Movie Night | The Man Who Killed Hitler and Then the Bigfoot` +- `RegenAdminPass`: if true, regenerates `AdminPassword` when the server starts. +- `RoomAccess`: the access policy of the chat room; this is managed by the + application and should not be edited manually. +- `RoomAccessPin`: if set, serves as the password required to enter the chatroom. +- `SessionKey`: key used for storing session data (cookies etc.) +- `StreamKey`: the key that OBS will use to connect to MovieNight. +- `StreamStats`: if true, prints statistics for the stream on server shutdown. +- `TitleLength`: the maximum allowed length for the stream title (set with `/playing`). +- `TwitchClientID`: OAuth client ID for the Twitch API, used for fetching emotes +- `TwitchClientSecret`: OAuth client secret for the Twitch API; [can be generated locally with curl](https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-client-credentials-flow). +- `WrappedEmotesOnly`: if true, requires that emote codes be wrapped in colons + or brackets; e.g., `:PogChamp:` +- `RateLimitChat`: the number of seconds between each message a non-privileged + user can post in chat. +- `RateLimitNick`: the number of seconds before a user can change their nick again. +- `RakeLimitColor`: the number of seconds before a user can change their color again. +- `RateLimitAuth`: the number of seconds between each allowed auth attempt +- `RateLimitDuplicate`: the numeber of seconds before a user can post a + duplicate message. +- `NoCache`: if true, set `Cache-Control: no-cache, must-revalidate` in the HTTP + header, to prevent caching responses. + +## License + +`flv.js` is Licensed under the Apache 2.0 license. This project is licened under the MIT license. From bd3868bc1645e3ebf62aa6b34633d6285ea0b9eb Mon Sep 17 00:00:00 2001 From: Bertrand Moreau <bertrand.moreau-prestataire@ca-cib.com> Date: Tue, 18 Aug 2020 17:18:45 +0200 Subject: [PATCH 02/15] Multi-target build Try to customize the MakeFile in order to be able to build an binary for any target system. --- .gitignore | 2 + Makefile | 7 +- readme.md | 349 +++++++++++++++++++++++++++-------------------------- 3 files changed, 184 insertions(+), 174 deletions(-) diff --git a/.gitignore b/.gitignore index d996f8d..7e1383f 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,5 @@ tags # channel and emote list from twitch subscribers.json +/.settings/ +/.project diff --git a/Makefile b/Makefile index e7fa083..f693306 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,13 @@ # For info on installing extra versions, see this page: # https://golang.org/doc/install#extra_versions +# goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows" +# goarchList = "386 amd64 amd64p32 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32leppc s390 s390x sparc sparc64" + TAGS= # Windows needs the .exe extension. -ifeq ($(OS),Windows_NT) +ifeq ($(TARGET),windows) EXT=.exe endif @@ -21,7 +24,7 @@ server: ServerMovieNight static/main.wasm # Bulid used for deploying to my server. ServerMovieNight: *.go common/*.go - GOOS=linux GOARCH=386 go$(GO_VERSION) build -o MovieNight $(TAGS) + GOOS=${TARGET} GOARCH=${ARCH} go$(GO_VERSION) build -o MovieNight $(TAGS) setdev: $(eval export TAGS=-tags "dev") diff --git a/readme.md b/readme.md index 7a95a42..8c4e75d 100644 --- a/readme.md +++ b/readme.md @@ -1,172 +1,177 @@ -<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --> -**Table of Contents** - -- [MovieNight stream server](#movienight-stream-server) - - [Build requirements](#build-requirements) - - [Older Go Versions](#older-go-versions) - - [Compile and install](#compile-and-install) - - [Docker build](#docker-build) - - [Building the Container](#building-the-container) - - [Running the Container](#running-the-container) - - [docker-compose](#docker-compose) - - [Notes for Running Using docker-compose](#notes-for-running-using-docker-compose) - - [Usage](#usage) - - [Configuration](#configuration) - -<!-- markdown-toc end --> -# MovieNight stream server - -[![Build status](https://api.travis-ci.org/zorchenhimer/MovieNight.svg?branch=master)](https://travis-ci.org/zorchenhimer/MovieNight) - -This is a single-instance streaming server with chat. Originally written to -replace Rabbit as the platform for watching movies with a group of people -online. - -## Build requirements - -- Go 1.13 or newer -- GNU Make - -### Older Go Versions - -You can install a newer version of Go alongside your OS's distribution by -following the guide here: [https://golang.org/doc/install#extra_versions](https://golang.org/doc/install#extra_versions) - -Once you have that setup add an enviromnent variable named `GO_VERSION` and -set it to the version you installed (eg, `1.14.1`). The Makefile will now use -the newer version. - -### Compile and install - -To just download and run: - -```bash -$ git clone https://github.com/zorchenhimer/MovieNight -$ cd MovieNight -$ make -$ ./MovieNight -``` - -### Docker build -MovieNight provides a Dockerfile and a docker-compose file to run MovieNight using Docker. - -#### Building the Container -Install Docker, clone the repository and build: - -```shell -docker build -t movienight . -``` - -#### Running the Container -Run the image once it's built: - -```shell -docker run -d -p 8089:8089 -p 1935:1935 [-v ./settings.json:/config/settings.json] movienight -``` - -Explanation: -- **-d** runs the container in the background. -- **-p 8089:8089** maps the MovieNight web interface to port 8089 on the server. -- **-p 1935:1935** maps the RTMP port for OBS to port 1935 (default RTMP port) on the server. -- **-v ./settings.json:/config/settings.json** maps the file *settings.json* into the container. [OPTIONAL] - -#### docker-compose -docker-compose will automatically build the image, no need to build it manually. - -Install Docker and docker-compose, clone the repository and change into the directory *./docker*. Then run: - -```shell -docker-compose up -d -``` - -This docker-compose file will create a volume called *movienight-config* and automatically add the standard *settings.json* file to it. It also maps port 8089 and 1935 to the same ports of the host. - -#### Notes for Running Using docker-compose -The container needs to be restarted to apply any changes you make to *settings.json*. - -## Usage - -Now you can use OBS to push a stream to the server. Set the stream URL to - -```text -rtmp://your.domain.host/live -``` - -and enter the stream key. - -Now you can view the stream at - -```text -http://your.domain.host:8089/ -``` - -There is a video only version at - -```text -http://your.domain.host:8089/video -``` - -and a chat only version at - -```text -http://your.domain.host:8089/chat -``` - -The default listen port is `:8089`. It can be changed by providing a new port -at startup: - -```text -Usage of .\MovieNight.exe: - -e bool - Whether or not to download approved emotes on startup (default "false") - -k string - Stream key, to protect your stream (default: "") - -l string - host:port of the MovieNight (default ":8089") - -r string - host:port of the RTMP server (default ":1935") -``` - -## Configuration - -MovieNight’s configuration is controlled by `settings.json`: - -- `AdminPassword`: users can enter `/auth <value>` into chat to grant themselves - admin privileges. This value is automatically regenerated unless - `RegenAdminPass` is false. -- `ApprovedEmotes`: list of Twitch users whose emotes can be imported into - MovieNight. Using `/addemotes <username>` in chat will add to this list. -- `Bans`: list of banned users. -- `LetThemLurk`: if false, announces when a user enters and leaves chat. -- `ListenAddress`: the port that MovieNight listens on, formatted as `:8089`. -- `LogFile`: the path of the MovieNight logfile, relative to the executable. -- `LogLevel`: the log level, defaults to `debug`. -- `MaxMessageCount`: the number of messages displayed in the chat window. -- `NewPin`: if true, regenerates `RoomAccessPin` when the server starts. -- `PageTitle`: The base string used in the `<title>` element of the page. When - the stream title is set with `/playing`, it is appended; e.g., `Movie Night | The Man Who Killed Hitler and Then the Bigfoot` -- `RegenAdminPass`: if true, regenerates `AdminPassword` when the server starts. -- `RoomAccess`: the access policy of the chat room; this is managed by the - application and should not be edited manually. -- `RoomAccessPin`: if set, serves as the password required to enter the chatroom. -- `SessionKey`: key used for storing session data (cookies etc.) -- `StreamKey`: the key that OBS will use to connect to MovieNight. -- `StreamStats`: if true, prints statistics for the stream on server shutdown. -- `TitleLength`: the maximum allowed length for the stream title (set with `/playing`). -- `TwitchClientID`: OAuth client ID for the Twitch API, used for fetching emotes -- `TwitchClientSecret`: OAuth client secret for the Twitch API; [can be generated locally with curl](https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-client-credentials-flow). -- `WrappedEmotesOnly`: if true, requires that emote codes be wrapped in colons - or brackets; e.g., `:PogChamp:` -- `RateLimitChat`: the number of seconds between each message a non-privileged - user can post in chat. -- `RateLimitNick`: the number of seconds before a user can change their nick again. -- `RakeLimitColor`: the number of seconds before a user can change their color again. -- `RateLimitAuth`: the number of seconds between each allowed auth attempt -- `RateLimitDuplicate`: the numeber of seconds before a user can post a - duplicate message. -- `NoCache`: if true, set `Cache-Control: no-cache, must-revalidate` in the HTTP - header, to prevent caching responses. - -## License - -`flv.js` is Licensed under the Apache 2.0 license. This project is licened under the MIT license. +<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --> +**Table of Contents** + +- [MovieNight stream server](#movienight-stream-server) + - [Build requirements](#build-requirements) + - [Older Go Versions](#older-go-versions) + - [Compile and install](#compile-and-install) + - [Docker build](#docker-build) + - [Building the Container](#building-the-container) + - [Running the Container](#running-the-container) + - [docker-compose](#docker-compose) + - [Notes for Running Using docker-compose](#notes-for-running-using-docker-compose) + - [Usage](#usage) + - [Configuration](#configuration) + +<!-- markdown-toc end --> +# MovieNight stream server + +[![Build status](https://api.travis-ci.org/zorchenhimer/MovieNight.svg?branch=master)](https://travis-ci.org/zorchenhimer/MovieNight) + +This is a single-instance streaming server with chat. Originally written to +replace Rabbit as the platform for watching movies with a group of people +online. + +## Build requirements + +- Go 1.13 or newer +- GNU Make + +### Older Go Versions + +You can install a newer version of Go alongside your OS's distribution by +following the guide here: [https://golang.org/doc/install#extra_versions](https://golang.org/doc/install#extra_versions) + +Once you have that setup add an enviromnent variable named `GO_VERSION` and +set it to the version you installed (eg, `1.14.1`). The Makefile will now use +the newer version. + +### Compile and install +You have to : + - download ; + - choose your `TARGET` "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows" + ; + - choose your `ARCH` "386 amd64 amd64p32 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32leppc s390 s390x sparc sparc64" + ; + - and run ; + +```bash +$ git clone https://github.com/zorchenhimer/MovieNight +$ cd MovieNight +$ make TARGET=windows ARCH=386 +$ ./MovieNight +``` + +### Docker build +MovieNight provides a Dockerfile and a docker-compose file to run MovieNight using Docker. + +#### Building the Container +Install Docker, clone the repository and build: + +```shell +docker build -t movienight . +``` + +#### Running the Container +Run the image once it's built: + +```shell +docker run -d -p 8089:8089 -p 1935:1935 [-v ./settings.json:/config/settings.json] movienight +``` + +Explanation: +- **-d** runs the container in the background. +- **-p 8089:8089** maps the MovieNight web interface to port 8089 on the server. +- **-p 1935:1935** maps the RTMP port for OBS to port 1935 (default RTMP port) on the server. +- **-v ./settings.json:/config/settings.json** maps the file *settings.json* into the container. [OPTIONAL] + +#### docker-compose +docker-compose will automatically build the image, no need to build it manually. + +Install Docker and docker-compose, clone the repository and change into the directory *./docker*. Then run: + +```shell +docker-compose up -d +``` + +This docker-compose file will create a volume called *movienight-config* and automatically add the standard *settings.json* file to it. It also maps port 8089 and 1935 to the same ports of the host. + +#### Notes for Running Using docker-compose +The container needs to be restarted to apply any changes you make to *settings.json*. + +## Usage + +Now you can use OBS to push a stream to the server. Set the stream URL to + +```text +rtmp://your.domain.host/live +``` + +and enter the stream key. + +Now you can view the stream at + +```text +http://your.domain.host:8089/ +``` + +There is a video only version at + +```text +http://your.domain.host:8089/video +``` + +and a chat only version at + +```text +http://your.domain.host:8089/chat +``` + +The default listen port is `:8089`. It can be changed by providing a new port +at startup: + +```text +Usage of .\MovieNight.exe: + -e bool + Whether or not to download approved emotes on startup (default "false") + -k string + Stream key, to protect your stream (default: "") + -l string + host:port of the MovieNight (default ":8089") + -r string + host:port of the RTMP server (default ":1935") +``` + +## Configuration + +MovieNight’s configuration is controlled by `settings.json`: + +- `AdminPassword`: users can enter `/auth <value>` into chat to grant themselves + admin privileges. This value is automatically regenerated unless + `RegenAdminPass` is false. +- `ApprovedEmotes`: list of Twitch users whose emotes can be imported into + MovieNight. Using `/addemotes <username>` in chat will add to this list. +- `Bans`: list of banned users. +- `LetThemLurk`: if false, announces when a user enters and leaves chat. +- `ListenAddress`: the port that MovieNight listens on, formatted as `:8089`. +- `LogFile`: the path of the MovieNight logfile, relative to the executable. +- `LogLevel`: the log level, defaults to `debug`. +- `MaxMessageCount`: the number of messages displayed in the chat window. +- `NewPin`: if true, regenerates `RoomAccessPin` when the server starts. +- `PageTitle`: The base string used in the `<title>` element of the page. When + the stream title is set with `/playing`, it is appended; e.g., `Movie Night | The Man Who Killed Hitler and Then the Bigfoot` +- `RegenAdminPass`: if true, regenerates `AdminPassword` when the server starts. +- `RoomAccess`: the access policy of the chat room; this is managed by the + application and should not be edited manually. +- `RoomAccessPin`: if set, serves as the password required to enter the chatroom. +- `SessionKey`: key used for storing session data (cookies etc.) +- `StreamKey`: the key that OBS will use to connect to MovieNight. +- `StreamStats`: if true, prints statistics for the stream on server shutdown. +- `TitleLength`: the maximum allowed length for the stream title (set with `/playing`). +- `TwitchClientID`: OAuth client ID for the Twitch API, used for fetching emotes +- `TwitchClientSecret`: OAuth client secret for the Twitch API; [can be generated locally with curl](https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-client-credentials-flow). +- `WrappedEmotesOnly`: if true, requires that emote codes be wrapped in colons + or brackets; e.g., `:PogChamp:` +- `RateLimitChat`: the number of seconds between each message a non-privileged + user can post in chat. +- `RateLimitNick`: the number of seconds before a user can change their nick again. +- `RakeLimitColor`: the number of seconds before a user can change their color again. +- `RateLimitAuth`: the number of seconds between each allowed auth attempt +- `RateLimitDuplicate`: the numeber of seconds before a user can post a + duplicate message. +- `NoCache`: if true, set `Cache-Control: no-cache, must-revalidate` in the HTTP + header, to prevent caching responses. + +## License + +`flv.js` is Licensed under the Apache 2.0 license. This project is licened under the MIT license. From 23793f4b3c0b07eae8b4e51952dcb48ba82b1c53 Mon Sep 17 00:00:00 2001 From: Bertrand Moreau <bertrand.moreau-prestataire@ca-cib.com> Date: Wed, 19 Aug 2020 14:20:45 +0200 Subject: [PATCH 03/15] CleverCloud deploy conf --- clevercloud/go.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 clevercloud/go.json diff --git a/clevercloud/go.json b/clevercloud/go.json new file mode 100644 index 0000000..aa93730 --- /dev/null +++ b/clevercloud/go.json @@ -0,0 +1,7 @@ +{ + "deploy": { + "appIsGoPath": false, + "main": "MovieNight", + "execDir": "./" + } +} From b75f9e6ca0431fdd6cf89bb449bd59c138165525 Mon Sep 17 00:00:00 2001 From: Zorglube <630192+zorglube@users.noreply.github.com> Date: Wed, 19 Aug 2020 14:30:40 +0200 Subject: [PATCH 04/15] Clever Cloud : "appIsGoPath": true, --- clevercloud/go.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clevercloud/go.json b/clevercloud/go.json index aa93730..e05b1ed 100644 --- a/clevercloud/go.json +++ b/clevercloud/go.json @@ -1,6 +1,6 @@ { "deploy": { - "appIsGoPath": false, + "appIsGoPath": true, "main": "MovieNight", "execDir": "./" } From dcad017738eeadcaf8894a12fb9e1307ac59ae52 Mon Sep 17 00:00:00 2001 From: Zorglube <630192+zorglube@users.noreply.github.com> Date: Wed, 19 Aug 2020 14:34:16 +0200 Subject: [PATCH 05/15] Clever Cloud : "appIsGoPath": false --- clevercloud/go.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clevercloud/go.json b/clevercloud/go.json index e05b1ed..aa93730 100644 --- a/clevercloud/go.json +++ b/clevercloud/go.json @@ -1,6 +1,6 @@ { "deploy": { - "appIsGoPath": true, + "appIsGoPath": false, "main": "MovieNight", "execDir": "./" } From 5d0786577e6dd5de07fab2a33dff7b0a2b3264e6 Mon Sep 17 00:00:00 2001 From: Zorglube <630192+zorglube@users.noreply.github.com> Date: Wed, 19 Aug 2020 14:45:30 +0200 Subject: [PATCH 06/15] "appIsGoPath": true --- clevercloud/go.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clevercloud/go.json b/clevercloud/go.json index aa93730..e05b1ed 100644 --- a/clevercloud/go.json +++ b/clevercloud/go.json @@ -1,6 +1,6 @@ { "deploy": { - "appIsGoPath": false, + "appIsGoPath": true, "main": "MovieNight", "execDir": "./" } From 762d62b92afdc6ef3ab68c911c4f43081ee0afc7 Mon Sep 17 00:00:00 2001 From: Bertrand Moreau <bertrand.moreau-prestataire@ca-cib.com> Date: Wed, 19 Aug 2020 14:47:24 +0200 Subject: [PATCH 07/15] Revert ""appIsGoPath": true" This reverts commit 5d0786577e6dd5de07fab2a33dff7b0a2b3264e6. --- clevercloud/go.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clevercloud/go.json b/clevercloud/go.json index e05b1ed..aa93730 100644 --- a/clevercloud/go.json +++ b/clevercloud/go.json @@ -1,6 +1,6 @@ { "deploy": { - "appIsGoPath": true, + "appIsGoPath": false, "main": "MovieNight", "execDir": "./" } From fd6ad1900b7472b38a66ed1df93fde7d1a8b0387 Mon Sep 17 00:00:00 2001 From: Bertrand Moreau <bertrand.moreau-prestataire@ca-cib.com> Date: Wed, 19 Aug 2020 14:47:24 +0200 Subject: [PATCH 08/15] Revert "Clever Cloud : "appIsGoPath": false" This reverts commit dcad017738eeadcaf8894a12fb9e1307ac59ae52. --- clevercloud/go.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clevercloud/go.json b/clevercloud/go.json index aa93730..e05b1ed 100644 --- a/clevercloud/go.json +++ b/clevercloud/go.json @@ -1,6 +1,6 @@ { "deploy": { - "appIsGoPath": false, + "appIsGoPath": true, "main": "MovieNight", "execDir": "./" } From 222560faa3e9001e4e87d11521acb632021f0274 Mon Sep 17 00:00:00 2001 From: Bertrand Moreau <bertrand.moreau-prestataire@ca-cib.com> Date: Wed, 19 Aug 2020 14:47:24 +0200 Subject: [PATCH 09/15] Revert "Clever Cloud : "appIsGoPath": true," This reverts commit b75f9e6ca0431fdd6cf89bb449bd59c138165525. --- clevercloud/go.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clevercloud/go.json b/clevercloud/go.json index e05b1ed..aa93730 100644 --- a/clevercloud/go.json +++ b/clevercloud/go.json @@ -1,6 +1,6 @@ { "deploy": { - "appIsGoPath": true, + "appIsGoPath": false, "main": "MovieNight", "execDir": "./" } From 36bd14b933ef3e4a56741114a3d637bc052458a5 Mon Sep 17 00:00:00 2001 From: Zorglube <630192+zorglube@users.noreply.github.com> Date: Wed, 19 Aug 2020 15:50:32 +0200 Subject: [PATCH 11/15] GitHub CI/CD --- .github/workflows/go.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..ae14b35 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,37 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + + - name: Build + run: TARGET="FreeBSD" ARCH="amd64" go build -o MovieNight + + - name: Test + run: go test -v . From 2bf8279eeea12b7073947dfbd8b12d6121f0a01a Mon Sep 17 00:00:00 2001 From: Zorglube <630192+zorglube@users.noreply.github.com> Date: Wed, 19 Aug 2020 16:02:02 +0200 Subject: [PATCH 12/15] Release FreeBSD --- .github/workflows/go.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ae14b35..8c1493d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,6 +5,8 @@ on: branches: [ master ] pull_request: branches: [ master ] + release: + types: [created] jobs: @@ -35,3 +37,15 @@ jobs: - name: Test run: go test -v . + + release-freebsd-amd64: + name: release freebsd/amd64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: wangyoucao577/go-release-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: FreeBSD + goarch: amd64 + From 01014bcb6c3ad55359b7b737fcd5a215d8dec863 Mon Sep 17 00:00:00 2001 From: Zorglube <630192+zorglube@users.noreply.github.com> Date: Wed, 19 Aug 2020 16:04:49 +0200 Subject: [PATCH 13/15] Release update --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8c1493d..19e10fd 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: wangyoucao577/go-release-action@master + - uses: zorglube/go-release-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} goos: FreeBSD From 142fbf27b2d9fefa566e87c88295b19d83c1f341 Mon Sep 17 00:00:00 2001 From: Bertrand Moreau <bertrand.moreau-prestataire@ca-cib.com> Date: Wed, 19 Aug 2020 16:07:36 +0200 Subject: [PATCH 14/15] Remove release --- .github/workflows/go.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 19e10fd..ae14b35 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,8 +5,6 @@ on: branches: [ master ] pull_request: branches: [ master ] - release: - types: [created] jobs: @@ -37,15 +35,3 @@ jobs: - name: Test run: go test -v . - - release-freebsd-amd64: - name: release freebsd/amd64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: zorglube/go-release-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - goos: FreeBSD - goarch: amd64 - From 63c8c25aadeb8d886411692a2c5c2299521e7170 Mon Sep 17 00:00:00 2001 From: Bertrand Moreau <bertrand.moreau-prestataire@ca-cib.com> Date: Wed, 19 Aug 2020 16:09:25 +0200 Subject: [PATCH 15/15] Remove git workflow --- .github/workflows/go.yml | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index ae14b35..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Go - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - - build: - name: Build - runs-on: ubuntu-latest - steps: - - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.13 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - - name: Build - run: TARGET="FreeBSD" ARCH="amd64" go build -o MovieNight - - - name: Test - run: go test -v .