Skip to content

Commit d5615d2

Browse files
committed
update sdk, config files, and compose file
1 parent f8a1e42 commit d5615d2

File tree

14 files changed

+132
-350
lines changed

14 files changed

+132
-350
lines changed

.devcontainer/docker-compose.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,28 +121,23 @@ services:
121121
- "20000:20000"
122122

123123
proxy:
124-
image: nginx/nginx-ingress
124+
image: nginx:stable
125125
container_name: proxy
126126
restart: always
127-
environment:
128-
RESEARCH_PORTAL_ADDR: "http://portals:5173"
129-
PHP_PORTAL_ADDR: "http://portals:8008"
130-
DJANGO_PORTAL_ADDR: "http://portals:8009"
131-
KEYCLOAK_ADDR: "http://keycloak:18080"
132127
volumes:
133-
- ../vault:/vault:ro # requires /vault/server.crt and /vault/server.key for ssl termination
134-
- ./proxy/nginx.conf:/etc/nginx/nginx.conf:ro
128+
- ../vault/server.key:/vault/server.key:ro
129+
- ../vault/server.crt:/vault/server.crt:ro
135130
- ./proxy/proxy.conf:/etc/nginx/conf.d/proxy.conf:ro
136131
networks:
137132
airavata-network:
138133
ipv4_address: 192.168.100.13
139134
extra_hosts:
140135
- "airavata.host:192.168.100.1"
141136
ports:
142-
- "8443:8443" # https keycloak
143137
- "5173:5173" # https research portal
144138
- "8008:8008" # https php portal
145139
- "8009:8009" # https django portal
140+
- "8443:8443" # https keycloak
146141

147142
keycloak:
148143
image: keycloak/keycloak:25.0

.devcontainer/keycloak/keycloak.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
db=dev-mem
22
http-enabled=true
33
http-port=18080
4-
https-port=0
4+
https-port=8443
55
hostname-strict=false
66
hostname-strict-https=false
77
health-enabled=true

.devcontainer/proxy/nginx.conf

Lines changed: 0 additions & 23 deletions
This file was deleted.

.devcontainer/proxy/proxy.conf

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,83 @@
1+
# research portal (5173)
12
server {
2-
listen 5173 ssl http2;
3-
server_name airavata.host;
3+
listen 5173 ssl;
4+
if ($scheme != "https") {
5+
return 301 https://$host$request_uri;
6+
}
7+
http2 on;
8+
server_name airavata.host;
49
ssl_certificate /vault/server.crt;
510
ssl_certificate_key /vault/server.key;
6-
ssl_protocols TLSv1.2 TLSv1.3;
7-
ssl_prefer_server_ciphers on;
8-
911
location / {
10-
proxy_pass $RESEARCH_PORTAL_ADDR;
11-
proxy_set_header Host $host;
12-
proxy_set_header X-Real-IP $remote_addr;
13-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14-
proxy_set_header X-Forwarded-Proto https;
12+
proxy_pass http://portals:5173;
13+
proxy_set_header Host $host;
14+
proxy_set_header X-Real-IP $remote_addr;
15+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16+
proxy_set_header X-Forwarded-Proto $scheme;
17+
proxy_set_header X-Forwarded-Port $server_port;
18+
proxy_redirect default;
1519
}
1620
}
1721

22+
# php portal (8008)
1823
server {
19-
listen 8008 ssl http2;
20-
server_name airavata.host;
24+
listen 8008 ssl;
25+
if ($scheme != "https") {
26+
return 301 https://$host$request_uri;
27+
}
28+
http2 on;
29+
server_name airavata.host;
2130
ssl_certificate /vault/server.crt;
2231
ssl_certificate_key /vault/server.key;
23-
2432
location / {
25-
proxy_pass $PHP_PORTAL_ADDR;
26-
proxy_set_header Host $host;
27-
proxy_set_header X-Real-IP $remote_addr;
28-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
29-
proxy_set_header X-Forwarded-Proto https;
33+
proxy_pass http://portals:8008;
34+
proxy_set_header Host $host;
35+
proxy_set_header X-Real-IP $remote_addr;
36+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
37+
proxy_set_header X-Forwarded-Proto $scheme;
38+
proxy_set_header X-Forwarded-Port $server_port;
39+
proxy_redirect default;
3040
}
3141
}
3242

43+
# django portal (8009)
3344
server {
34-
listen 8009 ssl http2;
35-
server_name airavata.host;
45+
listen 8009 ssl;
46+
if ($scheme != "https") {
47+
return 301 https://$host$request_uri;
48+
}
49+
http2 on;
50+
server_name airavata.host;
3651
ssl_certificate /vault/server.crt;
3752
ssl_certificate_key /vault/server.key;
38-
3953
location / {
40-
proxy_pass $DJANGO_PORTAL_ADDR;
41-
proxy_set_header Host $host;
42-
proxy_set_header X-Real-IP $remote_addr;
43-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
44-
proxy_set_header X-Forwarded-Proto https;
54+
proxy_pass http://portals:8009;
55+
proxy_set_header Host $host;
56+
proxy_set_header X-Real-IP $remote_addr;
57+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58+
proxy_set_header X-Forwarded-Proto $scheme;
59+
proxy_set_header X-Forwarded-Port $server_port;
60+
proxy_redirect default;
4561
}
4662
}
4763

64+
# keycloak (8443)
4865
server {
49-
listen 8443 ssl http2;
50-
server_name airavata.host;
66+
listen 8443 ssl;
67+
if ($scheme != "https") {
68+
return 301 https://$host$request_uri;
69+
}
70+
http2 on;
71+
server_name airavata.host;
5172
ssl_certificate /vault/server.crt;
5273
ssl_certificate_key /vault/server.key;
53-
5474
location / {
55-
proxy_pass $KEYCLOAK_ADDR;
56-
proxy_set_header Host $host;
57-
proxy_set_header X-Real-IP $remote_addr;
58-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
59-
proxy_set_header X-Forwarded-Proto https;
75+
proxy_pass http://keycloak:8443;
76+
proxy_set_header Host $host;
77+
proxy_set_header X-Real-IP $remote_addr;
78+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
79+
proxy_set_header X-Forwarded-Proto $scheme;
80+
proxy_set_header X-Forwarded-Port $server_port;
81+
proxy_redirect default;
6082
}
6183
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ distribution
206206
├── airavata.jks
207207
├── application-agent-service.yml
208208
├── application-research-service.yml
209-
├── client_truststore.jks
209+
├── client_truststore.p12
210210
├── email-config.yaml
211211
└── log4j2.xml
212212

@@ -216,7 +216,7 @@ distribution
216216
**What's in the vault?**
217217

218218
* `airavata_sym.jks`, `airavata.jks` - contains the keys used to secure SSH credentials, etc.
219-
* `client_truststore.jks` - contains the certificates (e.g., certbot fullchain.pem) used to secure network connections (TLS).
219+
* `client_truststore.p12` - contains the certificates (e.g., certbot fullchain.pem) used to secure network connections (TLS).
220220
* `email-config.yaml` - contains the email addresses observed by the email monitor.
221221
* `airavata-server.properties` - config file for the airavata api server.
222222
* `application-agent-service.yml` - config file for the airavata agent service.

dev-tools/airavata-python-sdk/airavata_jupyter_magic/device_auth.py renamed to dev-tools/airavata-python-sdk/airavata_auth/device_auth.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66

77
# Load environment variables from .env file
88

9-
class DeviceFlowAuthenticator:
10-
def __init__(self):
11-
self.client_id = "cybershuttle-agent"
12-
self.realm = "default"
13-
self.auth_server_url = "https://auth.cybershuttle.org"
9+
class AuthContext:
10+
11+
client_id: str = "cybershuttle-agent"
12+
realm: str = "default"
13+
auth_server_url: str = "https://auth.cybershuttle.org"
14+
api_host: str = "https://api.gateway.cybershuttle.org"
15+
file_server_url: str = "http://api.gateway.cybershuttle.org:8050"
1416

15-
if not self.client_id or not self.realm or not self.auth_server_url:
17+
def __init__(self):
18+
if not AuthContext.client_id or not AuthContext.realm or not AuthContext.auth_server_url:
1619
raise ValueError("Missing required environment variables for client ID, realm, or auth server URL")
1720

1821
self.device_code = None
@@ -21,8 +24,8 @@ def __init__(self):
2124

2225
def login(self):
2326
# Step 1: Request device and user code
24-
auth_device_url = f"{self.auth_server_url}/realms/{self.realm}/protocol/openid-connect/auth/device"
25-
response = requests.post(auth_device_url, data={"client_id": self.client_id, "scope": "openid"})
27+
auth_device_url = f"{AuthContext.auth_server_url}/realms/{AuthContext.realm}/protocol/openid-connect/auth/device"
28+
response = requests.post(auth_device_url, data={"client_id": AuthContext.client_id, "scope": "openid"})
2629

2730
if response.status_code != 200:
2831
print(f"Error in authentication request: {response.status_code} - {response.text}", flush=True)
@@ -37,12 +40,12 @@ def login(self):
3740

3841
def poll_for_token(self, url):
3942
assert self.interval is not None
40-
token_url = f"{self.auth_server_url}/realms/{self.realm}/protocol/openid-connect/token"
43+
token_url = f"{AuthContext.auth_server_url}/realms/{AuthContext.realm}/protocol/openid-connect/token"
4144
counter = 0
4245
with self.console.status(f"Authenticate via link: [link={url}]{url}[/link]", refresh_per_second=1) as status:
4346
while True:
4447
response = requests.post(token_url, data={
45-
"client_id": self.client_id,
48+
"client_id": AuthContext.client_id,
4649
"grant_type": "urn:ietf:params:oauth:grant-type:device_code",
4750
"device_code": self.device_code
4851
})

dev-tools/airavata-python-sdk/airavata_experiments/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
from __future__ import annotations
1818

1919
from . import base, plan
20-
from .auth import login, logout
20+
from airavata_auth.device_auth import AuthContext
2121
from .runtime import list_runtimes, Runtime
2222
from typing import Any
2323

24-
__all__ = ["login", "logout", "list_runtimes", "base", "plan"]
24+
25+
context = AuthContext()
26+
27+
def login():
28+
context.login()
29+
30+
__all__ = ["list_runtimes", "base", "plan", "login"]
2531

2632

2733
def display_runtimes(runtimes: list[Runtime]) -> None:

dev-tools/airavata-python-sdk/airavata_experiments/auth/__init__.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)