Skip to content

Commit

Permalink
Fix CORS issue + remove bSI dev domain name
Browse files Browse the repository at this point in the history
  • Loading branch information
rw-bsi committed Jul 10, 2024
1 parent 050d1e3 commit 8a8cc3d
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 36 deletions.
17 changes: 9 additions & 8 deletions .env
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# variables in Docker Compose
VERSION = v0.6.4
VERSION = 0.6.4
DEBUG = True
ENV = Development
PUBLIC_URL = https://dev.validate.buildingsmart.org
PUBLIC_URL = http://localhost

# Django
MEDIA_ROOT = /files_storage
DJANGO_DB = postgresql
DJANGO_SECRET_KEY = django-insecure-um7-^+&jbk_=80*xcc9uf4nh$4koida7)ja&6!vb*$8@n288jk
DJANGO_ALLOWED_HOSTS = dev.validate.buildingsmart.org
DJANGO_TRUSTED_ORIGINS = https://dev.validate.buildingsmart.org https://authentication.buildingsmart.org
DJANGO_ALLOWED_HOSTS = localhost
DJANGO_TRUSTED_ORIGINS = http://localhost:3000 http://localhost http://localhost:8000
DJANGO_LOG_LEVEL = INFO
DJANGO_GUNICORN_WORKERS = 3
DJANGO_GUNICORN_THREADS_PER_WORKER = 4
Expand All @@ -31,15 +31,16 @@ DJANGO_DB_USER_CONTEXT = SYSTEM
CELERY_CONCURRENCY = 4

# Email
MAILGUN_API_URL = https://api.eu.mailgun.net/v3/validate.buildingsmart.org/messages
MAILGUN_API_KEY = <API_KEY>
MAILGUN_API_URL = <MG_API_URL>
MAILGUN_API_KEY = <MG_API_KEY>
MAILGUN_FROM_NAME = Validation Service
MAILGUN_FROM_EMAIL = noreply@validate.buildingsmart.org
MAILGUN_FROM_EMAIL = noreply@localhost
ADMIN_EMAIL = noreply@localhost
CONTACT_EMAIL = noreply@localhost

# IAM
B2C_CLIENT_ID = <B2C_CLIENT_ID>
B2C_CLIENT_SECRET = <B2C_CLIENT_SECRET>
B2C_AUTHORITY = <B2C_AUTHORITY>
B2C_USER_FLOW = <B2C_USER_FLOW>
B2C_USER_FLOW = <B2C_USER_FLOW>
USE_WHITELIST = False
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ exit
6. Navigate to different services:

- Validation Service - React UI: http://localhost
- Django Admin UI: http://localhost/admin (or http://localhost:8000/admin) - default user/password: root/root
- Django Admin UI: http://localhost/admin - default user/password per step 5.
- Django API - Swagger: http://localhost/api/swagger-ui
- Django API - Redoc: http://localhost/api/redoc

Expand Down Expand Up @@ -168,6 +168,8 @@ npm run start
```shell
cd backend

. .dev/venv/bin/activate

DJANGO_SUPERUSER_USERNAME=root DJANGO_SUPERUSER_PASSWORD=root DJANGO_SUPERUSER_EMAIL=root@localhost python3 manage.py createsuperuser --noinput

DJANGO_SUPERUSER_USERNAME=SYSTEM DJANGO_SUPERUSER_PASSWORD=system DJANGO_SUPERUSER_EMAIL=system@localhost python3 manage.py createsuperuser --noinput
Expand All @@ -176,7 +178,7 @@ DJANGO_SUPERUSER_USERNAME=SYSTEM DJANGO_SUPERUSER_PASSWORD=system DJANGO_SUPERUS
9. Navigate to different services:

- Validation Service - React UI: http://localhost:3000
- Django Admin UI: http://localhost:8000/admin - default user/password: root/root
- Django Admin UI: http://localhost:8000/admin - default user/password per step 8
- Django API - Swagger: http://localhost:8000/api/swagger-ui
- Django API - Redoc: http://localhost:8000/api/redoc
- Celery Flower UI: http://localhost:5555
Expand Down
15 changes: 11 additions & 4 deletions backend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ TASK_TIMEOUT_LIMIT = 3600
DJANGO_DB_USER_CONTEXT = SYSTEM

# Email
MAILGUN_API_URL = https://api.eu.mailgun.net/v3/validate.buildingsmart.org/messages
MAILGUN_API_KEY = <API_KEY>
MAILGUN_API_URL = <MG_API_URL>
MAILGUN_API_KEY = <MG_API_KEY>
MAILGUN_FROM_NAME = Validation Service
MAILGUN_FROM_EMAIL = noreply@validate.buildingsmart.org
MAILGUN_FROM_EMAIL = noreply@localhost
ADMIN_EMAIL = noreply@localhost
CONTACT_EMAIL = noreply@localhost
CONTACT_EMAIL = noreply@localhost

# IAM
B2C_CLIENT_ID = <B2C_CLIENT_ID>
B2C_CLIENT_SECRET = <B2C_CLIENT_SECRET>
B2C_AUTHORITY = <B2C_AUTHORITY>
B2C_USER_FLOW = <B2C_USER_FLOW>
USE_WHITELIST = False
2 changes: 1 addition & 1 deletion backend/apps/ifc_validation/checks/ifc_gherkin_rules
Submodule ifc_gherkin_rules updated 43 files
+3 −3 .github/workflows/ci.yml
+1 −1 features/ALA003_Alignment-same-segment-types-in-business-logic-and-geometry.feature
+37 −0 features/ALS011_Alignment-segment-entity-type-consistency.feature
+31 −0 features/ALS012_Alignment-segment-start-and-length-attribute-types.feature
+26 −0 features/GEM051_Presence-of-geometric-context.feature
+2 −2 features/OJT001_Object-predefined-type.feature
+2 −2 features/environment.py
+16 −1 features/steps/givens/entities.py
+52 −53 features/steps/thens/alignment.py
+14 −3 features/steps/thens/attributes.py
+23 −1 features/steps/thens/existance.py
+8 −17 features/steps/thens/values.py
+1 −1 features/steps/utils/ifc43x_alignment_validation/entities/helpers.py
+13 −2 features/steps/validation_handling.py
+1 −1 ifc_validation_models
+336 −3,076 test/files/ala003/pass-ala003-same_segment_geometry_types.ifc
+336 −3,076 test/files/ala003/pass-ala003-without_segmented_reference_curve.ifc
+5 −11 test/files/ala003/segment_type_mapping.md
+10 −0 test/files/als011/README.md
+263 −0 test/files/als011/fail-als011-scenario01-composite_curve_inconsistent_types.ifc
+263 −0 test/files/als011/fail-als011-scenario02-gradient_curve_composite_curve_segment.ifc
+364 −0 test/files/als011/fail-als011-scenario02-segmented_ref_curve_composite_curve_segment.ifc
+263 −0 test/files/als011/pass-als011-scenario01-consistent_types.ifc
+364 −0 test/files/als011/pass-als011-scenario02-correct_types.ifc
+11 −0 test/files/als012/README.md
+364 −0 test/files/als012/fail-als012-scenario01-composite_curve_wrong_segment_start_type.ifc
+364 −0 test/files/als012/fail-als012-scenario02-composite_curve_wrong_segment_length_type.ifc
+364 −0 test/files/als012/fail-als012-scenario03-gradient_curve_wrong_segment_start_type.ifc
+364 −0 test/files/als012/fail-als012-scenario04-gradient_curve_wrong_segment_length_type.ifc
+364 −0 test/files/als012/fail-als012-scenario05-segmented_reference_curve_wrong_segment_start_type.ifc
+364 −0 test/files/als012/fail-als012-scenario06-segmented_reference_curve_wrong_segment_length_type.ifc
+364 −0 test/files/als012/pass-als012-correct_segment_start_and_length_types.ifc
+413 −0 test/files/als012/pass-als012-incorrect_types_not_part_of_alignment.ifc
+12 −0 test/files/gem051/README.md
+30 −0 test/files/gem051/fail-gem051-scenario01-ifccontext_related_to_ifcrepresentationcontext.ifc
+29 −0 test/files/gem051/fail-gem051-scenario01-ifcproject_excludes_context.ifc
+30 −0 test/files/gem051/fail-gem051-scenario01-ifcproject_related_to_ifcrepresentationcontext.ifc
+29 −0 test/files/gem051/fail-gem051-scenario02-ifccontext_excludes_geomcontext.ifc
+29 −0 test/files/gem051/pass-gem051-scenario01-ifcproject_includes_context.ifc
+30 −0 test/files/gem051/pass-gem051-scenario01-ifcproject_includes_subtype_geomcontext.ifc
+29 −0 test/files/gem051/pass-gem051-scenario02-ifccontext_includes_geomcontext.ifc
+4 −4 test/files/ojt001/fail-ojt001-scenario03-typed_via_relation_and_at_occurrence.ifc
+1 −1 test/files/ojt001/pass-ojt001-scenario01-userdefined_w_object_type.ifc
3 changes: 3 additions & 0 deletions backend/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@
LOGIN_CALLBACK_URL = os.environ.get("CALLBACK_URL", f"{PUBLIC_URL}/callback")
POST_LOGIN_REDIRECT_URL = os.environ.get("POST_LOGIN_REDIRECT_URL", f"{PUBLIC_URL}/dashboard")

# whitelisting of users
USE_WHITELIST = os.environ.get("USE_WHITELIST", False)

AUTHLIB_OAUTH_CLIENTS = {
'b2c': {
'client_id': B2C_CLIENT_ID,
Expand Down
5 changes: 3 additions & 2 deletions backend/core/views_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from authlib.integrations.django_client import OAuth

from .email_tasks import send_user_registered_admin_email_task
from .settings import LOGIN_CALLBACK_URL, POST_LOGIN_REDIRECT_URL, LOGOUT_URL, LOGIN_URL, PRODUCTION
from .settings import LOGIN_CALLBACK_URL, POST_LOGIN_REDIRECT_URL, LOGOUT_URL, LOGIN_URL
from .settings import USE_WHITELIST

oauth = OAuth()
oauth.register(name="b2c")
Expand Down Expand Up @@ -51,7 +52,7 @@ def callback(request):
username = username,
password = username,
email = userinfo['email'],
is_active = True if PRODUCTION else False,
is_active = not USE_WHITELIST, # whitelisting of users
is_superuser = False,
is_staff = False,
first_name = userinfo['given_name'],
Expand Down
9 changes: 6 additions & 3 deletions docker-compose.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ services:
expose:
- 8000
environment:
PUBLIC_URL: ${PUBLIC_URL}
PUBLIC_URL: ${PUBLIC_URL} # for IAM links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
Expand All @@ -52,7 +53,8 @@ services:
B2C_CLIENT_ID: ${B2C_CLIENT_ID}
B2C_CLIENT_SECRET: ${B2C_CLIENT_SECRET}
B2C_AUTHORITY: ${B2C_AUTHORITY}
B2C_USER_FLOW: ${B2C_USER_FLOW}
B2C_USER_FLOW: ${B2C_USER_FLOW}
USE_WHITELIST: ${USE_WHITELIST}
deploy: # example only
mode: replicated
replicas: 2
Expand All @@ -69,7 +71,8 @@ services:
volumes:
- files_data:/files_storage
environment:
PUBLIC_URL: ${PUBLIC_URL}
PUBLIC_URL: ${PUBLIC_URL} # for email links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
Expand Down
9 changes: 6 additions & 3 deletions docker-compose.load_balanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ services:
expose:
- 8000
environment:
PUBLIC_URL: ${PUBLIC_URL}
PUBLIC_URL: ${PUBLIC_URL} # for IAM links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
Expand All @@ -52,7 +53,8 @@ services:
B2C_CLIENT_ID: ${B2C_CLIENT_ID}
B2C_CLIENT_SECRET: ${B2C_CLIENT_SECRET}
B2C_AUTHORITY: ${B2C_AUTHORITY}
B2C_USER_FLOW: ${B2C_USER_FLOW}
B2C_USER_FLOW: ${B2C_USER_FLOW}
USE_WHITELIST: ${USE_WHITELIST}
deploy: # example only
mode: replicated
replicas: 2
Expand All @@ -73,7 +75,8 @@ services:
volumes:
- files_data:/files_storage
environment:
PUBLIC_URL: ${PUBLIC_URL}
PUBLIC_URL: ${PUBLIC_URL} # for email links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
Expand Down
7 changes: 5 additions & 2 deletions docker-compose.nodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ services:
ports:
- 8000:8000
environment:
PUBLIC_URL: ${PUBLIC_URL}
PUBLIC_URL: ${PUBLIC_URL} # for IAM links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
Expand All @@ -54,6 +55,7 @@ services:
B2C_CLIENT_SECRET: ${B2C_CLIENT_SECRET}
B2C_AUTHORITY: ${B2C_AUTHORITY}
B2C_USER_FLOW: ${B2C_USER_FLOW}
USE_WHITELIST: ${USE_WHITELIST}
depends_on:
- redis

Expand All @@ -66,7 +68,8 @@ services:
volumes:
- files_data:/files_storage
environment:
PUBLIC_URL: ${PUBLIC_URL}
PUBLIC_URL: ${PUBLIC_URL} # for email links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
Expand Down
7 changes: 5 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ services:
ports:
- 8000:8000
environment:
PUBLIC_URL: ${PUBLIC_URL}
PUBLIC_URL: ${PUBLIC_URL} # for IAM links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
Expand All @@ -54,6 +55,7 @@ services:
B2C_CLIENT_SECRET: ${B2C_CLIENT_SECRET}
B2C_AUTHORITY: ${B2C_AUTHORITY}
B2C_USER_FLOW: ${B2C_USER_FLOW}
USE_WHITELIST: ${USE_WHITELIST}
depends_on:
- db
- redis
Expand All @@ -67,7 +69,8 @@ services:
volumes:
- files_data:/files_storage
environment:
PUBLIC_URL: ${PUBLIC_URL}
PUBLIC_URL: ${PUBLIC_URL} # for email links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
Expand Down
4 changes: 1 addition & 3 deletions docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,4 @@ LABEL org.opencontainers.image.title="IFC Validation Service - Frontend" \
org.opencontainers.image.url="https://github.com/buildingSMART/validate" \
org.opencontainers.image.licenses="MIT"
#org.opencontainers.image.version="{$VERSION}" TODO
#org.opencontainers.image.created="TODO"

#CMD "certbot --nginx -d dev.validate.buildingsmart.org -n && ./docker-entrypoint.sh"
#org.opencontainers.image.created="TODO"
2 changes: 1 addition & 1 deletion docker/frontend/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server {
listen 80;
server_name dev.validate.buildingsmart.org;
server_name _;
server_tokens off;

# turn off buffering, enable streaming to backend
Expand Down
4 changes: 2 additions & 2 deletions frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PUBLIC_URL=https://dev.validate.buildingsmart.org
REACT_APP_FETCH_PATH=https://dev.validate.buildingsmart.org/bff
PUBLIC_URL=/
REACT_APP_FETCH_PATH=/bff
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui",
"version": "0.6.0",
"version": "0.6.4",
"private": true,
"dependencies": {
"@emotion/react": "^11.10.5",
Expand Down

0 comments on commit 8a8cc3d

Please sign in to comment.