diff --git a/README.md b/README.md index 2cca4a7c1..b22a8f746 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py index dc54ce44f..cdc55efad 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py @@ -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: