mendia 1.1.1

Dashboard collecting every movie in your friend group that tells notifies everyone on telegram whenever a new one came in.
mendia-1.1.1 is not a library.
Visit the last successful build: mendia-1.7.1

Mendia

Dependencies - Windows

Use an elevated powershell for the commands in the Windows section. Elevated means that the shell must have administrator rights.

Enable WSL2

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Download & Install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

wsl --set-default-version 2

Do a restart.

Chocolatey

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install vscode rust nodejs docker-desktop git mysql python

Installation

git clone https://gitlab.com/derfreak/mendia.git
cd mendia
rustup update

Create the environment variable MYSQLCLIENT_LIB_DIR. If mysql was installed with chocolatey the variable should probably point to C:\tools\mysql\current\lib where the file mysqlclient.lib is stored.

cargo install diesel_cli --no-default-features --features mysql

Create a virtual environment for python and install

pip install virtualenv
python -m virtualenv venv

Activate the environment and install the dependencies

source venv/Scripts/activate
pip install -r requirements.txt

Enable pre-commit

pre-commit install

Usage

Docker

This project uses Docker extensively, in order to start everything do

invoke docker

This whill take a while the first time, but consecutive runs should be faster.

Frontend

The frontend is a svelte application built with vite. Start the development server with

invoke frontend

Backend

The backend is written in rust running serving an api via a websocket connection.

See the Docker section if you do not plan development on the backend.

If you want to develop the backend it is better to start it manually

invoke backend

Make also sure to update the Caddyfile. The hostname of the /api/* route points to the docker instane of the backend. For local development change mendia to host.docker.internal

handle_path /api/* {
    reverse_proxy host.docker.internal:8000
}

Update the docker stack again with

invoke docker

Build the pipeline image

docker login registry.gitlab.com
docker build -t registry.gitlab.com/derfreak/mendia:latest .
docker push registry.gitlab.com/derfreak/mendia:latest

Upgrade packages

Install dependencies

cargo install -f cargo-upgrades
cargo install -f cargo-edit

Upgrade packages

cargo update

Database

The database contains important data like users and movies.

Users

Create users or update the password of an existing user

cd backend
cargo run --bin admin -- --config ./admin-config.yml --create-user USERNAME
Create/Update tables

Create tables via

cd backend/types
diesel migration --database-url mysql://root:example@127.0.0.1/mendia generate movies

Apply migration with

cd backend/types
diesel migration --database-url mysql://root:example@127.0.0.1/mendia run

Undo migration with

cd backend/types
diesel migration --database-url mysql://root:example@127.0.0.1/mendia redo
Testdata

This repository contains an example movie table. It can be imported with docker:

docker exec -i docker-db-1 mysql -uroot -pexample mendia < docker/data/mysql/movies.sql

License

Licensed under MIT