A server shell for you to play with Powered by Django + Nginx + Postgres + Bootstrap + Celery.

Overview

Template server

A server shell for you to play with

Powered by Django + Nginx + Postgres + Bootstrap + Celery.


Getting started

  1. Install Docker Community Edition
  2. Install docker-compose into python3, e.g. pip3 install --user docker-compose
  3. Add your user to the docker group. sudo usermod -a -G docker username ; you may have to reboot after this step for you to show up in the group.
  4. Create a file .local_params in the root directory using .local_params_examples as a template. Read section "Running jobs" for the details.

You should then use the local-docker-compose script as a drop in replacement for docker-compose. For example, to start the server you can run local-docker-compose up --build.

Cleaning up after docker for a clean rebuild:

  1. ./cluspro-docker-compose rm will remove the containers
  2. docker volume prune

If you don't explicitly remove the volumes between docker runs, the databases persist, so you can stop the containers and launch them again safely without any loss of data.

Architecture

Docker runs several services: web (which runs Gunicorn), nginx, db (Postgres database). Gunicorn handles the python (Django) code, accesses the database and cooperates with Nginx. Celery is a background task manager and it need rabbitMQ to run (message broker). Flower is a task monitor, which is powered by Celery. It can be accessed at localhost:5555

Structure

All the frontend code is located in server/. The structure of server/ directory is enforced by the Django rules, so we have server/server, where all the server settings are located (settings.py) as well as config.py. config.py is where the custom variables are kept (e.g. email login and password for sending messages to the user), which in turn are populated from the environment, which is set in docker-compose.yml.
core/ contains the app code, as it's called in Django. core/templates has all the html files, core/static - CSS and JS, and runner/ contains the code for job running.

Core/ structure

  1. views.py is the main file - it has functions, which render the pages and handle all the forms and requests. Most of functions return an HTML response.

  2. urls.py assigns URLs to the functions in views.py.

  3. models.py contains custom data tables, which are added to the default Django tables. Right now it contains a model for jobs, which can be customized as you wish. The intention, however, was to keep all the generic job fields as separate class attributes (job name, IP etc.) and to store all the rest job specific parameters as a json string in details_json field. This way we can prevent creating many different tables for different job types or addition of infinite new fields to the same job table (once we add new job parameters, for example).

  4. All the forms on the website are contained in forms.py and it should be kept so. These forms are all handled in views.py.

  5. emails.py has messages for users, whenever we want to send them something. They use the e-mail address and password specified in server/settings.py, which are in turn taken from environmental variables in docker-compose.yml. If they were not specified you will get an error, whenever the server is trying to send a message.

  6. env.py is where you should keep your local variables. Also all the variables in env dictionary will be passed as a context to the html templates, so you can refer to them in the templates.

At the first launch

Two users are created.

  1. admin with password 'admin'. This is a superuser, you should change the password for it immediately. The admin page is located at http://localhost:8080/admin
  2. anon, which is where you log in once you click 'use without your own account' button on the login page. It has limited permissions.

Also storage/ directory is created in the root, where all the jobs will be kept.

Jobs

When you run jobs they are stored in docker container in /storage, which is by default mounted in your project root. You can change this in docker-compose.yml. Storage has two directories: tmp/ for temporary storage, if you need to compute or check something before adding the job to the database, and jobs/ with all the jobs.


Running jobs

Jobs

Currently a job performs addition of two integer numbers. Some additional requirements are added to demonstrate how to use error pop-ups etc. The task itself is located in models.py.

.local_params

Environmental variables with some paths, e-mail login and password are stored in .local_params, which are used when you run local-docker-compose. To create the file use .local_params_example as a template.

Variables for sending e-mails. If you don't specify them, everything will still run, but you will get errors when new users register etc. If your e-mail is [email protected] and the password is password then the values should be:

EMAIL_USER - server
EMAIL_PASS - password
EMAIL_HOST - smtp.gmail.com

RABBITMQ_USER and RABBITMQ_PASS will be generated and added to .local_params at the first run of local-docker-compose, unless specified by the user.

LOCAL_PORT is the port, through which you access the server (default is 8080)

SECRET_KEY is for Django internal use (is generated at the first run of local-docker-compose) and should be kept secret.

Owner
Mengting Song
Mengting Song
pyRTOS is a real-time operating system (RTOS), written in Python.

pyRTOS Introduction pyRTOS is a real-time operating system (RTOS), written in Python. The primary goal of pyRTOS is to provide a pure Python RTOS that

Ben Williams 96 Dec 30, 2022
Nesse repositório serão armazenados os conteúdos de aula

Lets_Code_DS_Degree_Alunos Nesse repositório serão armazenados os conteúdos de aula Formato das aulas: Notebook de aula já vem comentado para reduzir

Patricia Bongiovanni Catandi 6 Jan 21, 2022
OntoSeer is a tool to help users build better quality ontologies

Ontoseer This document provides documentation for the first version of OntoSeer.OntoSeer is a tool that monitors the ontology development process andp

Knowledgeable Computing and Reasoning Lab 9 Aug 15, 2022
A simple code for processing images to local binary pattern.

This figure is gotten from this link https://link.springer.com/chapter/10.1007/978-3-030-01449-0_24 LBP-Local-Binary-Pattern A simple code for process

Happy N. Monday 3 Feb 15, 2022
A rough GSL work DynSAGE of my graduation project

DynSAGE Codes w.r.t DynSAGE-Diffuse can be found in function apply_dyn_model_v2 of src/utils.py. The training entrance is Line 144 - 155 of src/main.p

Yuhan Wang 3 Mar 22, 2022
A Python simple Dice Simulator just for fun

Dice Simulator 🎲 A Simple Python Dice Simulator 🧩 🎮 💭 Description: That program make your RPG session more easy and simple. Roll the dice never be

Lauro Brant 17 May 14, 2022
The Ultimate Widevine Content Ripper (KEY Extract + Download + Decrypt) is REBORN

NARROWVINE-REBORN ** UPDATE 21.12.01 ** As expected Google patched its ChromeCDM Whitebox exploit by Satsuoni with a force-update on the ChromeCDM. Th

Vank0n 104 Dec 07, 2022
Height 2 LDraw With python

Height2Ldraw About This project aims to be able to make a full lego 3D model using the ldraw file format (.ldr) from a height and color map, currently

1 Dec 22, 2021
This is a Python package named - calculator

Calculator Python Package This is a Calculator Package of Python. How To Install The Package? Install calchundred with pip (Package Installer Of Pytho

Arinjoy_Programmer 1 Nov 21, 2021
HomeAssistant Linux Companion

Application to run on linux desktop computer to provide sensors data to homeasssistant, and get notifications as if it was a mobile device.

Javier Lopez 10 Dec 27, 2022
A streaming animation of all the edits to a given Wikipedia page.

WikiFilms! What is it? A streaming animation of all the edits to a given Wikipedia page. How it works. It works by creating a "virtual camera," which

Tal Zaken 2 Jan 18, 2022
This library attempts to abstract the handling of Sigma rules in Python

This library attempts to abstract the handling of Sigma rules in Python. The rules are parsed using a schema defined with pydantic, and can be easily loaded from YAML files into a structured Python o

Caleb Stewart 44 Oct 29, 2022
Repository for DNN training, theory to practice, part of the Large Scale Machine Learning class at Mines Paritech

DNN Training, from theory to practice This repository is complementary to the deep learning training lesson given to les Mines ParisTech on the 11th o

Alexandre Défossez 6 Nov 14, 2022
Программа для практической работы №12 по дисциплине

Информатика: программа для практической работы №12 Код и блок-схема программы для практической работы №12 по дисциплине "Информатика" (I семестр). Сут

Vladislav 1 Dec 07, 2021
A log likelihood fit for extracting neutrino oscillation parameters

A-log-likelihood-fit-for-extracting-neutrino-oscillation-parameters Minimised the negative log-likelihood fit to extract neutrino oscillation paramete

Vid Homsak 1 Jan 23, 2022
A simple but complete exercise to learning Python

ResourceReservationProject This is a simple but complete exercise to learning Python. Task and flow chart We are going to do a new fork of the existin

2 Nov 14, 2022
Using Python to parse through email logs received through several backup systems.

outlook-automated-backup-control Backup monitoring on a mailbox: In this mailbox there will be backup logs. The identification will based on the follo

Connor 2 Sep 28, 2022
Mechanized literally means automation.

Mechanized literally means automation. And this branch which you are now observing is automated by the python script. This python project actually automates my workflow related to Git & Github.

Shreejan Dolai 4 Nov 11, 2022
Block when attacker want to bypass the limit of request

Block when attacker want to bypass the limit of request

iFanpS 1 Dec 01, 2021
Script to automate the scanning of "old printed photos"

photoscanner Script to automate the scanning of "old printed photos" Just run: ./scan_photos.py The script is prepared to be run by fades. Otherw

Facundo Batista 2 Jan 21, 2022