Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web:Settting up the fhir-web to connect with the CASI fhir server and keycloak #1316

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion app/public/config.js
Original file line number Diff line number Diff line change
@@ -1 +1,68 @@
window._env_ = {};
// window._env_ = {};
// config.js.tpl

window._env_ = {
// keycloak
REACT_APP_AUTHZ_STRATEGY: 'keycloak',
REACT_APP_KEYCLOAK_API_BASE_URL: '<keycloak-base-url>/auth/admin/realms/<keycloak-realm>',
REACT_APP_KEYCLOAK_LOGOUT_URL:
'<keycloak-base-url>/auth/realms/<keycloak-realm>/protocol/openid-connect/logout',
REACT_APP_OPENSRP_ACCESS_TOKEN_URL:
'<keycloak-base-url>/auth/realms/<keycloak-realm>/protocol/openid-connect/token',
REACT_APP_OPENSRP_AUTHORIZATION_URL:
'<keycloak-base-url>/auth/realms/<keycloak-realm>/protocol/openid-connect/auth',
REACT_APP_OPENSRP_CLIENT_ID: '<keycloak-client-id>',
REACT_APP_OPENSRP_USER_URL:
'<keycloak-base-url>/auth/realms/<keycloak-realm>/protocol/openid-connect/userinfo',

// fhir-web
REACT_APP_WEBSITE_NAME: 'OpenSRP-Web',
REACT_APP_OPENSRP_WEB_VERSION: '<fhir-web-release-tag>',
REACT_APP_DOMAIN_NAME: 'http://localhost:3000',
REACT_APP_EXPRESS_OAUTH_GET_STATE_URL: 'http://localhost:3000/oauth/state',
REACT_APP_EXPRESS_OAUTH_LOGOUT_URL: 'http://localhost:3000/logout',

// fhir-server
REACT_APP_FHIR_API_BASE_URL: 'http://casi.uwdigi.org:8080//fhir',

// UUID's
REACT_APP_FHIR_ROOT_LOCATION_ID: '<id-of-the-root-location-on-the-HAPI-server>',
REACT_APP_COMMODITIES_LIST_RESOURCE_ID: '<id-of-a-list-on-HAPI-fhir-server>',

// toggle fhir-web modules
REACT_APP_ENABLE_FHIR_CARE_TEAM: 'false',
REACT_APP_ENABLE_FHIR_GROUP: 'false',
REACT_APP_ENABLE_FHIR_HEALTHCARE_SERVICES: 'false',
REACT_APP_ENABLE_FHIR_LOCATIONS: 'false',
REACT_APP_ENABLE_FHIR_PATIENTS: 'false',
REACT_APP_ENABLE_FHIR_TEAMS: 'false',
REACT_APP_ENABLE_FHIR_USER_MANAGEMENT: 'false',
REACT_APP_ENABLE_FHIR_COMMODITY: 'false',
REACT_APP_ENABLE_QUEST: 'false',
REACT_APP_ENABLE_TEAMS_ASSIGNMENT_MODULE: 'false',

// i18n
REACT_APP_SUPPORTED_LANGUAGES: "en,fr",
REACT_APP_ENABLE_LANGUAGE_SWITCHER: 'false',
REACT_APP_PROJECT_CODE: 'core',
REACT_APP_LANGUAGE_CODE: 'en',

// optional overrides
SKIP_PREFLIGHT_CHECK: 'true',
GENERATE_SOURCEMAP: 'false',
INLINE_RUNTIME_CHUNK: 'false',
IMAGE_INLINE_SIZE_LIMIT: '0',
REACT_APP_MAIN_LOGO_SRC:
'https://github.com/opensrp/web/raw/master/app/src/assets/images/fhir-web-logo.png',
REACT_APP_OPENSRP_OAUTH_SCOPES: 'openid,profile',
REACT_APP_ENABLE_OPENSRP_OAUTH: 'true',
REACT_APP_BACKEND_ACTIVE: 'true',
REACT_APP_SUPPORTED_LANGUAGES: 'en',
REACT_APP_PROJECT_CODE: 'demo',
REACT_APP_DEFAULTS_TABLE_PAGE_SIZE: '10',
REACT_APP_OPENSRP_LOGOUT_URL: 'null',
REACT_APP_PRACTITIONER_TO_ORG_ASSIGNMENT_STRATEGY: 'ONE_TO_MANY',

// optional sentry config
// REACT_APP_SENTRY_CONFIG_JSON: "{\"dsn\":\"<sentry-dsn>\",\"environment\":\"<sentry-environment>\",\"release\":\"<app-release-version>\",\"release-name\":\"<app-release-name>\",\"release-namespace\":\"<app-release-namespace>\",\"tags\":{}}",
};
56 changes: 51 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,53 @@
# services:
# web:
# build: .
# ports:
# - "3000:3000"
# environment:
# - "API_URL=production.example.com"
# docker-compose.yml

version: '3.9'
services:
web:
build: .
fhir-web:
image: opensrp/web:v3.1.3
ports:
- "3000:3000"
environment:
- "API_URL=production.example.com"
- '3000:3000'
volumes:
# volume with React front-end environment variables
- ./config.js.tpl:/etc/confd/templates/config.js.tmpl
environment:
# optional overrides
- 'NODE_ENV=production' # 'NODE_ENV=development' if fhir-web-base-url === http://localhost:3000
- 'EXPRESS_ALLOW_TOKEN_RENEWAL=true'
- 'EXPRESS_OPENSRP_LOGOUT_URL=null'
- 'EXPRESS_REACT_BUILD_PATH=/usr/src/web'

# keycloak
- 'EXPRESS_OPENSRP_CLIENT_ID=<keycloak-client-id>'
- 'EXPRESS_OPENSRP_CLIENT_SECRET=<keycloak-client-secret>'
- 'EXPRESS_OPENSRP_ACCESS_TOKEN_URL=<keycloak-base-url>/auth/realms/<keycloak-realm>/protocol/openid-connect/token'
- 'EXPRESS_OPENSRP_AUTHORIZATION_URL=<keycloak-base-url>/auth/realms/<keycloak-realm>/protocol/openid-connect/auth'
- 'EXPRESS_KEYCLOAK_LOGOUT_URL=<keycloak-base-url>/auth/realms/<keycloak-realm>/protocol/openid-connect/logout'
- 'EXPRESS_OPENSRP_USER_URL=<keycloak-base-url>/auth/realms/<keycloak-realm>/protocol/openid-connect/userinfo'

# fhir web
- 'EXPRESS_OPENSRP_CALLBACK_URL=http://localhost:3000/oauth/callback/OpenSRP/'
- 'EXPRESS_FRONTEND_OPENSRP_CALLBACK_URL=http://localhost:3000/fe/oauth/callback/opensrp'
- 'EXPRESS_SERVER_LOGOUT_URL=http://localhost:3000/logout'

# UUID's
- 'EXPRESS_SESSION_SECRET=<randomly-generated-secret-string>'

# content security policy configuration
# remove optional-sentry-base-url config block if your deployment has no sentry
- 'EXPRESS_CONTENT_SECURITY_POLICY_CONFIG={"connect-src":["''self''","<optional-sentry-base-url>","<keycloak-base-url>","<fhir-server-base-url>"],"default-src":["''self''"],"img-src":["''self''","https://github.com/opensrp/","https://*.githubusercontent.com/opensrp/"]}'
# to disable CSP
# - 'EXPRESS_CONTENT_SECURITY_POLICY_CONFIG=false'

# optional sentry config
# - 'EXPRESS_RESPONSE_HEADERS={"report-to":", {endpoints:[{url:https://<optional-sentry-base-url>/api/<optional-sentry-projectId>/security/?sentry_key=<optional-sentry-key>\\u0026sentry_environment=<optional-sentry-environment>\\u0026sentry_release=<optional-sentry-release-name>}],group:csp-endpoint,max_age:10886400}"}'

# optional redis and redis sentinel session store config (use either or neither not both)
# - 'EXPRESS_REDIS_STAND_ALONE_URL=redis://username:password@redis-base-url:port/db'
# - 'EXPRESS_REDIS_SENTINEL_CONFIG={"name":"sentinelMasterName","sentinelPassword":"sentinelMasterPassword","sentinels":[{"host":"sentinel-node-1-base-url","port":"12345"},{"host":"sentinel-node-2-base-url","port":"12345"},{"host":"sentinel-node-3-base-url","port":"12345"}]}'