Skip to content

avacore1337/new-queue

Repository files navigation

new-queue

This the the new queue system for KTH (semi-official), rewritten in Rust and React. The old one can be found here but is no longer in service.

The system is current running at https://queue.csc.kth.se and help students and teachers keep track of who's next to present and/or get help. For help/support please direct your questions to [email protected].

Setup

sudo apt install libssl-dev pkg-config -y
sudo apt install postgresql postgresql-contrib -y
sudo apt install libpq-dev openssl -y
cp .env.example .env

Get rust nightly

Get rustup (nightly version)

run script, but pick nightly instead of stable. Subject to change when next time rocket is upgraded

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

rust version is managed by rust-toolchain.toml and should be automatically handled by cargo build

Install Diesel CLI

cargo install diesel_cli --no-default-features --features postgres

Setup postgresql

In case postgresql doesn't automaticaly start, run:

sudo service postgresql start

setup a user with your current username.

You know it works when you can run psql when logged in as your normal user.

Then run:

./reset_database.sh

If you want to reset your database you can just run the script again.

All the script really does is to run:

  • psql -f init.sql
  • diesel migration run
  • psql -f testing.sql

Setting up production

When setting up for production you need to create a database with password, and then add the new settings to the .env file.

The .env file also need a new secret so that auth tokens can't be decrypted.

Then simply run diesel migration run and then start the server in production mode with:

cargo run --release

Since things need to be reliable you probably want to enable auto-restart, start on boot, static serve, firewall, https certificates, etc. All the settings to set this up on a standard ubuntu 18.04, using Systemd and Nginx is available under the devops folder. The current setting assume that you use let's encrypt. Example instructions for how to set up can be found here.

Working Localy

Building

Build the project

cargo build

Starting the webserver

Start the project using

cargo run

In this mode anyone can log in as anyone by going to /mocklogin

Tips and tricks

Run new migrations with

diesel migration run

revert migrations with

diesel migration revert

Use sqlformat:

pip install sqlparse
sqlformat --reindent queue_history.sql -o queue_history.sql

Install debuggin extensions for React and Redux (Chrome)

(Firefox)

guides

Features and Bugs

Backend wants:

  • routing framework
  • backend websockets leave/errors
  • can we please rename "help" to something else? Or make it an enum perhaps

Frontend wants

  • [Feature] Anything else?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •