Skip to content

Vorlent/cozycast

Repository files navigation

CozyCast

CozyCast is an open-source platform designed for seamless video streaming over the internet. CozyCast offers an interactive and collaborative web browsing experience by providing remote access to web-based features, such as virtual desktops, user account management, and chat functionality.

Getting Started

Installation

  1. Clone this repository:
git clone https://github.com/Vorlent/cozycast.git
  1. Install Docker and Docker Compose. See the example for Arch:
sudo pacman -S docker docker-compose
sudo systemctl enable docker.socket
sudo systemctl start docker.socket

Visit https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ for Ubuntu installation instructions. Make sure to also install Docker Compose.

Configuration

  1. Create the .env file with the following environment variables:
export PRIVATE_IP=$(hostname -I | awk '{print $1}')
export PUBLIC_IP=$(curl ifconfig.me)

export TURN_IP=$PUBLIC_IP
export KURENTO_IP=$PRIVATE_IP
export COZYCAST_IP=$PRIVATE_IP

export SOURCE_URL=#<url>#

export COZYCAST_DB_HOST=postgres
export NETWORK_INTERFACES=#<your network interface here: eth0/wlo1/...>#

If you are using the provided terminal commands for the IP addresses, it is advised to check if they return the correct values.

If you have made modifications to the source code then it is recommended to set SOURCE_URL to point to the modified source code (e.g. git/github repository or downloadable zip file) to ensure compliance with the AGPL. If you have not made any modifications then you can simply set it to https://github.com/Vorlent/cozycast.

  1. Optional but recommended for https:
export MICRONAUT_ENVIRONMENTS=ssl
export DUCKDNS_TOKEN=#<token to set txt record'>#
export DUCKDNS_DOMAIN=#<duck dns domain>#
export KEYSTORE_PASSWORD=#<arbitrary_secret_value>#
export FORCE_HTTPS=true

If you set FORCE_HTTPS to true you won't be abble to access your website through http. Please keep that in mind.

  1. Optional but highly recomended if you are running both worker and server on the same machine:
export LOCAL_WORKER=true
  1. Random strings for the following secrets and passwords will be autogenerated and stored in the cozycast/data directory. Make sure the directory is writeable/readable.
TURN_SECRET
COZYCAST_DB_PASS
COZYCAST_JWT_SECRET
COZYCAST_INIT_ADMIN_PASSWORD

Usage

Start CozyCast with the following commands:

./cozycast build
./cozycast start

Afterwards you should be able to reach CozyCast through your public ip address or the dns server if you have configured one.

It is only necessary to build cozycast once. Only rebuild it if you have made any changes to the source code.

To stop CozyCast and clean up all processes, run:

./cozycast stop

On startup an admin account will be automatically created, with the username admin and an auto generated password which will be stored inside the cozycast/data folder. You can use this account to promote other users to admins.

There should appear a room named default which you can use.

On first startup you might not be able to create new accounts or join the room without being an admin. These settings can be configured inside of the room with an admin account. There is also an admin section on the front page of the website in which you can configure account creation.

Development

For development it is necessary to build cozycast at least once. Afterwards, you can start a dev environment with:

./cozycast dev

Any changes made to the source code will automatically restart and recompile the correct components while being in dev mode. A second ./build should not be required for further dev work.

To stop the dev environment use the regular:

./cozycast stop

You can also change your env file for local development to:

export PRIVATE_IP=$(hostname -I | awk '{print $1}')
export PUBLIC_IP=$PRIVATE_IP

Afterwards, you can reach the server via localhost or using your private IP address directly with any devices on your network.

For database acces you can use the following command after starting the instance with:

./cozycast db

Use regular SQL queries to check the data.

For debug informations you should check the docker containers and print out their logs to the terminal. If you are using VS Code the Docker extension is here highly recommended.

For the front-end development this browser plugin is recommended: https://preactjs.github.io/preact-devtools/ which will provide additional information if the application was started in the dev mode.

Troubleshooting

If you are experiencing some kind of problem on startup, please first make sure that you have the docker environment set up correctly. It also might be necessary to run the commands with sudo.

Currently, only the workers can create rooms, which can take a while. So please try waiting and refreshing your window first if you don't see any rooms. If you still don't see one after that, check the Docker worker logs for any issues. Restarting is advised if you see problems related to PulseAudio.

There is currently a bug with some browsers that prevents you from watching two separate instances of CozyCast simultaneously. This means that if you have two different servers running, one of the streams won't load. If you experience endless loading time, try closing one of the tabs and then refreshing the other.