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
Refer'd Resume Scanner

Refer'd Resume Scanner I wanted to share a free resource we built to assist applicants with resume building. Our resume scanner identifies potential s

Refer'd 74 Mar 07, 2022
Python wrapper to different clients to determine how a particular term is used.

Python wrapper to different clients to determine how a particular term is used.

Chris Mungall 3 Oct 24, 2022
A Notifier Program that Notifies you to relax your eyes Every 15 Minutes👀

Every 15 Minutes is an application that is used to Notify you to Relax your eyes Every 15 Minutes, This is fully made with Python and also with the us

FSP Gang s' Admin 1 Nov 03, 2021
A normal phoneNumber tracker made with python.

A normal phoneNumber tracker made with python.

CLAYZANE 2 Dec 30, 2021
MySQL Connectivity based project. Contains various functions of a Store-Management-System

An Intermediate Level Python - MySQL Connectivity based project. Contains various functions of a Store-Management-System.

Yash Wadhvani 2 Nov 21, 2022
A free website that keeps the people informed about housing and evictions.

Eviction Tracker Currently helping verify detainer warrant data for middle Tennessee - via Middle TN DSA - Red Door Collective Features Presents data

Red Door Collective 7 Dec 14, 2022
SuperMario - Python programming class ending assignment SuperMario, using pygame

SuperMario - Python programming class ending assignment SuperMario, using pygame

mars 2 Jan 04, 2022
Hack CMU Go Local Project

GoLocal A submission for the annual HackCMU Hackathon. We built a website which connects shopper with local businesses. The goal is to drive consumers

2 Oct 02, 2021
This is a multi-app executor that it used when we have some different task in a our applications and want to run them at the same time

This is a multi-app executor that it used when we have some different task in a our applications and want to run them at the same time. It uses SQLAlchemy for ORM and Alembic for database migrations.

Majid Iranpour 5 Apr 16, 2022
🐍 This snake helps you reconnect the Web, with RSS feeds!

This snake helps you reconnect the Web, with RSS feeds! RSSerpent is an open-source software that create RSS feeds for websites that do not provide an

211 Dec 08, 2022
Context-free grammar to Sublime-syntax file

Generate a sublime-syntax file from a non-left-recursive, follow-determined, context-free grammar

Haggai Nuchi 8 Nov 17, 2022
Quanser Labs Robotic Arm With Python

Quanser-Labs-Robotic-Arm As a team, we programmed a Robotic-Arm in Python on the

1 Jul 11, 2022
use Notepad++ for real-time sync after python appending new log text

FTP远程log同步工具 使用Notepad++配合来获取实时更新的log文档效果 适用于FTP协议的log远程同步工具,配合MT管理器开启FTP服务器使用,通过Notepad++监听文本变化,更便捷的使用电脑查看方法注入打印后的信息 功能 过滤器 对每行要打印的文本使用回调函数筛选,支持链式调用

Liuhaixv 1 Oct 17, 2021
a really simple bot that send you memes from reddit to whatsapp

a really simple bot that send you memes from reddit to whatsapp want to use use it? install the dependencies with pip3 install -r requirements.txt the

pai 10 Nov 28, 2021
Collapse a set of redundant kmers to use IUPAC degenerate bases

kmer-collapse Collapse a set of redundant kmers to use IUPAC degenerate bases Overview Given an input set of kmers, find the smallest set of kmers tha

Alex Reynolds 3 Jan 06, 2022
GUI tool to manage the contents of chests in Botw

Botw chest manager is a small gui tool allowing to easily manage chests. Sometimes Ice Spear can be very time consuming when adding a simple chest. The purpose of this light tool is to add a new ches

3 Aug 25, 2022
A module to prevent invites and joins to Matrix rooms by checking the involved server(s)' domain.

Synapse Domain Rule Checker A module to prevent invites and joins to Matrix rooms by checking the involved server(s)' domain. Installation From the vi

matrix.org 4 Oct 24, 2022
一个Graia-Saya的插件仓库

一个Graia-Saya的插件仓库 这是一个存储基于 Graia-Saya 的插件的仓库 如果您有这类项目

ZAPHAKIEL 111 Oct 24, 2022
Datamol is a python library to work with molecules.

Datamol is a python library to work with molecules. It's a layer built on top of RDKit and aims to be as light as possible.

datamol 276 Dec 19, 2022
The git for the Python Story Utility Package library.

PSUP, The Python Story Utility Package Module. PSUP helps making stories or games with options, diverging paths, different endings and so on. You can

Enoki 6 Nov 27, 2022