Skip to content

A Chemical Kinetics Simulator Game as a web-app, written in Python.

License

Notifications You must be signed in to change notification settings

ckwatson/web_gui

Repository files navigation

CKWatson Online

JavaScript Style Guide Code style: black pre-commit

A Chemical Kinetics Simulator Game as a webapp, written in Python.

Screenshot

Installation

Assuming you use mambaforge as your environment manager:

git clone https://github.com/ckwatson/web_gui.git
cd web_gui
git submodule update --init --recursive
mamba create -n ckw python=3.8 redis=5.0.3 -y
conda activate ckw
pip install -r requirements.txt

Setup

Make sure you are in the correct conda env:

conda activate ckw

To run CKWatson with Redis and gunicorn:

  1. In one terminal, execute redis-server.
  2. Then, in another terminal: gunicorn run:app --worker-class gevent --bind 127.0.0.1:80 --reload --timeout 6000

Alternatively, you can run the boot script directly: run.py

This uses Flask itself to host the server, but would lose the ability to send Server-Sent Events.

Either way, if the program encounters problems binding to the port 80, try sudo.

Deployment

Via Docker

You can either run CKWatson as a single container or with Redis using Docker Compose.

To run CKWatson as a single container:

  1. Build the image: docker build -t ckw .
  2. Start a container: docker run -p 80:80 --rm --name ckwatson ckw

To run CKWatson with Redis, simply use docker-compose up.

Via Kubernetes

I will be using minikube in this walkthrough. I will be using the local Docker Registry as the source of the Kubenetes image.

# Start the cluster:
minikube start
# Register the Docker Registry to minikube -- This is because we will be building the image from the Dockerfile for Kubenetes:
eval $(minikube docker-env)
# Build the Docker image for Kubenetes:
docker build -t ckw .
# Apply the Deployment (which manages the Pods/"virtual hosts" in the minikube cluster for the app) as well as the Service (which is a Load Balancer in this case that exposes the web app in the Pods) using the manifest file:
kubectl apply -f ./k8s
# Access the web app:
minikube service web

On Heroku

Please use this Buildpack for Auto-Deployment Support on submodules.

Folder Structure

  • kernel is where the actual code are stored.
  • puzzles is the repository of puzzle definitions. Admin can add puzzles there using the create page.
  • web stores the server program for web-based GUI. It translates user inputs into codes that the kernel could understand.
  • results stores the computed results as well as plotted figures generated by the kernel. Not really human-readable.

About

A Chemical Kinetics Simulator Game as a web-app, written in Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published