diff --git a/docker-compose.yml b/docker-compose.yml index 1cf550248..b505499b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,9 +10,9 @@ services: environment: - MYSQL_DATABASE=spiffworkflow_backend_development - MYSQL_ROOT_PASSWORD=my-secret-pw - - MYSQL_TCP_PORT=7003 + - MYSQL_TCP_PORT=8003 ports: - - "7003" + - "8003" healthcheck: test: mysql --user=root --password=my-secret-pw -e 'select 1' spiffworkflow_backend_development interval: 10s @@ -30,12 +30,12 @@ services: - SPIFFWORKFLOW_BACKEND_ENV=development - FLASK_DEBUG=0 - FLASK_SESSION_SECRET_KEY=super_secret_key - - OPEN_ID_SERVER_URL=http://localhost:7000/openid - - SPIFFWORKFLOW_FRONTEND_URL=http://localhost:7001 - - SPIFFWORKFLOW_BACKEND_URL=http://localhost:7000 - - SPIFFWORKFLOW_BACKEND_PORT=7000 + - OPEN_ID_SERVER_URL=http://localhost:8000/openid + - SPIFFWORKFLOW_FRONTEND_URL=http://localhost:8001 + - SPIFFWORKFLOW_BACKEND_URL=http://localhost:8000 + - SPIFFWORKFLOW_BACKEND_PORT=8000 - SPIFFWORKFLOW_BACKEND_UPGRADE_DB=true - - SPIFFWORKFLOW_BACKEND_DATABASE_URI=mysql+mysqlconnector://root:my-secret-pw@spiffworkflow-db:7003/spiffworkflow_backend_development + - SPIFFWORKFLOW_BACKEND_DATABASE_URI=mysql+mysqlconnector://root:my-secret-pw@spiffworkflow-db:8003/spiffworkflow_backend_development - BPMN_SPEC_ABSOLUTE_DIR=/app/process_models - SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA=false - SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME=example.yml @@ -43,12 +43,12 @@ services: - OPEN_ID_CLIENT_ID=spiffworkflow-backend - OPEN_ID_CLIENT_SECRET_KEY=my_open_id_secret_key ports: - - "7000:7000" + - "8000:8000" volumes: - ./process_models:/app/process_models - ./log:/app/log healthcheck: - test: curl localhost:7000/v1.0/status --fail + test: curl localhost:8000/v1.0/status --fail interval: 10s timeout: 5s retries: 20 @@ -58,9 +58,9 @@ services: image: ghcr.io/sartography/spiffworkflow-frontend environment: - APPLICATION_ROOT=/ - - PORT0=7001 + - PORT0=8001 ports: - - "7001:7001" + - "8001:8001" spiffworkflow-connector: container_name: spiffworkflow-connector @@ -69,10 +69,11 @@ services: - FLASK_ENV=${FLASK_ENV:-development} - FLASK_DEBUG=0 - FLASK_SESSION_SECRET_KEY=${FLASK_SESSION_SECRET_KEY:-super_secret_key} + - CONNECTOR_PROXY_PORT=8004 ports: - - "7004:7004" + - "8004:8004" healthcheck: - test: curl localhost:7004/liveness --fail + test: curl localhost:8004/liveness --fail interval: 10s timeout: 5s retries: 20 diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py index e933eda91..3427b47bb 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -17,7 +17,7 @@ from spiffworkflow_backend.models.task import MultiInstanceType from spiffworkflow_backend.models.task import Task from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.authorization_service import AuthorizationService -from spiffworkflow_backend.services.git_service import GitService +from spiffworkflow_backend.services.git_service import GitService, GitCommandError from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) @@ -36,7 +36,10 @@ class ProcessInstanceService: user: UserModel, ) -> ProcessInstanceModel: """Get_process_instance_from_spec.""" - current_git_revision = GitService.get_current_revision() + try: + current_git_revision = GitService.get_current_revision() + except GitCommandError as ge: + current_git_revision = "" process_instance_model = ProcessInstanceModel( status=ProcessInstanceStatus.not_started.value, process_initiator=user, diff --git a/spiffworkflow-frontend/src/config.tsx b/spiffworkflow-frontend/src/config.tsx index b0816a39d..abaadd5ef 100644 --- a/spiffworkflow-frontend/src/config.tsx +++ b/spiffworkflow-frontend/src/config.tsx @@ -1,11 +1,23 @@ -const host = window.location.hostname; -let hostAndPort = `api.${host}`; +const { port, hostname } = window.location; +let hostAndPort = `api.${hostname}`; let protocol = 'https'; -if (/^\d+\./.test(host) || host === 'localhost') { - hostAndPort = `${host}:7000`; + +if (/^\d+\./.test(hostname) || hostname === 'localhost') { + let serverPort = 7000; + if (!Number.isNaN(Number(port))) { + serverPort = Number(port) - 1; + } + hostAndPort = `${hostname}:${serverPort}`; protocol = 'http'; } -export const BACKEND_BASE_URL = `${protocol}://${hostAndPort}/v1.0`; + +let url = `${protocol}://${hostAndPort}/v1.0`; +// Allow overriding the backend base url with an environment variable at build time. +if (process.env.REACT_APP_BACKEND_BASE_URL) { + url = process.env.REACT_APP_BACKEND_BASE_URL; +} + +export const BACKEND_BASE_URL = url; export const PROCESS_STATUSES = [ 'not_started',