Skip to content

xszym/UMCS-lights

Repository files navigation

UMCS-lights

Pipeline status coverage report

The building of the Institute of Computer Science at University of Marie Curie Sklodowska is equipped with lights. Each window has a RGB LED panel that can be programmed.

The application will allow users to create scenes and animations that will be displayed on the Institute Building. Additionally, the moderator will be able to manage the displayed animation and the queue of future animations.

Contributors


Maciej Prostak

Jira 👀

Mateusz Moruś

Jira 👀

Dorota Zaremba

Jira 👀

Szymon Szostak

Jira 👀

Run application

docker-compose up

Create superuser

docker-compose exec backend python manage.py createsuperuser

Migrations

Run migrations when server is running

docker-compose exec backend python manage.py makemigrations
docker-compose exec backend python manage.py migrate

Static files

docker-compose exec backend python manage.py collectstatic

Testing

docker-compose exec backend pytest

Coverage:

docker-compose exec backend pytest -p no:warnings --cov=. --cov-report html

Linter

Flake8 (formatting)

docker-compose exec backend flake8 .

Black (formatting)

docker-compose exec backend black --check --exclude=migrations .
docker-compose exec backend black --diff --exclude=migrations .
docker-compose exec backend black --exclude=migrations .

ISort (sorting)

docker-compose exec backend isort . --check-only
docker-compose exec backend isort . --diff

Apply changes

docker-compose exec backend isort .

Setup deploy

  1. Login to your ssh server (Install docker and docker-compose)

  2. Create new user

sudo adduser deployer
  1. Add the user to the Docker group
sudo usermod -aG docker deployer
  1. Log in to created account
su deployer
  1. Generate ssh key
ssh-keygen -b 4096
  1. Add generated public key to authorized keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  1. Copy private key
cat ~/.ssh/id_rsa
  1. Log in to GitLab and go to Settings > CI / CD > Variables

  2. Click Add Variable:

    • Key: ID_RSA
      Value: Paste your SSH private key
      Type: File
      Environment Scope: All (default)
      Protect variable: Checked
      Mask variable: Unchecked

    • Key: SERVER_IP
      Value: your_server_IP
      Type: Variable
      Environment scope: All (default)
      Protect variable: Checked
      Mask variable: Checked

    • Key: SERVER_USER
      Value: deployer
      Type: Variable
      Environment scope: All (default)
      Protect variable: Checked
      Mask variable: Checked

    • Key: SERVER_SSH_PORT
      Value: your_server_SSH_PORT
      Type: Variable
      Environment scope: All (default)
      Protect variable: Checked
      Mask variable: Checked

  3. Clone this repository

git clone https://github.com/xszym/UMCS-lights/
  1. To fix issue with Remote error from secret service: org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.Secret.Collection' on object at path /org/freedesktop/secrets/collection/#:
sudo apt install gnupg2 pass