Update readme (#1010)

* Update README.md

Some notes for people that might want to run full-on native, with detail about how Mac hijacks port 7000 and how to get around it.

* Revert "Update README.md"

This reverts commit 096887c26d591f93a836ef808c148af09767f2d2.

* README update and native code patch

Some details for user that might be running Python3, Mac, and want to run everything locally/natively.
This commit is contained in:
Tim Consolazio 2024-02-09 17:22:53 -05:00 committed by GitHub
parent 90c49f8e5c
commit 223ff95014
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 0 deletions

View File

@ -16,6 +16,24 @@ First install python, poetry, and mysql. Then:
./bin/recreate_db clean
./bin/run_server_locally
## If you want to run all locally:
If you're on a Mac and trying to run native (might translate elsewhere) running python 3 and get errors with mysqlclient and psycopgen2 when running the Poetry install, you may need to install mysql-client, pkg-config, mysqlclient, and psycopgen2 first, remove mysqlclient and psycopgen2 from the pyproject.toml (or Poetry will try to build them and crash), and run the Poetry install again.
brew install mysql-client pkg-config
export PKG_CONFIG_PATH="$(brew --prefix)/opt/mysql-client/lib/pkgconfig"
pip install mysqlclient
pip install psycopg2
Python3 also won't recognize MySQLdb as a module. After the above installs (which you would do pre-Poetry), add these lines to __init__.py in the backend project:
import pymysql;
pymysql.install_as_MySQLdb()
On a Mac, port 7000 (used by the app) might be hijacked by Airplay. See the Docker section below.
Remember, if you don't need a full-on native dev experience, you can run the docker image, which saves you from all the native setup.
## Keycloak Setup
You will want an openid server of some sort.
@ -24,6 +42,9 @@ You can start it like this:
./keycloak/bin/start_keycloak
It'll be running on port 7002 (if you want to log into the keycloak admin, localhost:7002).
Creds = admin/admin (also logs you into the app if running the front end)
## Frontend Setup
First install nodejs, ideally the version in .tool-versions (but likely other versions will work). Then:
@ -32,6 +53,8 @@ First install nodejs, ideally the version in .tool-versions (but likely other ve
npm install
npm start
Assuming you're running KeyCloak as indicated above, login will be admin/admin.
## Run tests
./bin/run_pyl
@ -48,6 +71,8 @@ For full instructions, see [Running SpiffWorkflow Locally with Docker](https://w
The `docker-compose.yml` file is for running a full-fledged instance of spiff-arena while `editor.docker-compose.yml` provides BPMN graphical editor capability to libraries and projects that depend on SpiffWorkflow but have no built-in BPMN edit capabilities.
Note: For those who upgraded to MacOS 12.1 and are running everything locally, your AirPlay receiver may have started on Port 7000 and your docker (or anything requesting port 7000) may fail due to this port already being used. You can disable this port in System Preferences > Sharing > AirPlay receiver.
## Contributing
To start understanding the system, you might:

View File

@ -25,6 +25,11 @@ from spiffworkflow_backend.routes.user_blueprint import user_blueprint
from spiffworkflow_backend.services.monitoring_service import configure_sentry
from spiffworkflow_backend.services.monitoring_service import setup_prometheus_metrics
# This is necessary to make sure that the pymysql library is used as the MySQLdb library
# This is only needed if you want to run non-docker local and are using Python 3.
# See the repo's top-level README for details.
# import pymysql;
# pymysql.install_as_MySQLdb()
class MyJSONEncoder(DefaultJSONProvider):
def default(self, obj: Any) -> Any: