A Chemical Kinetics Simulator Game as a webapp, written in Python.
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
Make sure you are in the correct conda env:
conda activate ckw
To run CKWatson with Redis and gunicorn:
- In one terminal, execute
redis-server
. - 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
.
You can either run CKWatson as a single container or with Redis using Docker Compose.
To run CKWatson as a single container:
- Build the image:
docker build -t ckw .
- Start a container:
docker run -p 80:80 --rm --name ckwatson ckw
To run CKWatson with Redis, simply use docker-compose up
.
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
Please use this Buildpack for Auto-Deployment Support on submodules.
kernel
is where the actual code are stored.puzzles
is the repository of puzzle definitions. Admin can add puzzles there using thecreate
page.web
stores the server program for web-based GUI. It translates user inputs into codes that thekernel
could understand.results
stores the computed results as well as plotted figures generated by thekernel
. Not really human-readable.