How to run Capsul locally
Ensure you have the pre-requisites for the psycopg2 Postgres database adapter package:
sudo apt install python3-dev libpq-dev pg_config --version
Ensure you have the wonderful
pipenv python package management and virtual environment cli:
sudo apt install pipenv
Create python virtual environment and install packages:
Run an instance of Postgres (I used docker for this, you can use whatever you want, point is its listening on
docker run --rm -it -e POSTGRES_PASSWORD=dev -p 5432:5432 postgres
Run the app
pipenv run flask run
or, using Gunicorn:
pipenv run gunicorn --bind 127.0.0.1:5000 -k gevent --worker-connections 1000 app:app
Note that by default when running locally, the
SPOKE_MODEL is set to
mock, meaning that it won't actually try to spawn vms.
Crediting your account
Once you log in for the first time, you will want to give yourself some free capsulbux so you can create fake capsuls for testing.
pipenv run flask cli sql -c "INSERT INTO payments (email, dollars) VALUES ('<your email address here>', 20.00)"
Running scheduled tasks:
pipenv run flask cli cron-task
If you have Docker and Docker-Compose installed, you can use the
3wordchant/capsul-flask Docker image to launch capsul-flask, and a Postgres
database server, for you:
capsul-flask will read settings from your
.env file as usual; you can set any of the options mentioned in the configuration documentation.