Skip to content

Commit

Permalink
portalbackend refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanKarab committed Jul 26, 2023
1 parent 9406da4 commit fd8f390
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .versions_env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
EXAREME2=0.18.1
EXAREME=24.5.1
PORTALBACKEND=testing
PORTALBACKEND=7.9.0
GATEWAY=1.5.0
FRONTEND=9.3.1
MIP=7.1.0
32 changes: 26 additions & 6 deletions config/caddy/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,37 @@
import rp-{$MIP_LINK:direct} {$KEYCLOAK_HOST}
}

handle /services/sso/* {
uri replace /services/ /{$PORTAL_BACKEND_CONTEXT:services}/
import rp-{$MIP_LINK:direct} {$PORTAL_BACKEND_SERVER}
}
### Keycloak Authentication ---------------> ###
handle /services/oauth2/* {
uri replace /services/ /{$PORTAL_BACKEND_CONTEXT:services}/
import rp-{$MIP_LINK:direct} {$PORTAL_BACKEND_SERVER}
}

handle /services/sso/* {
uri replace /services/ /{$PORTAL_BACKEND_CONTEXT:services}/
import rp-{$MIP_LINK:direct} {$PORTAL_BACKEND_SERVER}
}

handle /services/login/* {
uri replace /services/ /{$PORTAL_BACKEND_CONTEXT:services}/
import rp-{$MIP_LINK:direct} {$PORTAL_BACKEND_SERVER}
}

handle /services/logout {
uri replace /services/ /{$PORTAL_BACKEND_CONTEXT:services}/
import rp-{$MIP_LINK:direct} {$PORTAL_BACKEND_SERVER}
}

# Keycloak redirects on /services/sso/login after login. In that case, redirect to /
redir /services/sso/login / permanent

### <--------------- Keycloak Authentication ###


handle_path /services/* {
import rp-{$MIP_LINK:direct} {$GATEWAY_SERVER}
}

# keycloak redirect on /services/ after login. In that case, redirect to /
redir /services/ / permanent

# hotfix for whitelabel error after login
redir /services/error / temporary
Expand Down
2 changes: 1 addition & 1 deletion federation_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def cli():

LOG_FILE_CHUNK_SIZE = 1024 # Will read the logfile in chunks
TIMESTAMP_REGEX = (
r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}" # 2022-04-13 18:25:22.875
r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z" # 2022-04-13T18:25:22.875Z
)
EXPERIMENT_FINISHED_PATTERN = rf"({TIMESTAMP_REGEX}) INFO .*? User -> (.*?) ,Endpoint.*?Finished the experiment: .*?uuid=(.*?), name.*?, status=(.*?), result.*?, finished=(.*?), algorithm=(.*?), algorithmId.*? created=(.*?), updated.*?"
EXPERIMENT_TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S.%f"
Expand Down
5 changes: 3 additions & 2 deletions tests/backend_components/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ services:
restart: unless-stopped

portalbackend_db:
image: postgres:11.3-alpine
image: postgres:11.20-alpine
volumes:
- ./.stored_data/portalbackenddb:/var/lib/postgresql/data
hostname: portalbackend_db
Expand Down Expand Up @@ -228,7 +228,8 @@ services:
### Exareme ###
EXAREME_URL: http://exareme_master:9090
### Keycloak ###
AUTHENTICATION: 0 # Should be enabled for keycloak
# AUTHENTICATION: 0
AUTHENTICATION: 1 # Should be enabled for keycloak
KEYCLOAK_AUTH_URL: http://172.17.0.1/auth/
KEYCLOAK_REALM: MIP
KEYCLOAK_CLIENT_ID: MIP
Expand Down
72 changes: 36 additions & 36 deletions tests/frontend_components/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ services:
- ENGINE_TYPE=exareme
- ENGINE_BASE_URL=http://172.17.0.1:8080/services/
- AUTH_SKIP=true
# - AUTH_ENABLE_SSO=true # Should be enabled for Keycloak
# - AUTH_ENABLE_SSO=false
- AUTH_ENABLE_SSO=true # Should be enabled for Keycloak
- BASE_URL_CONTEXT=services
- GATEWAY_PORT=8081
- CACHE_ENABLED=false
Expand Down Expand Up @@ -55,39 +56,38 @@ services:
MIP_LINK: direct
restart: unless-stopped

keycloak_db:
image: postgres:12.2
volumes:
- ./.stored_data/keycloak:/var/lib/postgresql/data
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: password
restart: unless-stopped

# keycloak_db:
# image: postgres:12.2
# volumes:
# - ./.stored_data/keycloak:/var/lib/postgresql/data
# environment:
# POSTGRES_DB: keycloak
# POSTGRES_USER: keycloak
# POSTGRES_PASSWORD: password
# restart: unless-stopped
#
# keycloak:
# image: jboss/keycloak:15.0.2
# command: -Djboss.http.port=8095
# volumes:
# - ../../config/keycloak/keycloak.json:/tmp/mip.json
# - ../../config/keycloak/HBPTheme:/opt/jboss/keycloak/themes/HBPTheme
# environment:
# DB_VENDOR: POSTGRES
# DB_ADDR: keycloak_db
# DB_PORT: 5432
# DB_DATABASE: keycloak
# DB_USER: keycloak
# DB_SCHEMA: public
# DB_PASSWORD: password
# KEYCLOAK_USER: admin
# KEYCLOAK_PASSWORD: Pa55w0rd
# KEYCLOAK_IMPORT: /tmp/mip.json
# KEYCLOAK_HOSTNAME: 172.17.0.1
# PROXY_ADDRESS_FORWARDING: 'true' #important for reverse proxy
# ports:
# - '8095:8095'
# - '8443:8443'
# depends_on:
# - keycloak_db
# restart: unless-stopped
keycloak:
image: jboss/keycloak:15.0.2
command: -Djboss.http.port=8095
volumes:
- ../../config/keycloak/keycloak.json:/tmp/mip.json
- ../../config/keycloak/HBPTheme:/opt/jboss/keycloak/themes/HBPTheme
environment:
DB_VENDOR: POSTGRES
DB_ADDR: keycloak_db
DB_PORT: 5432
DB_DATABASE: keycloak
DB_USER: keycloak
DB_SCHEMA: public
DB_PASSWORD: password
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: Pa55w0rd
KEYCLOAK_IMPORT: /tmp/mip.json
KEYCLOAK_HOSTNAME: 172.17.0.1
PROXY_ADDRESS_FORWARDING: 'true' #important for reverse proxy
ports:
- '8095:8095'
- '8443:8443'
depends_on:
- keycloak_db
restart: unless-stopped

0 comments on commit fd8f390

Please sign in to comment.