diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2e254d3142..dd55441296 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:22.04 as deps ARG TARGETARCH @@ -24,7 +24,7 @@ RUN wget https://go.dev/dl/go1.23.0.linux-amd64.tar.gz \ && tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz \ && rm go1.23.0.linux-amd64.tar.gz -# Install Thrift 0.23 +# Install Thrift 0.22 RUN wget https://dlcdn.apache.org/thrift/0.22.0/thrift-0.22.0.tar.gz \ && tar -xzf thrift-0.22.0.tar.gz \ && cd thrift-0.22.0 \ @@ -45,3 +45,26 @@ ENV MAVEN_HOME=/opt/maven ENV GOROOT=/usr/local/go ENV GOPATH=/home/developer/go ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GOROOT/bin:$GOPATH/bin + +EXPOSE 7878 8000 17000 8050 8930 8960 8962 8970 18800 19900 18889 19908 + +FROM deps AS compiler + +COPY --chown=developer:developer .. /home/developer/workspace +WORKDIR /home/developer/workspace +RUN mvn clean install -DskipTests + + +FROM eclipse-temurin:17-jdk AS runner +WORKDIR /app + +COPY --from=compiler /home/developer/workspace/distribution/*.tar.gz ./ + +COPY ../dev-tools/deployment-scripts/*.sh ./ +COPY ../vault ./vault + +RUN chmod +x ./distribution_update.sh ./services_up.sh + +EXPOSE 7878 8000 17000 8050 8930 8960 8962 8970 18800 19900 18889 19908 + +CMD ["sh", "-c", "./distribution_update.sh && ./services_up.sh && sleep infinity"] diff --git a/.devcontainer/database_scripts/init/00-accounts.sql b/.devcontainer/database_scripts/init/00-accounts.sql new file mode 100644 index 0000000000..0d57e5e080 --- /dev/null +++ b/.devcontainer/database_scripts/init/00-accounts.sql @@ -0,0 +1,3 @@ +CREATE USER IF NOT EXISTS 'airavata'@'%' IDENTIFIED BY '123456'; +GRANT ALL PRIVILEGES ON *.* TO 'airavata'@'%'; +FLUSH PRIVILEGES; \ No newline at end of file diff --git a/.devcontainer/database_scripts/init/01-databases.sql b/.devcontainer/database_scripts/init/01-databases.sql index 4ac2531a80..0f253c8430 100644 --- a/.devcontainer/database_scripts/init/01-databases.sql +++ b/.devcontainer/database_scripts/init/01-databases.sql @@ -3519,6 +3519,14 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `workflow_catalog` /*!40100 DEFAULT CHA USE `workflow_catalog`; +-- +-- Current Database: `research_catalog` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `research_catalog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */; + +USE `research_catalog`; + -- -- Current Database: `app_catalog` -- diff --git a/.devcontainer/database_scripts/init/06-cloud-execution-support-migration.sql b/.devcontainer/database_scripts/init/06-cloud-execution-support-migration.sql index 4338d2b0a7..81718b8f96 100644 --- a/.devcontainer/database_scripts/init/06-cloud-execution-support-migration.sql +++ b/.devcontainer/database_scripts/init/06-cloud-execution-support-migration.sql @@ -1,3 +1,5 @@ +USE app_catalog; + -- Add RESOURCE_TYPE column to base table ALTER TABLE `GROUP_COMPUTE_RESOURCE_PREFERENCE` ADD COLUMN `RESOURCE_TYPE` VARCHAR(255) NOT NULL DEFAULT 'SLURM'; diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 05d77d7d5d..ce760a6334 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "dockerComposeFile": "docker-compose.yml", "service": "devcontainer", "features": {}, - "workspaceFolder": "/workspace", + "workspaceFolder": "/home/developer/workspace", "forwardPorts": [], "customizations": { "vscode": { diff --git a/modules/distribution/src/main/docker/docker-compose.yml b/.devcontainer/docker-compose-alt.yml similarity index 98% rename from modules/distribution/src/main/docker/docker-compose.yml rename to .devcontainer/docker-compose-alt.yml index 0d0db348ab..553bdabb9e 100644 --- a/modules/distribution/src/main/docker/docker-compose.yml +++ b/.devcontainer/docker-compose-alt.yml @@ -42,7 +42,7 @@ services: links: - "keycloak:airavata.host" ports: - - "9930:9930" + - "8930:8930" - "7878:7878" - "8962:8962" - "8960:8960" @@ -121,7 +121,7 @@ services: - job.notification.enable=true - job.notification.emailids= - job.notification.flags=abe - - credential.store.keystore.url=/opt/keystores/airavata.jks + - credential.store.keystore.url=/opt/keystores/airavata.p12 - credential.store.keystore.alias=airavata - credential.store.keystore.password=airavata - credential.store.jdbc.url=jdbc:mariadb://db:3306/credential_store @@ -154,9 +154,9 @@ services: - TLS.enabled=true - TLS.api.server.port=9930 - TLS.client.timeout=10000 - - keystore.path=/opt/keystores/airavata.jks + - keystore.path=/opt/keystores/airavata.p12 - keystore.password=airavata - - trust.store=/opt/keystores/airavata.jks + - trust.store=/opt/keystores/airavata.p12 - trust.store.password=airavata - authz.cache.enabled=true - authz.cache.manager.class=org.apache.airavata.service.security.authzcache.DefaultAuthzCacheManager diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 1219394032..dc80be0480 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -13,40 +13,154 @@ volumes: services: devcontainer: - build: . + profiles: + - development + build: + dockerfile: Dockerfile + target: deps + container_name: devcontainer + restart: always volumes: - - ..:/workspace:cached + - ..:/home/developer/workspace:cached + - $HOME/.m2:/home/developer/.m2 + - $HOME/.ssh:/home/developer/.ssh + networks: + airavata-network: + ipv4_address: 192.168.100.9 + extra_hosts: + - "airavata.host:192.168.100.1" + ports: + - "7878:7878" # sharing registry service + - "8000:8000" # tunnel service + - "17000:17000" # tunnel service (ingress) + - "8050:8050" # file service + - "8082:8082" # rest proxy + - "8930:8930" # api service + - "8960:8960" # cred store service + - "8962:8962" # profile service + - "8970:8970" # registry service + - "18800:18800" # agent service (http) + - "19900:19900" # agent service (gRPC) + - "18889:18889" # research service (http) + - "19908:19908" # research service (gRPC) command: sleep infinity + + microservices: + profiles: + - staging + build: + dockerfile: Dockerfile + target: runner + container_name: microservices + restart: always + volumes: + - ../vault:/app/vault + networks: + airavata-network: + ipv4_address: 192.168.100.9 + extra_hosts: + - "airavata.host:192.168.100.1" + ports: + - "7878:7878" # sharing registry service + - "8000:8000" # tunnel service + - "17000:17000" # tunnel service (ingress) + - "8050:8050" # file service + - "8930:8930" # api service + - "8960:8960" # cred store service + - "8962:8962" # profile service + - "8970:8970" # registry service + - "18800:18800" # agent service (http) + - "19900:19900" # agent service (gRPC) + - "18889:18889" # research service (http) + - "19908:19908" # research service (gRPC) + depends_on: + - db + - kafka + - keycloak + - rabbitmq + - sshd + + portals: + build: + context: portals + dockerfile: Dockerfile + container_name: portals + restart: always + volumes: + - /tmp:/tmp + - ./portals/pga_config.php:/var/www/html/default/config/pga_config.php + networks: + airavata-network: + ipv4_address: 192.168.100.11 + extra_hosts: + - "airavata.host:192.168.100.1" + + jupyterhub: + build: + context: ../modules/research-framework/research-hub/compose + dockerfile: Dockerfile + container_name: jupyterhub + restart: always + environment: + OAUTH_CLIENT_ID: "cs-jupyterlab" + OAUTH_CLIENT_SECRET: "DxeMtfiWU1qkDEmaGHf13RDahCujzhy1" + JUPYTERHUB_CRYPT_KEY: "a99323294a5d6f9b1d0e7e33450dff44db664264231b985e069c6eba8f9a3e09" + DOCKER_NETWORK_NAME: jupyterhub_network + DOCKER_NOTEBOOK_IMAGE: cybershuttle/dev_jupyterlab-base + volumes: + - ../modules/research-framework/research-hub/compose/jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py + - /var/run/docker.sock:/var/run/docker.sock + networks: + airavata-network: + ipv4_address: 192.168.100.12 + extra_hosts: + - "airavata.host:192.168.100.1" + + proxy: + image: nginx:stable + container_name: proxy + restart: always + volumes: + - ../vault/server.key:/vault/server.key:ro + - ../vault/server.crt:/vault/server.crt:ro + - ./proxy/nginx.conf:/etc/nginx/nginx.conf:ro + - ./proxy/http.conf:/etc/nginx/conf.d/http.conf:ro + - ./proxy/stream.conf:/etc/nginx/conf.d/stream.conf:ro networks: airavata-network: - ipv4_address: 192.168.100.10 + ipv4_address: 192.168.100.13 extra_hosts: - "airavata.host:192.168.100.1" + ports: + - "5173:5173" # tls + research portal + - "8008:8008" # tls + php portal + - "8009:8009" # tls + django portal + - "8443:8443" # tls + keycloak + - "9930:9930" # tls + api + - "20000:20000" # tls + jupyterhub keycloak: - image: keycloak/keycloak:24.0 + image: keycloak/keycloak:25.0 + container_name: keycloak restart: always environment: KEYCLOAK_ADMIN: admin KEYCLOAK_ADMIN_PASSWORD: admin - ports: - - "18080:8080" - - "8443:8443" volumes: - ./keycloak/realm-default.json:/opt/keycloak/data/import/realm-default.json - ./keycloak/keycloak.conf:/opt/keycloak/conf/keycloak.conf - - ../keystores/airavata.jks:/opt/keycloak/conf/keystores/airavata.jks - command: ["start-dev", "--import-realm"] - depends_on: - - db + command: [ "start", "--import-realm" ] networks: airavata-network: - ipv4_address: 192.168.100.11 + ipv4_address: 192.168.100.14 extra_hosts: - "airavata.host:192.168.100.1" + ports: + - "18080:18080" db: image: mariadb:10.4.13 + container_name: db restart: always environment: MYSQL_ROOT_PASSWORD: 123456 @@ -55,8 +169,6 @@ services: volumes: - ./database_scripts/init:/docker-entrypoint-initdb.d - db_data:/var/lib/mysql - ports: - - "13306:3306" command: [ "mysqld", @@ -66,89 +178,80 @@ services: ] networks: airavata-network: - ipv4_address: 192.168.100.12 + ipv4_address: 192.168.100.15 extra_hosts: - "airavata.host:192.168.100.1" + ports: + - "13306:3306" rabbitmq: image: rabbitmq:4.0-management + container_name: rabbitmq restart: always environment: RABBITMQ_DEFAULT_VHOST: develop - ports: - - "5672:5672" - - "15672:15672" - depends_on: - - db networks: airavata-network: - ipv4_address: 192.168.100.13 + ipv4_address: 192.168.100.16 extra_hosts: - "airavata.host:192.168.100.1" + ports: + - "5672:5672" + - "15672:15672" zookeeper: - image: zookeeper + image: zookeeper:latest + container_name: zookeeper restart: always - hostname: zk - ports: - - "12181:2181" networks: airavata-network: - ipv4_address: 192.168.100.14 + ipv4_address: 192.168.100.17 extra_hosts: - "airavata.host:192.168.100.1" + ports: + - "2181:2181" kafka: image: wurstmeister/kafka:latest + container_name: kafka restart: always - hostname: kafka - ports: - - "9092:9092" environment: - KAFKA_ADVERTISED_HOST_NAME: 192.168.100.15 + KAFKA_ADVERTISED_HOST_NAME: airavata.host KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - depends_on: - - zookeeper networks: airavata-network: - ipv4_address: 192.168.100.15 + ipv4_address: 192.168.100.18 extra_hosts: - "airavata.host:192.168.100.1" + ports: + - "9092:9092" + depends_on: + - zookeeper sshd: - image: dimuthuupe/sshd:1.0 + image: panubo/sshd + container_name: sshd restart: always volumes: - /tmp:/tmp - ports: - - "22222:22" networks: airavata-network: - ipv4_address: 192.168.100.16 + ipv4_address: 192.168.100.20 extra_hosts: - "airavata.host:192.168.100.1" + ports: + - "22222:22" adminer: image: adminer:latest + container_name: adminer restart: always - ports: - - "18088:8080" - depends_on: - - db networks: airavata-network: - ipv4_address: 192.168.100.17 + ipv4_address: 192.168.100.21 extra_hosts: - "airavata.host:192.168.100.1" - - pga: - build: pga - volumes: - - /tmp:/tmp ports: - - "8000:80" - networks: - airavata-network: - ipv4_address: 192.168.100.18 - extra_hosts: - - "airavata.host:192.168.100.1" + - "18088:8080" + depends_on: + - db diff --git a/.devcontainer/keycloak/keycloak.conf b/.devcontainer/keycloak/keycloak.conf index 93ecbb9206..c9146ac414 100644 --- a/.devcontainer/keycloak/keycloak.conf +++ b/.devcontainer/keycloak/keycloak.conf @@ -1,20 +1,9 @@ -# Keycloak Configuration File db=dev-mem - -# HTTP/HTTPS settings http-enabled=true -http-port=8080 -https-port=8443 -https-key-store-file=${kc.home.dir}/conf/keystores/airavata.jks -https-key-store-password=airavata - -# Hostname configuration +http-port=18080 +proxy=edge +proxy-headers=xforwarded hostname-strict=false -hostname-strict-https=false - -# Health and metrics health-enabled=true metrics-enabled=true - -# Logging log-level=INFO diff --git a/.devcontainer/keycloak/realm-default.json b/.devcontainer/keycloak/realm-default.json index 3741b867a4..2bc90a0766 100644 --- a/.devcontainer/keycloak/realm-default.json +++ b/.devcontainer/keycloak/realm-default.json @@ -957,7 +957,7 @@ "alwaysDisplayInConsole" : false, "clientAuthenticatorType" : "client-secret", "secret" : "DxeMtfiWU1qkDEmaGHf13RDahCujzhy1", - "redirectUris" : [ "", "/*", "https://hub.cybershuttle.org/hub/oauth_callback" ], + "redirectUris" : [ "", "/*", "http://airavata.host:20000/hub/oauth_callback" ], "webOrigins" : [ "/*" ], "notBefore" : 0, "bearerOnly" : false, @@ -1052,7 +1052,7 @@ "description" : "", "rootUrl" : "", "adminUrl" : "", - "baseUrl" : "https://cybershuttle.org/", + "baseUrl" : "http://airavata.host:8009/", "surrogateAuthRequired" : false, "enabled" : true, "alwaysDisplayInConsole" : false, @@ -1102,8 +1102,8 @@ "alwaysDisplayInConsole" : false, "clientAuthenticatorType" : "client-secret", "secret" : "m36BXQIxX3j3VILadeHMK5IvbOeRlCCc", - "redirectUris" : [ "https://cybershuttle.org/callback-url", "http://localhost/callback-url", "http://airavata.host:8008/callback-url", "https://cybershuttle.org/", "https://cybershuttle.org/auth/callback*" ], - "webOrigins" : [ "https://cybershuttle.org", "*" ], + "redirectUris" : [ "http://airavata.host:8008/callback*", "https://airavata.host:8009/auth/callback*" ], + "webOrigins" : [ "*" ], "notBefore" : 0, "bearerOnly" : false, "consentRequired" : false, @@ -1119,8 +1119,8 @@ "oidc.ciba.grant.enabled" : "false", "client.secret.creation.time" : "1741724922", "backchannel.logout.session.required" : "true", - "frontchannel.logout.url" : "https://cybershuttle.org/", - "post.logout.redirect.uris" : "+##https://cybershuttle.org/", + "frontchannel.logout.url" : "http://airavata.host:8009/", + "post.logout.redirect.uris" : "+##http://airavata.host:8009/", "display.on.consent.screen" : "false", "oauth2.device.authorization.grant.enabled" : "true", "backchannel.logout.revoke.offline.tokens" : "false" @@ -1922,7 +1922,7 @@ "forwardParameters" : "kc_idp_hint", "authorizationUrl" : "https://cilogon.org/authorize", "disableUserInfo" : "false", - "logoutUrl" : "https://cybershuttle.org/", + "logoutUrl" : "http://airavata.host:8009/", "sendIdTokenOnLogout" : "true", "passMaxAge" : "false" } diff --git a/.devcontainer/pga/Dockerfile b/.devcontainer/pga/Dockerfile deleted file mode 100644 index e40ac6a74a..0000000000 --- a/.devcontainer/pga/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM php:8.1-apache - -# Install required PHP extensions and tools from apt -RUN apt-get update && apt-get install -y wget git unzip && rm -rf /var/lib/apt/lists/* - -# Install Composer (official way) -RUN wget https://getcomposer.org/installer -O composer-setup.php && \ - php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \ - rm composer-setup.php - -# Set up your application (example) -RUN mkdir -p /var/www/portals/default - -RUN wget -q https://github.com/apache/airavata-portals/archive/refs/heads/main.tar.gz -O /tmp/portals.tar.gz && \ - tar -xzf /tmp/portals.tar.gz --strip-components=2 -C /var/www/portals/default airavata-portals-main/airavata-php-gateway && \ - rm /tmp/portals.tar.gz - -COPY pga-default.conf /etc/apache2/sites-available/000-default.conf - -# Enable Apache modules -RUN a2enmod rewrite - -RUN mkdir -p /var/www/portals/default/storage/views && \ - mkdir -p /var/www/portals/default/storage/sessions && \ - mkdir -p /var/www/portals/default/bootstrap/cache - -# Set proper permissions for Laravel -RUN chmod -R 775 /var/www/portals/default/storage/views && \ - chmod -R 775 /var/www/portals/default/storage/sessions && \ - chmod -R 775 /var/www/portals/default/bootstrap/cache - -WORKDIR /var/www/portals/default -RUN composer install - -EXPOSE 80 -EXPOSE 443 diff --git a/.devcontainer/portals/Dockerfile b/.devcontainer/portals/Dockerfile new file mode 100644 index 0000000000..94a9de0b06 --- /dev/null +++ b/.devcontainer/portals/Dockerfile @@ -0,0 +1,33 @@ +FROM php:8.1-apache + +# TODO put all 3 portals -- research portal (:5173), php gateway (:8008), and django portal (:8009) +# TODO handle ssl termination before requests hit this container + +ARG PORTALS_REPO_URL=https://github.com/apache/airavata-portals/archive/refs/heads/main.tar.gz + +# set hostname +RUN echo "ServerName airavata.host" >> /etc/apache2/apache2.conf + +# install deps +RUN apt-get update && apt-get install -y wget git unzip && rm -rf /var/lib/apt/lists/* +RUN wget -qO- https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +# setup site config +COPY pga-default.conf /etc/apache2/sites-available/000-default.conf + +RUN a2enmod rewrite && a2ensite 000-default.conf && apache2ctl configtest + +USER www-data:www-data + +WORKDIR /var/www/html/default + +# ensure config directory exists for mounting +RUN mkdir -p config storage/views storage/sessions bootstrap/cache + +RUN wget -qO- $PORTALS_REPO_URL | tar xz --strip-components=2 -C . airavata-portals-main/airavata-php-gateway + +COPY pga_config.php /var/www/html/default/config/pga_config.php + +RUN composer install --no-dev --optimize-autoloader + +EXPOSE 5173 8008 8009 diff --git a/.devcontainer/pga/pga-default.conf b/.devcontainer/portals/pga-default.conf similarity index 58% rename from .devcontainer/pga/pga-default.conf rename to .devcontainer/portals/pga-default.conf index dec81542d8..e3b250eac4 100644 --- a/.devcontainer/pga/pga-default.conf +++ b/.devcontainer/portals/pga-default.conf @@ -1,7 +1,7 @@ - + - DocumentRoot /var/www/portals/default/public - + DocumentRoot /var/www/html/default/public + AllowOverride All ErrorLog /var/log/apache2/default.error.log diff --git a/.devcontainer/portals/pga_config.php b/.devcontainer/portals/pga_config.php new file mode 100644 index 0000000000..80fb112cec --- /dev/null +++ b/.devcontainer/portals/pga_config.php @@ -0,0 +1,324 @@ + [ + + /** + * Admin Role Name + */ + 'admin-role-name' => 'Internal/everyone', + + /** + * Read only Admin Role Name + */ + 'read-only-admin-role-name' => 'Internal/everyone', + + /** + * Gateway user role + */ + 'user-role-name' => 'Internal/everyone', + + /** + * Initial user role. This is the initial user role assigned to a new + * user. Set this to one of the three roles above to automatically + * grant new users that role, or set to some other role ('user-pending') + * to require admin approval before users have access. + */ + 'initial-role-name' => 'user-pending', + + /** + * Tenant Domain + */ + 'tenant-domain' => 'default', + + /** + * Tenant admin's username + */ + 'admin-username' => 'default-admin', + + /** + * Tenant admin's password + */ + 'admin-password' => 'ade4#21242ftfd', + + /** + * OAuth client key + */ + 'oauth-client-key' => 'pga', + + /** + * OAuth client secret + */ + 'oauth-client-secret' => 'upCMVu2RZcAXUqpr9V7phAbz6hhF9cbl', + + /** + * Authentication options + */ + 'auth-options' => [ + // Example of password based login + [ + 'oauth-grant-type' => 'password', + 'name' => 'Airavata PHP Gateway', + ], + // Example of external identity provider login + [ + 'oauth-grant-type' => 'authorization_code', + 'name' => 'CILogon', + // Optional + // Note: kc_idp_hint is used to skip Keycloak login screen and redirect immediately to this identity provider + // http://www.keycloak.org/docs/2.5/server_admin/topics/identity-broker/suggested.html + 'oauth-authorize-url-extra-params' => 'kc_idp_hint=oidc', + // Optional + 'logo' => '/assets/path_to_image.png' + ], + ], + + /** + * OAuth Grant Type (password or authorization_code) + */ + 'oauth-grant-type' => 'authorization_code', + + /** + * OAuth call back url (only if the grant type is authorization_code) + */ + 'oauth-callback-url' => 'http://localhost:8000/callback-url', + + /** + * For OIDC servers that support the discovery protocol. + */ + 'openid-connect-discovery-url' => 'http://airavata.host:18080/realms/default/.well-known/openid-configuration', + + /** + * Identity server url + */ + 'service-url' => 'http://airavata.host:18080', + + /** + * Enable HTTPS server verification + */ + 'verify-peer' => false, + + /** + * Path to the server certificate file + */ + 'cafile-path' => app_path() . '/resources/security/incommon_rsa_server_ca.pem', + ], + + + /** + * ***************************************************************** + * Airavata Client Configurations + * ***************************************************************** + */ + 'airavata' => [ + + /** + * Airavata API server location. Use tls:// as the protocol to + * connect TLS enabled Airavata + */ + 'airavata-server' => 'airavata.host', + + /** + * Airavata API server port + */ + 'airavata-port' => '8930', + + /** + * Airavata Profile Service server location. Use tls:// as the protocol to + * connect over TLS + */ + 'airavata-profile-service-server' => 'airavata.host', + + /** + * Airavata Profile Service port + */ + 'airavata-profile-service-port' => '8962', + + /** + * Airavata API server thrift communication timeout + */ + 'airavata-timeout' => '1000000', + + /** + * PGA Gateway ID + */ + 'gateway-id' => 'default', + + /** + * absolute path of the data dir + */ + 'experiment-data-absolute-path' => '/var/www/experimentData', + + /** + * Advanced experiments options + */ + 'advanced-experiment-options' => '', + + /** + * Default queue name + */ + 'queue-name' => 'long', + + /** + * Default node count + */ + 'node-count' => '1', + + /** + * Default total core count + */ + 'total-cpu-count' => '16', + + /** + * Default wall time limit + */ + 'wall-time-limit' => '30', + + /** + * Max node count + */ + 'max-node-count' => '4', + + /** + * Max total core count + */ + 'max-total-cpu-count' => '96', + + /** + * Max wall time limit + */ + 'max-wall-time-limit' => '120', + + /** + * Enable app-catalog cache + */ + 'enable-app-catalog-cache' => true, + + /** + * Life time of app catalog data cache in minutes + */ + 'app-catalog-cache-duration' => 5, + + /** + * Gateway data store resource id + */ + 'gateway-data-store-resource-id' => '', + + /** + * Data Sharing enabled + */ + 'data-sharing-enabled' => false, + + /** + * Group Resource Profile ID to use when submitting experiments + */ + 'group-resource-profile-id' => '', + ], + + /** + * ***************************************************************** + * Portal Related Configurations + * ***************************************************************** + */ + 'portal' => [ + /** + * Whether this portal is the SciGaP admin portal + */ + 'super-admin-portal' => true, + + /** + * Set the name of theme in use here + */ + 'theme' => 'base', + + /** + * Portal title + */ + 'portal-title' => 'Airavata PHP Gateway', + + /** + * Email address of the portal admin. Portal admin well get email notifications for events + * such as new user creation + */ + 'admin-emails' => ['xxx@xxx.com','yyy@yyy.com'], + + /** + * Email account that the portal should login to send emails + */ + 'portal-email-username' => 'xyz@abc.com', + + /** + * Password for the portal's email account + */ + 'portal-email-password' => 'xxxxxxxxxxx', + + /** + * SMTP server on which the portal should connect + */ + 'portal-smtp-server-host' => 'smtp.gmail.com', + + /** + * SMTP server port on which the portal should connect + */ + 'portal-smtp-server-port' => '587', + + /** + * Email verification code valid time interval in minutes + */ + 'email-verify-code-valid-time' => 360, + + /** + * Set this to true if theme has set links to login + */ + 'theme-based-login-links-configured' => false, + + /** + * Set the URL of the new Django portal for re-routing + */ + 'airavata-django-url' => "http://airavata.host:8009/", + + /** + * Set to true to enable reroute to the new Django portal + */ + 'reroute-to-django' => true, + + /** + * Set JIRA Issue Collector scripts here. + */ + 'jira-help' => + [ + /** + * Report Issue Script issued for your app by Atlassian JIRA + */ + 'report-issue-script' => '', + /** + * Collector id at the end of the above script + */ + 'report-issue-collector-id' => '', + /** + * Create Report Script issued for your app by Atlassian JIRA + */ + 'request-feature-script' => '', + /** + * Collector id at the end of the above script + */ + 'request-feature-collector-id' => '' + ], + + /** + * Set Google Analytics Id here. ID format that generates from + * creating tracker object should be + * + * UA-XXXXX-Y + * + * for it to be working correctly. Currently it is only set for + * sending pageviews. + */ + 'google-analytics-id' => '' + ] +); diff --git a/.devcontainer/proxy/http.conf b/.devcontainer/proxy/http.conf new file mode 100644 index 0000000000..19ebd0c9c5 --- /dev/null +++ b/.devcontainer/proxy/http.conf @@ -0,0 +1,104 @@ +# research portal (5173) +server { + listen 5173 ssl; + if ($scheme != "https") { + return 301 https://$host$request_uri; + } + http2 on; + server_name airavata.host; + ssl_certificate /vault/server.crt; + ssl_certificate_key /vault/server.key; + location / { + proxy_pass http://portals:5173; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_redirect default; + } +} + +# php portal (8008) +server { + listen 8008 ssl; + if ($scheme != "https") { + return 301 https://$host$request_uri; + } + http2 on; + server_name airavata.host; + ssl_certificate /vault/server.crt; + ssl_certificate_key /vault/server.key; + location / { + proxy_pass http://portals:8008; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_redirect default; + } +} + +# django portal (8009) +server { + listen 8009 ssl; + if ($scheme != "https") { + return 301 https://$host$request_uri; + } + http2 on; + server_name airavata.host; + ssl_certificate /vault/server.crt; + ssl_certificate_key /vault/server.key; + location / { + proxy_pass http://portals:8009; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_redirect default; + } +} + +# keycloak (8443) +server { + listen 8443 ssl; + if ($scheme != "https") { + return 301 https://$host$request_uri; + } + http2 on; + server_name airavata.host; + ssl_certificate /vault/server.crt; + ssl_certificate_key /vault/server.key; + location / { + proxy_pass http://keycloak:18080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_redirect default; + } +} + +# jupyterhub (20000) +server { + listen 20000 ssl; + if ($scheme != "https") { + return 301 https://$host$request_uri; + } + http2 on; + server_name airavata.host; + ssl_certificate /vault/server.crt; + ssl_certificate_key /vault/server.key; + location / { + proxy_pass http://jupyterhub:20000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_redirect default; + } +} diff --git a/.devcontainer/proxy/nginx.conf b/.devcontainer/proxy/nginx.conf new file mode 100644 index 0000000000..b9536d0aaa --- /dev/null +++ b/.devcontainer/proxy/nginx.conf @@ -0,0 +1,15 @@ +worker_processes auto; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/conf.d/http.conf; +} + +stream { + include /etc/nginx/conf.d/stream.conf; +} \ No newline at end of file diff --git a/.devcontainer/proxy/stream.conf b/.devcontainer/proxy/stream.conf new file mode 100644 index 0000000000..782fbfc51d --- /dev/null +++ b/.devcontainer/proxy/stream.conf @@ -0,0 +1,18 @@ +# Thrift server (9930 -> 8930) +server { + listen 9930 ssl; # accept TLS on port 9930 + proxy_pass 192.168.100.9:8930; # forward decrypted traffic + + # point to your cert+key + ssl_certificate /vault/server.crt; + ssl_certificate_key /vault/server.key; + + # (optional) enforce modern TLS only + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + # tuning + proxy_connect_timeout 5s; + proxy_timeout 5s; +} diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..43fb6a53e7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.devcontainer +.github +.idea +.run +.vscode \ No newline at end of file diff --git a/.gitignore b/.gitignore index 91d9f1ed6a..91267d90fb 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,7 @@ airavata-local-agent/build.sh modules/research-framework/compose -logs +logs/ # Ignore Maven build output **/target/ diff --git a/.run/APIServerStarter.run.xml b/.run/APIServerStarter.run.xml new file mode 100644 index 0000000000..9b77ef4b3b --- /dev/null +++ b/.run/APIServerStarter.run.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/.run/AgentServiceApplication.run.xml b/.run/AgentServiceApplication.run.xml new file mode 100644 index 0000000000..c220f66317 --- /dev/null +++ b/.run/AgentServiceApplication.run.xml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/.run/FileServerApplication.run.xml b/.run/FileServerApplication.run.xml new file mode 100644 index 0000000000..dd32867970 --- /dev/null +++ b/.run/FileServerApplication.run.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/.run/JobEngineStarter.run.xml b/.run/JobEngineStarter.run.xml new file mode 100644 index 0000000000..540bbd195b --- /dev/null +++ b/.run/JobEngineStarter.run.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/.run/JobMonitorStarter.run.xml b/.run/JobMonitorStarter.run.xml new file mode 100644 index 0000000000..4d25f476a6 --- /dev/null +++ b/.run/JobMonitorStarter.run.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/.run/ResearchServiceApplication.run.xml b/.run/ResearchServiceApplication.run.xml new file mode 100644 index 0000000000..dbec147802 --- /dev/null +++ b/.run/ResearchServiceApplication.run.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/README.md b/README.md index ff55d3384d..fa267b67e3 100644 --- a/README.md +++ b/README.md @@ -201,12 +201,10 @@ distribution ├── services_down.sh ├── services_up.sh └── vault - ├── airavata_sym.jks ├── airavata-server.properties - ├── airavata.jks + ├── airavata.p12 ├── application-agent-service.yml ├── application-research-service.yml - ├── client_truststore.jks ├── email-config.yaml └── log4j2.xml @@ -215,8 +213,7 @@ distribution **What's in the vault?** -* `airavata_sym.jks`, `airavata.jks` - contains the keys used to secure SSH credentials, etc. -* `client_truststore.jks` - contains the certificates (e.g., certbot fullchain.pem) used to secure network connections (TLS). +* `airavata.p12` - contains the keys used to secure SSH credentials, etc. * `email-config.yaml` - contains the email addresses observed by the email monitor. * `airavata-server.properties` - config file for the airavata api server. * `application-agent-service.yml` - config file for the airavata agent service. diff --git a/airavata-api/pom.xml b/airavata-api/pom.xml index 3a8f4e5149..2b54b5ec0b 100644 --- a/airavata-api/pom.xml +++ b/airavata-api/pom.xml @@ -113,8 +113,8 @@ under the License. commons-cli - net.sf.dozer - dozer + com.github.dozermapper + dozer-core org.slf4j @@ -323,6 +323,29 @@ under the License. software.amazon.awssdk retries + + + org.apache.zookeeper + zookeeper + + + org.slf4j + slf4j-log4j12 + + + log4j + log4j + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + @@ -416,6 +439,7 @@ under the License. + org.apache.openjpa openjpa-maven-plugin @@ -443,94 +467,7 @@ under the License. - - org.codehaus.mojo - exec-maven-plugin - - java - runtime - ${project.build.directory} - - - - - generate-migrations-mysql - - exec - - - - - -Dairavata.config.dir=${project.basedir}/src/main/resources/migrations-util/mysql - -classpath - - org.apache.airavata.registry.core.utils.migration.MigrationSchemaGenerator - - - - - - generate-schema-mysql - - exec - - - - - -Dairavata.config.dir=${project.basedir}/src/main/resources/migrations-util/mysql - -classpath - - org.apache.airavata.registry.core.utils.migration.MigrationSchemaGenerator - build - - - - - - generate-migrations-derby - - exec - - - - - -Dairavata.config.dir=${project.basedir}/src/main/resources/migrations-util/derby - -classpath - - org.apache.airavata.registry.core.utils.migration.MigrationSchemaGenerator - - - - - - generate-schema-derby - - exec - - - - - -Dairavata.config.dir=${project.basedir}/src/main/resources/migrations-util/derby - -classpath - - org.apache.airavata.registry.core.utils.migration.MigrationSchemaGenerator - build - - - - - - + org.apache.maven.plugins maven-surefire-plugin @@ -550,34 +487,80 @@ under the License. + - com.dkanejs.maven.plugins - docker-compose-maven-plugin + org.apache.maven.plugins + maven-assembly-plugin - mysql-up + api-server-distribution-package + package - up + single - - ${project.basedir}/src/main/resources/migrations-util/mysql/docker-compose.yml - true + posix + ${api.server.dist.name} + + src/main/assembly/api-server-bin-assembly.xml + + false + + + + + + maven-resources-plugin + - mysql-down + copy-api-server-resources + package - down + copy-resources - - ${project.basedir}/src/main/resources/migrations-util/mysql/docker-compose.yml + ${docker.api.server.build.directory} + + + ${docker.api.server.image.src.root} + false + + + ${session.executionRootDirectory}/dev-tools/deployment-scripts + false + + + ${session.executionRootDirectory}/distribution + + ${api.server.dist.name}.tar.gz + + + + + + io.fabric8 + docker-maven-plugin + 0.46.0 + + true + + + airavata/api-server + + ${docker.api.server.build.directory}/Dockerfile + + + + + + ${project.basedir}/src/test/java @@ -595,4 +578,11 @@ under the License. + + + ${project.build.directory}/api_server_docker_img_build + src/main/docker + apache-airavata-api-server-${project.version} + + \ No newline at end of file diff --git a/modules/distribution/src/main/assembly/api-server-bin-assembly.xml b/airavata-api/src/main/assembly/api-server-bin-assembly.xml similarity index 91% rename from modules/distribution/src/main/assembly/api-server-bin-assembly.xml rename to airavata-api/src/main/assembly/api-server-bin-assembly.xml index 89f361dd71..a4ba2f2ae6 100644 --- a/modules/distribution/src/main/assembly/api-server-bin-assembly.xml +++ b/airavata-api/src/main/assembly/api-server-bin-assembly.xml @@ -32,7 +32,7 @@ - ../.. + .. . INSTALL @@ -46,7 +46,7 @@ - ../../keystores + ../keystores conf/keystores *.jks @@ -55,19 +55,19 @@ - ../../airavata-api/src/main/resources + src/main/resources conf META-INF/persistence.xml + templates/*.template *.properties *.xml - *.template - ../../airavata-api/src/main/resources + src/main/resources/database_scripts database_scripts *.sql @@ -107,7 +107,7 @@ - false + true lib true diff --git a/modules/distribution/src/main/assembly/api-server-src-assembly.xml b/airavata-api/src/main/assembly/api-server-src-assembly.xml similarity index 100% rename from modules/distribution/src/main/assembly/api-server-src-assembly.xml rename to airavata-api/src/main/assembly/api-server-src-assembly.xml diff --git a/modules/distribution/src/main/docker/api-server/Dockerfile b/airavata-api/src/main/docker/Dockerfile similarity index 66% rename from modules/distribution/src/main/docker/api-server/Dockerfile rename to airavata-api/src/main/docker/Dockerfile index 5ac62051a0..49462eb199 100644 --- a/modules/distribution/src/main/docker/api-server/Dockerfile +++ b/airavata-api/src/main/docker/Dockerfile @@ -21,26 +21,43 @@ FROM eclipse-temurin:17-jre WORKDIR /opt # Copy the extracted distribution files -COPY ${api.server.dist.name}-bin.tar.gz /opt/ +COPY ${api.server.dist.name}.tar.gz /opt/ RUN tar -xzf /opt/${api.server.dist.name}-bin.tar.gz && \ rm /opt/${api.server.dist.name}-bin.tar.gz && \ mv /opt/${api.server.dist.name} /opt/apache-airavata -# Copy wait-for-it script for container orchestration -COPY wait-for-it.sh /opt/apache-airavata/wait-for-it.sh -RUN chmod +x /opt/apache-airavata/wait-for-it.sh - -# Add required configuration -RUN echo "api.server.monitoring.enabled=false" >> /opt/apache-airavata/bin/airavata-server.properties +# Copy server start scripts +COPY ./*.sh /opt/apache-airavata/ +RUN chmod +x /opt/apache-airavata/*.sh # Set environment variables ENV JAVA_HOME=/opt/java/openjdk ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV AIRAVATA_HOME=/opt/apache-airavata -# Expose the default API server port -EXPOSE 8960 9930 7878 8962 8970 - -# Set the entrypoint to use the shell script -ENTRYPOINT ["/opt/apache-airavata/bin/airavata-server-start.sh"] -CMD ["api-orch"] +# sharing registry service +EXPOSE 7878 +# tunnel service +EXPOSE 8000 +# tunnel service (ingress) +EXPOSE 17000 +# file service +EXPOSE 8050 +# api service +EXPOSE 8930 +# cred store service +EXPOSE 8960 +# profile service +EXPOSE 8962 +# registry service +EXPOSE 8970 +# agent service (http) +EXPOSE 18800 +# agent service (gRPC) +EXPOSE 19900 +# research service (http) +EXPOSE 18889 +# research service (gRPC) +EXPOSE 19908 + +CMD ["/opt/apache-airavata/services_up.sh && sleep infinity"] diff --git a/airavata-api/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java b/airavata-api/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java index 30601367bf..3a4b0999b2 100644 --- a/airavata-api/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java +++ b/airavata-api/src/main/java/org/apache/airavata/api/client/AiravataClientFactory.java @@ -24,67 +24,45 @@ import java.util.List; import java.util.Map; import org.apache.airavata.api.Airavata; +import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.Constants; +import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.error.AiravataClientException; import org.apache.airavata.model.security.AuthzToken; import org.apache.thrift.TException; import org.apache.thrift.protocol.TBinaryProtocol; -import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.transport.TSSLTransportFactory; import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransport; import org.apache.thrift.transport.TTransportException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class AiravataClientFactory { - private static final Logger logger = LoggerFactory.getLogger(AiravataClientFactory.class); - - public static Airavata.Client createAiravataClient(String serverHost, int serverPort) + public static Airavata.Client createAiravataClient(String serverHost, int serverPort, boolean secure) throws AiravataClientException { try { - TTransport transport = new TSocket(serverHost, serverPort); - transport.open(); - TProtocol protocol = new TBinaryProtocol(transport); + TTransport transport; + if (!secure) { + transport = new TSocket(serverHost, serverPort); + transport.open(); + } else { + // TLS enabled client + var params = new TSSLTransportFactory.TSSLTransportParameters(); + params.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword()); + transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params); + } + + var protocol = new TBinaryProtocol(transport); // TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "APIServer"); return new Airavata.Client(protocol); - } catch (TTransportException e) { + } catch (TTransportException | ApplicationSettingsException e) { AiravataClientException exception = new AiravataClientException(); exception.setParameter("Unable to connect to the server at " + serverHost + ":" + serverPort); throw exception; } } - /** - * This method returns a Airavata Client that talks to the API Server exposed over TLS. - * - * @param serverHost - * @param serverPort - * @param trustStorePath - * @param trustStorePassword - * @param clientTimeOut - * @return - * @throws AiravataClientConnectException - */ - public static Airavata.Client createAiravataSecureClient( - String serverHost, int serverPort, String trustStorePath, String trustStorePassword, int clientTimeOut) - throws AiravataClientException { - try { - TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); - params.setTrustStore(trustStorePath, trustStorePassword); - TSocket transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, clientTimeOut, params); - TProtocol protocol = new TBinaryProtocol(transport); - return new Airavata.Client(protocol); - } catch (TTransportException e) { - logger.error(e.getMessage(), e); - AiravataClientException clientError = new AiravataClientException(); - clientError.setParameter("Unable to connect to the server at " + serverHost + ":" + serverPort); - throw clientError; - } - } - - public static void main(String a[]) throws TException { + public static void main(String[] a) throws TException, ApplicationSettingsException { AuthzToken token = new AuthzToken(); token.setAccessToken( "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJBUGFKRUpERFc4ZEdzMExnc3ozYUdydERsZ2U0eWlQblFibUNsYnpJX2NVIn0.eyJqdGkiOiI1NmMwZDZmYy0yMGVhLTQ1Y2UtODUwNC1kMTY0MTZkYTdkYzEiLCJleHAiOjE2NDc0NTQyNjcsIm5iZiI6MCwiaWF0IjoxNjQ3NDUyNDY3LCJpc3MiOiJodHRwczovL2lhbWRldi5zY2lnYXAub3JnL2F1dGgvcmVhbG1zL3NlYWdyaWQiLCJhdWQiOiJwZ2EiLCJzdWIiOiI3ZGZkYjI4MS1lNWIzLTQ4MjQtOTcxZC00YzQ2ZmNkMzIwYTEiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJwZ2EiLCJhdXRoX3RpbWUiOjAsInNlc3Npb25fc3RhdGUiOiI1NWVkODI5OS0xN2FiLTQwNTEtYTBjYy0zMjgzNWQ1MTVlNjUiLCJhY3IiOiIxIiwiY2xpZW50X3Nlc3Npb24iOiIwMjU2OTljNS1lY2I2LTQ2ZDYtYmYwNy01ZDczOTk1ZTI3YjMiLCJhbGxvd2VkLW9yaWdpbnMiOlsiaHR0cHM6Ly9kZXYuc2VhZ3JpZC5vcmciXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsicGdhIjp7InJvbGVzIjpbImdhdGV3YXktdXNlciJdfSwiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsInZpZXctcHJvZmlsZSJdfX0sIm5hbWUiOiJFcm9tYSBBYmV5c2luZ2hlIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiMjAyMXRlc3QxIiwiZ2l2ZW5fbmFtZSI6IkVyb21hIiwiZmFtaWx5X25hbWUiOiJBYmV5c2luZ2hlIiwiZW1haWwiOiJlcm9tYS5hYmV5c2luZ2hlQGdtYWlsLmNvbSJ9.eMIrTzyc43CLkxCauiXIwPV99CmsBDbSbiIVEE9Qd3ASyJKXlzkrWsUVPE-g43i1iBKaHBcnLPkmzVz8Hb0B1wtDA5nKSgipGYjfJfaWdMzBrW1PkpeWMKDZHN3m4OS7YZnzQki0YJFvL1-IZsYf2UCnr_lsOi2M-dnj9xwEJ_VIdvvHl9I6ivhBUywYDU0uL9EoSL3kAes7FvooOhXnZiRxJpZK82VPZZiVAb-nv5xgCwQw0ipbm8b0kIta4cxhjKKDhyINRvGXJjqN3kRNsahYHLnwsRqRjabgvbSfe4vtS5iRoPO-qF-I-rSMf2jZPREMWxdLQ9uPXEk9mFxqbQ"); @@ -92,12 +70,7 @@ public static void main(String a[]) throws TException { claimsMap.put(Constants.GATEWAY_ID, "seagrid"); claimsMap.put(Constants.USER_NAME, "2021test1"); token.setClaimsMap(claimsMap); - Airavata.Client apiClient = createAiravataSecureClient( - "apidev.scigap.org", - 9930, - "/Users/eromaabeysinghe/development/local-airavata/airavata/dev-tools/ansible/inventories/scigap/production/files/airavata.jks", - "airavata", - 10000); + Airavata.Client apiClient = createAiravataClient("apidev.scigap.org", 8930, ServerSettings.isTLSEnabled()); List outputNames = new ArrayList<>(); outputNames.add("Gaussian-Application-Output"); diff --git a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java index 357485abf2..928d722d69 100644 --- a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java +++ b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java @@ -32,9 +32,6 @@ import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.error.AiravataErrorType; import org.apache.airavata.model.error.AiravataSystemException; -import org.apache.airavata.security.AiravataSecurityException; -import org.apache.airavata.service.security.AiravataSecurityManager; -import org.apache.airavata.service.security.SecurityManagerFactory; import org.apache.airavata.service.security.interceptor.SecurityModule; import org.apache.thrift.server.TServer; import org.apache.thrift.server.TThreadPoolServer; @@ -63,114 +60,76 @@ public void startAiravataServer(Airavata.Processor airavataAPISe throws AiravataSystemException { try { final String serverHost = ServerSettings.getSetting(Constants.API_SERVER_HOST, null); - if (!ServerSettings.isTLSEnabled()) { - final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_PORT, "8930")); + final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_PORT, "8930")); + if (!ServerSettings.isTLSEnabled()) { TServerTransport serverTransport; - - if (ServerSettings.isAPIServerTLSEnabled()) { - logger.info("Starting API Server with TLS Security.."); - - String keystore = ServerSettings.getApiServerKeystore(); - String keystorePWD = ServerSettings.getApiServerKeystorePasswd(); - TSSLTransportFactory.TSSLTransportParameters tlsParams = - new TSSLTransportFactory.TSSLTransportParameters(); - tlsParams.setKeyStore(keystore, keystorePWD); - serverTransport = TSSLTransportFactory.getServerSocket( - serverPort, 10000, InetAddress.getByName(serverHost), tlsParams); + if (serverHost == null) { + serverTransport = new TServerSocket(serverPort); } else { - if (serverHost == null) { - serverTransport = new TServerSocket(serverPort); - } else { - InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort); - serverTransport = new TServerSocket(inetSocketAddress); - } + InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort); + serverTransport = new TServerSocket(inetSocketAddress); } - TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport); options.minWorkerThreads = Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_MIN_THREADS, "50")); server = new TThreadPoolServer(options.processor(airavataAPIServer)); - new Thread() { - public void run() { - server.serve(); - setStatus(ServerStatus.STOPPED); - logger.info("Airavata API Server Stopped."); - } - }.start(); - new Thread() { - public void run() { - while (!server.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; + new Thread(() -> { + server.serve(); + setStatus(ServerStatus.STOPPED); + logger.info("Airavata API Server Stopped."); + }) + .start(); + new Thread(() -> { + while (!server.isServing()) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + break; + } + } + if (server.isServing()) { + setStatus(ServerStatus.STARTED); + logger.info("Starting Airavata API Server on Port " + serverPort); + logger.info("Listening to Airavata Clients ...."); } - } - if (server.isServing()) { - setStatus(ServerStatus.STARTED); - logger.info("Starting Airavata API Server on Port " + serverPort); - logger.info("Listening to Airavata Clients ...."); - } - } - }.start(); + }) + .start(); logger.info("Started API Server ...."); } else { - /**********start thrift server over TLS******************/ - TSSLTransportFactory.TSSLTransportParameters TLSParams = - new TSSLTransportFactory.TSSLTransportParameters(); + var TLSParams = new TSSLTransportFactory.TSSLTransportParameters(); TLSParams.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword()); - TServerSocket TLSServerTransport = TSSLTransportFactory.getServerSocket( - ServerSettings.getTLSServerPort(), - ServerSettings.getTLSClientTimeout(), - InetAddress.getByName(serverHost), - TLSParams); + var TLSServerTransport = TSSLTransportFactory.getServerSocket( + serverPort, ServerSettings.getTLSClientTimeout(), InetAddress.getByName(serverHost), TLSParams); TThreadPoolServer.Args settings = new TThreadPoolServer.Args(TLSServerTransport); settings.minWorkerThreads = Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_MIN_THREADS, "50")); TLSServer = new TThreadPoolServer(settings.processor(airavataAPIServer)); - new Thread() { - public void run() { - TLSServer.serve(); - setStatus(ServerStatus.STOPPED); - logger.info("Airavata API Server over TLS Stopped."); - } - }.start(); - new Thread() { - public void run() { - while (!TLSServer.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; + new Thread(() -> { + TLSServer.serve(); + setStatus(ServerStatus.STOPPED); + logger.info("Airavata API Server over TLS Stopped."); + }) + .start(); + new Thread(() -> { + while (!TLSServer.isServing()) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + break; + } + } + if (TLSServer.isServing()) { + setStatus(ServerStatus.STARTED); } - } - if (TLSServer.isServing()) { - setStatus(ServerStatus.STARTED); - } - } - }.start(); - logger.info("API server started over TLS on Port: " + ServerSettings.getTLSServerPort() + " ..."); + }) + .start(); + logger.info("API server started over TLS on Port: " + serverPort + " ..."); } - /*perform any security related initialization at the server startup, according to the underlying security - manager implementation being used.*/ - AiravataSecurityManager securityManager = SecurityManagerFactory.getSecurityManager(); - securityManager.initializeSecurityInfra(); - - } catch (TTransportException e) { - logger.error(e.getMessage(), e); - setStatus(ServerStatus.FAILED); + } catch (TTransportException | ApplicationSettingsException | UnknownHostException e) { logger.error("Failed to start API server ...", e); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } catch (ApplicationSettingsException e) { - logger.error(e.getMessage(), e); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } catch (UnknownHostException e) { - logger.error(e.getMessage(), e); - throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); - } catch (AiravataSecurityException e) { - logger.error(e.getMessage(), e); + setStatus(ServerStatus.FAILED); throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); } } diff --git a/airavata-api/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java b/airavata-api/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java index 1634d2b8ae..d12ed29b59 100644 --- a/airavata-api/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java +++ b/airavata-api/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java @@ -43,9 +43,6 @@ public class ApplicationSettings { private Exception propertyLoadException; - protected static final String TRUST_STORE_PATH = "trust.store"; - protected static final String TRUST_STORE_PASSWORD = "trust.store.password"; - private static final String REGULAR_EXPRESSION = "\\$\\{[a-zA-Z.-]*\\}"; private static final Logger logger = LoggerFactory.getLogger(ApplicationSettings.class); @@ -114,10 +111,6 @@ protected static ApplicationSettings getInstance() { return INSTANCE; } - protected static void setInstance(ApplicationSettings settingsInstance) { - INSTANCE = settingsInstance; - } - private void saveProperties() throws ApplicationSettingsException { URL url = getPropertyFileURL(); if (url.getProtocol().equalsIgnoreCase("file")) { @@ -228,81 +221,6 @@ private String deriveAbsoluteValueImpl(String property) { return property; } - public void setSettingImpl(String key, String value) throws ApplicationSettingsException { - properties.setProperty(key, value); - saveProperties(); - } - - public boolean isSettingDefinedImpl(String key) throws ApplicationSettingsException { - validateSuccessfulPropertyFileLoad(); - return properties.containsKey(key); - } - - public String getTrustStorePathImpl() throws ApplicationSettingsException { - return getSetting(TRUST_STORE_PATH); - } - - public String getTrustStorePasswordImpl() throws ApplicationSettingsException { - return getSetting(TRUST_STORE_PASSWORD); - } - - public String getCredentialStoreKeyStorePathImpl() throws ApplicationSettingsException { - return getSetting("credential.store.keystore.url"); - } - - public String getCredentialStoreKeyAliasImpl() throws ApplicationSettingsException { - return getSetting("credential.store.keystore.alias"); - } - - public String getCredentialStoreKeyStorePasswordImpl() throws ApplicationSettingsException { - return getSetting("credential.store.keystore.password"); - } - - public String getCredentialStoreNotifierEnabledImpl() throws ApplicationSettingsException { - return getSetting("notifier.enabled"); - } - - public String getCredentialStoreNotifierDurationImpl() throws ApplicationSettingsException { - return getSetting("notifier.duration"); - } - - public String getCredentialStoreEmailServerImpl() throws ApplicationSettingsException { - return getSetting("email.server"); - } - - public String getCredentialStoreEmailServerPortImpl() throws ApplicationSettingsException { - return getSetting("email.server.port"); - } - - public String getCredentialStoreEmailUserImpl() throws ApplicationSettingsException { - return getSetting("email.user"); - } - - public String getCredentialStoreEmailPasswordImpl() throws ApplicationSettingsException { - return getSetting("email.password"); - } - - public String getCredentialStoreEmailSSLConnectImpl() throws ApplicationSettingsException { - return getSetting("email.ssl"); - } - - public String getCredentialStoreEmailFromEmailImpl() throws ApplicationSettingsException { - return getSetting("email.from"); - } - - /** - * @deprecated use {{@link #getSetting(String)}} - * @return - */ - @Deprecated - public Properties getPropertiesImpl() { - return properties; - } - - public void mergeSettingsImpl(Map props) { - properties.putAll(props); - } - public void mergeSettingsImpl(InputStream stream) throws IOException { Properties tmpProp = new Properties(); tmpProp.load(stream); @@ -356,46 +274,10 @@ public static boolean getBooleanSetting(String key) throws ApplicationSettingsEx .orElseThrow(() -> new ApplicationSettingsException("Value can not be parsed to Boolean")); } - public static long getLongSetting(String key) throws ApplicationSettingsException { - String val = getInstance().getSettingImpl(key); - try { - return Long.parseLong(val); - } catch (NumberFormatException e) { - throw new ApplicationSettingsException("Value can not be parsed to long", e); - } - } - - public static double getDoubleSetting(String key) throws ApplicationSettingsException { - String val = getInstance().getSettingImpl(key); - try { - return Double.parseDouble(val); - } catch (NumberFormatException e) { - throw new ApplicationSettingsException("Value can not be parsed to double", e); - } - } - public static boolean isSettingDefined(String key) throws ApplicationSettingsException { return getInstance().properties.containsKey(key); } - public static boolean isTrustStorePathDefined() throws ApplicationSettingsException { - return ApplicationSettings.isSettingDefined(TRUST_STORE_PATH); - } - - public static String getTrustStorePath() throws ApplicationSettingsException { - String airavataConfigDir = getSetting(AIRAVATA_CONFIG_DIR); - String trustStorePath = getSetting(TRUST_STORE_PATH); - return new File(airavataConfigDir, trustStorePath).getAbsolutePath(); - } - - public static String getTrustStorePassword() throws ApplicationSettingsException { - return getSetting(TRUST_STORE_PASSWORD); - } - - public static void initializeTrustStore() throws ApplicationSettingsException { - SecurityUtil.setTrustStoreParameters(getTrustStorePath(), getTrustStorePassword()); - } - public static String getCredentialStoreKeyStorePath() throws ApplicationSettingsException { String airavataConfigDir = getSetting(AIRAVATA_CONFIG_DIR); String credentialStoreKeyStorePath = getSetting("credential.store.keystore.url"); @@ -418,14 +300,6 @@ public static String getCredentialStoreServerPort() throws ApplicationSettingsEx return getSetting("credential.store.server.port"); } - public static String getCredentialStoreNotifierEnabled() throws ApplicationSettingsException { - return getSetting("notifier.enabled"); - } - - public static String getCredentialStoreNotifierDuration() throws ApplicationSettingsException { - return getSetting("notifier.duration"); - } - public static String getCredentialStoreEmailServer() throws ApplicationSettingsException { return getSetting("email.server"); } @@ -478,14 +352,6 @@ public static Boolean enableDataAnalyzerJobScanning() throws ApplicationSettings return getSetting("data.analyzer.job.scanning.enable").equalsIgnoreCase("true"); } - public static String getUserProfileServerHost() throws ApplicationSettingsException { - return getSetting(ServerSettings.USER_PROFILE_SERVER_HOST); - } - - public static String getUserProfileServerPort() throws ApplicationSettingsException { - return getSetting(ServerSettings.USER_PROFILE_SERVER_PORT); - } - public static String getProfileServiceServerHost() throws ApplicationSettingsException { return getSetting(ServerSettings.PROFILE_SERVICE_SERVER_HOST); } @@ -499,29 +365,11 @@ public static String getIamServerUrl() throws ApplicationSettingsException { } public static boolean isThriftClientPoolAbandonedRemovalEnabled() { - return Boolean.valueOf(getSetting(THRIFT_CLIENT_POOL_ABANDONED_REMOVAL_ENABLED, "false")); + return Boolean.parseBoolean(getSetting(THRIFT_CLIENT_POOL_ABANDONED_REMOVAL_ENABLED, "false")); } public static boolean isThriftClientPoolAbandonedRemovalLogged() { - return Boolean.valueOf(getSetting(THRIFT_CLIENT_POOL_ABANDONED_REMOVAL_LOGGED, "false")); - } - - /** - * @deprecated use {{@link #getSetting(String)}} - * @return - * @throws ApplicationSettingsException - */ - @Deprecated - public static Properties getProperties() throws ApplicationSettingsException { - return getInstance().properties; - } - - public static void mergeSettings(Map props) { - getInstance().mergeSettingsImpl(props); - } - - public static void mergeSettings(InputStream stream) throws IOException { - getInstance().mergeSettingsImpl(stream); + return Boolean.parseBoolean(getSetting(THRIFT_CLIENT_POOL_ABANDONED_REMOVAL_LOGGED, "false")); } public static void mergeSettingsCommandLineArgs(String[] args) { @@ -548,7 +396,7 @@ public static URL loadFile(String fileName) { return asfile.toURI().toURL(); } } catch (MalformedURLException e) { - logger.error("Error parsing the file from airavata.config.dir", airavataConfigDir); + logger.error("Error parsing the file from airavata.config.dir: {}", airavataConfigDir); } } diff --git a/airavata-api/src/main/java/org/apache/airavata/common/utils/Constants.java b/airavata-api/src/main/java/org/apache/airavata/common/utils/Constants.java index a0b14ccd78..4d347b46d8 100644 --- a/airavata-api/src/main/java/org/apache/airavata/common/utils/Constants.java +++ b/airavata-api/src/main/java/org/apache/airavata/common/utils/Constants.java @@ -23,51 +23,29 @@ * Constants used in Airavata should go here. */ public final class Constants { - - public static final String USER_IN_SESSION = "userName"; - - public static final String STAT = "stat"; public static final String JOB = "job"; + // API security relates property names - public static final String IS_API_SECURED = "api.secured"; public static final String SECURITY_MANAGER_CLASS = "security.manager.class"; - public static final String REMOTE_OAUTH_SERVER_URL = "remote.oauth.authorization.server"; public static final String IS_TLS_ENABLED = "TLS.enabled"; - public static final String TLS_SERVER_PORT = "TLS.api.server.port"; public static final String KEYSTORE_PATH = "keystore.path"; public static final String KEYSTORE_PASSWORD = "keystore.password"; public static final String TLS_CLIENT_TIMEOUT = "TLS.client.timeout"; - public static final String IS_SHARING_TLS_ENABLED = "sharing.tls.enabled"; - public static final String API_METHOD_NAME = "api.method.name"; // constants in XACML authorization response. - public static final String NOT_APPLICABLE = "NotApplicable"; - public static final String INDETERMINATE = "Indeterminate"; - public static final String DENY = "Deny"; - public static final String PERMIT = "Permit"; - - public static final String AUTHORIZATION_POLICY_NAME = "authorization.policy"; public static final String AUTHZ_CACHE_MANAGER_CLASS = "authz.cache.manager.class"; - public static final String AUTHZ_CACHE_ENABLED = "authz.cache.enabled"; public static final String IN_MEMORY_CACHE_SIZE = "in.memory.cache.size"; - public static final String LOCAL_DATA_LOCATION = "local.data.location"; // Names of the attributes that could be passed in the AuthzToken's claims map. public static final String USER_NAME = "userName"; public static final String GATEWAY_ID = "gatewayID"; public static final String EMAIL = "email"; - public static final String ROLE = "role"; - - public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location"; - public static final String TRUSTED_CERTIFICATE_SYSTEM_PROPERTY = "X509_CERT_DIR"; - - public static final String NEWLINE = System.getProperty("line.separator"); public static final String ENABLE_STREAMING_TRANSFER = "enable.streaming.transfer"; } diff --git a/airavata-api/src/main/java/org/apache/airavata/common/utils/JPAUtils.java b/airavata-api/src/main/java/org/apache/airavata/common/utils/JPAUtils.java index ad6d47f840..415c360840 100644 --- a/airavata-api/src/main/java/org/apache/airavata/common/utils/JPAUtils.java +++ b/airavata-api/src/main/java/org/apache/airavata/common/utils/JPAUtils.java @@ -38,8 +38,11 @@ public class JPAUtils { static { Map properties = new HashMap(); properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp2.BasicDataSource"); - properties.put("openjpa.DynamicEnhancementAgent", "false"); - properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported"); + properties.put( + "openjpa.DynamicEnhancementAgent", System.getProperty("openjpa.DynamicEnhancementAgent", "false")); + properties.put( + "openjpa.RuntimeUnenhancedClasses", + System.getProperty("openjpa.RuntimeUnenhancedClasses", "unsupported")); properties.put("openjpa.RemoteCommitProvider", "sjvm"); properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"); // use the following to enable logging of all SQL statements diff --git a/airavata-api/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java b/airavata-api/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java index 4d622c5960..b842a83429 100644 --- a/airavata-api/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java +++ b/airavata-api/src/main/java/org/apache/airavata/common/utils/SecurityUtil.java @@ -33,60 +33,11 @@ public class SecurityUtil { public static final String PASSWORD_HASH_METHOD_PLAINTEXT = "PLAINTEXT"; - public static final String CHARSET_ENCODING = "UTF-8"; - public static final String ENCRYPTION_ALGORITHM = "AES"; public static final String PADDING_MECHANISM = "AES/CBC/PKCS5Padding"; private static final Logger logger = LoggerFactory.getLogger(SecurityUtil.class); - /** - * Creates a hash of given string with the given hash algorithm. - * - * @param stringToDigest - * The string to digest. - * @param digestingAlgorithm - * Hash algorithm. - * @return The digested string. - * @throws NoSuchAlgorithmException - * If given hash algorithm doesnt exists. - */ - public static String digestString(String stringToDigest, String digestingAlgorithm) - throws NoSuchAlgorithmException { - - if (digestingAlgorithm == null || digestingAlgorithm.equals(PASSWORD_HASH_METHOD_PLAINTEXT)) { - return stringToDigest; - } - - MessageDigest messageDigest = MessageDigest.getInstance(digestingAlgorithm); - try { - return new String(messageDigest.digest(stringToDigest.getBytes("UTF-8"))); - } catch (UnsupportedEncodingException e) { - logger.error("Error encoding password string when creating digest", e); - throw new RuntimeException("Error encoding password string when creating digest", e); - } - } - - /** - * Sets the truststore for application. Useful when communicating over HTTPS. - * - * @param trustStoreFilePath - * Where trust store is located. - * @param trustStorePassword - * The trust store password. - */ - public static void setTrustStoreParameters(String trustStoreFilePath, String trustStorePassword) { - - if (System.getProperty("javax.net.ssl.trustStrore") == null) { - logger.info("Setting Java trust store to " + trustStoreFilePath); - System.setProperty("javax.net.ssl.trustStrore", trustStoreFilePath); - } - - if (System.getProperty("javax.net.ssl.trustStorePassword") == null) { - System.setProperty("javax.net.ssl.trustStorePassword", trustStoreFilePath); - } - } - public static byte[] encryptString( String keyStorePath, String keyAlias, KeyStorePasswordCallback passwordCallback, String value) throws GeneralSecurityException, IOException { @@ -107,13 +58,7 @@ public static byte[] encrypt( private static Key getSymmetricKey(String keyStorePath, String keyAlias, KeyStorePasswordCallback passwordCallback) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException, UnrecoverableKeyException { - - KeyStore ks = SecurityUtil.loadKeyStore(keyStorePath, "jceks", passwordCallback); - - if (ks == null) { - throw new IOException("Unable to load Java keystore " + keyStorePath); - } - + KeyStore ks = SecurityUtil.loadKeyStore(keyStorePath, passwordCallback); return ks.getKey(keyAlias, passwordCallback.getSecretKeyPassPhrase(keyAlias)); } @@ -137,46 +82,15 @@ public static String decryptString( return new String(decrypted, CHARSET_ENCODING); } - public static KeyStore loadKeyStore( - String keyStoreFilePath, String keyStoreType, KeyStorePasswordCallback passwordCallback) + public static KeyStore loadKeyStore(String keyStoreFilePath, KeyStorePasswordCallback passwordCallback) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException { File keystoreFile = new File(keyStoreFilePath); - - InputStream is; - if (keystoreFile.exists()) { - logger.debug("Loading keystore file from path " + keyStoreFilePath); - is = new FileInputStream(keyStoreFilePath); + if (keystoreFile.exists() && keystoreFile.isFile()) { + logger.debug("Found keystore: {}", keyStoreFilePath); } else { - logger.debug("Trying to load keystore file form class path " + keyStoreFilePath); - is = SecurityUtil.class.getClassLoader().getResourceAsStream(keyStoreFilePath); - if (is != null) { - logger.debug("Trust store file was loaded form class path " + keyStoreFilePath); - } - } - - if (is == null) { - throw new KeyStoreException("Could not find a keystore file in path " + keyStoreFilePath); + throw new FileNotFoundException("Keystore file not found: " + keyStoreFilePath); } - - try { - return loadKeyStore(is, keyStoreType, passwordCallback); - } finally { - is.close(); - } - } - - public static KeyStore loadKeyStore( - InputStream inputStream, String keyStoreType, KeyStorePasswordCallback passwordCallback) - throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException { - - if (keyStoreType == null) { - keyStoreType = KeyStore.getDefaultType(); - } - - KeyStore ks = KeyStore.getInstance(keyStoreType); - ks.load(inputStream, passwordCallback.getStorePassword()); - - return ks; + return KeyStore.getInstance(keystoreFile, passwordCallback.getStorePassword()); } } diff --git a/airavata-api/src/main/java/org/apache/airavata/common/utils/ServerSettings.java b/airavata-api/src/main/java/org/apache/airavata/common/utils/ServerSettings.java index 63419cafcb..e62cac05dd 100644 --- a/airavata-api/src/main/java/org/apache/airavata/common/utils/ServerSettings.java +++ b/airavata-api/src/main/java/org/apache/airavata/common/utils/ServerSettings.java @@ -20,55 +20,18 @@ package org.apache.airavata.common.utils; import java.io.File; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.HashMap; -import java.util.Map; import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class ServerSettings extends ApplicationSettings { - private static final Logger log = LoggerFactory.getLogger(ServerSettings.class); - private static final String DEFAULT_USER = "default.registry.user"; private static final String DEFAULT_USER_PASSWORD = "default.registry.password"; private static final String DEFAULT_USER_GATEWAY = "default.registry.gateway"; private static final String ENABLE_SHARING = "enable.sharing"; - public static final String IP = "ip"; - - private static final String API_SERVER_TLS_ENABLED = "apiserver.tls.enabled"; - private static final String API_SERVER_KEYSTORE = "apiserver.keystore"; - private static final String API_SERVER_KEYSTORE_PASSWD = "apiserver.keystore.password"; - - // Orchestrator Constants - public static final String ORCHESTRATOR_SERVER_HOST = "orchestrator.server.host"; - public static final String ORCHESTRATOR_SERVER_PORT = "orchestrator.server.port"; - public static final String ORCHESTRATOR_SERVER_NAME = "orchestrator.server.name"; - // Gfac constants - public static final String GFAC_SERVER_HOST = "gfac.server.host"; - public static final String GFAC_SERVER_PORT = "gfac.server.port"; - public static final String GFAC_SERVER_NAME = "gfac.server.name"; - public static final String GFAC_THREAD_POOL_SIZE = "gfac.thread.pool.size"; - public static final int DEFAULT_GFAC_THREAD_POOL_SIZE = 50; - public static final String GFAC_CONFIG_XML = "gfac-config.xml"; - // Credential Store constants - public static final String CREDENTIAL_SERVER_HOST = "credential.store.server.host"; - public static final String CREDENTIAL_SERVER_PORT = "credential.store.server.port"; // Zookeeper + curator constants public static final String EMBEDDED_ZK = "embedded.zk"; public static final String ZOOKEEPER_SERVER_CONNECTION = "zookeeper.server.connection"; - public static final String ZOOKEEPER_TIMEOUT = "zookeeper.timeout"; - - // Aurora Scheduler Constants - public static final String AURORA_SCHEDULER_HOSTS = "aurora.scheduler.hosts"; - public static final String AURORA_EXECUTOR_NAME = "aurora.executor.name"; - public static final String MESOS_CLUSTER_NAME = "mesos.cluster.name"; - public static final String AURORA_SCHEDULER_CONNECT_TIMEOUT_MS = "aurora.scheduler.timeoutms"; - public static final String AURORA_EXECUTOR_CONFIG_TEMPLATE_FILE = "aurora.executor.config.template.filename"; - private static final String CREDENTIAL_STORE_DB_URL = "credential.store.jdbc.url"; private static final String CREDENTIAL_STORE_DB_USER = "credential.store.jdbc.user"; private static final String CREDENTIAL_STORE_DB_PASSWORD = "credential.store.jdbc.password"; @@ -76,51 +39,28 @@ public class ServerSettings extends ApplicationSettings { private static final java.lang.String SHARING_REGISTRY_PORT = "sharing.registry.server.port"; private static final java.lang.String SHARING_REGISTRY_HOST = "sharing.registry.server.host"; - private static String USER_PROFILE_MONGODB_PORT = "userprofile.mongodb.port"; - private static final String REGISTRY_DB_URL = "registry.jdbc.url"; private static final String REGISTRY_DB_USER = "registry.jdbc.user"; private static final String REGISTRY_DB_PASSWORD = "registry.jdbc.password"; private static final String REGISTRY_DB_DRIVER = "registry.jdbc.driver"; private static final String HOST_SCHEDULER = "host.scheduler"; - private static final String MY_PROXY_SERVER = "myproxy.server"; - private static final String MY_PROXY_USER = "myproxy.user"; - private static final String MY_PROXY_PASSWORD = "myproxy.password"; - private static final String MY_PROXY_LIFETIME = "myproxy.life"; public static final String JOB_NOTIFICATION_ENABLE = "job.notification.enable"; public static final String JOB_NOTIFICATION_EMAILIDS = "job.notification.emailids"; - public static final String JOB_NOTIFICATION_FLAGS = "job.notification.flags"; public static final String RABBITMQ_BROKER_URL = "rabbitmq.broker.url"; public static final String RABBITMQ_STATUS_EXCHANGE_NAME = "rabbitmq.status.exchange.name"; public static final String RABBITMQ_PROCESS_EXCHANGE_NAME = "rabbitmq.process.exchange.name"; public static final String RABBITMQ_EXPERIMENT_EXCHANGE_NAME = "rabbitmq.experiment.exchange.name"; - public static final String RABBITMQ_PROCESS_LAUNCH_QUEUE_NAME = "process.launch.queue.name"; - public static final String RABBITMQ_EXPERIMENT_LAUNCH_QUEUE_NAME = "experiment.launch.queue.name"; public static final String RABBITMQ_DURABLE_QUEUE = "durable.queue"; public static final String RABBITMQ_PREFETCH_COUNT = "prefetch.count"; - // Workflow Enactment Service component configuration. - private static final String ENACTMENT_THREAD_POOL_SIZE = "enactment.thread.pool.size"; - private static final int DEFAULT_ENACTMENT_THREAD_POOL_SIZE = 10; - private static final String WORKFLOW_PARSER = "workflow.parser"; - - // email based monitoring configurations + // email-based monitoring configurations private static final String EMAIL_BASED_MONITORING_PERIOD = "email.based.monitoring.period"; private static final String EMAIL_BASED_MONITOR_HOST = "email.based.monitor.host"; private static final String EMAIL_BASED_MONITOR_ADDRESS = "email.based.monitor.address"; private static final String EMAIL_BASED_MONITOR_PASSWORD = "email.based.monitor.password"; private static final String EMAIL_BASED_MONITOR_FOLDER_NAME = "email.based.monitor.folder.name"; private static final String EMAIL_BASED_MONITOR_STORE_PROTOCOL = "email.based.monitor.store.protocol"; - private static final String ENABLE_EMAIL_BASED_MONITORING = "enable.email.based.monitoring"; - - private static final String IS_RUNNING_ON_AWS = "isRunningOnAws"; - private static final String SERVER_ROLES = "server.roles"; - - // User Profile onstants - - public static final String USER_PROFILE_SERVER_HOST = "user.profile.server.host"; - public static final String USER_PROFILE_SERVER_PORT = "user.profile.server.port"; // Profile Service Constants public static final String PROFILE_SERVICE_SERVER_HOST = "profile.service.server.host"; @@ -131,15 +71,7 @@ public class ServerSettings extends ApplicationSettings { public static final String IAM_SERVER_SUPER_ADMIN_USERNAME = "iam.server.super.admin.username"; public static final String IAM_SERVER_SUPER_ADMIN_PASSWORD = "iam.server.super.admin.password"; - /* Caching */ - private static final String SESSION_CACHE_ACCESS_TIME_OUT = "ssh.session.cache.access.timeout"; - - // todo until AIRAVATA-2066 is finished, keep server side list configurations here. - private static Map listConfigurations = new HashMap<>(); - private static boolean stopAllThreads = false; - private static boolean emailBaseNotificationEnable; - private static String outputLocation; // Airavata Metascheduler public static final String COMPUTE_RESOURCE_SELECTION_POLICY_CLASS = "compute.resource.selection.policy.class"; @@ -152,7 +84,6 @@ public class ServerSettings extends ApplicationSettings { public static final String COMPUTE_RESOURCE_RESCHEDULER_CLASS = "compute.resource.rescheduler.policy.class"; public static final String METASCHEDULER_MAXIMUM_RESCHEDULED_THRESHOLD = "metascheduler.maximum.rescheduler.threshold"; - public static final String METASCHEDULER_MULTIPLE_CR_ENABLING_FACTOR = "metascheduler.multiple.cr.enabling.factor"; public static final String DATA_ANALYZER_SCANNING_INTERVAL = "data.analyzer.scanning.interval"; public static final String DATA_ANALYZER_NO_OF_SCANNING_PARALLEL_JOBS = "data.analyzer.scanning.parallel.jobs"; public static final String DATA_ANALYZER_ENABLED_GATEWAYS = "data.analyzer.enabled.gateways"; @@ -162,10 +93,6 @@ public static String getDefaultUser() throws ApplicationSettingsException { return getSetting(DEFAULT_USER); } - public static String getRabbitmqProcessLaunchQueueName() { - return getSetting(RABBITMQ_PROCESS_LAUNCH_QUEUE_NAME, "process.launch.queue"); - } - public static String getRabbitmqExperimentLaunchQueueName() { return getSetting(RABBITMQ_EXPERIMENT_EXCHANGE_NAME, "experiment.launch.queue"); } @@ -187,11 +114,11 @@ public static String getRabbitmqExperimentExchangeName() { } public static boolean getRabbitmqDurableQueue() { - return Boolean.valueOf(getSetting(RABBITMQ_DURABLE_QUEUE, "false")); + return Boolean.parseBoolean(getSetting(RABBITMQ_DURABLE_QUEUE, "false")); } public static int getRabbitmqPrefetchCount() { - return Integer.valueOf(getSetting(RABBITMQ_PREFETCH_COUNT, "200")); + return Integer.parseInt(getSetting(RABBITMQ_PREFETCH_COUNT, "200")); } public static String getDefaultUserPassword() throws ApplicationSettingsException { @@ -234,22 +161,6 @@ public static String getCredentialStoreDBURL() throws ApplicationSettingsExcepti } } - public static boolean isAPIServerTLSEnabled() { - try { - return Boolean.parseBoolean(getSetting(API_SERVER_TLS_ENABLED)); - } catch (ApplicationSettingsException e) { - return false; - } - } - - public static String getApiServerKeystorePasswd() throws ApplicationSettingsException { - return getSetting(API_SERVER_KEYSTORE_PASSWD); - } - - public static String getApiServerKeystore() throws ApplicationSettingsException { - return getSetting(API_SERVER_KEYSTORE); - } - public static String getHostScheduler() throws ApplicationSettingsException { return getSetting(HOST_SCHEDULER); } @@ -262,55 +173,12 @@ public static void setStopAllThreads(boolean stopAllThreads) { ServerSettings.stopAllThreads = stopAllThreads; } - public static String getMyProxyServer() throws ApplicationSettingsException { - return getSetting(MY_PROXY_SERVER); - } - - public static String getMyProxyUser() throws ApplicationSettingsException { - return getSetting(MY_PROXY_USER); - } - - public static String getMyProxyPassword() throws ApplicationSettingsException { - return getSetting(MY_PROXY_PASSWORD); - } - - public static int getMyProxyLifetime() throws ApplicationSettingsException { - return Integer.parseInt(getSetting(MY_PROXY_LIFETIME)); - } - public static boolean isEmbeddedZK() { return Boolean.parseBoolean(getSetting(EMBEDDED_ZK, "true")); } - public static String getIp() { - try { - return getSetting(IP); - } catch (ApplicationSettingsException e) { - try { - return InetAddress.getLocalHost().getHostAddress(); - } catch (UnknownHostException e1) { - e1.printStackTrace(); - } - } - return null; - } - - public static int getEnactmentThreadPoolSize() { - String threadPoolSize = null; - try { - threadPoolSize = getSetting(ENACTMENT_THREAD_POOL_SIZE); - } catch (ApplicationSettingsException e) { - return DEFAULT_ENACTMENT_THREAD_POOL_SIZE; - } - return Integer.valueOf(threadPoolSize); - } - - public static String getWorkflowParser() throws ApplicationSettingsException { - return getSetting(WORKFLOW_PARSER); - } - public static int getEmailMonitorPeriod() throws ApplicationSettingsException { - return Integer.valueOf(getSetting(EMAIL_BASED_MONITORING_PERIOD, "100000")); + return Integer.parseInt(getSetting(EMAIL_BASED_MONITORING_PERIOD, "100000")); } public static String getEmailBasedMonitorHost() throws ApplicationSettingsException { @@ -333,18 +201,6 @@ public static String getEmailBasedMonitorStoreProtocol() throws ApplicationSetti return getSetting(EMAIL_BASED_MONITOR_STORE_PROTOCOL); } - public static boolean isEmailBasedNotificationEnable() { - return Boolean.valueOf(getSetting(ENABLE_EMAIL_BASED_MONITORING, "false")); - } - - public static boolean isAPISecured() throws ApplicationSettingsException { - return Boolean.valueOf(getSetting(Constants.IS_API_SECURED)); - } - - public static String getRemoteAuthzServerUrl() throws ApplicationSettingsException { - return getSetting(Constants.REMOTE_OAUTH_SERVER_URL); - } - public static String getRemoteIDPServiceUrl() throws ApplicationSettingsException { return getSetting(ServerSettings.IAM_SERVER_URL); } @@ -357,68 +213,12 @@ public static String getIamServerSuperAdminPassword() throws ApplicationSettings return getSetting(ServerSettings.IAM_SERVER_SUPER_ADMIN_PASSWORD); } - public static String getAuthorizationPoliyName() throws ApplicationSettingsException { - return getSetting(Constants.AUTHORIZATION_POLICY_NAME); - } - public static String getZookeeperConnection() throws ApplicationSettingsException { return getSetting(ZOOKEEPER_SERVER_CONNECTION, "localhost:2181"); } - public static int getZookeeperTimeout() { - return Integer.valueOf(getSetting(ZOOKEEPER_TIMEOUT, "3000")); - } - - public static String getGFacServerName() throws ApplicationSettingsException { - return getSetting(GFAC_SERVER_NAME); - } - - public static String getGfacServerHost() throws ApplicationSettingsException { - return getSetting(GFAC_SERVER_HOST); - } - - public static String getGFacServerPort() throws ApplicationSettingsException { - return getSetting(GFAC_SERVER_PORT); - } - - public static int getGFacThreadPoolSize() { - try { - String threadPoolSize = getSetting(GFAC_THREAD_POOL_SIZE); - if (threadPoolSize != null && !threadPoolSize.isEmpty()) { - return Integer.valueOf(threadPoolSize); - } else { - log.warn("Thread pool size is not configured, use default gfac thread pool size " - + DEFAULT_GFAC_THREAD_POOL_SIZE); - } - } catch (ApplicationSettingsException e) { - log.warn("Couldn't read thread pool size from configuration on exception, use default gfac thread pool " - + "size " + DEFAULT_GFAC_THREAD_POOL_SIZE); - } - return DEFAULT_GFAC_THREAD_POOL_SIZE; - } - - public static String getOrchestratorServerName() throws ApplicationSettingsException { - return getSetting(ORCHESTRATOR_SERVER_NAME); - } - - public static String getOrchestratorServerHost() throws ApplicationSettingsException { - return getSetting(ORCHESTRATOR_SERVER_HOST); - } - - public static int getOrchestratorServerPort() throws ApplicationSettingsException { - return Integer.valueOf(getSetting(ORCHESTRATOR_SERVER_PORT)); - } - public static boolean isTLSEnabled() throws ApplicationSettingsException { - return Boolean.valueOf(getSetting(Constants.IS_TLS_ENABLED)); - } - - public static boolean isSharingTLSEnabled() throws ApplicationSettingsException { - return Boolean.valueOf(getSetting(Constants.IS_SHARING_TLS_ENABLED)); - } - - public static int getTLSServerPort() throws ApplicationSettingsException { - return Integer.valueOf(getSetting(Constants.TLS_SERVER_PORT)); + return Boolean.parseBoolean(getSetting(Constants.IS_TLS_ENABLED, "false")); } public static String getKeyStorePath() throws ApplicationSettingsException { @@ -432,7 +232,7 @@ public static String getKeyStorePassword() throws ApplicationSettingsException { } public static int getTLSClientTimeout() throws ApplicationSettingsException { - return Integer.valueOf(getSetting(Constants.TLS_CLIENT_TIMEOUT)); + return Integer.parseInt(getSetting(Constants.TLS_CLIENT_TIMEOUT)); } public static String getSecurityManagerClassName() throws ApplicationSettingsException { @@ -444,11 +244,11 @@ public static String getAuthzCacheManagerClassName() throws ApplicationSettingsE } public static boolean isAuthzCacheEnabled() throws ApplicationSettingsException { - return Boolean.valueOf(getSetting(Constants.AUTHZ_CACHE_ENABLED)); + return Boolean.parseBoolean(getSetting(Constants.AUTHZ_CACHE_ENABLED)); } public static int getCacheSize() throws ApplicationSettingsException { - return Integer.valueOf(getSetting(Constants.IN_MEMORY_CACHE_SIZE)); + return Integer.parseInt(getSetting(Constants.IN_MEMORY_CACHE_SIZE)); } public static String getLocalDataLocation() { @@ -459,42 +259,6 @@ public static Boolean isEnableSharing() throws ApplicationSettingsException { return Boolean.parseBoolean(getSetting(ENABLE_SHARING)); } - public static boolean isRunningOnAws() { - return Boolean.valueOf(getSetting(IS_RUNNING_ON_AWS, "false")); - } - - public static void setServerRoles(String[] roles) { - listConfigurations.put(SERVER_ROLES, roles); - } - - public static String[] getServerRoles() { - return listConfigurations.get(SERVER_ROLES); - } - - public static String getAuroraSchedulerHosts() throws ApplicationSettingsException { - return getSetting(AURORA_SCHEDULER_HOSTS); - } - - public static String getMesosClusterName() throws ApplicationSettingsException { - return getSetting(MESOS_CLUSTER_NAME); - } - - public static String getAuroraExecutorName() throws ApplicationSettingsException { - return getSetting(AURORA_EXECUTOR_NAME); - } - - public static String getAuroraExecutorConfigTemplateFileName() throws ApplicationSettingsException { - return getSetting(AURORA_EXECUTOR_CONFIG_TEMPLATE_FILE); - } - - public static int getAuroraSchedulerTimeout() throws ApplicationSettingsException { - return Integer.valueOf(getSetting(AURORA_SCHEDULER_CONNECT_TIMEOUT_MS)); - } - - public static int getSessionCacheAccessTimeout() { - return Integer.valueOf(getSetting(SESSION_CACHE_ACCESS_TIME_OUT, "30")); - } - public static String getSharingRegistryPort() { return getSetting(SHARING_REGISTRY_PORT, "7878"); } @@ -562,8 +326,4 @@ public static int getDataAnalyzerNoOfScanningParallelJobs() throws ApplicationSe public static int getMetaschedulerReschedulingThreshold() throws ApplicationSettingsException { return Integer.parseInt(getSetting(METASCHEDULER_MAXIMUM_RESCHEDULED_THRESHOLD, "5")); } - - public static int getMetaschedulerMultipleCREnablingFactor() throws ApplicationSettingsException { - return Integer.parseInt(getSetting(METASCHEDULER_MULTIPLE_CR_ENABLING_FACTOR, "0.5")); - } } diff --git a/airavata-api/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java b/airavata-api/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java index 2c591adb3c..4be231a139 100644 --- a/airavata-api/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java +++ b/airavata-api/src/main/java/org/apache/airavata/credential/store/client/TestSSLClient.java @@ -97,7 +97,7 @@ public static void testCertificateCredential(CredentialStoreService.Client clien X509Certificate[] x509Certificates = new X509Certificate[1]; KeyStore ks = KeyStore.getInstance("JKS"); File keyStoreFile = new File( - "/Users/smarru/code/airavata-master/modules/configuration/server/src/main/resources/airavata.jks"); + "/Users/smarru/code/airavata-master/modules/configuration/server/src/main/resources/airavata.p12"); FileInputStream fis = new FileInputStream(keyStoreFile); char[] password = "airavata".toCharArray(); ks.load(fis, password); diff --git a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/TaskContext.java b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/TaskContext.java index ca4b3c9fba..a5491f3f53 100644 --- a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/TaskContext.java +++ b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/TaskContext.java @@ -772,7 +772,7 @@ public UserProfile getUserProfile() throws TaskOnFailException { this.userProfile = getProfileClient() .getUserProfileById(authzToken, getProcessModel().getUserName(), getGatewayId()); } catch (Exception e) { - logger.error("Failed to fetch the user profile for user id " + processModel.getUserName(), e); + logger.error("Failed to fetch the user profile for user id {}", processModel.getUserName(), e); throw new TaskOnFailException( "Failed to fetch the user profile for user id " + processModel.getUserName(), true, e); } diff --git a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/submission/config/JobFactory.java b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/submission/config/JobFactory.java index 202ed7bc0d..3eed223f16 100644 --- a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/submission/config/JobFactory.java +++ b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/submission/config/JobFactory.java @@ -34,19 +34,19 @@ public class JobFactory { public static String getTemplateFileName(ResourceJobManagerType resourceJobManagerType) { switch (resourceJobManagerType) { case FORK: - return "FORK_Groovy.template"; + return "templates/FORK_Groovy.template"; case PBS: - return "PBS_Groovy.template"; + return "templates/PBS_Groovy.template"; case SLURM: - return "SLURM_Groovy.template"; + return "templates/SLURM_Groovy.template"; case UGE: - return "UGE_Groovy.template"; + return "templates/UGE_Groovy.template"; case LSF: - return "LSF_Groovy.template"; + return "templates/LSF_Groovy.template"; case CLOUD: - return "CLOUD_Groovy.template"; + return "templates/CLOUD_Groovy.template"; case HTCONDOR: - return "HTCONDOR_Groovy.template"; + return "templates/HTCONDOR_Groovy.template"; default: return null; } @@ -119,7 +119,7 @@ public static JobManagerConfiguration getJobManagerConfiguration(ResourceJobMana throw new Exception("Resource job manager can not be null"); } - String templateFileName = getTemplateFileName(resourceJobManager.getResourceJobManagerType()); + String templateFileName = "templates/" + getTemplateFileName(resourceJobManager.getResourceJobManagerType()); switch (resourceJobManager.getResourceJobManagerType()) { case PBS: return new PBSJobConfiguration( diff --git a/airavata-api/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java b/airavata-api/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java index d4d55ce94a..4e3a656f62 100644 --- a/airavata-api/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java +++ b/airavata-api/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java @@ -24,8 +24,6 @@ * */ public class OrchestratorConstants { - public static final String AIRAVATA_PROPERTIES = "airavata-server.properties"; - public static final int hotUpdateInterval = 1000; public static final String SUBMIT_INTERVAL = "submitter.interval"; public static final String THREAD_POOL_SIZE = "threadpool.size"; public static final String START_SUBMITTER = "start.submitter"; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java index e6d794c120..2d079f6411 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories; +import com.github.dozermapper.core.Mapper; import jakarta.persistence.EntityManager; import jakarta.persistence.Query; import java.util.ArrayList; @@ -27,7 +28,6 @@ import org.apache.airavata.registry.core.utils.Committer; import org.apache.airavata.registry.core.utils.DBConstants; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationDeploymentRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationDeploymentRepository.java index caa30a1ce2..3c5f050ec9 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationDeploymentRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationDeploymentRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.*; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription; @@ -30,7 +31,6 @@ import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.registry.cpi.ApplicationDeployment; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +55,7 @@ protected ApplicationDeploymentEntity saveApplicationDeployment( ApplicationDeploymentDescription applicationDeploymentDescription, String gatewayId) throws AppCatalogException { - if (applicationDeploymentDescription.getAppDeploymentId().trim().equals("") + if (applicationDeploymentDescription.getAppDeploymentId().trim().isEmpty() || applicationDeploymentDescription.getAppDeploymentId().equals(airavata_commonsConstants.DEFAULT_ID)) { logger.debug( "If Application Deployment ID is empty or DEFAULT, set it as the compute host name plus the App Module ID"); @@ -158,8 +158,9 @@ public List getApplicationDeployments(Map queryParameters = new HashMap<>(); queryParameters.put( @@ -173,8 +174,9 @@ public List getApplicationDeployments(Map queryParameters = new HashMap<>(); queryParameters.put(DBConstants.ApplicationDeployment.COMPUTE_HOST_ID, filters.get(fieldName)); @@ -187,7 +189,7 @@ public List getApplicationDeployments(Map getAllApplicationDeployements(Stri throws AppCatalogException { Map queryParameters = new HashMap<>(); queryParameters.put(DBConstants.ApplicationDeployment.GATEWAY_ID, gatewayId); - List applicationDeploymentDescriptionList = - select(QueryConstants.FIND_APPLICATION_DEPLOYMENTS_FOR_GATEWAY_ID, -1, 0, queryParameters); - return applicationDeploymentDescriptionList; + return select(QueryConstants.FIND_APPLICATION_DEPLOYMENTS_FOR_GATEWAY_ID, -1, 0, queryParameters); } @Override @@ -239,9 +239,7 @@ public List getAccessibleApplicationDeployment queryParameters.put(DBConstants.ApplicationDeployment.GATEWAY_ID, gatewayId); queryParameters.put(DBConstants.ApplicationDeployment.ACCESSIBLE_APPLICATION_DEPLOYMENT_IDS, accessibleAppIds); queryParameters.put(DBConstants.ApplicationDeployment.ACCESSIBLE_COMPUTE_HOST_IDS, accessibleCompHostIds); - List accessibleApplicationDeployments = - select(QueryConstants.FIND_ACCESSIBLE_APPLICATION_DEPLOYMENTS, -1, 0, queryParameters); - return accessibleApplicationDeployments; + return select(QueryConstants.FIND_ACCESSIBLE_APPLICATION_DEPLOYMENTS, -1, 0, queryParameters); } @Override @@ -260,13 +258,11 @@ public List getAccessibleApplicationDeployment queryParameters.put(DBConstants.ApplicationDeployment.ACCESSIBLE_APPLICATION_DEPLOYMENT_IDS, accessibleAppIds); queryParameters.put( DBConstants.ApplicationDeployment.ACCESSIBLE_COMPUTE_HOST_IDS, accessibleComputeResourceIds); - List accessibleApplicationDeployments = - select(QueryConstants.FIND_ACCESSIBLE_APPLICATION_DEPLOYMENTS_FOR_APP_MODULE, -1, 0, queryParameters); - return accessibleApplicationDeployments; + return select(QueryConstants.FIND_ACCESSIBLE_APPLICATION_DEPLOYMENTS_FOR_APP_MODULE, -1, 0, queryParameters); } @Override - public List getAllApplicationDeployementIds() throws AppCatalogException { + public List getAllApplicationDeployementIds() { List applicationDeploymentIds = new ArrayList<>(); List applicationDeploymentDescriptionList = select(QueryConstants.GET_ALL_APPLICATION_DEPLOYMENTS, 0); @@ -282,7 +278,7 @@ public List getAllApplicationDeployementIds() throws AppCatalogException } @Override - public boolean isAppDeploymentExists(String deploymentId) throws AppCatalogException { + public boolean isAppDeploymentExists(String deploymentId) { return isExists(deploymentId); } diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepository.java index 75f1f1a37d..091ac4723e 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.*; import org.apache.airavata.common.utils.AiravataUtils; @@ -35,7 +36,6 @@ import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.registry.cpi.ApplicationInterface; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java index 825bf7db7b..a56cca9f4a 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import jakarta.persistence.Query; import java.util.HashMap; import java.util.List; @@ -64,7 +65,6 @@ import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.registry.cpi.ComputeResource; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/DataMovementRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/DataMovementRepository.java index d79cab3600..5476698b23 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/DataMovementRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/DataMovementRepository.java @@ -19,11 +19,11 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import org.apache.airavata.model.data.movement.DataMovementInterface; import org.apache.airavata.registry.core.entities.appcatalog.DataMovementInterfaceEntity; import org.apache.airavata.registry.core.entities.appcatalog.DataMovementInterfacePK; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; -import org.dozer.Mapper; public class DataMovementRepository extends AppCatAbstractRepository { diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java index 612a1fae3b..b5aaf0b245 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -33,7 +34,6 @@ import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.registry.cpi.GwyResourceProfile; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -105,6 +105,7 @@ public String updateGatewayResourceProfile(GatewayResourceProfile gatewayResourc @Override public GatewayResourceProfile getGatewayProfile(String gatewayId) { GatewayResourceProfile gatewayResourceProfile = get(gatewayId); + gatewayResourceProfile.setGatewayID(gatewayId); if (gatewayResourceProfile.getComputeResourcePreferences() != null && !gatewayResourceProfile.getComputeResourcePreferences().isEmpty()) { for (ComputeResourcePreference preference : gatewayResourceProfile.getComputeResourcePreferences()) { diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/JobSubmissionInterfaceRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/JobSubmissionInterfaceRepository.java index 3f2736efc1..f10bb006f9 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/JobSubmissionInterfaceRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/JobSubmissionInterfaceRepository.java @@ -19,11 +19,11 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface; import org.apache.airavata.registry.core.entities.appcatalog.JobSubmissionInterfaceEntity; import org.apache.airavata.registry.core.entities.appcatalog.JobSubmissionInterfacePK; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; -import org.dozer.Mapper; public class JobSubmissionInterfaceRepository extends AppCatAbstractRepository< diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ParserRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ParserRepository.java index e58c31b192..989e704203 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ParserRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ParserRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,7 +29,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.AppCatalogException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StorageResourceRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StorageResourceRepository.java index 63bc52649d..475e414226 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StorageResourceRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StorageResourceRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,7 +35,6 @@ import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.registry.cpi.StorageResource; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepository.java index c8a3502094..8091926915 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/UserResourceProfileRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.appcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.*; import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference; @@ -33,7 +34,6 @@ import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.AppCatalogException; import org.apache.airavata.registry.cpi.UsrResourceProfile; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentErrorRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentErrorRepository.java index 63b40aa330..c0312b32ac 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentErrorRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentErrorRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.List; import org.apache.airavata.model.commons.ErrorModel; import org.apache.airavata.model.experiment.ExperimentModel; @@ -27,7 +28,6 @@ import org.apache.airavata.registry.core.utils.ExpCatalogUtils; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentInputRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentInputRepository.java index bf8e9d86c4..5db34cd846 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentInputRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentInputRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.List; import org.apache.airavata.model.application.io.InputDataObjectType; import org.apache.airavata.model.experiment.ExperimentModel; @@ -26,7 +27,6 @@ import org.apache.airavata.registry.core.entities.expcatalog.ExperimentInputPK; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentOutputRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentOutputRepository.java index 30783d0e7d..ceae29a034 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentOutputRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentOutputRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.List; import org.apache.airavata.model.application.io.OutputDataObjectType; import org.apache.airavata.model.experiment.ExperimentModel; @@ -26,7 +27,6 @@ import org.apache.airavata.registry.core.entities.expcatalog.ExperimentOutputPK; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java index 3b014d0784..d3b8fd1a3a 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,7 +35,6 @@ import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; import org.apache.airavata.registry.cpi.ResultOrderType; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepository.java index cbe3904cd1..05398aa487 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.List; import org.apache.airavata.common.utils.AiravataUtils; @@ -30,7 +31,6 @@ import org.apache.airavata.registry.core.utils.ExpCatalogUtils; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/GatewayRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/GatewayRepository.java index 9fa65f5d8d..010b06a441 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/GatewayRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/GatewayRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; @@ -31,7 +32,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/GatewayUsageReportingCommandRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/GatewayUsageReportingCommandRepository.java index 5e91960817..ec38ed0640 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/GatewayUsageReportingCommandRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/GatewayUsageReportingCommandRepository.java @@ -19,12 +19,12 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import org.apache.airavata.model.workspace.GatewayUsageReportingCommand; import org.apache.airavata.registry.core.entities.expcatalog.GatewayUsageReportingCommandEntity; import org.apache.airavata.registry.core.entities.expcatalog.GatewayUsageReportingPK; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/JobRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/JobRepository.java index c92352689d..c3b4fb24b1 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/JobRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/JobRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -32,7 +33,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/JobStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/JobStatusRepository.java index 412a32b8bd..61bc9310b3 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/JobStatusRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/JobStatusRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.List; import org.apache.airavata.model.job.JobModel; @@ -31,7 +32,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/NotificationRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/NotificationRepository.java index 01171a43bb..93b066c33e 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/NotificationRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/NotificationRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; @@ -30,7 +31,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessErrorRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessErrorRepository.java index d497702ac6..4b0998b096 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessErrorRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessErrorRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.*; import org.apache.airavata.model.commons.ErrorModel; import org.apache.airavata.model.process.ProcessModel; @@ -27,7 +28,6 @@ import org.apache.airavata.registry.core.utils.ExpCatalogUtils; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessInputRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessInputRepository.java index 4d54314b29..6fae1e1602 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessInputRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessInputRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.*; import org.apache.airavata.model.application.io.InputDataObjectType; import org.apache.airavata.model.process.ProcessModel; @@ -26,7 +27,6 @@ import org.apache.airavata.registry.core.entities.expcatalog.ProcessInputPK; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessOutputRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessOutputRepository.java index 2f5c61c814..1b3084415c 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessOutputRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessOutputRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.*; import org.apache.airavata.model.application.io.OutputDataObjectType; import org.apache.airavata.model.process.ProcessModel; @@ -26,7 +27,6 @@ import org.apache.airavata.registry.core.entities.expcatalog.ProcessOutputPK; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessRepository.java index ee04532942..0f7316f2ee 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; @@ -35,7 +36,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessStatusRepository.java index de0303dd2a..c0d8d078aa 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessStatusRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessStatusRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; @@ -33,7 +34,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessWorkflowRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessWorkflowRepository.java index 2cc8808c9b..984fb417c9 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessWorkflowRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessWorkflowRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.Collections; import java.util.List; import org.apache.airavata.model.process.ProcessModel; @@ -27,7 +28,6 @@ import org.apache.airavata.registry.core.entities.expcatalog.ProcessWorkflowPK; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProjectRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProjectRepository.java index 8ce0939c95..ebb637c1d8 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProjectRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProjectRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.*; import org.apache.airavata.common.utils.AiravataUtils; @@ -31,7 +32,6 @@ import org.apache.airavata.registry.cpi.RegistryException; import org.apache.airavata.registry.cpi.ResultOrderType; import org.apache.airavata.registry.cpi.utils.Constants; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/QueueStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/QueueStatusRepository.java index d417e3b086..9acfa41e31 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/QueueStatusRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/QueueStatusRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,7 +30,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskErrorRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskErrorRepository.java index 8b5b80b80d..a08840021b 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskErrorRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskErrorRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.List; import org.apache.airavata.model.commons.ErrorModel; import org.apache.airavata.model.task.TaskModel; @@ -27,7 +28,6 @@ import org.apache.airavata.registry.core.utils.ExpCatalogUtils; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskRepository.java index b7e1da7101..5facb7e1d8 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -31,7 +32,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskStatusRepository.java index 7b9359cc9e..1435416551 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskStatusRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/TaskStatusRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.expcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.List; import org.apache.airavata.model.status.TaskState; @@ -29,7 +30,6 @@ import org.apache.airavata.registry.core.utils.ExpCatalogUtils; import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.RegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataProductRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataProductRepository.java index d53ec11c01..e1c8e620dc 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataProductRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataProductRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.replicacatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.*; import org.apache.airavata.model.data.replica.DataProductModel; @@ -29,7 +30,6 @@ import org.apache.airavata.registry.core.utils.QueryConstants; import org.apache.airavata.registry.cpi.DataProductInterface; import org.apache.airavata.registry.cpi.ReplicaCatalogException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataReplicaLocationRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataReplicaLocationRepository.java index a9183d8779..df0ad7693e 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataReplicaLocationRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataReplicaLocationRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.replicacatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.List; import java.util.UUID; @@ -28,7 +29,6 @@ import org.apache.airavata.registry.core.utils.ObjectMapperSingleton; import org.apache.airavata.registry.cpi.DataReplicaLocationInterface; import org.apache.airavata.registry.cpi.ReplicaCatalogException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowRepository.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowRepository.java index 2a140f543b..70ca71e890 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/repositories/workflowcatalog/WorkflowRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.registry.core.repositories.workflowcatalog; +import com.github.dozermapper.core.Mapper; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; @@ -29,7 +30,6 @@ import org.apache.airavata.registry.core.utils.*; import org.apache.airavata.registry.cpi.WorkflowCatalog; import org.apache.airavata.registry.cpi.WorkflowCatalogException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/CustomBeanFactory.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/CustomBeanFactory.java index 01178f1cee..985f2250e5 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/CustomBeanFactory.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/CustomBeanFactory.java @@ -19,15 +19,16 @@ */ package org.apache.airavata.registry.core.utils; +import com.github.dozermapper.core.BeanFactory; +import com.github.dozermapper.core.config.BeanContainer; +import com.github.dozermapper.core.util.MappingUtils; +import com.github.dozermapper.core.util.ReflectionUtils; import java.lang.reflect.Field; import java.util.Map; import java.util.Map.Entry; import org.apache.thrift.TBase; import org.apache.thrift.TFieldIdEnum; import org.apache.thrift.meta_data.FieldMetaData; -import org.dozer.BeanFactory; -import org.dozer.util.MappingUtils; -import org.dozer.util.ReflectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,9 +37,9 @@ public class CustomBeanFactory implements BeanFactory { private static final Logger logger = LoggerFactory.getLogger(CustomBeanFactory.class); @Override - public Object createBean(Object source, Class sourceClass, String targetBeanId) { + public Object createBean(Object source, Class sourceClass, String targetBeanId, BeanContainer beanContainer) { Object result; - Class destClass = MappingUtils.loadClass(targetBeanId); + Class destClass = MappingUtils.loadClass(targetBeanId, beanContainer); if (logger.isDebugEnabled()) { logger.debug("Creating bean of type " + destClass.getSimpleName()); } diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/DozerConverter/CsvStringConverter.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/DozerConverter/CsvStringConverter.java index 752ee1cc65..10d7271b44 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/DozerConverter/CsvStringConverter.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/DozerConverter/CsvStringConverter.java @@ -19,9 +19,9 @@ */ package org.apache.airavata.registry.core.utils.DozerConverter; +import com.github.dozermapper.core.DozerConverter; import java.util.Arrays; import java.util.List; -import org.dozer.DozerConverter; /** * CsvStringConverter diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/DozerConverter/StorageDateConverter.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/DozerConverter/StorageDateConverter.java index 77b3d88648..b41ff74af9 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/DozerConverter/StorageDateConverter.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/DozerConverter/StorageDateConverter.java @@ -19,8 +19,8 @@ */ package org.apache.airavata.registry.core.utils.DozerConverter; +import com.github.dozermapper.core.DozerConverter; import java.sql.Timestamp; -import org.dozer.DozerConverter; /** * Created by skariyat on 4/11/18. diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ObjectMapperSingleton.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ObjectMapperSingleton.java index d7ec283349..4099d40ecd 100644 --- a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ObjectMapperSingleton.java +++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ObjectMapperSingleton.java @@ -19,35 +19,32 @@ */ package org.apache.airavata.registry.core.utils; -import java.util.ArrayList; +import com.github.dozermapper.core.CustomFieldMapper; +import com.github.dozermapper.core.DozerBeanMapperBuilder; +import com.github.dozermapper.core.Mapper; +import com.github.dozermapper.core.classmap.ClassMap; +import com.github.dozermapper.core.fieldmap.FieldMap; import org.apache.commons.lang3.ClassUtils; import org.apache.thrift.TBase; import org.apache.thrift.TFieldIdEnum; -import org.dozer.CustomFieldMapper; -import org.dozer.DozerBeanMapper; -import org.dozer.classmap.ClassMap; -import org.dozer.fieldmap.FieldMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ObjectMapperSingleton extends DozerBeanMapper { +public class ObjectMapperSingleton { private static final Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class); - private static ObjectMapperSingleton instance; + private static Mapper mapper; private ObjectMapperSingleton() {} - public static ObjectMapperSingleton getInstance() { - if (instance == null) { - instance = new ObjectMapperSingleton(); - instance.setMappingFiles(new ArrayList() { - { - add("dozer_mapping.xml"); - } - }); - instance.setCustomFieldMapper(new SkipUnsetPrimitiveFieldMapper()); + public static Mapper getInstance() { + if (mapper == null) { + mapper = DozerBeanMapperBuilder.create() + .withMappingFiles("dozer_mapping.xml") + .withCustomFieldMapper(new SkipUnsetPrimitiveFieldMapper()) + .build(); } - return instance; + return mapper; } private static class SkipUnsetPrimitiveFieldMapper implements CustomFieldMapper { @@ -70,7 +67,7 @@ private boolean isSourceUnsetThriftField(Object source, FieldMap fieldMap) { TBase thriftSource = (TBase) source; try { Class thriftFieldsEnum = - Class.forName(thriftSource.getClass().getName() + "$_Fields"); + Class.forName(thriftSource.getClass().getName() + "$$_Fields"); TFieldIdEnum srcField = (TFieldIdEnum) thriftFieldsEnum .getMethod("findByName", String.class) .invoke(null, fieldMap.getSrcFieldName()); diff --git a/airavata-api/src/main/java/org/apache/airavata/security/util/TrustStoreManager.java b/airavata-api/src/main/java/org/apache/airavata/security/util/TrustStoreManager.java deleted file mode 100644 index 683ffdb5ef..0000000000 --- a/airavata-api/src/main/java/org/apache/airavata/security/util/TrustStoreManager.java +++ /dev/null @@ -1,100 +0,0 @@ -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -package org.apache.airavata.security.util; - -import java.io.*; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import org.apache.airavata.common.utils.SecurityUtil; -import org.apache.airavata.security.AiravataSecurityException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TrustStoreManager { - private static final Logger logger = LoggerFactory.getLogger(TrustStoreManager.class); - - public SSLContext initializeTrustStoreManager(String trustStorePath, String trustStorePassword) - throws AiravataSecurityException { - try { - // load and initialize the trust store - - File trustStoreFile = new File(trustStorePath); - InputStream is; - if (trustStoreFile.exists()) { - logger.debug("Loading trust store file from path " + trustStorePath); - is = new FileInputStream(trustStorePath); - } else { - logger.debug("Trying to load trust store file form class path " + trustStorePath); - is = SecurityUtil.class.getClassLoader().getResourceAsStream(trustStorePath); - if (is != null) { - logger.debug("Trust store file was loaded form class path " + trustStorePath); - } - } - - if (is == null) { - throw new AiravataSecurityException("Could not find a trust store file in path " + trustStorePath); - } - - KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); - - char[] trustPassword = trustStorePassword.toCharArray(); - - trustStore.load(is, trustPassword); - - // initialize a trust manager factory - TrustManagerFactory trustFactory = - TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - trustFactory.init(trustStore); - - // get the trust managers from the factory - TrustManager[] trustManagers = trustFactory.getTrustManagers(); - - // initialize an ssl context to use these managers and set as default - SSLContext sslContext = SSLContext.getInstance("SSL"); - sslContext.init(null, trustManagers, null); - SSLContext.setDefault(sslContext); - return sslContext; - } catch (CertificateException e) { - logger.error(e.getMessage(), e); - throw new AiravataSecurityException("Error in initializing the trust store."); - } catch (NoSuchAlgorithmException e) { - logger.error(e.getMessage(), e); - throw new AiravataSecurityException("Error in initializing the trust store."); - } catch (KeyStoreException e) { - logger.error(e.getMessage(), e); - throw new AiravataSecurityException("Error in initializing the trust store."); - } catch (KeyManagementException e) { - logger.error(e.getMessage(), e); - throw new AiravataSecurityException("Error in initializing the trust store."); - } catch (FileNotFoundException e) { - logger.error(e.getMessage(), e); - throw new AiravataSecurityException("Error in initializing the trust store."); - } catch (IOException e) { - logger.error(e.getMessage(), e); - throw new AiravataSecurityException("Error in initializing the trust store."); - } - } -} diff --git a/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java b/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java index 4381715829..4c8086a112 100644 --- a/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java +++ b/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java @@ -98,7 +98,7 @@ private static void loadServers(String serverNames) { serversLoaded = true; Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { - setSystemShutDown(true); + setSystemShutDown(); stopAllServers(); } }); @@ -163,11 +163,8 @@ private static List handleServerDependencies(String serverNames) { // }); // } - public static void main(String args[]) throws IOException, AiravataException, ParseException { + public static void main(String[] args) throws IOException, AiravataException, ParseException { ServerSettings.mergeSettingsCommandLineArgs(args); - ServerSettings.setServerRoles( - ApplicationSettings.getSetting(SERVERS_KEY, "all").split(",")); - if (ServerSettings.getBooleanSetting("api.server.monitoring.enabled")) { MonitoringServer monitoringServer = new MonitoringServer( ServerSettings.getSetting("api.server.monitoring.host"), @@ -393,8 +390,8 @@ private static boolean isSystemShutDown() { return systemShutDown; } - private static void setSystemShutDown(boolean systemShutDown) { - ServerMain.systemShutDown = systemShutDown; + private static void setSystemShutDown() { + ServerMain.systemShutDown = true; } // private static int getPID(){ diff --git a/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/repositories/AbstractRepository.java b/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/repositories/AbstractRepository.java index 1749123f9d..f7af96c783 100644 --- a/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/repositories/AbstractRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/repositories/AbstractRepository.java @@ -19,13 +19,13 @@ */ package org.apache.airavata.service.profile.commons.repositories; +import com.github.dozermapper.core.Mapper; import jakarta.persistence.Query; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.airavata.service.profile.commons.utils.JPAUtils; import org.apache.airavata.service.profile.commons.utils.ObjectMapperSingleton; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/utils/ObjectMapperSingleton.java b/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/utils/ObjectMapperSingleton.java index 9499d4bcfe..7559aa55b7 100644 --- a/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/utils/ObjectMapperSingleton.java +++ b/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/utils/ObjectMapperSingleton.java @@ -19,19 +19,19 @@ */ package org.apache.airavata.service.profile.commons.utils; -import org.dozer.DozerBeanMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.github.dozermapper.core.DozerBeanMapperBuilder; +import com.github.dozermapper.core.Mapper; -public class ObjectMapperSingleton extends DozerBeanMapper { - private static final Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class); +public class ObjectMapperSingleton { - private static ObjectMapperSingleton instance; + private static Mapper mapper; - private ObjectMapperSingleton() {} - - public static ObjectMapperSingleton getInstance() { - if (instance == null) instance = new ObjectMapperSingleton(); - return instance; + public static Mapper getInstance() { + if (mapper == null) { + mapper = DozerBeanMapperBuilder.create() + .withMappingFiles("dozer_mapping.xml") + .build(); + } + return mapper; } } diff --git a/airavata-api/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java b/airavata-api/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java index 30918be8eb..bdf85bd4aa 100644 --- a/airavata-api/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java +++ b/airavata-api/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java @@ -23,21 +23,18 @@ import jakarta.ws.rs.client.ClientBuilder; import jakarta.ws.rs.core.Response; import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; import java.security.KeyStore; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.common.utils.SecurityUtil; import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.credential.store.PasswordCredential; import org.apache.airavata.model.user.Status; import org.apache.airavata.model.user.UserProfile; import org.apache.airavata.model.workspace.Gateway; +import org.apache.airavata.security.AiravataSecurityException; import org.apache.airavata.service.profile.iam.admin.services.core.interfaces.TenantManagementInterface; import org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException; import org.keycloak.admin.client.Keycloak; @@ -57,7 +54,7 @@ public class TenantManagementKeycloakImpl implements TenantManagementInterface { private static final Logger logger = LoggerFactory.getLogger(TenantManagementKeycloakImpl.class); - private String superAdminRealmId = "master"; + private final String superAdminRealmId = "master"; private static Keycloak getClient(String adminUrl, String realm, PasswordCredential AdminPasswordCreds) { @@ -87,51 +84,33 @@ private static Client getResteasyClient() { var builder = ClientBuilder.newBuilder(); try { - if (ServerSettings.isTrustStorePathDefined()) { - builder.trustStore(loadKeyStore()); + if (ServerSettings.isTLSEnabled()) { + var keyStorePath = ServerSettings.getKeyStorePath(); + var keyStorePassword = ServerSettings.getKeyStorePassword(); + builder.keyStore(loadKeyStore(keyStorePath, keyStorePassword), keyStorePassword); } } catch (ApplicationSettingsException e) { throw new RuntimeException("Failed to read application settings", e); + } catch (AiravataSecurityException e) { + throw new RuntimeException("Failed to load key store", e); } return builder.build(); } - private static KeyStore loadKeyStore() { - - InputStream is = null; + private static KeyStore loadKeyStore(String keyStorePath, String keyStorePassword) + throws ApplicationSettingsException, AiravataSecurityException { + var keyStoreFile = new File(keyStorePath); + if (keyStoreFile.exists() && keyStoreFile.isFile()) { + logger.info("Loading trust store file from path {}", keyStorePath); + } else { + logger.error("Trust store file does not exist at path {}", keyStorePath); + throw new ApplicationSettingsException("Trust store file does not exist at path " + keyStorePath); + } try { - - String trustStorePath = ServerSettings.getTrustStorePath(); - File trustStoreFile = new File(trustStorePath); - - if (trustStoreFile.exists()) { - logger.debug("Loading trust store file from path " + trustStorePath); - is = new FileInputStream(trustStorePath); - } else { - logger.debug("Trying to load trust store file form class path " + trustStorePath); - is = SecurityUtil.class.getClassLoader().getResourceAsStream(trustStorePath); - if (is != null) { - logger.debug("Trust store file was loaded form class path " + trustStorePath); - } - } - - if (is == null) { - throw new RuntimeException("Could not find a trust store file in path " + trustStorePath); - } - - KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); - ks.load(is, ServerSettings.getTrustStorePassword().toCharArray()); - return ks; + return KeyStore.getInstance(keyStoreFile, keyStorePassword.toCharArray()); } catch (Exception e) { - throw new RuntimeException("Failed to load trust store KeyStore instance", e); - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException e) { - logger.error("Failed to close trust store FileInputStream", e); - } - } + logger.error("Failed to load trust store file from path {}", keyStorePath, e); + throw new AiravataSecurityException("Failed to load trust store file from path " + keyStorePath, e); } } @@ -895,9 +874,9 @@ private static UserRepresentation getUserByUsername(Keycloak client, String tena public static void main(String[] args) throws IamAdminServicesException, ApplicationSettingsException { TenantManagementKeycloakImpl tenantManagementKeycloak = new TenantManagementKeycloakImpl(); // If testing with self-signed certificate, load certificate into - // modules/configuration/server/src/main/resources/airavata.jks and uncomment the following + // modules/configuration/server/src/main/resources/airavata.p12 and uncomment the following // ServerSettings.setSetting("trust.store", - // "./modules/configuration/server/src/main/resources/airavata.jks"); + // "./modules/configuration/server/src/main/resources/airavata.p12"); // ServerSettings.setSetting("trust.store.password", "airavata"); ServerSettings.setSetting("iam.server.url", ""); String accessToken = ""; diff --git a/airavata-api/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java b/airavata-api/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java index 2616df7d45..5f2912d310 100644 --- a/airavata-api/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.service.profile.user.core.repositories; +import com.github.dozermapper.core.Mapper; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,7 +29,6 @@ import org.apache.airavata.service.profile.commons.utils.JPAUtils; import org.apache.airavata.service.profile.commons.utils.ObjectMapperSingleton; import org.apache.airavata.service.profile.commons.utils.QueryConstants; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/service/security/AiravataSecurityManager.java b/airavata-api/src/main/java/org/apache/airavata/service/security/AiravataSecurityManager.java index c848fd0300..065b23ec52 100644 --- a/airavata-api/src/main/java/org/apache/airavata/service/security/AiravataSecurityManager.java +++ b/airavata-api/src/main/java/org/apache/airavata/service/security/AiravataSecurityManager.java @@ -24,16 +24,11 @@ import org.apache.airavata.security.AiravataSecurityException; public interface AiravataSecurityManager { - /** - * Implement this method in your SecurityManager to perform necessary initializations at the server startup. - * @throws AiravataSecurityException - */ - public void initializeSecurityInfra() throws AiravataSecurityException; /** * Implement this method with the user authentication/authorization logic in your SecurityManager. * @param authzToken : this includes OAuth token and user's claims - * @param metaData : this includes other meta data needed for security enforcements. + * @param metaData : this includes other metadata needed for security enforcements. * @return * @throws AiravataSecurityException */ diff --git a/airavata-api/src/main/java/org/apache/airavata/service/security/KeyCloakSecurityManager.java b/airavata-api/src/main/java/org/apache/airavata/service/security/KeyCloakSecurityManager.java index b60dda2faf..489b6a4f1b 100644 --- a/airavata-api/src/main/java/org/apache/airavata/service/security/KeyCloakSecurityManager.java +++ b/airavata-api/src/main/java/org/apache/airavata/service/security/KeyCloakSecurityManager.java @@ -25,14 +25,9 @@ import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Base64; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Collectors; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.Constants; import org.apache.airavata.common.utils.ServerSettings; @@ -42,19 +37,13 @@ import org.apache.airavata.credential.store.exception.CredentialStoreException; import org.apache.airavata.model.appcatalog.gatewaygroups.GatewayGroups; import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile; -import org.apache.airavata.model.credential.store.PasswordCredential; import org.apache.airavata.model.security.AuthzToken; import org.apache.airavata.model.workspace.Gateway; import org.apache.airavata.registry.api.RegistryService; import org.apache.airavata.registry.api.client.RegistryServiceClientFactory; import org.apache.airavata.registry.api.exception.RegistryServiceException; import org.apache.airavata.security.AiravataSecurityException; -import org.apache.airavata.security.util.TrustStoreManager; -import org.apache.airavata.service.security.authzcache.AuthzCacheEntry; -import org.apache.airavata.service.security.authzcache.AuthzCacheIndex; -import org.apache.airavata.service.security.authzcache.AuthzCacheManager; -import org.apache.airavata.service.security.authzcache.AuthzCacheManagerFactory; -import org.apache.airavata.service.security.authzcache.AuthzCachedStatus; +import org.apache.airavata.service.security.authzcache.*; import org.apache.airavata.sharing.registry.client.SharingRegistryServiceClientFactory; import org.apache.airavata.sharing.registry.models.SharingRegistryException; import org.apache.airavata.sharing.registry.models.UserGroup; @@ -70,16 +59,12 @@ import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.thrift.TException; -import org.json.JSONArray; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class KeyCloakSecurityManager implements AiravataSecurityManager { private static final Logger logger = LoggerFactory.getLogger(KeyCloakSecurityManager.class); - - private HashMap rolePermissionConfig = new HashMap<>(); - // Methods that users user to manage their user resource profile private static final String USER_RESOURCE_PROFILE_USER_METHODS = "/airavata/registerUserResourceProfile|/airavata/getUserResourceProfile" @@ -122,32 +107,11 @@ public class KeyCloakSecurityManager implements AiravataSecurityManager { private static final String GROUP_BASED_AUTH_METHODS = "/airavata/getGatewayGroups"; private static final String INTERMEDIATE_OUTPUTS_METHODS = "/airavata/fetchIntermediateOutputs|/airavata/getIntermediateOutputProcessStatus"; - + private final HashMap rolePermissionConfig = new HashMap<>(); private RegistryService.Client registryServiceClient = null; private SharingRegistryService.Client sharingRegistryServiceClient = null; - private static class GatewayGroupMembership { - private boolean inAdminsGroup = false; - private boolean inReadOnlyAdminsGroup = false; - - public boolean isInAdminsGroup() { - return inAdminsGroup; - } - - public void setInAdminsGroup(boolean inAdminsGroup) { - this.inAdminsGroup = inAdminsGroup; - } - - public boolean isInReadOnlyAdminsGroup() { - return inReadOnlyAdminsGroup; - } - - public void setInReadOnlyAdminsGroup(boolean inReadOnlyAdminsGroup) { - this.inReadOnlyAdminsGroup = inReadOnlyAdminsGroup; - } - } - - public KeyCloakSecurityManager() throws AiravataSecurityException { + public KeyCloakSecurityManager() throws AiravataSecurityException, ApplicationSettingsException { rolePermissionConfig.put("admin", "/airavata/.*"); rolePermissionConfig.put("gateway-provider", "/airavata/.*"); rolePermissionConfig.put( @@ -205,37 +169,27 @@ public KeyCloakSecurityManager() throws AiravataSecurityException { + APPLICATION_DEPLOYMENT_METHODS + "|" + GROUP_BASED_AUTH_METHODS + "|" + APPLICATION_MODULE_METHODS + "|" + CREDENTIAL_TOKEN_METHODS + "|" + INTERMEDIATE_OUTPUTS_METHODS); - - initializeSecurityInfra(); } - /** - * Implement this method in your SecurityManager to perform necessary initializations at the server startup. - * - * @throws AiravataSecurityException - */ - @Override - public void initializeSecurityInfra() throws AiravataSecurityException { - try { - // initialize SSL context with the trust store (if defined) that contains the public cert of WSO2 Identity - // Server. - if (ServerSettings.isTrustStorePathDefined()) { - TrustStoreManager trustStoreManager = new TrustStoreManager(); - trustStoreManager.initializeTrustStoreManager( - ServerSettings.getTrustStorePath(), ServerSettings.getTrustStorePassword()); - } - } catch (Exception e) { - throw new AiravataSecurityException(e.getMessage(), e); - } + public static void main(String[] args) throws AiravataSecurityException, ApplicationSettingsException, IOException { + // If testing with self-signed certificate, load certificate into + // modules/configuration/server/src/main/resources/airavata.p12 and uncomment the following + // ServerSettings.setSetting("trust.store", + // "./modules/configuration/server/src/main/resources/airavata.p12"); + // ServerSettings.setSetting("trust.store.password", "airavata"); + KeyCloakSecurityManager keyCloakSecurityManager = new KeyCloakSecurityManager(); + final String tokenURL = "..."; + final String clientId = "..."; + final String clientSecret = "..."; + JSONObject jsonObject = keyCloakSecurityManager.getClientCredentials(tokenURL, clientId, clientSecret); + System.out.println("access_token=" + jsonObject.getString("access_token")); } /** * Implement this method with the user authentication/authorization logic in your SecurityManager. * * @param authzToken : this includes OAuth token and user's claims - * @param metaData : this includes other meta data needed for security enforcements. - * @return - * @throws AiravataSecurityException + * @param metaData : this includes other metadata needed for security enforcements. */ @Override public boolean isUserAuthorized(AuthzToken authzToken, Map metaData) @@ -245,58 +199,41 @@ public boolean isUserAuthorized(AuthzToken authzToken, Map metaD String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); String action = "/airavata/" + metaData.get(Constants.API_METHOD_NAME); try { - if (!ServerSettings.isAPISecured()) { + if (!ServerSettings.isTLSEnabled()) { return true; } initServiceClients(); + boolean decision; if (ServerSettings.isAuthzCacheEnabled()) { - // obtain an instance of AuthzCacheManager implementation. - AuthzCacheManager authzCacheManager = AuthzCacheManagerFactory.getAuthzCacheManager(); - - // check in the cache - AuthzCachedStatus authzCachedStatus = authzCacheManager.getAuthzCachedStatus( - new AuthzCacheIndex(subject, gatewayId, accessToken, action)); - - if (AuthzCachedStatus.AUTHORIZED.equals(authzCachedStatus)) { - logger.debug("Authz decision for: (" + subject + ", " + accessToken + ", " + action - + ") is retrieved from cache."); - return true; - } else if (AuthzCachedStatus.NOT_AUTHORIZED.equals(authzCachedStatus)) { - logger.debug("Authz decision for: (" + subject + ", " + accessToken + ", " + action - + ") is retrieved from cache."); - return false; - } else if (AuthzCachedStatus.NOT_CACHED.equals(authzCachedStatus)) { - logger.debug("Authz decision for: (" + subject + ", " + accessToken + ", " + action - + ") is not in the cache. " + "Generating decision based on group membership."); - GatewayGroupMembership gatewayGroupMembership = - getGatewayGroupMembership(subject, accessToken, gatewayId); - boolean authorizationDecision = hasPermission(gatewayGroupMembership, action); - // cache the authorization decision - long currentTime = System.currentTimeMillis(); - // TODO get the actual token expiration time - authzCacheManager.addToAuthzCache( - new AuthzCacheIndex(subject, gatewayId, accessToken, action), - new AuthzCacheEntry(authorizationDecision, currentTime + 1000 * 60 * 60, currentTime)); - return authorizationDecision; - } else { - // undefined status returned from the authz cache manager - throw new AiravataSecurityException("Error in reading from the authorization cache."); + var authzCacheManager = AuthzCacheManagerFactory.getAuthzCacheManager(); + var cacheIndex = new AuthzCacheIndex(subject, gatewayId, accessToken, action); + var authzCachedStatus = authzCacheManager.getAuthzCachedStatus(cacheIndex); + switch (authzCachedStatus) { + case AUTHORIZED -> decision = true; + case NOT_AUTHORIZED -> decision = false; + case NOT_CACHED -> { + var gatewayGroupMembership = getGatewayGroupMembership(subject, accessToken, gatewayId); + decision = hasPermission(gatewayGroupMembership, action); + // TODO get the actual token expiration time + var currentTime = System.currentTimeMillis(); + authzCacheManager.addToAuthzCache( + new AuthzCacheIndex(subject, gatewayId, accessToken, action), + new AuthzCacheEntry(decision, currentTime + 1000 * 60 * 60, currentTime)); + } + default -> throw new AiravataSecurityException("Error in reading from the authorization cache."); } } else { - GatewayGroupMembership gatewayGroupMembership = - getGatewayGroupMembership(subject, accessToken, gatewayId); - return hasPermission(gatewayGroupMembership, action); + var gatewayGroupMembership = getGatewayGroupMembership(subject, accessToken, gatewayId); + decision = hasPermission(gatewayGroupMembership, action); } - + logger.debug("Authz decision for: ({},{},{}) = {}", subject, accessToken, action, decision); + return decision; } catch (ApplicationSettingsException e) { logger.error("Missing or invalid application setting.", e); throw new AiravataSecurityException(e.getMessage(), e); } catch (Exception e) { - logger.error( - "Error occurred while checking if user: " + subject + " is authorized for action: " + action - + " in gateway: " + gatewayId, - e); + logger.error("Error making Authz decision for: ({},{},{})", subject, action, gatewayId, e); throw new AiravataSecurityException(e.getMessage(), e); } finally { closeServiceClients(); @@ -359,7 +296,8 @@ private GatewayGroupMembership getGatewayGroupMembership(String username, String GatewayGroups gatewayGroups = getGatewayGroups(gatewayId); List userGroups = sharingRegistryServiceClient.getAllMemberGroupsForUser(gatewayId, username + "@" + gatewayId); - List userGroupIds = userGroups.stream().map(g -> g.getGroupId()).collect(Collectors.toList()); + List userGroupIds = + userGroups.stream().map(UserGroup::getGroupId).toList(); GatewayGroupMembership gatewayGroupMembership = new GatewayGroupMembership(); gatewayGroupMembership.setInAdminsGroup(userGroupIds.contains(gatewayGroups.getAdminsGroupId())); gatewayGroupMembership.setInReadOnlyAdminsGroup( @@ -382,31 +320,6 @@ private void validateToken(String username, String token, String gatewayId) thro } } - private String[] getUserRolesFromOAuthToken(String username, String token, String gatewayId) throws Exception { - GatewayResourceProfile gwrp = getRegistryServiceClient().getGatewayResourceProfile(gatewayId); - String identityServerRealm = gwrp.getIdentityServerTenant(); - String openIdConnectUrl = getOpenIDConfigurationUrl(identityServerRealm); - JSONObject openIdConnectConfig = new JSONObject(getFromUrl(openIdConnectUrl, token)); - String userInfoEndPoint = openIdConnectConfig.getString("userinfo_endpoint"); - JSONObject userInfo = new JSONObject(getFromUrl(userInfoEndPoint, token)); - if (!username.equals(userInfo.get("preferred_username"))) { - throw new AiravataSecurityException("Subject name and username for the token doesn't match"); - } - String userId = userInfo.getString("sub"); - - String userRoleMappingUrl = ServerSettings.getRemoteIDPServiceUrl() + "/admin/realms/" - + identityServerRealm + "/users/" - + userId + "/role-mappings/realm"; - JSONArray roleMappings = new JSONArray(getFromUrl(userRoleMappingUrl, getAdminAccessToken(gatewayId))); - String[] roles = new String[roleMappings.length()]; - for (int i = 0; i < roleMappings.length(); i++) { - roles[i] = - (new JSONObject(roleMappings.get(i).toString())).get("name").toString(); - } - - return roles; - } - private String getOpenIDConfigurationUrl(String realm) throws ApplicationSettingsException { return ServerSettings.getRemoteIDPServiceUrl() + "/realms/" + realm + "/.well-known/openid-configuration"; } @@ -430,43 +343,13 @@ public String getFromUrl(String urlToRead, String token) throws Exception { return result.toString(); } - private String getAdminAccessToken(String gatewayId) throws Exception { - CredentialStoreService.Client csClient = getCredentialStoreServiceClient(); - GatewayResourceProfile gwrp = getRegistryServiceClient().getGatewayResourceProfile(gatewayId); - String identityServerRealm = gwrp.getIdentityServerTenant(); - String openIdConnectUrl = getOpenIDConfigurationUrl(identityServerRealm); - JSONObject openIdConnectConfig = new JSONObject(getFromUrl(openIdConnectUrl, null)); - PasswordCredential credential = - csClient.getPasswordCredential(gwrp.getIdentityServerPwdCredToken(), gwrp.getGatewayID()); - String username = credential.getLoginUserName(); - String password = credential.getPassword(); - String urlString = openIdConnectConfig.getString("token_endpoint"); - StringBuilder result = new StringBuilder(); - URL url = new URL(urlString); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod("POST"); - conn.setDoOutput(true); - String postFields = - "client_id=admin-cli&username=" + username + "&password=" + password + "&grant_type=password"; - conn.getOutputStream().write(postFields.getBytes()); - BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); - String line; - while ((line = rd.readLine()) != null) { - result.append(line); - } - rd.close(); - JSONObject tokenInfo = new JSONObject(result.toString()); - return tokenInfo.get("access_token").toString(); - } - private String getTokenEndpoint(String gatewayId) throws Exception { String openIdConnectUrl = getOpenIDConfigurationUrl(gatewayId); JSONObject openIdConnectConfig = new JSONObject(getFromUrl(openIdConnectUrl, null)); return openIdConnectConfig.getString("token_endpoint"); } - private JSONObject getClientCredentials(String tokenURL, String clientId, String clientSecret) - throws ApplicationSettingsException, AiravataSecurityException { + private JSONObject getClientCredentials(String tokenURL, String clientId, String clientSecret) throws IOException { CloseableHttpClient httpClient = HttpClients.createSystem(); @@ -478,23 +361,13 @@ private JSONObject getClientCredentials(String tokenURL, String clientId, String formParams.add(new BasicNameValuePair("grant_type", "client_credentials")); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, Consts.UTF_8); httpPost.setEntity(entity); - try { - CloseableHttpResponse response = httpClient.execute(httpPost); - try { - String responseBody = EntityUtils.toString(response.getEntity()); - JSONObject tokenInfo = new JSONObject(responseBody); - return tokenInfo; - } finally { - response.close(); - } + try (CloseableHttpResponse response = httpClient.execute(httpPost)) { + String responseBody = EntityUtils.toString(response.getEntity()); + return new JSONObject(responseBody); } catch (IOException e) { throw new RuntimeException(e); } finally { - try { - httpClient.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } + httpClient.close(); } } @@ -516,18 +389,6 @@ private boolean hasPermission(GatewayGroupMembership gatewayGroupMembership, Str return matcher.matches(); } - private boolean hasPermission(String[] roles, String apiMethod) { - for (int i = 0; i < roles.length; i++) { - String role = roles[i]; - if (this.rolePermissionConfig.keySet().contains(role)) { - Pattern pattern = Pattern.compile(this.rolePermissionConfig.get(role)); - Matcher matcher = pattern.matcher(apiMethod); - if (matcher.matches()) return true; - } - } - return false; - } - private void initServiceClients() throws TException, ApplicationSettingsException { registryServiceClient = getRegistryServiceClient(); sharingRegistryServiceClient = getSharingRegistryServiceClient(); @@ -563,8 +424,7 @@ private CredentialStoreService.Client getCredentialStoreServiceClient() } } - private SharingRegistryService.Client getSharingRegistryServiceClient() - throws TException, ApplicationSettingsException { + private SharingRegistryService.Client getSharingRegistryServiceClient() throws TException { final int serverPort = Integer.parseInt(ServerSettings.getSharingRegistryPort()); final String serverHost = ServerSettings.getSharingRegistryHost(); try { @@ -574,17 +434,24 @@ private SharingRegistryService.Client getSharingRegistryServiceClient() } } - public static void main(String[] args) throws AiravataSecurityException, ApplicationSettingsException { - // If testing with self-signed certificate, load certificate into - // modules/configuration/server/src/main/resources/airavata.jks and uncomment the following - // ServerSettings.setSetting("trust.store", - // "./modules/configuration/server/src/main/resources/airavata.jks"); - // ServerSettings.setSetting("trust.store.password", "airavata"); - KeyCloakSecurityManager keyCloakSecurityManager = new KeyCloakSecurityManager(); - final String tokenURL = "..."; - final String clientId = "..."; - final String clientSecret = "..."; - JSONObject jsonObject = keyCloakSecurityManager.getClientCredentials(tokenURL, clientId, clientSecret); - System.out.println("access_token=" + jsonObject.getString("access_token")); + private static class GatewayGroupMembership { + private boolean inAdminsGroup = false; + private boolean inReadOnlyAdminsGroup = false; + + public boolean isInAdminsGroup() { + return inAdminsGroup; + } + + public void setInAdminsGroup(boolean inAdminsGroup) { + this.inAdminsGroup = inAdminsGroup; + } + + public boolean isInReadOnlyAdminsGroup() { + return inReadOnlyAdminsGroup; + } + + public void setInReadOnlyAdminsGroup(boolean inReadOnlyAdminsGroup) { + this.inReadOnlyAdminsGroup = inReadOnlyAdminsGroup; + } } } diff --git a/airavata-api/src/main/java/org/apache/airavata/service/security/SecurityManagerFactory.java b/airavata-api/src/main/java/org/apache/airavata/service/security/SecurityManagerFactory.java index 0823330c6e..4d0e46dc06 100644 --- a/airavata-api/src/main/java/org/apache/airavata/service/security/SecurityManagerFactory.java +++ b/airavata-api/src/main/java/org/apache/airavata/service/security/SecurityManagerFactory.java @@ -34,9 +34,8 @@ public class SecurityManagerFactory { public static AiravataSecurityManager getSecurityManager() throws AiravataSecurityException { try { - Class secManagerImpl = Class.forName(ServerSettings.getSecurityManagerClassName()); - AiravataSecurityManager securityManager = (AiravataSecurityManager) secManagerImpl.newInstance(); - return securityManager; + Class secManagerImpl = Class.forName(ServerSettings.getSecurityManagerClassName()); + return (AiravataSecurityManager) secManagerImpl.newInstance(); } catch (ClassNotFoundException e) { String error = "Security Manager class could not be found."; logger.error(e.getMessage(), e); @@ -45,11 +44,7 @@ public static AiravataSecurityManager getSecurityManager() throws AiravataSecuri String error = "Error in reading the configuration related to Security Manager class."; logger.error(e.getMessage(), e); throw new AiravataSecurityException(error); - } catch (InstantiationException e) { - String error = "Error in instantiating the Security Manager class."; - logger.error(e.getMessage(), e); - throw new AiravataSecurityException(error); - } catch (IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException e) { String error = "Error in instantiating the Security Manager class."; logger.error(e.getMessage(), e); throw new AiravataSecurityException(error); diff --git a/airavata-api/src/main/java/org/apache/airavata/service/security/interceptor/SecurityInterceptor.java b/airavata-api/src/main/java/org/apache/airavata/service/security/interceptor/SecurityInterceptor.java index 4b11e0a686..eb328c5cf1 100644 --- a/airavata-api/src/main/java/org/apache/airavata/service/security/interceptor/SecurityInterceptor.java +++ b/airavata-api/src/main/java/org/apache/airavata/service/security/interceptor/SecurityInterceptor.java @@ -64,7 +64,7 @@ public Object invoke(MethodInvocation invocation) throws Throwable { private void authorize(AuthzToken authzToken, Map metaData) throws AuthorizationException { try { - boolean isAPISecured = ServerSettings.isAPISecured(); + boolean isAPISecured = ServerSettings.isTLSEnabled(); if (isAPISecured) { AiravataSecurityManager securityManager = SecurityManagerFactory.getSecurityManager(); boolean isAuthz = securityManager.isUserAuthorized(authzToken, metaData); diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/repositories/AbstractRepository.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/repositories/AbstractRepository.java index 9cc7a7c79f..8b7c471488 100644 --- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/repositories/AbstractRepository.java +++ b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/repositories/AbstractRepository.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.sharing.registry.db.repositories; +import com.github.dozermapper.core.Mapper; import jakarta.persistence.EntityManager; import jakarta.persistence.Query; import java.util.ArrayList; @@ -29,7 +30,6 @@ import org.apache.airavata.sharing.registry.db.utils.JPAUtils; import org.apache.airavata.sharing.registry.db.utils.ObjectMapperSingleton; import org.apache.airavata.sharing.registry.models.SharingRegistryException; -import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/utils/ObjectMapperSingleton.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/utils/ObjectMapperSingleton.java index e35fc9bfb6..eaeee21d67 100644 --- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/utils/ObjectMapperSingleton.java +++ b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/utils/ObjectMapperSingleton.java @@ -19,19 +19,19 @@ */ package org.apache.airavata.sharing.registry.db.utils; -import org.dozer.DozerBeanMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.github.dozermapper.core.DozerBeanMapperBuilder; +import com.github.dozermapper.core.Mapper; -public class ObjectMapperSingleton extends DozerBeanMapper { - private static final Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class); +public class ObjectMapperSingleton { - private static ObjectMapperSingleton instance; + private static Mapper mapper; - private ObjectMapperSingleton() {} - - public static ObjectMapperSingleton getInstance() { - if (instance == null) instance = new ObjectMapperSingleton(); - return instance; + public static Mapper getInstance() { + if (mapper == null) { + mapper = DozerBeanMapperBuilder.create() + .withMappingFiles("dozer_mapping.xml") + .build(); + } + return mapper; } } diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java index 5a9c58659e..f84b3c974f 100644 --- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java +++ b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java @@ -76,63 +76,57 @@ public void start() throws Exception { new SharingRegistryServerHandler(createSharingRegistryDBInitConfig())); TServerTransport serverTransport; + TThreadPoolServer.Args options; - if (!ServerSettings.isSharingTLSEnabled()) { + if (!ServerSettings.isTLSEnabled()) { InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort); serverTransport = new TServerSocket(inetSocketAddress); - TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport); - options.minWorkerThreads = 30; - server = new TThreadPoolServer(options.processor(processor)); + options = new TThreadPoolServer.Args(serverTransport); } else { TSSLTransportFactory.TSSLTransportParameters TLSParams = new TSSLTransportFactory.TSSLTransportParameters(); TLSParams.requireClientAuth(true); TLSParams.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword()); - if (ServerSettings.isTrustStorePathDefined()) { - TLSParams.setTrustStore(ServerSettings.getTrustStorePath(), ServerSettings.getTrustStorePassword()); - } TServerSocket TLSServerTransport = TSSLTransportFactory.getServerSocket( serverPort, ServerSettings.getTLSClientTimeout(), InetAddress.getByName(serverHost), TLSParams); - TThreadPoolServer.Args options = new TThreadPoolServer.Args(TLSServerTransport); - options.minWorkerThreads = 30; - server = new TThreadPoolServer(options.processor(processor)); + options = new TThreadPoolServer.Args(TLSServerTransport); } - - new Thread() { - public void run() { - server.serve(); - setStatus(IServer.ServerStatus.STOPPED); - logger.info("Sharing Registry Server Stopped."); - } - }.start(); - new Thread() { - public void run() { - while (!server.isServing()) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - break; + options.minWorkerThreads = 30; + server = new TThreadPoolServer(options.processor(processor)); + + new Thread(() -> { + server.serve(); + setStatus(ServerStatus.STOPPED); + logger.info("Sharing Registry Server Stopped."); + }) + .start(); + new Thread(() -> { + while (!server.isServing()) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + break; + } } - } - if (server.isServing()) { - - try { - logger.info("Register sharing service with DB Event publishers"); - SharingServiceDBEventMessagingFactory.registerSharingServiceWithPublishers( - Constants.PUBLISHERS); - - logger.info("Start sharing service DB Event subscriber"); - SharingServiceDBEventMessagingFactory.getDBEventSubscriber(); - } catch (AiravataException | SharingRegistryException e) { - logger.error("Error starting sharing service. Error setting up DB event services."); - server.stop(); + if (server.isServing()) { + + try { + logger.info("Register sharing service with DB Event publishers"); + SharingServiceDBEventMessagingFactory.registerSharingServiceWithPublishers( + Constants.PUBLISHERS); + + logger.info("Start sharing service DB Event subscriber"); + SharingServiceDBEventMessagingFactory.getDBEventSubscriber(); + } catch (AiravataException | SharingRegistryException e) { + logger.error("Error starting sharing service. Error setting up DB event services."); + server.stop(); + } + setStatus(ServerStatus.STARTED); + logger.info("Starting Sharing Registry Server on Port " + serverPort); + logger.info("Listening to Sharing Registry server clients ...."); } - setStatus(IServer.ServerStatus.STARTED); - logger.info("Starting Sharing Registry Server on Port " + serverPort); - logger.info("Listening to Sharing Registry server clients ...."); - } - } - }.start(); + }) + .start(); } catch (TTransportException e) { setStatus(IServer.ServerStatus.FAILED); @@ -175,10 +169,6 @@ public void setServer(TServer server) { this.server = server; } - public boolean isTestMode() { - return testMode; - } - public void setTestMode(boolean testMode) { this.testMode = testMode; } diff --git a/airavata-api/src/main/resources/airavata-client.properties b/airavata-api/src/main/resources/airavata-client.properties deleted file mode 100644 index 4bdb489b1f..0000000000 --- a/airavata-api/src/main/resources/airavata-client.properties +++ /dev/null @@ -1,249 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -api.secured=true -api.server.monitoring.enabled=True -api.server.monitoring.host=localhost -api.server.monitoring.port=9097 -apiserver.host=localhost -apiserver.min.threads=50 -apiserver.name=apiserver-node0 -apiserver.port=8930 -apiserver=org.apache.airavata.api.server.AiravataAPIServer - -appcatalog.jdbc.driver=org.mariadb.jdbc.Driver -appcatalog.jdbc.password=CHANGE_ME -appcatalog.jdbc.url=jdbc:mariadb://localhost:13306/app_catalog -appcatalog.jdbc.user=root -appcatalog.validationQuery=SELECT 1 from CONFIGURATION - -authz.cache.enabled=true -authz.cache.manager.class=org.apache.airavata.service.security.authzcache.DefaultAuthzCacheManager - -cache.enable=false - -cluster.status.monitoring.enable=false -cluster.status.monitoring.repeat.time=18000 - -credential.store.jdbc.driver=org.mariadb.jdbc.Driver -credential.store.jdbc.password=CHANGE_ME -credential.store.jdbc.url=jdbc:mariadb://localhost:13306/credential_store -credential.store.jdbc.user=root -credential.store.jdbc.validationQuery=SELECT 1 from CONFIGURATION -credential.store.keystore.alias=airavata -credential.store.keystore.password=airavata -credential.store.keystore.url=keystores/airavata.jks -credential.store.server.host=localhost -credential.store.server.port=8960 -credentialstore=org.apache.airavata.credential.store.server.CredentialStoreServer - -data.analyzer.job.scanning.enable=false -data.parser.delete.container=True - -db_event_manager=org.apache.airavata.db.event.manager.DBEventManagerRunner - -default.registry.gateway=default -default.registry.oauth.client.id=pga -default.registry.oauth.client.secret=GtRMiIQG5UJJdmmeM6iQS0BZR4Yj0gbt -default.registry.password.hash.method=SHA -default.registry.password=CHANGE_ME -default.registry.user=default-admin - -durable.queue=false - -email.based.monitor.address=monitoring.airavata@gmail.com -email.based.monitor.folder.name=INBOX -email.based.monitor.host=imap.gmail.com -email.based.monitor.password=CHANGE_ME -email.based.monitor.store.protocol=imaps -email.based.monitoring.period=10000 -email.expiration.minutes=60 -email.from=airavata@apache.org -email.password=CHANGE_ME -email.server.port=465 -email.server=smtp.googlemail.com -email.ssl=true -email.user=airavata - -embedded.mode=false -embedded.zk=false - -enable.kafka.logging=false -enable.realtime.monitor=False -enable.sharing=true -enable.streaming.transfer=False -enable.validation=true - -enactment.thread.pool.size=10 - -experiment.launch.queue.name=experiment.launch.queue - -helix.cluster.name=AiravataCluster -helix.controller.name=AiravataController -helix.participant.name=AiravataParticipant - -host.scheduler=org.apache.airavata.orchestrator.core.schedule.DefaultHostScheduler - -iam.server.super.admin.password=CHANGE_ME -iam.server.super.admin.username=admin -iam.server.url=https://auth.dev.cybershuttle.org - -in.memory.cache.size=1000 -isRunningOnAws=false - -job.monitor.broker.publisher.id=AiravataMonitorPublisher -job.monitor.email.publisher.id=EmailBasedProducer -job.monitor.realtime.publisher.id=RealtimeProducer - -job.monitor.broker.topic=monitoring-data -job.monitor.broker.url=localhost:9092 -job.notification.emailids= -job.notification.enable=true -job.notification.flags=abe -job.status.publish.endpoint=http://localhost:8082/topics/helix-airavata-mq -job.validators=org.apache.airavata.orchestrator.core.validator.impl.BatchQueueValidator,org.apache.airavata.orchestrator.core.validator.impl.ExperimentStatusValidator - -jpa.cache.size=-1 - -kafka.broker.consumer.group=MonitoringConsumer -kafka.broker.list=localhost:9092 -kafka.broker.topic=monitoring-data - -kafka.broker.url=localhost:9092 -kafka.parser.broker.consumer.group=CHANGE_ME -kafka.parser.topic=CHANGE_ME -kafka.parsing.broker.url=CHANGE_ME -kafka.topic.prefix=local - -keystore.password=airavata -keystore.path=keystores/airavata.jks - -local.data.location=/home/exouser/temp-storage - -metaschedluer.job.scanning.enable=false - -orchestrator.server.host=localhost -orchestrator.server.min.threads=50 -orchestrator.server.name=orchestrator-node0 -orchestrator.server.port=8940 -orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer - -parser.storage.resource.id=CHANGE_ME - -participant.monitoring.enabled=true -participant.monitoring.host=localhost -participant.monitoring.port=9096 - -post.workflow.manager.loadbalance.clusters=false -post.workflow.manager.monitoring.enabled=true -post.workflow.manager.monitoring.host=localhost -post.workflow.manager.monitoring.port=9094 -post.workflow.manager.name=AiravataPostWM - -pre.workflow.manager.loadbalance.clusters=false -pre.workflow.manager.monitoring.enabled=true -pre.workflow.manager.monitoring.host=localhost -pre.workflow.manager.monitoring.port=9093 -pre.workflow.manager.name=AiravataPreWM - -prefetch.count=200 - -process.launch.queue.name=process.launch.queue - -profile_service=org.apache.airavata.service.profile.server.ProfileServiceServer -profile.service.jdbc.driver=org.mariadb.jdbc.Driver -profile.service.jdbc.password=CHANGE_ME -profile.service.jdbc.url=jdbc:mariadb://localhost:13306/profile_service -profile.service.jdbc.user=root -profile.service.server.host=localhost -profile.service.server.port=8962 -profile.service.validationQuery=SELECT 1 - -rabbitmq.broker.url=amqp://guest:guest@localhost:5672/develop -rabbitmq.experiment.exchange.name=experiment_exchange -rabbitmq.process.exchange.name=process_exchange -rabbitmq.status.exchange.name=status_exchange - -realtime.monitor.broker.consumer.group=monitor -realtime.monitor.broker.topic=helix-airavata-mq -realtime.monitor.broker.url=localhost:9092 - -registry.jdbc.driver=org.mariadb.jdbc.Driver -registry.jdbc.password=CHANGE_ME -registry.jdbc.url=jdbc:mariadb://localhost:13306/experiment_catalog -registry.jdbc.user=root - -regserver.server.host=localhost -regserver.server.min.threads=50 -regserver.server.name=regserver-node0 -regserver.server.port=8970 -regserver=org.apache.airavata.registry.api.service.RegistryAPIServer - -replicacatalog.jdbc.driver=org.mariadb.jdbc.Driver -replicacatalog.jdbc.password=CHANGE_ME -replicacatalog.jdbc.url=jdbc:mariadb://localhost:13306/replica_catalog -replicacatalog.jdbc.user=root -replicacatalog.validationQuery=SELECT 1 from CONFIGURATION - -security.manager.class=org.apache.airavata.service.security.KeyCloakSecurityManager - -sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer -sharing.registry.server.host=localhost -sharing.registry.server.port=7878 -sharing.tls.enabled=false -sharingcatalog.jdbc.driver=org.mariadb.jdbc.Driver -sharingcatalog.jdbc.password=CHANGE_ME -sharingcatalog.jdbc.url=jdbc:mariadb://localhost:13306/sharing_catalog -sharingcatalog.jdbc.user=root -sharingcatalog.validationQuery=SELECT 1 from CONFIGURATION - -start.submitter=true -submitter.interval=10000 - -super.tenant.gatewayId=default - -threadpool.size=10 - -thrift.client.pool.abandoned.removal.enabled=true -thrift.client.pool.abandoned.removal.logged=false - -TLS.api.server.port=9930 -TLS.client.timeout=10000 -TLS.enabled=true - -trust.store.password=airavata -trust.store=keystores/airavata.jks - -usage.reporting.endpoint=https://xsede-xdcdb-api.xsede.org/gateway/v2/job_attributes -usage.reporting.key=CHANGE_ME -userprofile.mongodb.host=localhost -userprofile.mongodb.port=27017 - -validationQuery=SELECT 1 from CONFIGURATION - -workflowcatalog.jdbc.driver=org.mariadb.jdbc.Driver -workflowcatalog.jdbc.password=CHANGE_ME -workflowcatalog.jdbc.url=jdbc:mariadb://localhost:13306/workflow_catalog -workflowcatalog.jdbc.user=root -workflowcatalog.validationQuery=SELECT 1 from CONFIGURATION -workflowserver=org.apache.airavata.api.server.WorkflowServer - -zookeeper.server.connection=localhost:2181 -zookeeper.timeout=30000 diff --git a/airavata-api/src/main/resources/airavata-server.properties b/airavata-api/src/main/resources/airavata-server.properties index 4bdb489b1f..10ad48660a 100644 --- a/airavata-api/src/main/resources/airavata-server.properties +++ b/airavata-api/src/main/resources/airavata-server.properties @@ -17,66 +17,54 @@ # specific language governing permissions and limitations # under the License. # +airavata.config.dir=. -api.secured=true -api.server.monitoring.enabled=True -api.server.monitoring.host=localhost +api.server.monitoring.enabled=true +api.server.monitoring.host=0.0.0.0 api.server.monitoring.port=9097 -apiserver.host=localhost -apiserver.min.threads=50 +apiserver.host=0.0.0.0 apiserver.name=apiserver-node0 apiserver.port=8930 apiserver=org.apache.airavata.api.server.AiravataAPIServer appcatalog.jdbc.driver=org.mariadb.jdbc.Driver -appcatalog.jdbc.password=CHANGE_ME -appcatalog.jdbc.url=jdbc:mariadb://localhost:13306/app_catalog -appcatalog.jdbc.user=root +appcatalog.jdbc.password=123456 +appcatalog.jdbc.url=jdbc:mariadb://airavata.host:13306/app_catalog +appcatalog.jdbc.user=airavata appcatalog.validationQuery=SELECT 1 from CONFIGURATION -authz.cache.enabled=true -authz.cache.manager.class=org.apache.airavata.service.security.authzcache.DefaultAuthzCacheManager - -cache.enable=false - cluster.status.monitoring.enable=false cluster.status.monitoring.repeat.time=18000 credential.store.jdbc.driver=org.mariadb.jdbc.Driver -credential.store.jdbc.password=CHANGE_ME -credential.store.jdbc.url=jdbc:mariadb://localhost:13306/credential_store -credential.store.jdbc.user=root +credential.store.jdbc.password=123456 +credential.store.jdbc.url=jdbc:mariadb://airavata.host:13306/credential_store +credential.store.jdbc.user=airavata credential.store.jdbc.validationQuery=SELECT 1 from CONFIGURATION -credential.store.keystore.alias=airavata -credential.store.keystore.password=airavata -credential.store.keystore.url=keystores/airavata.jks -credential.store.server.host=localhost +credential.store.server.host=0.0.0.0 credential.store.server.port=8960 credentialstore=org.apache.airavata.credential.store.server.CredentialStoreServer data.analyzer.job.scanning.enable=false -data.parser.delete.container=True +data.parser.delete.container=true db_event_manager=org.apache.airavata.db.event.manager.DBEventManagerRunner default.registry.gateway=default default.registry.oauth.client.id=pga -default.registry.oauth.client.secret=GtRMiIQG5UJJdmmeM6iQS0BZR4Yj0gbt -default.registry.password.hash.method=SHA -default.registry.password=CHANGE_ME +default.registry.oauth.client.secret=upCMVu2RZcAXUqpr9V7phAbz6hhF9cbl +default.registry.password=ade4#21242ftfd default.registry.user=default-admin -durable.queue=false - email.based.monitor.address=monitoring.airavata@gmail.com email.based.monitor.folder.name=INBOX email.based.monitor.host=imap.gmail.com -email.based.monitor.password=CHANGE_ME +email.based.monitor.password=123456 email.based.monitor.store.protocol=imaps email.based.monitoring.period=10000 email.expiration.minutes=60 email.from=airavata@apache.org -email.password=CHANGE_ME +email.password=123456 email.server.port=465 email.server=smtp.googlemail.com email.ssl=true @@ -85,133 +73,112 @@ email.user=airavata embedded.mode=false embedded.zk=false -enable.kafka.logging=false enable.realtime.monitor=False enable.sharing=true enable.streaming.transfer=False enable.validation=true -enactment.thread.pool.size=10 - -experiment.launch.queue.name=experiment.launch.queue - helix.cluster.name=AiravataCluster helix.controller.name=AiravataController helix.participant.name=AiravataParticipant host.scheduler=org.apache.airavata.orchestrator.core.schedule.DefaultHostScheduler -iam.server.super.admin.password=CHANGE_ME +iam.server.super.admin.password=admin iam.server.super.admin.username=admin -iam.server.url=https://auth.dev.cybershuttle.org +iam.server.url=http://airavata.host:18080 in.memory.cache.size=1000 -isRunningOnAws=false job.monitor.broker.publisher.id=AiravataMonitorPublisher job.monitor.email.publisher.id=EmailBasedProducer job.monitor.realtime.publisher.id=RealtimeProducer - job.monitor.broker.topic=monitoring-data -job.monitor.broker.url=localhost:9092 +job.monitor.broker.url=airavata.host:9092 job.notification.emailids= job.notification.enable=true -job.notification.flags=abe -job.status.publish.endpoint=http://localhost:8082/topics/helix-airavata-mq +job.status.publish.endpoint=http://airavata.host:8082/topics/helix-airavata-mq job.validators=org.apache.airavata.orchestrator.core.validator.impl.BatchQueueValidator,org.apache.airavata.orchestrator.core.validator.impl.ExperimentStatusValidator -jpa.cache.size=-1 - +kafka.broker.url=airavata.host:9092 kafka.broker.consumer.group=MonitoringConsumer -kafka.broker.list=localhost:9092 kafka.broker.topic=monitoring-data +kafka.parsing.broker.url=airavata.host:9092 +kafka.parser.broker.consumer.group=ParsingConsumer +kafka.parser.topic=parsing-data -kafka.broker.url=localhost:9092 -kafka.parser.broker.consumer.group=CHANGE_ME -kafka.parser.topic=CHANGE_ME -kafka.parsing.broker.url=CHANGE_ME -kafka.topic.prefix=local - -keystore.password=airavata -keystore.path=keystores/airavata.jks - -local.data.location=/home/exouser/temp-storage +local.data.location=/tmp metaschedluer.job.scanning.enable=false -orchestrator.server.host=localhost +orchestrator.server.host=airavata.host orchestrator.server.min.threads=50 -orchestrator.server.name=orchestrator-node0 orchestrator.server.port=8940 orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer parser.storage.resource.id=CHANGE_ME participant.monitoring.enabled=true -participant.monitoring.host=localhost +participant.monitoring.host=airavata.host participant.monitoring.port=9096 post.workflow.manager.loadbalance.clusters=false post.workflow.manager.monitoring.enabled=true -post.workflow.manager.monitoring.host=localhost +post.workflow.manager.monitoring.host=airavata.host post.workflow.manager.monitoring.port=9094 post.workflow.manager.name=AiravataPostWM pre.workflow.manager.loadbalance.clusters=false pre.workflow.manager.monitoring.enabled=true -pre.workflow.manager.monitoring.host=localhost +pre.workflow.manager.monitoring.host=airavata.host pre.workflow.manager.monitoring.port=9093 pre.workflow.manager.name=AiravataPreWM -prefetch.count=200 - -process.launch.queue.name=process.launch.queue - profile_service=org.apache.airavata.service.profile.server.ProfileServiceServer profile.service.jdbc.driver=org.mariadb.jdbc.Driver -profile.service.jdbc.password=CHANGE_ME -profile.service.jdbc.url=jdbc:mariadb://localhost:13306/profile_service -profile.service.jdbc.user=root -profile.service.server.host=localhost +profile.service.jdbc.password=123456 +profile.service.jdbc.url=jdbc:mariadb://airavata.host:13306/profile_service +profile.service.jdbc.user=airavata +profile.service.server.host=airavata.host profile.service.server.port=8962 profile.service.validationQuery=SELECT 1 -rabbitmq.broker.url=amqp://guest:guest@localhost:5672/develop +# RabbitMQ Settings +rabbitmq.broker.url=amqp://guest:guest@airavata.host:5672/develop rabbitmq.experiment.exchange.name=experiment_exchange rabbitmq.process.exchange.name=process_exchange rabbitmq.status.exchange.name=status_exchange +durable.queue=false +prefetch.count=200 realtime.monitor.broker.consumer.group=monitor realtime.monitor.broker.topic=helix-airavata-mq -realtime.monitor.broker.url=localhost:9092 +realtime.monitor.broker.url=airavata.host:9092 registry.jdbc.driver=org.mariadb.jdbc.Driver -registry.jdbc.password=CHANGE_ME -registry.jdbc.url=jdbc:mariadb://localhost:13306/experiment_catalog -registry.jdbc.user=root +registry.jdbc.password=123456 +registry.jdbc.url=jdbc:mariadb://airavata.host:13306/experiment_catalog +registry.jdbc.user=airavata -regserver.server.host=localhost +regserver.server.host=0.0.0.0 regserver.server.min.threads=50 regserver.server.name=regserver-node0 regserver.server.port=8970 regserver=org.apache.airavata.registry.api.service.RegistryAPIServer replicacatalog.jdbc.driver=org.mariadb.jdbc.Driver -replicacatalog.jdbc.password=CHANGE_ME -replicacatalog.jdbc.url=jdbc:mariadb://localhost:13306/replica_catalog -replicacatalog.jdbc.user=root +replicacatalog.jdbc.password=123456 +replicacatalog.jdbc.url=jdbc:mariadb://airavata.host:13306/replica_catalog +replicacatalog.jdbc.user=airavata replicacatalog.validationQuery=SELECT 1 from CONFIGURATION -security.manager.class=org.apache.airavata.service.security.KeyCloakSecurityManager - sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer -sharing.registry.server.host=localhost +sharing.registry.server.host=0.0.0.0 sharing.registry.server.port=7878 -sharing.tls.enabled=false sharingcatalog.jdbc.driver=org.mariadb.jdbc.Driver -sharingcatalog.jdbc.password=CHANGE_ME -sharingcatalog.jdbc.url=jdbc:mariadb://localhost:13306/sharing_catalog -sharingcatalog.jdbc.user=root +sharingcatalog.jdbc.password=123456 +sharingcatalog.jdbc.url=jdbc:mariadb://airavata.host:13306/sharing_catalog +sharingcatalog.jdbc.user=airavata sharingcatalog.validationQuery=SELECT 1 from CONFIGURATION start.submitter=true @@ -224,26 +191,25 @@ threadpool.size=10 thrift.client.pool.abandoned.removal.enabled=true thrift.client.pool.abandoned.removal.logged=false -TLS.api.server.port=9930 +# security settings TLS.client.timeout=10000 -TLS.enabled=true - -trust.store.password=airavata -trust.store=keystores/airavata.jks - -usage.reporting.endpoint=https://xsede-xdcdb-api.xsede.org/gateway/v2/job_attributes -usage.reporting.key=CHANGE_ME -userprofile.mongodb.host=localhost -userprofile.mongodb.port=27017 +TLS.enabled=false +keystore.path=keystores/airavata.p12 +keystore.password=airavata +credential.store.keystore.url=keystores/airavata.p12 +credential.store.keystore.password=airavata +credential.store.keystore.alias=airavata +authz.cache.enabled=true +authz.cache.manager.class=org.apache.airavata.service.security.authzcache.DefaultAuthzCacheManager +security.manager.class=org.apache.airavata.service.security.KeyCloakSecurityManager validationQuery=SELECT 1 from CONFIGURATION workflowcatalog.jdbc.driver=org.mariadb.jdbc.Driver -workflowcatalog.jdbc.password=CHANGE_ME -workflowcatalog.jdbc.url=jdbc:mariadb://localhost:13306/workflow_catalog -workflowcatalog.jdbc.user=root +workflowcatalog.jdbc.password=123456 +workflowcatalog.jdbc.url=jdbc:mariadb://airavata.host:13306/workflow_catalog +workflowcatalog.jdbc.user=airavata workflowcatalog.validationQuery=SELECT 1 from CONFIGURATION -workflowserver=org.apache.airavata.api.server.WorkflowServer -zookeeper.server.connection=localhost:2181 -zookeeper.timeout=30000 +zookeeper.server.connection=airavata.host:2181 +StrictHostKeyChecking=no \ No newline at end of file diff --git a/airavata-api/src/main/resources/appcatalog-derby.sql b/airavata-api/src/main/resources/appcatalog-derby.sql deleted file mode 100644 index bc3be54f2e..0000000000 --- a/airavata-api/src/main/resources/appcatalog-derby.sql +++ /dev/null @@ -1,742 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -CREATE TABLE COMPUTE_RESOURCE -( - RESOURCE_ID VARCHAR (255) NOT NULL, - HOST_NAME VARCHAR (255) NOT NULL, - RESOURCE_DESCRIPTION VARCHAR (255), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - MAX_MEMORY_NODE INTEGER, - CPUS_PER_NODE INTEGER, - DEFAULT_NODE_COUNT INTEGER, - DEFAULT_CPU_COUNT INTEGER, - DEFAULT_WALLTIME INTEGER, - ENABLED SMALLINT, - GATEWAY_USAGE_REPORTING SMALLINT, - GATEWAY_USAGE_MODULE_LOAD_CMD VARCHAR(500), - GATEWAY_USAGE_EXECUTABLE VARCHAR(255), - PRIMARY KEY (RESOURCE_ID) -); - -CREATE TABLE HOST_ALIAS -( - RESOURCE_ID VARCHAR(255) NOT NULL, - ALIAS VARCHAR(255), - PRIMARY KEY(RESOURCE_ID,ALIAS), - FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE -); - -CREATE TABLE HOST_IPADDRESS -( - RESOURCE_ID VARCHAR(255) NOT NULL, - IP_ADDRESS VARCHAR(255), - PRIMARY KEY(RESOURCE_ID,IP_ADDRESS), - FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE -); - -CREATE TABLE GSISSH_SUBMISSION -( - SUBMISSION_ID VARCHAR(255), - RESOURCE_JOB_MANAGER VARCHAR(255), - SSH_PORT INTEGER, - INSTALLED_PATH VARCHAR(255), - MONITOR_MODE VARCHAR(255), - PRIMARY KEY(SUBMISSION_ID) -); - -CREATE TABLE GSISSH_EXPORT -( - SUBMISSION_ID VARCHAR(255) NOT NULL, - EXPORT VARCHAR(255), - PRIMARY KEY(SUBMISSION_ID, EXPORT), - FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE -); - -CREATE TABLE GSISSH_PREJOBCOMMAND -( - SUBMISSION_ID VARCHAR(255) NOT NULL, - COMMAND VARCHAR(255), - PRIMARY KEY(SUBMISSION_ID, COMMAND), - FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE -); - -CREATE TABLE GSISSH_POSTJOBCOMMAND -( - SUBMISSION_ID VARCHAR(255) NOT NULL, - COMMAND VARCHAR(255), - PRIMARY KEY(SUBMISSION_ID, COMMAND), - FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE -); - -CREATE TABLE GLOBUS_SUBMISSION -( - SUBMISSION_ID VARCHAR(255), - RESOURCE_JOB_MANAGER VARCHAR(255), - SECURITY_PROTOCAL VARCHAR(255), - PRIMARY KEY(SUBMISSION_ID) -); - -CREATE TABLE UNICORE_SUBMISSION -( - SUBMISSION_ID VARCHAR(255), - SECURITY_PROTOCAL VARCHAR(255), - UNICORE_ENDPOINT_URL VARCHAR(255), - PRIMARY KEY(SUBMISSION_ID) -); - -CREATE TABLE UNICORE_DATAMOVEMENT -( - DATAMOVEMENT_ID VARCHAR(255), - SECURITY_PROTOCAL VARCHAR(255), - UNICORE_ENDPOINT_URL VARCHAR(255), - PRIMARY KEY(DATAMOVEMENT_ID) -); - - -CREATE TABLE GLOBUS_GK_ENDPOINT -( - SUBMISSION_ID VARCHAR(255) NOT NULL, - ENDPOINT VARCHAR(255), - PRIMARY KEY(SUBMISSION_ID, ENDPOINT), - FOREIGN KEY (SUBMISSION_ID) REFERENCES GLOBUS_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE -); - -CREATE TABLE RESOURCE_JOB_MANAGER -( - RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL, - PUSH_MONITORING_ENDPOINT VARCHAR (255), - JOB_MANAGER_BIN_PATH VARCHAR (255), - RESOURCE_JOB_MANAGER_TYPE VARCHAR (255) NOT NULL, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (RESOURCE_JOB_MANAGER_ID) -); - - - -CREATE TABLE SSH_JOB_SUBMISSION -( - RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL, - JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL, - ALTERNATIVE_SSH_HOSTNAME VARCHAR (255), - SECURITY_PROTOCOL VARCHAR (255) NOT NULL, - SSH_PORT INTEGER, - MONITOR_MODE VARCHAR (255), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID), - FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) -); - -CREATE TABLE SCP_DATA_MOVEMENT -( - QUEUE_DESCRIPTION VARCHAR (255), - DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL, - SECURITY_PROTOCOL VARCHAR (255) NOT NULL, - ALTERNATIVE_SCP_HOSTNAME VARCHAR (255), - SSH_PORT INTEGER, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID) -); - -CREATE TABLE GRIDFTP_DATA_MOVEMENT -( - DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL, - SECURITY_PROTOCOL VARCHAR (255) NOT NULL, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID) -); - -CREATE TABLE GRIDFTP_ENDPOINT -( - ENDPOINT VARCHAR (255) NOT NULL, - DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL, - PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID,ENDPOINT), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - FOREIGN KEY (DATA_MOVEMENT_INTERFACE_ID) REFERENCES GRIDFTP_DATA_MOVEMENT(DATA_MOVEMENT_INTERFACE_ID) ON DELETE CASCADE -); - ---CREATE TABLE JOB_SUBMISSION_PROTOCOL ---( --- RESOURCE_ID VARCHAR(255), --- SUBMISSION_ID VARCHAR(255), --- JOB_TYPE VARCHAR(255), --- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, --- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', --- PRIMARY KEY(RESOURCE_ID,SUBMISSION_ID,JOB_TYPE), --- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE ---); --- ---CREATE TABLE DATA_MOVEMENT_PROTOCOL ---( --- RESOURCE_ID VARCHAR(255), --- DATA_MOVE_ID VARCHAR(255), --- DATA_MOVE_TYPE VARCHAR(255), --- CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, --- UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', --- PRIMARY KEY(RESOURCE_ID,DATA_MOVE_ID,DATA_MOVE_TYPE), --- FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE ---); - -CREATE TABLE APPLICATION_MODULE -( - MODULE_ID VARCHAR(255), - MODULE_NAME VARCHAR(255), - MODULE_VERSION VARCHAR(255), - MODULE_DESC VARCHAR(500), - GATEWAY_ID VARCHAR (255) NOT NULL, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL, - PRIMARY KEY(MODULE_ID) -); - -CREATE TABLE APPLICATION_DEPLOYMENT -( - DEPLOYMENT_ID VARCHAR(255), - APP_MODULE_ID VARCHAR(255) NOT NULL, - COMPUTE_HOSTID VARCHAR(255) NOT NULL, - EXECUTABLE_PATH VARCHAR(255), - PARALLELISM VARCHAR(255), - APPLICATION_DESC VARCHAR(255), - ENV_MODULE_LOAD_CMD VARCHAR(255), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL, - GATEWAY_ID VARCHAR(255) NOT NULL, - DEFAULT_QUEUE_NAME VARCHAR(255), - DEFAULT_NODE_COUNT INTEGER, - DEFAULT_CPU_COUNT INTEGER, - DEFAULT_WALLTIME INTEGER, - EDITABLE_BY_USER SMALLINT, - PRIMARY KEY(DEPLOYMENT_ID), - FOREIGN KEY (COMPUTE_HOSTID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, - FOREIGN KEY (APP_MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE -); - -CREATE TABLE MODULE_LOAD_CMD -( - CMD VARCHAR (255) NOT NULL, - APP_DEPLOYMENT_ID VARCHAR (255) NOT NULL, - COMMAND_ORDER INTEGER, - PRIMARY KEY (APP_DEPLOYMENT_ID,CMD), - FOREIGN KEY (APP_DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE PREJOB_COMMAND -( - APPDEPLOYMENT_ID VARCHAR(255) NOT NULL, - COMMAND VARCHAR(255), - COMMAND_ORDER INTEGER, - PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND), - FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE POSTJOB_COMMAND -( - APPDEPLOYMENT_ID VARCHAR(255) NOT NULL, - COMMAND VARCHAR(255), - COMMAND_ORDER INTEGER, - PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND), - FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE LIBRARY_PREPAND_PATH -( - DEPLOYMENT_ID VARCHAR(255) NOT NULL, - NAME VARCHAR(255), - VALUE VARCHAR(255), - PRIMARY KEY(DEPLOYMENT_ID, NAME), - FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE LIBRARY_APEND_PATH -( - DEPLOYMENT_ID VARCHAR(255) NOT NULL, - NAME VARCHAR(255), - VALUE VARCHAR(255), - PRIMARY KEY(DEPLOYMENT_ID, NAME), - FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE APP_ENVIRONMENT -( - DEPLOYMENT_ID VARCHAR(255) NOT NULL, - NAME VARCHAR(255), - VALUE VARCHAR(255), - ENV_ORDER INTEGER, - PRIMARY KEY(DEPLOYMENT_ID, NAME), - FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE APPLICATION_INTERFACE -( - INTERFACE_ID VARCHAR(255), - APPLICATION_NAME VARCHAR(255), - APPLICATION_DESCRIPTION VARCHAR(500), - GATEWAY_ID VARCHAR(255) NOT NULL, - ARCHIVE_WORKING_DIRECTORY SMALLINT, - HAS_OPTIONAL_FILE_INPUTS SMALLINT, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL, - PRIMARY KEY(INTERFACE_ID) -); - -CREATE TABLE APP_MODULE_MAPPING -( - INTERFACE_ID VARCHAR(255) NOT NULL, - MODULE_ID VARCHAR(255) NOT NULL, - PRIMARY KEY(INTERFACE_ID, MODULE_ID), - FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE, - FOREIGN KEY (MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE -); - -CREATE TABLE APPLICATION_INPUT -( - INTERFACE_ID VARCHAR(255) NOT NULL, - INPUT_KEY VARCHAR(255), - INPUT_VALUE VARCHAR(255), - DATA_TYPE VARCHAR(255), - METADATA VARCHAR(4096), - APP_ARGUMENT VARCHAR(255), - STANDARD_INPUT SMALLINT, - USER_FRIENDLY_DESC CLOB, - INPUT_ORDER INTEGER, - IS_REQUIRED SMALLINT, - REQUIRED_TO_COMMANDLINE SMALLINT, - DATA_STAGED SMALLINT, - IS_READ_ONLY SMALLINT, - OVERRIDE_FILENAME VARCHAR(255), - PRIMARY KEY(INTERFACE_ID,INPUT_KEY), - FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE -); - -CREATE TABLE APPLICATION_OUTPUT -( - INTERFACE_ID VARCHAR(255) NOT NULL, - OUTPUT_KEY VARCHAR(255), - OUTPUT_VALUE VARCHAR(255), - DATA_TYPE VARCHAR(255), - IS_REQUIRED SMALLINT, - REQUIRED_TO_COMMANDLINE SMALLINT, - DATA_MOVEMENT SMALLINT, - DATA_NAME_LOCATION VARCHAR(255), - SEARCH_QUERY VARCHAR(255), - APP_ARGUMENT VARCHAR(255), - OUTPUT_STREAMING SMALLINT, - METADATA VARCHAR(4096), - PRIMARY KEY(INTERFACE_ID,OUTPUT_KEY), - FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE -); - -CREATE TABLE GATEWAY_PROFILE -( - GATEWAY_ID VARCHAR(255), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - CS_TOKEN VARCHAR (255), - IDENTITY_SERVER_TENANT VARCHAR (255), - IDENTITY_SERVER_PWD_CRED_TOKEN VARCHAR (255), - PRIMARY KEY(GATEWAY_ID) -); - -CREATE TABLE COMPUTE_RESOURCE_PREFERENCE -( - GATEWAY_ID VARCHAR(255) NOT NULL, - RESOURCE_ID VARCHAR(255) NOT NULL, - OVERRIDE_BY_AIRAVATA SMALLINT, - PREFERED_JOB_SUB_PROTOCOL VARCHAR(255), - PREFERED_DATA_MOVE_PROTOCOL VARCHAR(255), - PREFERED_BATCH_QUEUE VARCHAR(255), - SCRATCH_LOCATION VARCHAR(255), - ALLOCATION_PROJECT_NUMBER VARCHAR(255), - LOGIN_USERNAME VARCHAR(255), - RESOURCE_CS_TOKEN VARCHAR(255), - USAGE_REPORTING_GATEWAY_ID VARCHAR(255), - QUALITY_OF_SERVICE VARCHAR(255), - RESERVATION VARCHAR (255), - RESERVATION_START_TIME timestamp, - RESERVATION_END_TIME timestamp, - SSH_ACCOUNT_PROVISIONER VARCHAR(255), - SSH_ACCOUNT_PROVISIONER_ADDITIONAL_INFO VARCHAR(1000), - PRIMARY KEY(GATEWAY_ID,RESOURCE_ID), - FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, - FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE -); - -CREATE TABLE SSH_ACCOUNT_PROVISIONER_CONFIG -( - GATEWAY_ID VARCHAR(255) NOT NULL, - RESOURCE_ID VARCHAR(255) NOT NULL, - CONFIG_NAME VARCHAR(255) NOT NULL, - CONFIG_VALUE VARCHAR(255), - PRIMARY KEY (GATEWAY_ID, RESOURCE_ID, CONFIG_NAME), - FOREIGN KEY (GATEWAY_ID, RESOURCE_ID) REFERENCES COMPUTE_RESOURCE_PREFERENCE (GATEWAY_ID, RESOURCE_ID) ON DELETE CASCADE -); - -CREATE TABLE BATCH_QUEUE -( - COMPUTE_RESOURCE_ID VARCHAR(255) NOT NULL, - MAX_RUNTIME INTEGER, - MAX_JOB_IN_QUEUE INTEGER, - QUEUE_DESCRIPTION VARCHAR(255), - QUEUE_NAME VARCHAR(255) NOT NULL, - MAX_PROCESSORS INTEGER, - MAX_NODES INTEGER, - MAX_MEMORY INTEGER, - CPU_PER_NODE INTEGER, - DEFAULT_NODE_COUNT INTEGER, - DEFAULT_CPU_COUNT INTEGER, - DEFAULT_WALLTIME INTEGER, - QUEUE_SPECIFIC_MACROS VARCHAR(255), - IS_DEFAULT_QUEUE SMALLINT, - PRIMARY KEY (COMPUTE_RESOURCE_ID,QUEUE_NAME), - FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE -); - -CREATE TABLE COMPUTE_RESOURCE_FILE_SYSTEM -( - COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL, - PATH VARCHAR (255), - FILE_SYSTEM VARCHAR (255) NOT NULL, - PRIMARY KEY (COMPUTE_RESOURCE_ID,FILE_SYSTEM), - FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE - ); - -CREATE TABLE JOB_SUBMISSION_INTERFACE -( - JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL, - COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL, - JOB_SUBMISSION_PROTOCOL VARCHAR (255) NOT NULL, - PRIORITY_ORDER INTEGER, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (COMPUTE_RESOURCE_ID,JOB_SUBMISSION_INTERFACE_ID), - FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE -); - -CREATE TABLE DATA_MOVEMENT_INTERFACE -( - COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL, - DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL, - DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL, - PRIORITY_ORDER INTEGER, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (COMPUTE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID), - FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE -); - -CREATE TABLE STORAGE_RESOURCE -( - STORAGE_RESOURCE_ID VARCHAR (255) NOT NULL, - HOST_NAME VARCHAR (255) NOT NULL, - DESCRIPTION VARCHAR (255), - ENABLED SMALLINT , - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (STORAGE_RESOURCE_ID) -); - -CREATE TABLE STORAGE_INTERFACE -( - STORAGE_RESOURCE_ID VARCHAR (255) NOT NULL, - DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL, - DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL, - PRIORITY_ORDER INTEGER, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (STORAGE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID), - FOREIGN KEY (STORAGE_RESOURCE_ID) REFERENCES STORAGE_RESOURCE(STORAGE_RESOURCE_ID) ON DELETE CASCADE -); - -CREATE TABLE JOB_MANAGER_COMMAND -( - RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL, - COMMAND_TYPE VARCHAR (255) NOT NULL, - COMMAND VARCHAR (255), - PRIMARY KEY (RESOURCE_JOB_MANAGER_ID,COMMAND_TYPE), - FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) ON DELETE CASCADE -); - -CREATE TABLE PARALLELISM_COMMAND -( - RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL, - COMMAND_TYPE VARCHAR (255) NOT NULL, - COMMAND VARCHAR (255), - PRIMARY KEY (RESOURCE_JOB_MANAGER_ID,COMMAND_TYPE), - FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) ON DELETE CASCADE -); - -CREATE TABLE LOCAL_SUBMISSION -( - RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL, - JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL, - SECURITY_PROTOCOL VARCHAR (255) NOT NULL, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID), - FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) -); - -CREATE TABLE LOCAL_DATA_MOVEMENT -( - DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL, - PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID) -); - -CREATE TABLE STORAGE_PREFERENCE -( - GATEWAY_ID VARCHAR(255) NOT NULL, - STORAGE_RESOURCE_ID VARCHAR(255) NOT NULL, - LOGIN_USERNAME VARCHAR(255), - FS_ROOT_LOCATION VARCHAR(255), - RESOURCE_CS_TOKEN VARCHAR(255), - PRIMARY KEY(GATEWAY_ID,STORAGE_RESOURCE_ID), - FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE -); - -CREATE TABLE USER_RESOURCE_PROFILE ( - USER_ID varchar(255) NOT NULL, - CREATION_TIME TIMESTAMP DEFAULT NULL, - CS_TOKEN varchar(255) DEFAULT NULL, - GATEWAY_ID varchar(255) DEFAULT NULL, - IDENTITY_SERVER_PWD_CRED_TOKEN varchar(255) DEFAULT NULL, - IDENTITY_SERVER_TENANT varchar(255) DEFAULT NULL, - UPDATE_TIME TIMESTAMP DEFAULT NULL, - PRIMARY KEY (USER_ID,GATEWAY_ID) -); - -CREATE TABLE USER_STORAGE_PREFERENCE ( - STORAGE_RESOURCE_ID varchar(255) NOT NULL, - USER_ID varchar(255) NOT NULL, - RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL, - FS_ROOT_LOCATION varchar(255) DEFAULT NULL, - GATEWAY_ID varchar(255) DEFAULT NULL, - LOGIN_USERNAME varchar(255) DEFAULT NULL, - PRIMARY KEY (STORAGE_RESOURCE_ID,USER_ID,GATEWAY_ID) -); - -CREATE TABLE USER_COMPUTE_RESOURCE_PREFERENCE ( - RESOURCE_ID varchar(255) NOT NULL, - USER_ID varchar(255) NOT NULL, - PREFERED_BATCH_QUEUE varchar(255) DEFAULT NULL, - RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL, - GATEWAY_ID varchar(255) DEFAULT NULL, - LOGIN_USERNAME varchar(255) DEFAULT NULL, - ALLOCATION_PROJECT_NUMBER varchar(255) DEFAULT NULL, - QUALITY_OF_SERVICE varchar(255) DEFAULT NULL, - RESERVATION varchar(255) DEFAULT NULL, - RESERVATION_END_TIME TIMESTAMP DEFAULT NULL, - RESERVATION_START_TIME TIMESTAMP DEFAULT NULL, - SCRATCH_LOCATION varchar(255) DEFAULT NULL, - VALIDATED SMALLINT NOT NULL DEFAULT 0, - PRIMARY KEY (RESOURCE_ID,USER_ID,GATEWAY_ID) -); - -CREATE TABLE GROUP_RESOURCE_PROFILE ( - GATEWAY_ID varchar(255) NOT NULL, - GROUP_RESOURCE_PROFILE_ID varchar(255) NOT NULL, - GROUP_RESOURCE_PROFILE_NAME varchar(255) DEFAULT NULL, - CREATION_TIME BIGINT NOT NULL, - UPDATE_TIME BIGINT NOT NULL, - DEFAULT_CREDENTIAL_STORE_TOKEN varchar(255) DEFAULT NULL, - PRIMARY KEY (GROUP_RESOURCE_PROFILE_ID), - UNIQUE (GATEWAY_ID, GROUP_RESOURCE_PROFILE_NAME) -); - -CREATE TABLE BATCH_QUEUE_RESOURCE_POLICY ( - RESOURCE_POLICY_ID varchar(255) NOT NULL, - COMPUTE_RESOURCE_ID varchar(255) NOT NULL, - GROUP_RESOURCE_PROFILE_ID varchar(255) NOT NULL, - QUEUE_NAME varchar(255) NOT NULL, - MAX_ALLOWED_NODES INTEGER, - MAX_ALLOWED_CORES INTEGER, - MAX_ALLOWED_WALLTIME INTEGER, - PRIMARY KEY (RESOURCE_POLICY_ID), - FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, - FOREIGN KEY (GROUP_RESOURCE_PROFILE_ID) REFERENCES GROUP_RESOURCE_PROFILE(GROUP_RESOURCE_PROFILE_ID) ON DELETE CASCADE -); - -CREATE TABLE COMPUTE_RESOURCE_POLICY ( - RESOURCE_POLICY_ID varchar(255) NOT NULL, - COMPUTE_RESOURCE_ID varchar(255) NOT NULL, - GROUP_RESOURCE_PROFILE_ID varchar(255) NOT NULL, - PRIMARY KEY (RESOURCE_POLICY_ID), - FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, - FOREIGN KEY (GROUP_RESOURCE_PROFILE_ID) REFERENCES GROUP_RESOURCE_PROFILE(GROUP_RESOURCE_PROFILE_ID) ON DELETE CASCADE -); - -CREATE TABLE COMPUTE_RESOURCE_POLICY_QUEUES ( - RESOURCE_POLICY_ID varchar(255) NOT NULL, - QUEUE_NAME varchar(255) NOT NULL, - PRIMARY KEY (RESOURCE_POLICY_ID, QUEUE_NAME), - FOREIGN KEY (RESOURCE_POLICY_ID) REFERENCES COMPUTE_RESOURCE_POLICY(RESOURCE_POLICY_ID) ON DELETE CASCADE -); - -CREATE TABLE GROUP_COMPUTE_RESOURCE_PREFERENCE -( - RESOURCE_ID VARCHAR(255) NOT NULL, - GROUP_RESOURCE_PROFILE_ID varchar(255) NOT NULL, - OVERRIDE_BY_AIRAVATA SMALLINT, - PREFERED_JOB_SUB_PROTOCOL VARCHAR(255), - PREFERED_DATA_MOVE_PROTOCOL VARCHAR(255), - PREFERED_BATCH_QUEUE VARCHAR(255), - SCRATCH_LOCATION VARCHAR(255), - ALLOCATION_PROJECT_NUMBER VARCHAR(255), - LOGIN_USERNAME VARCHAR(255), - RESOURCE_CS_TOKEN VARCHAR(255), - USAGE_REPORTING_GATEWAY_ID VARCHAR(255), - QUALITY_OF_SERVICE VARCHAR(255), - SSH_ACCOUNT_PROVISIONER VARCHAR(255), - SSH_ACCOUNT_PROVISIONER_ADDITIONAL_INFO VARCHAR(1000), - PRIMARY KEY(RESOURCE_ID,GROUP_RESOURCE_PROFILE_ID), - FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, - FOREIGN KEY (GROUP_RESOURCE_PROFILE_ID) REFERENCES GROUP_RESOURCE_PROFILE(GROUP_RESOURCE_PROFILE_ID) ON DELETE CASCADE -); - -CREATE TABLE COMPUTE_RESOURCE_RESERVATION -- ComputeResourceReservationEntity - (RESERVATION_ID VARCHAR(255) NOT NULL, END_TIME TIMESTAMP NOT NULL, RESERVATION_NAME VARCHAR(255) NOT NULL, START_TIME TIMESTAMP NOT NULL, RESOURCE_ID VARCHAR(255) NOT NULL, GROUP_RESOURCE_PROFILE_ID VARCHAR(255) NOT NULL, PRIMARY KEY (RESERVATION_ID)); -CREATE TABLE COMPUTE_RESOURCE_RESERVATION_QUEUE (RESERVATION_ID VARCHAR(255), QUEUE_NAME VARCHAR(255) NOT NULL); -CREATE INDEX I_CMPTN_Q_RESERVATION_ID ON COMPUTE_RESOURCE_RESERVATION_QUEUE (RESERVATION_ID); -ALTER TABLE COMPUTE_RESOURCE_RESERVATION ADD FOREIGN KEY (RESOURCE_ID, GROUP_RESOURCE_PROFILE_ID) REFERENCES GROUP_COMPUTE_RESOURCE_PREFERENCE (RESOURCE_ID, GROUP_RESOURCE_PROFILE_ID) ON DELETE CASCADE; - -CREATE TABLE GRP_SSH_ACC_PROV_CONFIG -( - RESOURCE_ID VARCHAR(255) NOT NULL, - GROUP_RESOURCE_PROFILE_ID VARCHAR(255) NOT NULL, - CONFIG_NAME VARCHAR(255) NOT NULL, - CONFIG_VALUE VARCHAR(255), - PRIMARY KEY (RESOURCE_ID, CONFIG_NAME, GROUP_RESOURCE_PROFILE_ID), - FOREIGN KEY (RESOURCE_ID,GROUP_RESOURCE_PROFILE_ID) REFERENCES GROUP_COMPUTE_RESOURCE_PREFERENCE (RESOURCE_ID,GROUP_RESOURCE_PROFILE_ID) ON DELETE CASCADE -); - -CREATE TABLE PARSING_TEMPLATE -( - PARSING_TEMPLATE_ID VARCHAR(255) NOT NULL, - APP_INTERFACE_ID VARCHAR(255) NOT NULL, - GATEWAY_ID VARCHAR(255) NOT NULL, - PRIMARY KEY (PARSING_TEMPLATE_ID) -); - -CREATE TABLE PARSER -( - PARSER_ID VARCHAR(255) NOT NULL, - IMAGE_NAME VARCHAR(255) NOT NULL, - OUTPUT_DIR_PATH VARCHAR(255) NOT NULL, - INPUT_DIR_PATH VARCHAR(255) NOT NULL, - EXECUTION_COMMAND VARCHAR(255) NOT NULL, - GATEWAY_ID VARCHAR(255) NOT NULL, - PRIMARY KEY (PARSER_ID) -); - -CREATE TABLE PARSER_OUTPUT -( - PARSER_OUTPUT_ID VARCHAR(255) NOT NULL, - PARSER_OUTPUT_NAME VARCHAR(255) NOT NULL, - PARSER_OUTPUT_REQUIRED SMALLINT NOT NULL, - PARSER_ID VARCHAR(255) NOT NULL, - OUTPUT_TYPE VARCHAR(255) NOT NULL, - PRIMARY KEY (PARSER_OUTPUT_ID), - FOREIGN KEY (PARSER_ID) REFERENCES PARSER (PARSER_ID) ON DELETE CASCADE -); - -CREATE TABLE PARSER_INPUT -( - PARSER_INPUT_ID VARCHAR(255) NOT NULL, - PARSER_INPUT_NAME VARCHAR(255) NOT NULL, - PARSER_INPUT_REQUIRED SMALLINT NOT NULL, - PARSER_ID VARCHAR(255) NOT NULL, - INPUT_TYPE VARCHAR(255) NOT NULL, - PRIMARY KEY (PARSER_INPUT_ID), - FOREIGN KEY (PARSER_ID) REFERENCES PARSER (PARSER_ID) ON DELETE CASCADE -); - -CREATE TABLE PARSING_TEMPLATE_INPUT -( - PARSING_TEMPLATE_INPUT_ID VARCHAR(255) NOT NULL, - TARGET_PARSER_INPUT_ID VARCHAR(255) NOT NULL, - APPLICATION_OUTPUT_NAME VARCHAR(255), - VALUE VARCHAR(255), - PARSING_TEMPLATE_ID VARCHAR(255) NOT NULL, - PRIMARY KEY (PARSING_TEMPLATE_INPUT_ID), - FOREIGN KEY (TARGET_PARSER_INPUT_ID) REFERENCES PARSER_INPUT (PARSER_INPUT_ID) ON DELETE CASCADE, - FOREIGN KEY (PARSING_TEMPLATE_ID) REFERENCES PARSING_TEMPLATE (PARSING_TEMPLATE_ID) ON DELETE CASCADE -); - -CREATE TABLE PARSER_CONNECTOR -( - PARSER_CONNECTOR_ID VARCHAR(255) NOT NULL, - PARENT_PARSER_ID VARCHAR(255) NOT NULL, - CHILD_PARSER_ID VARCHAR(255) NOT NULL, - PARSING_TEMPLATE_ID VARCHAR(255) NOT NULL, - PRIMARY KEY (PARSER_CONNECTOR_ID), - FOREIGN KEY (PARENT_PARSER_ID) REFERENCES PARSER (PARSER_ID) ON DELETE CASCADE, - FOREIGN KEY (CHILD_PARSER_ID) REFERENCES PARSER (PARSER_ID) ON DELETE CASCADE, - FOREIGN KEY (PARSING_TEMPLATE_ID) REFERENCES PARSING_TEMPLATE (PARSING_TEMPLATE_ID) ON DELETE CASCADE -); - -CREATE TABLE PARSER_CONNECTOR_INPUT -( - PARSER_CONNECTOR_INPUT_ID VARCHAR(255) NOT NULL, - PARSER_INPUT_ID VARCHAR(255) NOT NULL, - PARSER_OUTPUT_ID VARCHAR(255), - VALUE VARCHAR(255), - PARSER_CONNECTOR_ID VARCHAR(255) NOT NULL, - PRIMARY KEY (PARSER_CONNECTOR_INPUT_ID), - FOREIGN KEY (PARSER_INPUT_ID) REFERENCES PARSER_INPUT (PARSER_INPUT_ID) ON DELETE CASCADE, - FOREIGN KEY (PARSER_OUTPUT_ID) REFERENCES PARSER_OUTPUT (PARSER_OUTPUT_ID) ON DELETE CASCADE, - FOREIGN KEY (PARSER_CONNECTOR_ID) REFERENCES PARSER_CONNECTOR (PARSER_CONNECTOR_ID) ON DELETE CASCADE -); - -CREATE TABLE GATEWAY_GROUPS -( - GATEWAY_ID VARCHAR(255) NOT NULL, - ADMINS_GROUP_ID VARCHAR(255), - READ_ONLY_ADMINS_GROUP_ID VARCHAR(255), - DEFAULT_GATEWAY_USERS_GROUP_ID VARCHAR(255), - PRIMARY KEY(GATEWAY_ID) -); - -CREATE TABLE CLOUD_JOB_SUBMISSION ( - JOB_SUBMISSION_INTERFACE_ID varchar(255) NOT NULL, - EXECUTABLE_TYPE VARCHAR(255) DEFAULT NULL, - NODE_ID VARCHAR(255) DEFAULT NULL, - PROVIDER_NAME VARCHAR(255) DEFAULT NULL, - SECURITY_PROTOCOL VARCHAR(255) DEFAULT NULL, - USER_ACCOUNT_NAME VARCHAR(255) DEFAULT NULL, - PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID) -); - -CREATE TABLE CONFIGURATION -( - CONFIG_KEY VARCHAR(255), - CONFIG_VAL VARCHAR(255), - PRIMARY KEY(CONFIG_KEY, CONFIG_VAL) -); - -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('app_catalog_version', '0.16'); - - - diff --git a/airavata-api/src/main/resources/credstore-derby.sql b/airavata-api/src/main/resources/credstore-derby.sql deleted file mode 100644 index 7ccc001f88..0000000000 --- a/airavata-api/src/main/resources/credstore-derby.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE COMMUNITY_USER ( - GATEWAY_ID VARCHAR(256) NOT NULL, - COMMUNITY_USER_NAME VARCHAR(256) NOT NULL, - TOKEN_ID VARCHAR(256) NOT NULL, - COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL, - PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID) -); - -CREATE TABLE CREDENTIALS ( - GATEWAY_ID VARCHAR(256) NOT NULL, - TOKEN_ID VARCHAR(256) NOT NULL, - CREDENTIAL BLOB NOT NULL, - PORTAL_USER_ID VARCHAR(256) NOT NULL, - TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - DESCRIPTION VARCHAR(500), - CREDENTIAL_OWNER_TYPE VARCHAR(10) DEFAULT 'GATEWAY' NOT NULL, - PRIMARY KEY (GATEWAY_ID, TOKEN_ID) -); - -CREATE TABLE CONFIGURATION ( - CONFIG_KEY VARCHAR(255), - CONFIG_VAL VARCHAR(255), - PRIMARY KEY (CONFIG_KEY, CONFIG_VAL) -); - -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES ('credential_store_version', '0.16'); - diff --git a/airavata-api/src/main/resources/airavataworkflowcatalog-derby.sql b/airavata-api/src/main/resources/database_scripts/airavataworkflowcatalog-derby.sql similarity index 100% rename from airavata-api/src/main/resources/airavataworkflowcatalog-derby.sql rename to airavata-api/src/main/resources/database_scripts/airavataworkflowcatalog-derby.sql diff --git a/airavata-api/src/main/resources/appcatalog-mysql.sql b/airavata-api/src/main/resources/database_scripts/appcatalog-mysql.sql similarity index 100% rename from airavata-api/src/main/resources/appcatalog-mysql.sql rename to airavata-api/src/main/resources/database_scripts/appcatalog-mysql.sql diff --git a/airavata-api/src/main/resources/credstore-mysql.sql b/airavata-api/src/main/resources/database_scripts/credstore-mysql.sql similarity index 100% rename from airavata-api/src/main/resources/credstore-mysql.sql rename to airavata-api/src/main/resources/database_scripts/credstore-mysql.sql diff --git a/airavata-api/src/main/resources/expcatalog-mysql.sql b/airavata-api/src/main/resources/database_scripts/expcatalog-mysql.sql similarity index 100% rename from airavata-api/src/main/resources/expcatalog-mysql.sql rename to airavata-api/src/main/resources/database_scripts/expcatalog-mysql.sql diff --git a/airavata-api/src/main/resources/replicacatalog-mysql.sql b/airavata-api/src/main/resources/database_scripts/replicacatalog-mysql.sql similarity index 100% rename from airavata-api/src/main/resources/replicacatalog-mysql.sql rename to airavata-api/src/main/resources/database_scripts/replicacatalog-mysql.sql diff --git a/airavata-api/src/main/resources/sharing-registry-mysql.sql b/airavata-api/src/main/resources/database_scripts/sharing-registry-mysql.sql similarity index 100% rename from airavata-api/src/main/resources/sharing-registry-mysql.sql rename to airavata-api/src/main/resources/database_scripts/sharing-registry-mysql.sql diff --git a/airavata-api/src/main/resources/user-profile-catalog-mysql.sql b/airavata-api/src/main/resources/database_scripts/user-profile-catalog-mysql.sql similarity index 100% rename from airavata-api/src/main/resources/user-profile-catalog-mysql.sql rename to airavata-api/src/main/resources/database_scripts/user-profile-catalog-mysql.sql diff --git a/airavata-api/src/main/resources/workflowcatalog-mysql.sql b/airavata-api/src/main/resources/database_scripts/workflowcatalog-mysql.sql similarity index 100% rename from airavata-api/src/main/resources/workflowcatalog-mysql.sql rename to airavata-api/src/main/resources/database_scripts/workflowcatalog-mysql.sql diff --git a/modules/distribution/src/main/resources/distribution/bin/controller.sh b/airavata-api/src/main/resources/distribution/bin/controller.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/controller.sh rename to airavata-api/src/main/resources/distribution/bin/controller.sh diff --git a/modules/distribution/src/main/resources/distribution/bin/email-monitor.sh b/airavata-api/src/main/resources/distribution/bin/email-monitor.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/email-monitor.sh rename to airavata-api/src/main/resources/distribution/bin/email-monitor.sh diff --git a/modules/distribution/src/main/resources/distribution/bin/orchestrator.sh b/airavata-api/src/main/resources/distribution/bin/orchestrator.sh similarity index 84% rename from modules/distribution/src/main/resources/distribution/bin/orchestrator.sh rename to airavata-api/src/main/resources/distribution/bin/orchestrator.sh index cdf615f51b..5e457ac5bc 100755 --- a/modules/distribution/src/main/resources/distribution/bin/orchestrator.sh +++ b/airavata-api/src/main/resources/distribution/bin/orchestrator.sh @@ -27,14 +27,6 @@ SERVERS="" ARGS=() while [[ $# -gt 0 ]]; do case $1 in - -security) - JAVA_OPTS+=" -Djava.security.manager -Djava.security.policy=${AIRAVATA_HOME}/conf/axis2.policy -Daxis2.home=${AIRAVATA_HOME}" - shift - ;; - -enableLegacyTLS) - JAVA_OPTS+=" -Djava.security.policy=${AIRAVATA_HOME}/bin/enableLegacyTLS.security -Djava.security.disableSystemPropertiesFile=true" - shift - ;; apiserver | gfac | orchestrator | credentialstore | regserver) if [ -z "$SERVERS" ]; then SERVERS="$1"; else SERVERS="$SERVERS,$1"; fi shift diff --git a/modules/distribution/src/main/resources/distribution/bin/parser-wm.sh b/airavata-api/src/main/resources/distribution/bin/parser-wm.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/parser-wm.sh rename to airavata-api/src/main/resources/distribution/bin/parser-wm.sh diff --git a/modules/distribution/src/main/resources/distribution/bin/participant.sh b/airavata-api/src/main/resources/distribution/bin/participant.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/participant.sh rename to airavata-api/src/main/resources/distribution/bin/participant.sh diff --git a/modules/distribution/src/main/resources/distribution/bin/post-wm.sh b/airavata-api/src/main/resources/distribution/bin/post-wm.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/post-wm.sh rename to airavata-api/src/main/resources/distribution/bin/post-wm.sh diff --git a/modules/distribution/src/main/resources/distribution/bin/pre-wm.sh b/airavata-api/src/main/resources/distribution/bin/pre-wm.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/pre-wm.sh rename to airavata-api/src/main/resources/distribution/bin/pre-wm.sh diff --git a/modules/distribution/src/main/resources/distribution/bin/realtime-monitor.sh b/airavata-api/src/main/resources/distribution/bin/realtime-monitor.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/realtime-monitor.sh rename to airavata-api/src/main/resources/distribution/bin/realtime-monitor.sh diff --git a/modules/distribution/src/main/resources/distribution/bin/setenv.sh b/airavata-api/src/main/resources/distribution/bin/setenv.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/setenv.sh rename to airavata-api/src/main/resources/distribution/bin/setenv.sh diff --git a/modules/distribution/src/main/resources/distribution/bin/sharing-registry.sh b/airavata-api/src/main/resources/distribution/bin/sharing-registry.sh similarity index 100% rename from modules/distribution/src/main/resources/distribution/bin/sharing-registry.sh rename to airavata-api/src/main/resources/distribution/bin/sharing-registry.sh diff --git a/airavata-api/src/main/resources/distribution/conf/.gitkeep b/airavata-api/src/main/resources/distribution/conf/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/airavata-api/src/main/resources/dozer_mapping.xml b/airavata-api/src/main/resources/dozer_mapping.xml index d9cc624291..5576403229 100644 --- a/airavata-api/src/main/resources/dozer_mapping.xml +++ b/airavata-api/src/main/resources/dozer_mapping.xml @@ -20,10 +20,10 @@ under the License. --> - + xsi:schemaLocation="http://dozermapper.github.io/schema/bean-mapping + https://dozermapper.github.io/schema/bean-mapping.xsd"> org.apache.airavata.registry.core.utils.CustomBeanFactory diff --git a/airavata-api/src/main/resources/enableLegacyTLS.properties b/airavata-api/src/main/resources/enableLegacyTLS.properties deleted file mode 100644 index b11f9d560e..0000000000 --- a/airavata-api/src/main/resources/enableLegacyTLS.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Remove TLSv1 and TLSv1.1 from disabledAlgorithms -jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, \ - DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \ - include jdk.disabled.namedCurves diff --git a/airavata-api/src/main/resources/expcatalog-derby.sql b/airavata-api/src/main/resources/expcatalog-derby.sql deleted file mode 100644 index 914a81b3a8..0000000000 --- a/airavata-api/src/main/resources/expcatalog-derby.sql +++ /dev/null @@ -1,445 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -CREATE TABLE GATEWAY -( - GATEWAY_ID VARCHAR(255), - GATEWAY_NAME VARCHAR(255), - DOMAIN VARCHAR(255), - EMAIL_ADDRESS VARCHAR(255), - GATEWAY_ACRONYM varchar(255), - GATEWAY_ADMIN_EMAIL varchar(255), - GATEWAY_ADMIN_FIRST_NAME varchar(255), - GATEWAY_APPROVAL_STATUS varchar(255), - GATEWAY_PUBLIC_ABSTRACT varchar(255), - GATEWAY_URL varchar(255), - GATEWAY_ADMIN_LAST_NAME varchar(255), - IDENTITY_SERVER_PASSWORD_TOKEN varchar(255), - IDENTITY_SERVER_USERNAME varchar(255), - GATEWAY_REVIEW_PROPOSAL_DESCRIPTION varchar(255), - DECLINED_REASON varchar(255), - OAUTH_CLIENT_SECRET varchar(255), - OAUTH_CLIENT_ID varchar(255), - REQUEST_CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - REQUESTER_USERNAME VARCHAR(255), - PRIMARY KEY (GATEWAY_ID) -); - -CREATE TABLE NOTIFICATION -( - NOTIFICATION_ID VARCHAR(255) NOT NULL, - GATEWAY_ID VARCHAR(255), - TITLE VARCHAR(255), - PRIORITY VARCHAR(255), - NOTIFICATION_MESSAGE VARCHAR(4096) NOT NULL, - PUBLISHED_DATE TIMESTAMP, - EXPIRATION_DATE TIMESTAMP, - CREATION_DATE TIMESTAMP, - PRIMARY KEY (NOTIFICATION_ID) -); - -CREATE TABLE USERS -( - AIRAVATA_INTERNAL_USER_ID VARCHAR(255) NOT NULL, - USER_NAME VARCHAR(255), - PASSWORD VARCHAR(255), - GATEWAY_ID VARCHAR(255) NOT NULL, - PRIMARY KEY (GATEWAY_ID, USER_NAME), - FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE, - UNIQUE (AIRAVATA_INTERNAL_USER_ID) -); - -CREATE TABLE GATEWAY_WORKER -( - GATEWAY_ID VARCHAR(255) NOT NULL, - USER_NAME VARCHAR(255), - PRIMARY KEY (GATEWAY_ID, USER_NAME), - FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE -); - -CREATE TABLE PROJECT -( - GATEWAY_ID VARCHAR(255) NOT NULL, - USER_NAME VARCHAR(255), - PROJECT_NAME VARCHAR(255), - PROJECT_ID VARCHAR(255), - DESCRIPTION VARCHAR(255), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (PROJECT_ID), - FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY(GATEWAY_ID) ON DELETE CASCADE -); - -CREATE TABLE PROJECT_USER -( - PROJECT_ID VARCHAR(255) NOT NULL, - USER_NAME VARCHAR(255) NOT NULL, - PRIMARY KEY (PROJECT_ID,USER_NAME), - FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE -); - -CREATE TABLE EXPERIMENT ( - EXPERIMENT_ID varchar(255), - PROJECT_ID varchar(255) NOT NULL, - GATEWAY_ID varchar(255), - EXPERIMENT_TYPE varchar(255), - USER_NAME varchar(255), - EXPERIMENT_NAME varchar(255), - CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - DESCRIPTION varchar(255), - EXECUTION_ID varchar(255), - GATEWAY_EXECUTION_ID varchar(255), - GATEWAY_INSTANCE_ID varchar(255), - ENABLE_EMAIL_NOTIFICATION SMALLINT, - EMAIL_ADDRESSES CLOB, - PRIMARY KEY (EXPERIMENT_ID), - FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID) ON DELETE CASCADE -); - - -CREATE TABLE EXPERIMENT_INPUT -( - EXPERIMENT_ID varchar(255) NOT NULL, - INPUT_NAME varchar(255), - INPUT_VALUE CLOB, - DATA_TYPE varchar(255), - APPLICATION_ARGUMENT varchar(255), - STANDARD_INPUT SMALLINT, - USER_FRIENDLY_DESCRIPTION CLOB, - METADATA varchar(4096), - INPUT_ORDER INT, - IS_REQUIRED SMALLINT, - REQUIRED_TO_ADDED_TO_CMD SMALLINT, - DATA_STAGED SMALLINT, - STORAGE_RESOURCE_ID varchar(255), - IS_READ_ONLY SMALLINT, - OVERRIDE_FILENAME VARCHAR(255), - PRIMARY KEY(EXPERIMENT_ID,INPUT_NAME), - FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE EXPERIMENT_OUTPUT -( - EXPERIMENT_ID varchar(255) NOT NULL, - OUTPUT_NAME varchar(255), - OUTPUT_VALUE CLOB, - DATA_TYPE varchar(255), - APPLICATION_ARGUMENT varchar(255), - IS_REQUIRED SMALLINT, - REQUIRED_TO_ADDED_TO_CMD SMALLINT, - DATA_MOVEMENT SMALLINT, - LOCATION varchar(255), - SEARCH_QUERY varchar(255), - OUTPUT_STREAMING SMALLINT, - STORAGE_RESOURCE_ID varchar(255), - METADATA varchar(4096), - PRIMARY KEY(EXPERIMENT_ID,OUTPUT_NAME), - FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE -); - - -CREATE TABLE EXPERIMENT_STATUS ( - STATUS_ID varchar(255), - EXPERIMENT_ID varchar(255) NOT NULL, - STATE varchar(255), - TIME_OF_STATE_CHANGE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - REASON CLOB, - PRIMARY KEY (STATUS_ID, EXPERIMENT_ID), - FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE -); - - -CREATE TABLE EXPERIMENT_ERROR ( - ERROR_ID varchar(255), - EXPERIMENT_ID varchar(255) NOT NULL, - CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - ACTUAL_ERROR_MESSAGE CLOB, - USER_FRIENDLY_MESSAGE CLOB, - TRANSIENT_OR_PERSISTENT SMALLINT, - ROOT_CAUSE_ERROR_ID_LIST CLOB, - PRIMARY KEY (ERROR_ID, EXPERIMENT_ID), - FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE USER_CONFIGURATION_DATA ( - EXPERIMENT_ID varchar(255) NOT NULL, - AIRAVATA_AUTO_SCHEDULE SMALLINT, - OVERRIDE_MANUAL_SCHEDULED_PARAMS SMALLINT, - SHARE_EXPERIMENT_PUBLICALLY SMALLINT, - THROTTLE_RESOURCES SMALLINT, - USER_DN varchar(255), - GENERATE_CERT SMALLINT, - RESOURCE_HOST_ID varchar(255), - TOTAL_CPU_COUNT INT, - NODE_COUNT INT, - NUMBER_OF_THREADS INT, - QUEUE_NAME varchar(255), - WALL_TIME_LIMIT INT, - TOTAL_PHYSICAL_MEMORY INT, - STATIC_WORKING_DIR varchar(255), - OVERRIDE_LOGIN_USER_NAME varchar(255), - OVERRIDE_SCRATCH_LOCATION varchar(255), - OVERRIDE_ALLOCATION_PROJECT_NUMBER varchar(255), - STORAGE_RESOURCE_ID varchar(255), - EXPERIMENT_DATA_DIR VARCHAR (512), - GROUP_RESOURCE_PROFILE_ID VARCHAR(255) DEFAULT NULL, - IS_USE_USER_CR_PREF SMALLINT, - PRIMARY KEY (EXPERIMENT_ID), - FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE COMPUTE_RESOURCE_SCHEDULING ( - EXPERIMENT_ID varchar(255) NOT NULL, - RESOURCE_HOST_ID varchar(255) NOT NULL, - TOTAL_CPU_COUNT INT, - NODE_COUNT INT, - NUMBER_OF_THREADS INT, - QUEUE_NAME varchar(255) NOT NULL, - WALL_TIME_LIMIT INT, - TOTAL_PHYSICAL_MEMORY INT, - PARALLEL_GROUP_COUNT INT, - STATIC_WORKING_DIR varchar(255), - OVERRIDE_LOGIN_USER_NAME varchar(255), - OVERRIDE_SCRATCH_LOCATION varchar(255), - OVERRIDE_ALLOCATION_PROJECT_NUMBER varchar(255), - PRIMARY KEY (EXPERIMENT_ID,RESOURCE_HOST_ID,QUEUE_NAME), - FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE -); - - -CREATE VIEW LATEST_EXPERIMENT_STATUS AS - select ES1.EXPERIMENT_ID AS EXPERIMENT_ID, ES1.STATE AS STATE, ES1.TIME_OF_STATE_CHANGE AS TIME_OF_STATE_CHANGE - from EXPERIMENT_STATUS ES1 LEFT JOIN EXPERIMENT_STATUS ES2 ON (ES1.EXPERIMENT_ID = ES2.EXPERIMENT_ID - AND ES1.TIME_OF_STATE_CHANGE < ES2.TIME_OF_STATE_CHANGE) WHERE ES2.TIME_OF_STATE_CHANGE is NULL; - -CREATE VIEW EXPERIMENT_SUMMARY AS - select E.EXPERIMENT_ID AS EXPERIMENT_ID, E.PROJECT_ID AS PROJECT_ID, E.GATEWAY_ID AS GATEWAY_ID, - E.USER_NAME AS USER_NAME, E.EXECUTION_ID AS EXECUTION_ID, E.EXPERIMENT_NAME AS EXPERIMENT_NAME, - E.CREATION_TIME AS CREATION_TIME, E.DESCRIPTION AS DESCRIPTION, ES.STATE AS STATE, UD.RESOURCE_HOST_ID - AS RESOURCE_HOST_ID, ES.TIME_OF_STATE_CHANGE AS TIME_OF_STATE_CHANGE - from ((EXPERIMENT E left join LATEST_EXPERIMENT_STATUS ES on((E.EXPERIMENT_ID = ES.EXPERIMENT_ID))) - left join USER_CONFIGURATION_DATA UD on((E.EXPERIMENT_ID = UD.EXPERIMENT_ID))) where true; - -CREATE TABLE PROCESS ( - PROCESS_ID varchar(255), - EXPERIMENT_ID varchar(255) NOT NULL, - CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - LAST_UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - PROCESS_DETAIL CLOB, - APPLICATION_INTERFACE_ID varchar(255), - TASK_DAG CLOB, - APPLICATION_DEPLOYMENT_ID varchar(255), - COMPUTE_RESOURCE_ID varchar(255), - GATEWAY_EXECUTION_ID varchar(255), - ENABLE_EMAIL_NOTIFICATION SMALLINT, - EMAIL_ADDRESSES CLOB, - STORAGE_RESOURCE_ID varchar(255), - USER_DN varchar(255), - GENERATE_CERT SMALLINT, - EXPERIMENT_DATA_DIR VARCHAR (512), - USERNAME VARCHAR (255), - GROUP_RESOURCE_PROFILE_ID VARCHAR (255) DEFAULT NULL, - USE_USER_CR_PREF SMALLINT, - PRIMARY KEY (PROCESS_ID), - FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT(EXPERIMENT_ID) ON DELETE CASCADE -); - -CREATE TABLE PROCESS_INPUT -( - PROCESS_ID varchar(255) NOT NULL, - INPUT_NAME varchar(255), - INPUT_VALUE CLOB, - DATA_TYPE varchar(255), - APPLICATION_ARGUMENT varchar(255), - STANDARD_INPUT SMALLINT, - USER_FRIENDLY_DESCRIPTION CLOB, - METADATA varchar(4096), - INPUT_ORDER INT, - IS_REQUIRED SMALLINT, - REQUIRED_TO_ADDED_TO_CMD SMALLINT, - DATA_STAGED SMALLINT, - STORAGE_RESOURCE_ID varchar(255), - IS_READ_ONLY SMALLINT, - OVERRIDE_FILENAME VARCHAR(255), - PRIMARY KEY(PROCESS_ID,INPUT_NAME), - FOREIGN KEY (PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE -); - -CREATE TABLE PROCESS_OUTPUT -( - PROCESS_ID varchar(255) NOT NULL, - OUTPUT_NAME varchar(255), - OUTPUT_VALUE CLOB, - DATA_TYPE varchar(255), - APPLICATION_ARGUMENT varchar(255), - IS_REQUIRED SMALLINT, - REQUIRED_TO_ADDED_TO_CMD SMALLINT, - DATA_MOVEMENT SMALLINT, - LOCATION varchar(255), - SEARCH_QUERY varchar(255), - OUTPUT_STREAMING SMALLINT, - STORAGE_RESOURCE_ID varchar(255), - METADATA varchar(4096), - PRIMARY KEY(PROCESS_ID,OUTPUT_NAME), - FOREIGN KEY (PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE -); - - -CREATE TABLE PROCESS_STATUS ( - STATUS_ID varchar(255), - PROCESS_ID varchar(255) NOT NULL, - STATE varchar(255), - TIME_OF_STATE_CHANGE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - REASON CLOB, - PRIMARY KEY (STATUS_ID, PROCESS_ID), - FOREIGN KEY (PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE -); - - -CREATE TABLE PROCESS_ERROR ( - ERROR_ID varchar(255), - PROCESS_ID varchar(255) NOT NULL, - CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - ACTUAL_ERROR_MESSAGE CLOB, - USER_FRIENDLY_MESSAGE CLOB, - TRANSIENT_OR_PERSISTENT SMALLINT, - ROOT_CAUSE_ERROR_ID_LIST CLOB, - PRIMARY KEY (ERROR_ID, PROCESS_ID), - FOREIGN KEY (PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE -); - -CREATE TABLE PROCESS_RESOURCE_SCHEDULE ( - PROCESS_ID varchar(255) NOT NULL, - RESOURCE_HOST_ID varchar(255), - TOTAL_CPU_COUNT INT, - NODE_COUNT INT, - NUMBER_OF_THREADS INT, - QUEUE_NAME varchar(255), - WALL_TIME_LIMIT INT, - TOTAL_PHYSICAL_MEMORY INT, - STATIC_WORKING_DIR varchar(255), - OVERRIDE_ALLOCATION_PROJECT_NUMBER varchar(255), - OVERRIDE_LOGIN_USER_NAME varchar(255), - OVERRIDE_SCRATCH_LOCATION varchar(255), - PRIMARY KEY (PROCESS_ID), - FOREIGN KEY (PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE -); - -CREATE TABLE TASK ( - TASK_ID varchar(255), - TASK_TYPE varchar(255), - PARENT_PROCESS_ID varchar(255), - CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - LAST_UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - TASK_DETAIL CLOB, - SUB_TASK_MODEL BLOB, - MAX_RETRY INT NOT NULL DEFAULT 3, - CURRENT_RETRY INT NOT NULL DEFAULT 0, - PRIMARY KEY (TASK_ID), - FOREIGN KEY (PARENT_PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE -); - -CREATE TABLE TASK_STATUS ( - STATUS_ID varchar(255), - TASK_ID varchar(255) NOT NULL, - STATE varchar(255), - TIME_OF_STATE_CHANGE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - REASON CLOB, - PRIMARY KEY (STATUS_ID, TASK_ID), - FOREIGN KEY (TASK_ID) REFERENCES TASK(TASK_ID) ON DELETE CASCADE -); - - -CREATE TABLE TASK_ERROR ( - ERROR_ID varchar(255), - TASK_ID varchar(255) NOT NULL, - CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - ACTUAL_ERROR_MESSAGE CLOB, - USER_FRIENDLY_MESSAGE CLOB, - TRANSIENT_OR_PERSISTENT SMALLINT, - ROOT_CAUSE_ERROR_ID_LIST CLOB, - PRIMARY KEY (ERROR_ID, TASK_ID), - FOREIGN KEY (TASK_ID) REFERENCES TASK(TASK_ID) ON DELETE CASCADE -); - -CREATE TABLE JOB ( - JOB_ID varchar(255), - TASK_ID varchar(255) NOT NULL, - PROCESS_ID varchar(255), - JOB_DESCRIPTION CLOB NOT NULL, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - COMPUTE_RESOURCE_CONSUMED varchar(255), - JOB_NAME varchar(255), - WORKING_DIR varchar(255), - STD_OUT CLOB, - STD_ERR CLOB, - EXIT_CODE INT, - PRIMARY KEY (JOB_ID, TASK_ID), - FOREIGN KEY (TASK_ID) REFERENCES TASK(TASK_ID) ON DELETE CASCADE -); - -CREATE TABLE JOB_STATUS ( - STATUS_ID varchar(255), - JOB_ID varchar(255) NOT NULL, - TASK_ID varchar(255) NOT NULL, - STATE varchar(255), - TIME_OF_STATE_CHANGE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - REASON CLOB, - PRIMARY KEY (STATUS_ID, JOB_ID, TASK_ID), - FOREIGN KEY (JOB_ID, TASK_ID) REFERENCES JOB(JOB_ID, TASK_ID) ON DELETE CASCADE -); - -CREATE TABLE QUEUE_STATUS( - HOST_NAME VARCHAR(255) NOT NULL, - QUEUE_NAME VARCHAR(255) NOT NULL, - CREATED_TIME BIGINT NOT NULL, - QUEUE_UP SMALLINT, - RUNNING_JOBS INT, - QUEUED_JOBS INT, - PRIMARY KEY (HOST_NAME, QUEUE_NAME, CREATED_TIME) -); - -CREATE TABLE CONFIGURATION -( - CONFIG_KEY VARCHAR(255), - CONFIG_VAL VARCHAR(255), - EXPIRE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - CATEGORY_ID VARCHAR (255), - PRIMARY KEY(CONFIG_KEY, CONFIG_VAL, CATEGORY_ID) -); - -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL, EXPIRE_DATE, CATEGORY_ID) VALUES('registry.version', '0.16', CURRENT_TIMESTAMP ,'SYSTEM'); - -CREATE TABLE PROCESS_WORKFLOW -( - PROCESS_ID varchar(255) NOT NULL, - WORKFLOW_ID varchar(255) NOT NULL, - TYPE varchar(255) DEFAULT NULL, - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (PROCESS_ID, WORKFLOW_ID), - FOREIGN KEY (PROCESS_ID) REFERENCES PROCESS(PROCESS_ID) ON DELETE CASCADE -); - -CREATE TABLE GATEWAY_USAGE_REPORTING_COMMAND ( - GATEWAY_ID VARCHAR(255) NOT NULL, - COMPUTE_RESOURCE_ID VARCHAR(255) NOT NULL, - COMMAND LONG VARCHAR NOT NULL, - PRIMARY KEY (GATEWAY_ID, COMPUTE_RESOURCE_ID) -) diff --git a/airavata-api/src/main/resources/gsissh.properties b/airavata-api/src/main/resources/gsissh.properties deleted file mode 100644 index 3fdf76df98..0000000000 --- a/airavata-api/src/main/resources/gsissh.properties +++ /dev/null @@ -1,26 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -########################################################################### -# Specifies system level configurations as a key/value pairs. -########################################################################### - -StrictHostKeyChecking=no -ssh.session.timeout=360000 diff --git a/airavata-api/src/main/resources/log4j2.xml b/airavata-api/src/main/resources/log4j2.xml index 2af1a20101..8fb27b1b68 100644 --- a/airavata-api/src/main/resources/log4j2.xml +++ b/airavata-api/src/main/resources/log4j2.xml @@ -25,18 +25,6 @@ - - - %d [%t] %-5p %c{30} %X - %m%n - - - - - - - - @@ -46,7 +34,6 @@ - \ No newline at end of file diff --git a/airavata-api/src/main/resources/replicacatalog-derby.sql b/airavata-api/src/main/resources/replicacatalog-derby.sql deleted file mode 100644 index d215179ad9..0000000000 --- a/airavata-api/src/main/resources/replicacatalog-derby.sql +++ /dev/null @@ -1,85 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -CREATE TABLE DATA_PRODUCT -( - PRODUCT_URI VARCHAR (255), - GATEWAY_ID VARCHAR (255), - PRODUCT_NAME VARCHAR (255), - PRODUCT_DESCRIPTION VARCHAR (255), - OWNER_NAME VARCHAR (255), - PARENT_PRODUCT_URI VARCHAR (255), - PRODUCT_SIZE INTEGER , - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - LAST_MODIFIED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - PRODUCT_TYPE VARCHAR(10), - PRIMARY KEY (PRODUCT_URI) - -- in Derby can't create self-reference FOREIGN KEY in CREATE TABLE - -- statement so this gets added via the following ALTER TABLE statement - -- FOREIGN KEY (PARENT_PRODUCT_URI) REFERENCES DATA_PRODUCT (PRODUCT_URI) ON DELETE CASCADE -); - -ALTER TABLE DATA_PRODUCT ADD FOREIGN KEY (PARENT_PRODUCT_URI) REFERENCES DATA_PRODUCT (PRODUCT_URI) ON DELETE CASCADE; - -CREATE TABLE DATA_REPLICA_LOCATION -( - REPLICA_ID VARCHAR (255), - PRODUCT_URI VARCHAR (255) NOT NULL, - REPLICA_NAME VARCHAR (255), - REPLICA_DESCRIPTION VARCHAR (255), - STORAGE_RESOURCE_ID VARCHAR (255), - FILE_PATH VARCHAR (1024), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - LAST_MODIFIED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - VALID_UNTIL_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', - REPLICA_LOCATION_CATEGORY VARCHAR(26), - REPLICA_PERSISTENT_TYPE VARCHAR(10), - PRIMARY KEY (REPLICA_ID), - FOREIGN KEY (PRODUCT_URI) REFERENCES DATA_PRODUCT(PRODUCT_URI) ON DELETE CASCADE -); - -CREATE TABLE DATA_PRODUCT_METADATA -( - PRODUCT_URI VARCHAR(255) NOT NULL, - METADATA_KEY VARCHAR(255), - METADATA_VALUE VARCHAR(255), - PRIMARY KEY(PRODUCT_URI, METADATA_KEY), - FOREIGN KEY (PRODUCT_URI) REFERENCES DATA_PRODUCT(PRODUCT_URI) ON DELETE CASCADE -); - -CREATE TABLE DATA_REPLICA_METADATA -( - REPLICA_ID VARCHAR(255) NOT NULL, - METADATA_KEY VARCHAR(255), - METADATA_VALUE VARCHAR(255), - PRIMARY KEY(REPLICA_ID, METADATA_KEY), - FOREIGN KEY (REPLICA_ID) REFERENCES DATA_REPLICA_LOCATION(REPLICA_ID) ON DELETE CASCADE -); - - -CREATE TABLE CONFIGURATION -( - CONFIG_KEY VARCHAR(255), - CONFIG_VAL VARCHAR(255), - PRIMARY KEY(CONFIG_KEY, CONFIG_VAL) -); - -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('data_catalog_version', '0.16'); diff --git a/airavata-api/src/main/resources/sharing-registry-derby.sql b/airavata-api/src/main/resources/sharing-registry-derby.sql deleted file mode 100644 index 6fe96a104b..0000000000 --- a/airavata-api/src/main/resources/sharing-registry-derby.sql +++ /dev/null @@ -1,150 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -CREATE TABLE DOMAIN ( - DOMAIN_ID VARCHAR(255) NOT NULL, - NAME VARCHAR(255) NOT NULL, - DESCRIPTION VARCHAR(255), - CREATED_TIME BIGINT NOT NULL, - UPDATED_TIME BIGINT NOT NULL, - INITIAL_USER_GROUP_ID VARCHAR(255), - PRIMARY KEY (DOMAIN_ID) -); - -CREATE TABLE SHARING_USER ( - USER_ID VARCHAR(255) NOT NULL, - DOMAIN_ID VARCHAR(255) NOT NULL, - USER_NAME VARCHAR(255) NOT NULL, - FIRST_NAME VARCHAR (255), - LAST_NAME VARCHAR (255), - EMAIL VARCHAR (255), - ICON BLOB, - CREATED_TIME BIGINT NOT NULL, - UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (USER_ID, DOMAIN_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - -CREATE TABLE GROUP_ADMIN ( - ADMIN_ID VARCHAR(255) NOT NULL, - GROUP_ID VARCHAR(255) NOT NULL, - DOMAIN_ID VARCHAR(255) NOT NULL, - PRIMARY KEY (ADMIN_ID, GROUP_ID, DOMAIN_ID), - FOREIGN KEY (ADMIN_ID, DOMAIN_ID) REFERENCES SHARING_USER(USER_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - -CREATE TABLE USER_GROUP ( - GROUP_ID VARCHAR(255) NOT NULL, - DOMAIN_ID VARCHAR(255) NOT NULL, - NAME VARCHAR(255) NOT NULL, - DESCRIPTION VARCHAR(255), - OWNER_ID VARCHAR(255) NOT NULL, - GROUP_TYPE VARCHAR(255) NOT NULL, - GROUP_CARDINALITY VARCHAR(255) NOT NULL, - CREATED_TIME BIGINT NOT NULL, - UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (GROUP_ID, DOMAIN_ID), - FOREIGN KEY (OWNER_ID, DOMAIN_ID) REFERENCES SHARING_USER(USER_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - - -CREATE TABLE GROUP_MEMBERSHIP ( - PARENT_ID VARCHAR(255) NOT NULL, - CHILD_ID VARCHAR(255) NOT NULL, - DOMAIN_ID VARCHAR(255) NOT NULL, - CHILD_TYPE VARCHAR(255) NOT NULL, - CREATED_TIME BIGINT NOT NULL, - UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PARENT_ID, CHILD_ID, DOMAIN_ID), - FOREIGN KEY (PARENT_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (CHILD_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - -CREATE TABLE ENTITY_TYPE ( - ENTITY_TYPE_ID VARCHAR(255) NOT NULL, - DOMAIN_ID VARCHAR(255) NOT NULL, - NAME VARCHAR(255) NOT NULL, - DESCRIPTION VARCHAR(255), - CREATED_TIME BIGINT NOT NULL, - UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (ENTITY_TYPE_ID, DOMAIN_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - -CREATE TABLE PERMISSION_TYPE ( - PERMISSION_TYPE_ID VARCHAR(255) NOT NULL, - DOMAIN_ID VARCHAR(255) NOT NULL, - NAME VARCHAR(255) NOT NULL, - DESCRIPTION VARCHAR(255), - CREATED_TIME BIGINT NOT NULL, - UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PERMISSION_TYPE_ID, DOMAIN_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - -CREATE TABLE ENTITY ( - ENTITY_ID VARCHAR(255) NOT NULL, - DOMAIN_ID VARCHAR(255) NOT NULL, - ENTITY_TYPE_ID VARCHAR(255) NOT NULL, - OWNER_ID VARCHAR(255) NOT NULL, - PARENT_ENTITY_ID VARCHAR(255), - NAME VARCHAR(255) NOT NULL, - DESCRIPTION VARCHAR(255), - BINARY_DATA BLOB, - FULL_TEXT VARCHAR(255), - SHARED_COUNT BIGINT DEFAULT 0, - ORIGINAL_ENTITY_CREATION_TIME BIGINT NOT NULL, - CREATED_TIME BIGINT NOT NULL, - UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (ENTITY_ID, DOMAIN_ID), - FOREIGN KEY (ENTITY_TYPE_ID, DOMAIN_ID) REFERENCES ENTITY_TYPE(ENTITY_TYPE_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (OWNER_ID, DOMAIN_ID) REFERENCES SHARING_USER(USER_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (PARENT_ENTITY_ID, DOMAIN_ID) REFERENCES ENTITY(ENTITY_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - --- ALTER TABLE ENTITY ADD FULLTEXT FULL_TEXT_INDEX(FULL_TEXT); - -CREATE TABLE SHARING ( - PERMISSION_TYPE_ID VARCHAR(255) NOT NULL, - ENTITY_ID VARCHAR(255) NOT NULL, - DOMAIN_ID VARCHAR (255) NOT NULL, - GROUP_ID VARCHAR(255) NOT NULL, - SHARING_TYPE VARCHAR(255) NOT NULL, - INHERITED_PARENT_ID VARCHAR(255), - CREATED_TIME BIGINT NOT NULL, - UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PERMISSION_TYPE_ID, ENTITY_ID, GROUP_ID, DOMAIN_ID, INHERITED_PARENT_ID), - FOREIGN KEY (PERMISSION_TYPE_ID, DOMAIN_ID) REFERENCES PERMISSION_TYPE(PERMISSION_TYPE_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (ENTITY_ID, DOMAIN_ID) REFERENCES ENTITY(ENTITY_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (INHERITED_PARENT_ID, DOMAIN_ID) REFERENCES ENTITY(ENTITY_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (GROUP_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - -CREATE TABLE CONFIGURATION -( - CONFIG_KEY VARCHAR(255) NOT NULL, - CONFIG_VALUE VARCHAR(255) NOT NULL, - PRIMARY KEY(CONFIG_KEY, CONFIG_VALUE) -); - -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VALUE) VALUES('sharing_reg_version', '0.17'); - -ALTER TABLE DOMAIN ADD FOREIGN KEY (INITIAL_USER_GROUP_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION; diff --git a/airavata-api/src/main/resources/CLOUD_Groovy.template b/airavata-api/src/main/resources/templates/CLOUD_Groovy.template similarity index 100% rename from airavata-api/src/main/resources/CLOUD_Groovy.template rename to airavata-api/src/main/resources/templates/CLOUD_Groovy.template diff --git a/airavata-api/src/main/resources/FORK_Groovy.template b/airavata-api/src/main/resources/templates/FORK_Groovy.template similarity index 100% rename from airavata-api/src/main/resources/FORK_Groovy.template rename to airavata-api/src/main/resources/templates/FORK_Groovy.template diff --git a/airavata-api/src/main/resources/HTCONDOR_Groovy.template b/airavata-api/src/main/resources/templates/HTCONDOR_Groovy.template similarity index 100% rename from airavata-api/src/main/resources/HTCONDOR_Groovy.template rename to airavata-api/src/main/resources/templates/HTCONDOR_Groovy.template diff --git a/airavata-api/src/main/resources/LSF_Groovy.template b/airavata-api/src/main/resources/templates/LSF_Groovy.template similarity index 100% rename from airavata-api/src/main/resources/LSF_Groovy.template rename to airavata-api/src/main/resources/templates/LSF_Groovy.template diff --git a/airavata-api/src/main/resources/PBS_Groovy.template b/airavata-api/src/main/resources/templates/PBS_Groovy.template similarity index 100% rename from airavata-api/src/main/resources/PBS_Groovy.template rename to airavata-api/src/main/resources/templates/PBS_Groovy.template diff --git a/airavata-api/src/main/resources/SLURM_Groovy.template b/airavata-api/src/main/resources/templates/SLURM_Groovy.template similarity index 100% rename from airavata-api/src/main/resources/SLURM_Groovy.template rename to airavata-api/src/main/resources/templates/SLURM_Groovy.template diff --git a/airavata-api/src/main/resources/UGE_Groovy.template b/airavata-api/src/main/resources/templates/UGE_Groovy.template similarity index 100% rename from airavata-api/src/main/resources/UGE_Groovy.template rename to airavata-api/src/main/resources/templates/UGE_Groovy.template diff --git a/airavata-api/src/main/resources/user-profile-catalog-derby.sql b/airavata-api/src/main/resources/user-profile-catalog-derby.sql deleted file mode 100644 index 9ac9155f89..0000000000 --- a/airavata-api/src/main/resources/user-profile-catalog-derby.sql +++ /dev/null @@ -1,163 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -CREATE TABLE IF NOT EXISTS GATEWAY ( - AIRAVATA_INTERNAL_GATEWAY_ID varchar(255) NOT NULL, - DECLINED_REASON varchar(255) DEFAULT NULL, - GATEWAY_DOMAIN varchar(255) DEFAULT NULL, - EMAIL_ADDRESS varchar(255) DEFAULT NULL, - GATEWAY_ACRONYM varchar(255) DEFAULT NULL, - GATEWAY_ADMIN_EMAIL varchar(255) DEFAULT NULL, - GATEWAY_ADMIN_FIRST_NAME varchar(255) DEFAULT NULL, - GATEWAY_ADMIN_LAST_NAME varchar(255) DEFAULT NULL, - GATEWAY_APPROVAL_STATUS varchar(255) DEFAULT NULL, - GATEWAY_ID varchar(255) DEFAULT NULL, - GATEWAY_NAME varchar(255) DEFAULT NULL, - GATEWAY_PUBLIC_ABSTRACT varchar(255) DEFAULT NULL, - GATEWAY_URL varchar(255) DEFAULT NULL, - IDENTITY_SERVER_PASSWORD_TOKEN varchar(255) DEFAULT NULL, - IDENTITY_SERVER_USERNAME varchar(255) DEFAULT NULL, - OAUTH_CLIENT_ID varchar(255) DEFAULT NULL, - OAUTH_CLIENT_SECRET varchar(255) DEFAULT NULL, - REQUEST_CREATION_TIME bigint(20) DEFAULT NULL, - REQUESTER_USERNAME varchar(255) DEFAULT NULL, - GATEWAY_REVIEW_PROPOSAL_DESCRIPTION varchar(255) DEFAULT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_GATEWAY_ID) -); - -CREATE TABLE USER_PROFILE ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - USER_ID VARCHAR (255) NOT NULL, - GATEWAY_ID VARCHAR (255) NOT NULL, - USER_MODEL_VERSION VARCHAR (255), - FIRST_NAME VARCHAR (255), - LAST_NAME VARCHAR (255), - MIDDLE_NAME VARCHAR (255), - NAME_PREFIX VARCHAR (255), - NAME_SUFFIX VARCHAR (255), - ORCID_ID VARCHAR (255), - COUNTRY VARCHAR (255), - HOME_ORGANIZATION VARCHAR (255), - ORIGINATION_AFFILIATION VARCHAR (255), - CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - LAST_ACCESS_TIME TIMESTAMP, - VALID_UNTIL TIMESTAMP, - STATE VARCHAR (255), - COMMENTS CLOB, - GPG_KEY CLOB, - TIME_ZONE VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID) -); - -CREATE TABLE USER_PROFILE_EMAIL ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - EMAIL VARCHAR (255) NOT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, EMAIL), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE USER_PROFILE_PHONE ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - PHONE VARCHAR (255) NOT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, PHONE ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE USER_PROFILE_NATIONALITY ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - NATIONALITY VARCHAR (255) NOT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, NATIONALITY ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE USER_PROFILE_LABELED_URI ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - LABELED_URI VARCHAR (255) NOT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, LABELED_URI ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE NSF_DEMOGRAPHIC ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - GENDER VARCHAR (255) NOT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE NSF_DEMOGRAPHIC_ETHNICITY ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - ETHNICITY VARCHAR (255) NOT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, ETHNICITY ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE NSF_DEMOGRAPHIC_RACE ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - RACE VARCHAR (255) NOT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, RACE ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE NSF_DEMOGRAPHIC_DISABILITY ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - DISABILITY VARCHAR (255) NOT NULL, - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID, DISABILITY ), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES NSF_DEMOGRAPHIC(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE CUSTOMIZED_DASHBOARD ( - AIRAVATA_INTERNAL_USER_ID VARCHAR (255) NOT NULL, - ENABLED_EXPERIMENT_ID VARCHAR (255), - ENABLED_NAME VARCHAR (255), - ENABLED_DESCRIPTION VARCHAR (255), - ENABLED_PROJECT VARCHAR (255), - ENABLED_OWNER VARCHAR (255), - ENABLED_APPLICATION VARCHAR (255), - ENABLED_COMPUTE_RESOURCE VARCHAR (255), - ENABLED_JOB_NAME VARCHAR (255), - ENABLED_JOB_ID VARCHAR (255), - ENABLED_JOB_STATUS VARCHAR (255), - ENABLED_JOB_CREATION_TIME VARCHAR (255), - ENABLED_NOTIFICATIONS_TO VARCHAR (255), - ENABLED_WORKING_DIR VARCHAR (255), - ENABLED_JOB_DESCRIPTION VARCHAR (255), - ENABLED_CREATION_TIME VARCHAR (255), - ENABLED_LAST_MODIFIED_TIME VARCHAR (255), - ENABLED_WALL_TIME VARCHAR (255), - ENABLED_CPU_COUNT VARCHAR (255), - ENABLED_NODE_COUNT VARCHAR (255), - ENABLED_QUEUE VARCHAR (255), - ENABLED_INPUTS VARCHAR (255), - ENABLED_OUTPUTS VARCHAR (255), - ENABLED_STORAGE_DIR VARCHAR (255), - ENABLED_ERRORS VARCHAR (255), - PRIMARY KEY (AIRAVATA_INTERNAL_USER_ID), - FOREIGN KEY (AIRAVATA_INTERNAL_USER_ID) REFERENCES USER_PROFILE(AIRAVATA_INTERNAL_USER_ID) ON DELETE CASCADE -); - -CREATE TABLE CONFIGURATION -( - CONFIG_KEY VARCHAR(255) NOT NULL, - CONFIG_VAL VARCHAR(255) NOT NULL, - PRIMARY KEY(CONFIG_KEY, CONFIG_VAL) -); - -INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('user_profile_catalog_version', '0.17'); diff --git a/airavata-api/src/main/resources/workflowcatalog-derby.sql b/airavata-api/src/main/resources/workflowcatalog-derby.sql deleted file mode 100644 index beff4ca8b6..0000000000 --- a/airavata-api/src/main/resources/workflowcatalog-derby.sql +++ /dev/null @@ -1,128 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -CREATE TABLE WORKFLOW -( - TEMPLATE_ID VARCHAR (255) NOT NULL, - WORKFLOW_NAME VARCHAR (255) NOT NULL, - CREATED_USER VARCHAR (255), - GATEWAY_ID VARCHAR (255), - GRAPH CLOB, - IMAGE BLOB, - CREATION_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - UPDATE_TIME timestamp DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY (TEMPLATE_ID) -); - -CREATE TABLE WORKFLOW_INPUT -( - TEMPLATE_ID VARCHAR(255) NOT NULL, - INPUT_KEY VARCHAR(255), - INPUT_VALUE CLOB, - DATA_TYPE VARCHAR(255), - METADATA VARCHAR(255), - APP_ARGUMENT VARCHAR(255), - STANDARD_INPUT SMALLINT, - USER_FRIENDLY_DESC VARCHAR(255), - INPUT_ORDER INTEGER, - IS_REQUIRED SMALLINT, - REQUIRED_TO_COMMANDLINE SMALLINT, - DATA_STAGED SMALLINT, - PRIMARY KEY(TEMPLATE_ID,INPUT_KEY), - FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE -); - -CREATE TABLE WORKFLOW_OUTPUT -( - TEMPLATE_ID VARCHAR(255) NOT NULL, - OUTPUT_KEY VARCHAR(255), - OUTPUT_VALUE VARCHAR(255), - DATA_TYPE VARCHAR(255), - IS_REQUIRED SMALLINT, - REQUIRED_TO_COMMANDLINE SMALLINT, - DATA_MOVEMENT SMALLINT, - DATA_NAME_LOCATION VARCHAR(255), - SEARCH_QUERY VARCHAR(255), - APP_ARGUMENT VARCHAR(255), - OUTPUT_STREAMING SMALLINT, - PRIMARY KEY(TEMPLATE_ID,OUTPUT_KEY), - FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE -); - -CREATE TABLE COMPONENT_STATUS -( - STATUS_ID VARCHAR (255) NOT NULL, - TEMPLATE_ID VARCHAR (255) NOT NULL, - STATE VARCHAR(255), - REASON VARCHAR(255), - UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (STATUS_ID), - FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE -); - -CREATE TABLE WORKFLOW_STATUS -( - STATUS_ID VARCHAR (255) NOT NULL, - TEMPLATE_ID VARCHAR (255) NOT NULL, - STATE VARCHAR(255), - REASON VARCHAR(255), - UPDATE_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (STATUS_ID, TEMPLATE_ID), - FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE -); - -CREATE TABLE EDGE -( - EDGE_ID VARCHAR (255) NOT NULL, - TEMPLATE_ID VARCHAR (255) NOT NULL, - NAME VARCHAR (255), - COMPONENT_STATUS_ID VARCHAR(255), - DESCRIPTION VARCHAR(500), - CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (EDGE_ID, TEMPLATE_ID), - FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE -); - -CREATE TABLE PORT -( - PORT_ID VARCHAR (255) NOT NULL, - TEMPLATE_ID VARCHAR (255) NOT NULL, - NAME VARCHAR (255), - COMPONENT_STATUS_ID VARCHAR(255), - DESCRIPTION VARCHAR(500), - CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (PORT_ID, TEMPLATE_ID), - FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE -); - -CREATE TABLE NODE -( - NODE_ID VARCHAR (255) NOT NULL, - TEMPLATE_ID VARCHAR (255) NOT NULL, - NAME VARCHAR (255), - APPLICATION_ID VARCHAR (255), - APPLICATION_NAME VARCHAR (255), - COMPONENT_STATUS_ID VARCHAR(255), - DESCRIPTION VARCHAR(500), - CREATED_TIME timestamp DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (NODE_ID, TEMPLATE_ID), - FOREIGN KEY (TEMPLATE_ID) REFERENCES WORKFLOW(TEMPLATE_ID) ON DELETE CASCADE -); \ No newline at end of file diff --git a/airavata-api/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java b/airavata-api/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java index 85a09c4416..2dca024184 100644 --- a/airavata-api/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java +++ b/airavata-api/src/test/java/org/apache/airavata/common/utils/SecurityUtilTest.java @@ -21,8 +21,7 @@ import static org.junit.jupiter.api.Assertions.*; -import java.io.InputStream; -import java.net.URI; +import java.nio.charset.StandardCharsets; import java.security.KeyStore; import org.junit.jupiter.api.Test; @@ -32,54 +31,36 @@ * Time: 10:42 AM */ public class SecurityUtilTest { - @Test - public void testEncryptString() throws Exception { - URI uri = this.getClass().getClassLoader().getResource("airavata.jks").toURI(); + private final String keyStorePath = "airavata.p12"; - assert uri != null; + @Test + public void testEncryptString() throws Exception { String stringToEncrypt = "Test string to encrypt"; byte[] encrypted = - SecurityUtil.encryptString(uri.getPath(), "mykey", new TestKeyStoreCallback(), stringToEncrypt); + SecurityUtil.encryptString(keyStorePath, "mykey", new TestKeyStoreCallback(), stringToEncrypt); - String decrypted = SecurityUtil.decryptString(uri.getPath(), "mykey", new TestKeyStoreCallback(), encrypted); - assertTrue(stringToEncrypt.equals(decrypted)); + String decrypted = SecurityUtil.decryptString(keyStorePath, "mykey", new TestKeyStoreCallback(), encrypted); + assertEquals(stringToEncrypt, decrypted); } @Test public void testEncryptBytes() throws Exception { - - URI uri = this.getClass().getClassLoader().getResource("airavata.jks").toURI(); - - assert uri != null; - String stringToEncrypt = "Test string to encrypt"; - byte[] encrypted = SecurityUtil.encrypt( - uri.getPath(), "mykey", new TestKeyStoreCallback(), stringToEncrypt.getBytes("UTF-8")); - - byte[] decrypted = SecurityUtil.decrypt(uri.getPath(), "mykey", new TestKeyStoreCallback(), encrypted); - assertTrue(stringToEncrypt.equals(new String(decrypted, "UTF-8"))); - } - - @Test - public void testLoadKeyStore() throws Exception { - InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("airavata.jks"); - - KeyStore ks = SecurityUtil.loadKeyStore(inputStream, "jceks", new TestKeyStoreCallback()); - assertNotNull(ks); + byte[] plaintext = stringToEncrypt.getBytes(StandardCharsets.UTF_8); + byte[] encrypted = SecurityUtil.encrypt(keyStorePath, "mykey", new TestKeyStoreCallback(), plaintext); + byte[] decrypted = SecurityUtil.decrypt(keyStorePath, "mykey", new TestKeyStoreCallback(), encrypted); + assertEquals(plaintext, decrypted); } @Test public void testLoadKeyStoreFromFile() throws Exception { - URI uri = this.getClass().getClassLoader().getResource("airavata.jks").toURI(); - - assert uri != null; - KeyStore ks = SecurityUtil.loadKeyStore(uri.getPath(), "jceks", new TestKeyStoreCallback()); + KeyStore ks = SecurityUtil.loadKeyStore(keyStorePath, new TestKeyStoreCallback()); assertNotNull(ks); } - private class TestKeyStoreCallback implements KeyStorePasswordCallback { + private static class TestKeyStoreCallback implements KeyStorePasswordCallback { @Override public char[] getStorePassword() { @@ -91,7 +72,6 @@ public char[] getSecretKeyPassPhrase(String keyAlias) { if (keyAlias.equals("mykey")) { return "airavatasecretkey".toCharArray(); } - return null; } } diff --git a/airavata-api/src/test/java/org/apache/airavata/credential/store/cpi/SSHSummaryTest/SSHSummaryTest.java b/airavata-api/src/test/java/org/apache/airavata/credential/store/cpi/SSHSummaryTest/SSHSummaryTest.java index a6e9e56730..b5ed5f14ce 100644 --- a/airavata-api/src/test/java/org/apache/airavata/credential/store/cpi/SSHSummaryTest/SSHSummaryTest.java +++ b/airavata-api/src/test/java/org/apache/airavata/credential/store/cpi/SSHSummaryTest/SSHSummaryTest.java @@ -119,7 +119,7 @@ private void initializeKeys() throws Exception { String baseDirectory = System.getProperty("credential.module.directory"); String keyStorePath = - "src" + File.separator + "test" + File.separator + "resources" + File.separator + "airavata.jks"; + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "airavata.p12"; if (baseDirectory != null) { keyStorePath = baseDirectory + File.separator + keyStorePath; diff --git a/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java b/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java index f33a823d34..7dea307aa5 100644 --- a/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java +++ b/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java @@ -126,7 +126,7 @@ private void initializeKeys() throws Exception { String baseDirectory = System.getProperty("credential.module.directory"); String keyStorePath = - "src" + File.separator + "test" + File.separator + "resources" + File.separator + "airavata.jks"; + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "airavata.p12"; if (baseDirectory != null) { keyStorePath = baseDirectory + File.separator + keyStorePath; @@ -245,7 +245,7 @@ public void testSerialization() throws CredentialStoreException { @Test public void testSerializationWithEncryption() throws CredentialStoreException, URISyntaxException { - URI uri = this.getClass().getClassLoader().getResource("airavata.jks").toURI(); + URI uri = this.getClass().getClassLoader().getResource("airavata.p12").toURI(); String secretKeyAlias = "mykey"; assert uri != null; diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/core/utils/CustomBeanFactoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/core/utils/CustomBeanFactoryTest.java index 99e69cae10..b1ffb928f1 100644 --- a/airavata-api/src/test/java/org/apache/airavata/registry/core/utils/CustomBeanFactoryTest.java +++ b/airavata-api/src/test/java/org/apache/airavata/registry/core/utils/CustomBeanFactoryTest.java @@ -37,7 +37,7 @@ public void testRequiredFieldWithDefault() { CustomBeanFactory customBeanFactory = new CustomBeanFactory(); UserConfigurationDataModel fromFactory = (UserConfigurationDataModel) - customBeanFactory.createBean(null, null, UserConfigurationDataModel.class.getName()); + customBeanFactory.createBean(null, null, UserConfigurationDataModel.class.getName(), null); Assertions.assertTrue(fromFactory.isSetAiravataAutoSchedule()); } @@ -52,7 +52,7 @@ public void testOptionalFieldWithDefault() { CustomBeanFactory customBeanFactory = new CustomBeanFactory(); UserConfigurationDataModel fromFactory = (UserConfigurationDataModel) - customBeanFactory.createBean(null, null, UserConfigurationDataModel.class.getName()); + customBeanFactory.createBean(null, null, UserConfigurationDataModel.class.getName(), null); Assertions.assertTrue(fromFactory.isSetShareExperimentPublicly()); } } diff --git a/airavata-api/src/test/java/org/apache/airavata/service/security/KeyCloakSecurityManagerTest.java b/airavata-api/src/test/java/org/apache/airavata/service/security/KeyCloakSecurityManagerTest.java index 91656fbb57..6718317258 100644 --- a/airavata-api/src/test/java/org/apache/airavata/service/security/KeyCloakSecurityManagerTest.java +++ b/airavata-api/src/test/java/org/apache/airavata/service/security/KeyCloakSecurityManagerTest.java @@ -40,7 +40,6 @@ import org.apache.airavata.registry.api.RegistryService; import org.apache.airavata.registry.api.client.RegistryServiceClientFactory; import org.apache.airavata.security.AiravataSecurityException; -import org.apache.airavata.security.util.TrustStoreManager; import org.apache.airavata.service.security.authzcache.AuthzCacheIndex; import org.apache.airavata.service.security.authzcache.AuthzCacheManager; import org.apache.airavata.service.security.authzcache.AuthzCacheManagerFactory; @@ -57,9 +56,6 @@ public class KeyCloakSecurityManagerTest { public static final String TEST_GATEWAY = "test-gateway"; public static final String TEST_ACCESS_TOKEN = "abc123"; - @Mocked - private TrustStoreManager mockTrustStoreManager; - @Mocked private ServerSettings mockServerSettings; @@ -85,10 +81,7 @@ public class KeyCloakSecurityManagerTest { public void setUp() throws AiravataSecurityException, ApplicationSettingsException { new Expectations() { { - mockServerSettings.isTrustStorePathDefined(); - result = true; - mockTrustStoreManager.initializeTrustStoreManager(anyString, anyString); - mockServerSettings.isAPISecured(); + mockServerSettings.isTLSEnabled(); result = true; mockServerSettings.getRegistryServerHost(); result = "localhost"; @@ -261,7 +254,7 @@ public void testWithAuthzDecisionNotInCache( } private void runIsUserAuthorizedTest(String apiMethod, boolean expectedAuthorization) - throws AiravataSecurityException { + throws AiravataSecurityException, ApplicationSettingsException { KeyCloakSecurityManager keyCloakSecurityManager = new KeyCloakSecurityManager(); diff --git a/airavata-api/src/test/java/org/apache/airavata/sharing/registry/CipresTest.java b/airavata-api/src/test/java/org/apache/airavata/sharing/registry/CipresTest.java index 332c78c0f6..b00dabc129 100644 --- a/airavata-api/src/test/java/org/apache/airavata/sharing/registry/CipresTest.java +++ b/airavata-api/src/test/java/org/apache/airavata/sharing/registry/CipresTest.java @@ -20,42 +20,48 @@ package org.apache.airavata.sharing.registry; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.sharing.registry.models.*; import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.thrift.TException; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.transport.TSSLTransportFactory; +import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransport; import org.apache.thrift.transport.TTransportException; public class CipresTest { + private static final Logger log = LogManager.getLogger(CipresTest.class); + public static void main(String[] args) throws InterruptedException, TException, ApplicationSettingsException { System.out.println("Hello World!"); // should use the correct host name and port here String serverHost = "wb-airavata.scigap.org"; - int serverPort = 7878; + TTransport transport = null; - TProtocol protocol = null; + TProtocol protocol; + TSSLTransportFactory.TSSLTransportParameters params; + try { SharingRegistryService.Client sharingServiceClient; - // Non Secure Client - // transport = new TSocket(serverHost, serverPort); - // transport.open(); - // protocol = new TBinaryProtocol(transport); - // sharingServiceClient= new SharingRegistryService.Client(protocol); - - // TLS enabled client - TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); - params.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword()); - params.setTrustStore(ServerSettings.getTrustStorePath(), ServerSettings.getTrustStorePassword()); - transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params); + if (!ServerSettings.isTLSEnabled()) { + transport = new TSocket(serverHost, serverPort); + transport.open(); + } else { + // TLS enabled client + params = new TSSLTransportFactory.TSSLTransportParameters(); + params.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword()); + transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params); + } + protocol = new TBinaryProtocol(transport); sharingServiceClient = new SharingRegistryService.Client(protocol); @@ -163,10 +169,10 @@ public static void main(String[] args) throws InterruptedException, TException, sharingServiceClient.createGroup(userGroup2); System.out.println("After group creation...\n"); - sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("test-user-3"), "test-group-2"); + sharingServiceClient.addUsersToGroup(domainId, List.of("test-user-3"), "test-group-2"); System.out.println("After adding user to group...\n"); - sharingServiceClient.addChildGroupsToParentGroup(domainId, Arrays.asList("test-group-2"), "test-group-1"); + sharingServiceClient.addChildGroupsToParentGroup(domainId, List.of("test-group-2"), "test-group-1"); PermissionType permissionType1 = new PermissionType(); // required @@ -278,13 +284,13 @@ public static void main(String[] args) throws InterruptedException, TException, System.out.println("Before shareEntityWithGroups READ...\n"); long time = System.currentTimeMillis(); sharingServiceClient.shareEntityWithGroups( - domainId, "test-experiment-2", Arrays.asList("test-group-2"), "READ", true); + domainId, "test-experiment-2", List.of("test-group-2"), "READ", true); System.out.println("Time for sharing " + (System.currentTimeMillis() - time)); // shared with non cascading permissions System.out.println("Before shareEntityWithGroups CLONE...\n"); time = System.currentTimeMillis(); sharingServiceClient.shareEntityWithGroups( - domainId, "test-experiment-2", Arrays.asList("test-group-2"), "CLONE", false); + domainId, "test-experiment-2", List.of("test-group-2"), "CLONE", false); System.out.println("Time for sharing " + (System.currentTimeMillis() - time)); // test-project-1 is explicitly shared with test-user-2 with WRITE permission @@ -441,9 +447,9 @@ public static void main(String[] args) throws InterruptedException, TException, sharingServiceClient.createGroup(Group1); System.out.println("After Group1 creation...\n"); - sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("UserB"), "Group1"); - sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("UserC"), "Group1"); - sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("UserD"), "Group1"); + sharingServiceClient.addUsersToGroup(domainId, List.of("UserB"), "Group1"); + sharingServiceClient.addUsersToGroup(domainId, List.of("UserC"), "Group1"); + sharingServiceClient.addUsersToGroup(domainId, List.of("UserD"), "Group1"); System.out.println("After adding users to Group1 creation...\n"); @@ -562,7 +568,7 @@ public static void main(String[] args) throws InterruptedException, TException, // sharingServiceClient.shareEntityWithGroups(domainId, "test-experiment-2", Arrays.asList("test-group-2"), // "READ", true); time = System.currentTimeMillis(); - sharingServiceClient.shareEntityWithGroups(domainId, "Folder1", Arrays.asList("Group1"), "READ", true); + sharingServiceClient.shareEntityWithGroups(domainId, "Folder1", List.of("Group1"), "READ", true); System.out.println("Time for sharing " + (System.currentTimeMillis() - time)); System.out.println("After READ sharing UserBFolder1 with Group1 ...\n"); // sharingServiceClient.shareEntityWithGroups(domainId, "Folder2", Arrays.asList("Group1"), "READ", true); @@ -619,7 +625,7 @@ public static void main(String[] args) throws InterruptedException, TException, System.out.println(sharingServiceClient.searchEntities(domainId, "UserC", sharedfilters, 0, -1)); System.out.println("After searchEntities 2...\n"); - sharingServiceClient.removeUsersFromGroup(domainId, Arrays.asList("UserD"), "Group1"); + sharingServiceClient.removeUsersFromGroup(domainId, List.of("UserD"), "Group1"); System.out.println("After removing UserD from Group1 ...\n"); sharingServiceClient.deleteGroup(domainId, "Group1"); @@ -627,20 +633,14 @@ public static void main(String[] args) throws InterruptedException, TException, System.out.println("End of try clause...\n"); } catch (TTransportException ex1) { - System.out.println("TTransportException...\n"); - System.out.println(ex1); - System.out.println(ex1.getCause()); - ex1.printStackTrace(); - System.out.println(ex1.getMessage()); + log.error("TTransportException: {}", ex1.getMessage(), ex1); } catch (SharingRegistryException ex2) { - System.out.println("SharingRegistryException...\n"); - System.out.println(ex2.getMessage()); + log.error("SharingRegistryException: {}", ex2.getMessage(), ex2); } catch (TException ex3) { - System.out.println("TException...\n"); - System.out.println(ex3.getMessage()); + log.error("TException: {}", ex3.getMessage(), ex3); } finally { - System.out.println("In finally...\n"); - transport.close(); + log.info("Closing transport..."); + if (transport != null) transport.close(); } } } diff --git a/airavata-api/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java b/airavata-api/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java index 81775dcbb4..650bee7430 100644 --- a/airavata-api/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java +++ b/airavata-api/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java @@ -20,7 +20,7 @@ package org.apache.airavata.sharing.registry; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.sharing.registry.models.*; @@ -35,11 +35,8 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class SharingRegistryServiceTest { - private static final Logger logger = LoggerFactory.getLogger(SharingRegistryServiceTest.class); @BeforeAll public static void setUp() throws Exception { @@ -53,23 +50,21 @@ public static void setUp() throws Exception { public void test() throws TException, InterruptedException, ApplicationSettingsException { String serverHost = "localhost"; int serverPort = 7878; + TTransport transport; SharingRegistryService.Client sharingServiceClient; - if (!ServerSettings.isSharingTLSEnabled()) { - TTransport transport = new TSocket(serverHost, serverPort); + if (!ServerSettings.isTLSEnabled()) { + transport = new TSocket(serverHost, serverPort); transport.open(); - TProtocol protocol = new TBinaryProtocol(transport); - sharingServiceClient = new SharingRegistryService.Client(protocol); } else { TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(); params.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword()); - params.setTrustStore(ServerSettings.getTrustStorePath(), ServerSettings.getTrustStorePassword()); - - TTransport transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params); - TProtocol protocol = new TBinaryProtocol(transport); - sharingServiceClient = new SharingRegistryService.Client(protocol); + transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params); } + TProtocol protocol = new TBinaryProtocol(transport); + sharingServiceClient = new SharingRegistryService.Client(protocol); + Domain domain = new Domain(); // has to be one word domain.setName("test-domain" + Math.random()); @@ -183,10 +178,9 @@ public void test() throws TException, InterruptedException, ApplicationSettingsE sharingServiceClient.createGroup(userGroup1); userGroup1.setDescription("updated description"); sharingServiceClient.updateGroup(userGroup1); - Assertions.assertTrue(sharingServiceClient - .getGroup(domainId, userGroup1.getGroupId()) - .getDescription() - .equals("updated description")); + Assertions.assertEquals( + "updated description", + sharingServiceClient.getGroup(domainId, userGroup1.getGroupId()).getDescription()); Assertions.assertTrue(sharingServiceClient.isGroupExists(domainId, "test-group-1")); UserGroup userGroup2 = new UserGroup(); @@ -205,29 +199,27 @@ public void test() throws TException, InterruptedException, ApplicationSettingsE sharingServiceClient.createGroup(userGroup2); - sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("test-user-3"), "test-group-2"); + sharingServiceClient.addUsersToGroup(domainId, List.of("test-user-3"), "test-group-2"); - sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("test-user-7"), "test-group-1"); + sharingServiceClient.addUsersToGroup(domainId, List.of("test-user-7"), "test-group-1"); - sharingServiceClient.addChildGroupsToParentGroup(domainId, Arrays.asList("test-group-2"), "test-group-1"); + sharingServiceClient.addChildGroupsToParentGroup(domainId, List.of("test-group-2"), "test-group-1"); // Group roles Assertions.assertTrue(sharingServiceClient.hasOwnerAccess(domainId, "test-group-1", "test-user-1")); // user has admin access - Assertions.assertTrue( - sharingServiceClient.addGroupAdmins(domainId, "test-group-1", Arrays.asList("test-user-7"))); + Assertions.assertTrue(sharingServiceClient.addGroupAdmins(domainId, "test-group-1", List.of("test-user-7"))); Assertions.assertTrue(sharingServiceClient.hasAdminAccess(domainId, "test-group-1", "test-user-7")); UserGroup getGroup = sharingServiceClient.getGroup(domainId, "test-group-1"); - Assertions.assertTrue(getGroup.getGroupAdmins().size() == 1); + Assertions.assertEquals(1, getGroup.getGroupAdmins().size()); - Assertions.assertTrue( - sharingServiceClient.removeGroupAdmins(domainId, "test-group-1", Arrays.asList("test-user-7"))); + Assertions.assertTrue(sharingServiceClient.removeGroupAdmins(domainId, "test-group-1", List.of("test-user-7"))); Assertions.assertFalse(sharingServiceClient.hasAdminAccess(domainId, "test-group-1", "test-user-7")); // transfer group ownership - sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("test-user-2"), "test-group-1"); + sharingServiceClient.addUsersToGroup(domainId, List.of("test-user-2"), "test-group-1"); Assertions.assertTrue(sharingServiceClient.transferGroupOwnership(domainId, "test-group-1", "test-user-2")); Assertions.assertTrue(sharingServiceClient.hasOwnerAccess(domainId, "test-group-1", "test-user-2")); Assertions.assertTrue(sharingServiceClient.transferGroupOwnership(domainId, "test-group-1", "test-user-1")); @@ -339,12 +331,11 @@ public void test() throws TException, InterruptedException, ApplicationSettingsE entity4.setFullText("test input file 1 for experiment 2"); sharingServiceClient.createEntity(entity4); - Assertions.assertTrue( - sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount() == 0); - sharingServiceClient.shareEntityWithUsers( - domainId, "test-project-1", Arrays.asList("test-user-2"), "WRITE", true); - Assertions.assertTrue( - sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount() == 1); + Assertions.assertEquals( + 0, sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount()); + sharingServiceClient.shareEntityWithUsers(domainId, "test-project-1", List.of("test-user-2"), "WRITE", true); + Assertions.assertEquals( + 1, sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount()); ArrayList filters = new ArrayList<>(); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.setSearchField(EntitySearchField.SHARED_COUNT); @@ -357,17 +348,15 @@ public void test() throws TException, InterruptedException, ApplicationSettingsE .searchEntities(domainId, "test-user-2", filters, 0, -1) .size()); - sharingServiceClient.revokeEntitySharingFromUsers( - domainId, "test-project-1", Arrays.asList("test-user-2"), "WRITE"); - Assertions.assertTrue( - sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount() == 0); - sharingServiceClient.shareEntityWithUsers( - domainId, "test-project-1", Arrays.asList("test-user-2"), "WRITE", true); + sharingServiceClient.revokeEntitySharingFromUsers(domainId, "test-project-1", List.of("test-user-2"), "WRITE"); + Assertions.assertEquals( + 0, sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount()); + sharingServiceClient.shareEntityWithUsers(domainId, "test-project-1", List.of("test-user-2"), "WRITE", true); sharingServiceClient.shareEntityWithGroups( - domainId, "test-experiment-2", Arrays.asList("test-group-2"), "READ", true); + domainId, "test-experiment-2", List.of("test-group-2"), "READ", true); sharingServiceClient.shareEntityWithGroups( - domainId, "test-experiment-2", Arrays.asList("test-group-2"), "CLONE", false); + domainId, "test-experiment-2", List.of("test-group-2"), "CLONE", false); // true Assertions.assertTrue(sharingServiceClient.userHasAccess(domainId, "test-user-2", "test-project-1", "WRITE")); @@ -417,10 +406,11 @@ public void test() throws TException, InterruptedException, ApplicationSettingsE searchCriteria.setSearchField(EntitySearchField.PERMISSION_TYPE_ID); filters.add(searchCriteria); - Assertions.assertTrue(sharingServiceClient + Assertions.assertEquals( + 1, + sharingServiceClient .searchEntities(domainId, "test-user-2", filters, 0, -1) - .size() - == 1); + .size()); Entity persistedEntity = sharingServiceClient .searchEntities(domainId, "test-user-2", filters, 0, -1) .get(0); @@ -433,9 +423,10 @@ public void test() throws TException, InterruptedException, ApplicationSettingsE searchCriteria.setValue("test-user-1"); searchCriteria.setSearchField(EntitySearchField.OWNER_ID); filters.add(searchCriteria); - Assertions.assertTrue(sharingServiceClient + Assertions.assertEquals( + 0, + sharingServiceClient .searchEntities(domainId, "test-user-2", filters, 0, -1) - .size() - == 0); + .size()); } } diff --git a/dev-tools/airavata-python-sdk/airavata_jupyter_magic/device_auth.py b/dev-tools/airavata-python-sdk/airavata_auth/device_auth.py similarity index 74% rename from dev-tools/airavata-python-sdk/airavata_jupyter_magic/device_auth.py rename to dev-tools/airavata-python-sdk/airavata_auth/device_auth.py index b81e1815f8..b4070842c7 100644 --- a/dev-tools/airavata-python-sdk/airavata_jupyter_magic/device_auth.py +++ b/dev-tools/airavata-python-sdk/airavata_auth/device_auth.py @@ -6,13 +6,16 @@ # Load environment variables from .env file -class DeviceFlowAuthenticator: - def __init__(self): - self.client_id = "cybershuttle-agent" - self.realm = "default" - self.auth_server_url = "https://auth.dev.cybershuttle.org" +class AuthContext: + + client_id: str = "cybershuttle-agent" + realm: str = "default" + auth_server_url: str = "https://auth.cybershuttle.org" + api_host: str = "https://api.gateway.cybershuttle.org" + file_server_url: str = "http://api.gateway.cybershuttle.org:8050" - if not self.client_id or not self.realm or not self.auth_server_url: + def __init__(self): + if not AuthContext.client_id or not AuthContext.realm or not AuthContext.auth_server_url: raise ValueError("Missing required environment variables for client ID, realm, or auth server URL") self.device_code = None @@ -21,8 +24,8 @@ def __init__(self): def login(self): # Step 1: Request device and user code - auth_device_url = f"{self.auth_server_url}/realms/{self.realm}/protocol/openid-connect/auth/device" - response = requests.post(auth_device_url, data={"client_id": self.client_id, "scope": "openid"}) + auth_device_url = f"{AuthContext.auth_server_url}/realms/{AuthContext.realm}/protocol/openid-connect/auth/device" + response = requests.post(auth_device_url, data={"client_id": AuthContext.client_id, "scope": "openid"}) if response.status_code != 200: print(f"Error in authentication request: {response.status_code} - {response.text}", flush=True) @@ -37,12 +40,12 @@ def login(self): def poll_for_token(self, url): assert self.interval is not None - token_url = f"{self.auth_server_url}/realms/{self.realm}/protocol/openid-connect/token" + token_url = f"{AuthContext.auth_server_url}/realms/{AuthContext.realm}/protocol/openid-connect/token" counter = 0 with self.console.status(f"Authenticate via link: [link={url}]{url}[/link]", refresh_per_second=1) as status: while True: response = requests.post(token_url, data={ - "client_id": self.client_id, + "client_id": AuthContext.client_id, "grant_type": "urn:ietf:params:oauth:grant-type:device_code", "device_code": self.device_code }) diff --git a/dev-tools/airavata-python-sdk/airavata_experiments/__init__.py b/dev-tools/airavata-python-sdk/airavata_experiments/__init__.py index 98391d4fa4..dd391c07c4 100644 --- a/dev-tools/airavata-python-sdk/airavata_experiments/__init__.py +++ b/dev-tools/airavata-python-sdk/airavata_experiments/__init__.py @@ -17,11 +17,17 @@ from __future__ import annotations from . import base, plan -from .auth import login, logout +from airavata_auth.device_auth import AuthContext from .runtime import list_runtimes, Runtime from typing import Any -__all__ = ["login", "logout", "list_runtimes", "base", "plan"] + +context = AuthContext() + +def login(): + context.login() + +__all__ = ["list_runtimes", "base", "plan", "login"] def display_runtimes(runtimes: list[Runtime]) -> None: diff --git a/dev-tools/airavata-python-sdk/airavata_experiments/auth/__init__.py b/dev-tools/airavata-python-sdk/airavata_experiments/auth/__init__.py deleted file mode 100644 index 443d0a5c49..0000000000 --- a/dev-tools/airavata-python-sdk/airavata_experiments/auth/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from .device_auth import DeviceFlowAuthenticator - -context = DeviceFlowAuthenticator( - idp_url="https://auth.cybershuttle.org", - realm="default", - client_id="cybershuttle-agent", -) - - -def login(): - context.login() - - -def logout(): - context.logout() diff --git a/dev-tools/airavata-python-sdk/airavata_experiments/auth/device_auth.py b/dev-tools/airavata-python-sdk/airavata_experiments/auth/device_auth.py deleted file mode 100644 index 8ed873f181..0000000000 --- a/dev-tools/airavata-python-sdk/airavata_experiments/auth/device_auth.py +++ /dev/null @@ -1,186 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import datetime -import json -import os -import time -import webbrowser - -import jwt -import requests - - -class DeviceFlowAuthenticator: - - idp_url: str - realm: str - client_id: str - interval: int - device_code: str | None - _access_token: str | None - _refresh_token: str | None - - def __has_expired__(self, token: str) -> bool: - try: - decoded = jwt.decode(token, options={"verify_signature": False}) - tA = datetime.datetime.now(datetime.timezone.utc).timestamp() - tB = int(decoded.get("exp", 0)) - return tA >= tB - except: - return True - - @property - def access_token(self) -> str: - if self._access_token and not self.__has_expired__(self._access_token): - return self._access_token - elif self._refresh_token and not self.__has_expired__(self._refresh_token): - self.refresh() - else: - self.login() - assert self._access_token - return self._access_token - - @property - def refresh_token(self) -> str: - if self._refresh_token and not self.__has_expired__(self._refresh_token): - return self._refresh_token - else: - self.login() - assert self._refresh_token - return self._refresh_token - - - def __init__( - self, - idp_url: str, - realm: str, - client_id: str, - ): - self.idp_url = idp_url - self.realm = realm - self.client_id = client_id - - if not self.client_id or not self.realm or not self.idp_url: - raise ValueError( - "Missing required environment variables for client ID, realm, or auth server URL") - - self.interval = 5 - self.device_code = None - self._access_token = None - self._refresh_token = None - - def refresh(self) -> None: - auth_device_url = f"{self.idp_url}/realms/{self.realm}/protocol/openid-connect/token" - response = requests.post(auth_device_url, data={ - "client_id": self.client_id, - "grant_type": "refresh_token", - "scope": "openid", - "refresh_token": self._refresh_token - }) - if response.status_code != 200: - raise Exception(f"Error in token refresh request: {response.status_code} - {response.text}") - data = response.json() - self._refresh_token = data["refresh_token"] - self._access_token = data["access_token"] - assert self._access_token is not None - assert self._refresh_token is not None - self.__persist_token__(self._refresh_token, self._access_token) - - def login(self, interactive: bool = True) -> None: - auth_warning = None - try: - # [Flow A] Reuse saved token - if os.path.exists("auth.state"): - try: - # [A1] Load token from file - with open("auth.state", "r") as f: - data = json.load(f) - self._refresh_token = str(data["refresh_token"]) - self._access_token = str(data["access_token"]) - except: - auth_warning = "Failed to load auth.state file!" - else: - # [A2] Check if access token is valid, if so, return - if not self.__has_expired__(self._access_token): - return print("Authenticated via saved access token!") - else: - auth_warning = "Access token is invalid!" - # [A3] Check if refresh token is valid. if so, refresh - try: - if not self.__has_expired__(self._refresh_token): - self.refresh() - return print("Authenticated via saved refresh token!") - else: - auth_warning = "Refresh token is invalid!" - except Exception as e: - print(*e.args) - if auth_warning: - print(auth_warning) - - # [Flow B] Request device and user code - - # [B1] Initiate device auth flow - auth_device_url = f"{self.idp_url}/realms/{self.realm}/protocol/openid-connect/auth/device" - response = requests.post(auth_device_url, data={ - "client_id": self.client_id, - "scope": "openid", - }) - if response.status_code != 200: - raise Exception(f"Error in device authorization request: {response.status_code} - {response.text}") - data = response.json() - self.device_code = data.get("device_code", self.device_code) - self.interval = data.get("interval", self.interval) - url = data['verification_uri_complete'] - print(f"Please authenticate by visiting: {url}") - if interactive: - webbrowser.open(url) - - # [B2] Poll until token is received - token_url = f"{self.idp_url}/realms/{self.realm}/protocol/openid-connect/token" - print("Waiting for authorization...") - while True: - response = requests.post( - token_url, - data={ - "client_id": self.client_id, - "grant_type": "urn:ietf:params:oauth:grant-type:device_code", - "device_code": self.device_code, - }, - ) - if response.status_code == 200: - data = response.json() - self.__persist_token__(data["refresh_token"], data["access_token"]) - print("Authenticated via device auth!") - return - elif response.status_code == 400 and response.json().get("error") == "authorization_pending": - time.sleep(self.interval) - else: - raise Exception(f"Authorization error: {response.status_code} - {response.text}") - - except Exception as e: - print("login() failed!", e) - - def logout(self) -> None: - self._access_token = None - self._refresh_token = None - - def __persist_token__(self, refresh_token: str, access_token: str) -> None: - self._access_token = access_token - self._refresh_token = refresh_token - import json - with open("auth.state", "w") as f: - json.dump({"refresh_token": self._refresh_token, "access_token": self._access_token}, f) diff --git a/dev-tools/airavata-python-sdk/airavata_experiments/plan.py b/dev-tools/airavata-python-sdk/airavata_experiments/plan.py index d9bad69ad3..800089a8f9 100644 --- a/dev-tools/airavata-python-sdk/airavata_experiments/plan.py +++ b/dev-tools/airavata-python-sdk/airavata_experiments/plan.py @@ -27,7 +27,8 @@ import uuid from .airavata import AiravataOperator -from .auth import context + +from airavata_auth.device_auth import AuthContext class Plan(pydantic.BaseModel): @@ -127,7 +128,7 @@ def save_json(self, filename: str) -> None: json.dump(self.model_dump(), f, indent=2) def save(self) -> None: - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) az = av.__airavata_token__(av.access_token, av.default_gateway_id()) assert az.accessToken is not None assert az.claimsMap is not None @@ -139,10 +140,10 @@ def save(self) -> None: import requests if self.id is None: self.id = str(uuid.uuid4()) - response = requests.post("https://api.gateway.cybershuttle.org/api/v1/plan", headers=headers, json=self.model_dump()) + response = requests.post(f"{AuthContext.api_host}/api/v1/plan", headers=headers, json=self.model_dump()) print(f"Plan saved: {self.id}") else: - response = requests.put(f"https://api.gateway.cybershuttle.org/api/v1/plan/{self.id}", headers=headers, json=self.model_dump()) + response = requests.put(f"{AuthContext.api_host}/api/v1/plan/{self.id}", headers=headers, json=self.model_dump()) print(f"Plan updated: {self.id}") if response.status_code == 200: @@ -159,7 +160,7 @@ def load_json(filename: str) -> Plan: def load(id: str | None) -> Plan: assert id is not None - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) az = av.__airavata_token__(av.access_token, av.default_gateway_id()) assert az.accessToken is not None assert az.claimsMap is not None @@ -169,7 +170,7 @@ def load(id: str | None) -> Plan: 'X-Claims': json.dumps(az.claimsMap) } import requests - response = requests.get(f"https://api.gateway.cybershuttle.org/api/v1/plan/{id}", headers=headers) + response = requests.get(f"{AuthContext.api_host}/api/v1/plan/{id}", headers=headers) if response.status_code == 200: body = response.json() @@ -179,7 +180,7 @@ def load(id: str | None) -> Plan: raise Exception(response) def query() -> list[Plan]: - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) az = av.__airavata_token__(av.access_token, av.default_gateway_id()) assert az.accessToken is not None assert az.claimsMap is not None @@ -189,7 +190,7 @@ def query() -> list[Plan]: 'X-Claims': json.dumps(az.claimsMap) } import requests - response = requests.get(f"https://api.gateway.cybershuttle.org/api/v1/plan/user", headers=headers) + response = requests.get(f"{AuthContext.api_host}/api/v1/plan/user", headers=headers) if response.status_code == 200: items: list = response.json() diff --git a/dev-tools/airavata-python-sdk/airavata_experiments/runtime.py b/dev-tools/airavata-python-sdk/airavata_experiments/runtime.py index 36c4dc4c93..ed92a1f9a2 100644 --- a/dev-tools/airavata-python-sdk/airavata_experiments/runtime.py +++ b/dev-tools/airavata-python-sdk/airavata_experiments/runtime.py @@ -14,10 +14,10 @@ # limitations under the License. # from __future__ import annotations -from .auth import context import abc from typing import Any from pathlib import Path +import os import pydantic @@ -83,7 +83,7 @@ class Mock(Runtime): _state: int = 0 def __init__(self) -> None: - super().__init__(id="mock") + super().__init__(id="mock", args={}) def execute(self, task: Task) -> None: import uuid @@ -142,7 +142,7 @@ def execute(self, task: Task) -> None: print(f"[Remote] Creating Experiment: name={task.name}") from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) try: launch_state = av.launch_experiment( experiment_name=task.name, @@ -172,7 +172,7 @@ def execute_py(self, libraries: list[str], code: str, task: Task) -> None: assert task.pid is not None from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) result = av.execute_py(task.project, libraries, code, task.agent_ref, task.pid, task.runtime.args) print(result) @@ -181,7 +181,7 @@ def status(self, task: Task) -> tuple[str, str]: assert task.agent_ref is not None from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) # prioritize job state, fallback to experiment state job_id, job_state = av.get_task_status(task.ref) if not job_state or job_state == "UN_SUBMITTED": @@ -194,7 +194,7 @@ def signal(self, signal: str, task: Task) -> None: assert task.agent_ref is not None from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) av.stop_experiment(task.ref) def ls(self, task: Task) -> list[str]: @@ -205,7 +205,7 @@ def ls(self, task: Task) -> list[str]: assert task.workdir is not None from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) files = av.list_files(task.pid, task.agent_ref, task.sr_host, task.workdir) return files @@ -217,7 +217,7 @@ def upload(self, file: Path, task: Task) -> str: assert task.workdir is not None from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) result = av.upload_files(task.pid, task.agent_ref, task.sr_host, [file], task.workdir).pop() return result @@ -229,7 +229,7 @@ def download(self, file: str, local_dir: str, task: Task) -> str: assert task.workdir is not None from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) result = av.download_file(task.pid, task.agent_ref, task.sr_host, file, task.workdir, local_dir) return result @@ -241,7 +241,7 @@ def cat(self, file: str, task: Task) -> bytes: assert task.workdir is not None from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) content = av.cat_file(task.pid, task.agent_ref, task.sr_host, file, task.workdir) return content @@ -259,7 +259,7 @@ def list_runtimes( walltime: int | None = None, ) -> list[Runtime]: from .airavata import AiravataOperator - av = AiravataOperator(context.access_token) + av = AiravataOperator(os.environ['CS_ACCESS_TOKEN']) all_runtimes = av.get_available_runtimes() out_runtimes = [] for r in all_runtimes: diff --git a/dev-tools/airavata-python-sdk/airavata_jupyter_magic/__init__.py b/dev-tools/airavata-python-sdk/airavata_jupyter_magic/__init__.py index 42aa241bd4..7944043df4 100644 --- a/dev-tools/airavata-python-sdk/airavata_jupyter_magic/__init__.py +++ b/dev-tools/airavata-python-sdk/airavata_jupyter_magic/__init__.py @@ -18,7 +18,7 @@ import tempfile import yaml from IPython.core.getipython import get_ipython -from IPython.core.interactiveshell import ExecutionResult, InteractiveShell +from IPython.core.interactiveshell import ExecutionResult from IPython.core.magic import register_cell_magic, register_line_magic from IPython.display import HTML, Image, Javascript, display from rich.console import Console @@ -26,8 +26,7 @@ from jupyter_client.blocking.client import BlockingKernelClient -from .device_auth import DeviceFlowAuthenticator -import asyncio +from airavata_auth.device_auth import AuthContext # ======================================================================== # DATA STRUCTURES @@ -169,7 +168,7 @@ def is_runtime_ready(access_token: str, rt: RuntimeInfo, rt_name: str): raise InvalidStateError(msg) # third, check the state of agent - url = f"{api_base_url}/api/v1/agent/{rt.agentId}" + url = f"{AuthContext.api_host}/api/v1/agent/{rt.agentId}" res = requests.get(url) code = res.status_code astate = "CREATING_WORKSPACE" @@ -193,7 +192,7 @@ def execute_shell_async(access_token: str, rt_name: str, arguments: list[str]) - if rt is None: raise Exception(f"Runtime {rt_name} not found.") - url = f"{api_base_url}/api/v1/agent/execute/asyncshell" + url = f"{AuthContext.api_host}/api/v1/agent/execute/asyncshell" headers = generate_headers(access_token, rt_name) res = requests.post(url, headers=headers, data=json.dumps({ "agentId": rt.agentId, @@ -211,7 +210,7 @@ def execute_shell_async(access_token: str, rt_name: str, arguments: list[str]) - # Check if the request was successful while True: - url = api_base_url + "/api/v1/agent/execute/asyncshell/" + executionId + url = f"{AuthContext.api_host}/api/v1/agent/execute/asyncshell/{executionId}" res = requests.get(url, headers={'Accept': 'application/json'}) data = res.json() @@ -236,7 +235,7 @@ def get_hostname(access_token: str, rt_name: str) -> str | None: if rt is None: raise Exception(f"Runtime {rt_name} not found.") - url = f"{api_base_url}/api/v1/agent/execute/shell" + url = f"{AuthContext.api_host}/api/v1/agent/execute/shell" headers = generate_headers(access_token, rt_name) res = requests.post(url, headers=headers, data=json.dumps({ "agentId": rt.agentId, @@ -252,7 +251,7 @@ def get_hostname(access_token: str, rt_name: str) -> str | None: return print(f"Failed to get hostname for runtime={rt_name}") while True: - url = f"{api_base_url}/api/v1/agent/execute/shell/{executionId}" + url = f"{AuthContext.api_host}/api/v1/agent/execute/shell/{executionId}" res = requests.get(url, headers={'Accept': 'application/json'}) data = res.json() if data.get('executed'): @@ -274,7 +273,7 @@ def open_tunnel(access_token: str, rt_name: str, rt_hostname: str, rt_port: int) if rt is None: raise Exception(f"Runtime {rt_name} not found.") - url = f"{api_base_url}/api/v1/agent/setup/tunnel" + url = f"{AuthContext.api_host}/api/v1/agent/setup/tunnel" headers = generate_headers(access_token, rt_name) res = requests.post(url, headers=headers, data=json.dumps({ "agentId": rt.agentId, @@ -290,7 +289,7 @@ def open_tunnel(access_token: str, rt_name: str, rt_hostname: str, rt_port: int) return print(f"Failed to setup tunnel for runtime={rt_name}") while True: - url = f"{api_base_url}/api/v1/agent/setup/tunnel/{executionId}" + url = f"{AuthContext.api_host}/api/v1/agent/setup/tunnel/{executionId}" res = requests.get(url, headers={'Accept': 'application/json'}) data = res.json() if data.get('status') == "OK": @@ -329,7 +328,7 @@ def terminate_shell_async(access_token: str, rt_name: str, process_id: str, proc if rt is None: raise Exception(f"Runtime {rt_name} not found.") - url = f"{api_base_url}/api/v1/agent/terminate/asyncshell" + url = f"{AuthContext.api_host}/api/v1/agent/terminate/asyncshell" headers = generate_headers(access_token, rt_name) res = requests.post(url, headers=headers, data=json.dumps({ "agentId": rt.agentId, @@ -357,7 +356,7 @@ def get_experiment_state(experiment_id: str, headers: dict) -> tuple[ProcessStat @returns: the experiment state """ - url = f"{api_base_url}/api/v1/exp/{experiment_id}" + url = f"{AuthContext.api_host}/api/v1/exp/{experiment_id}" res = requests.get(url, headers=headers) code = res.status_code if code != 200: @@ -381,7 +380,7 @@ def get_process_state(experiment_id: str, headers: dict) -> tuple[str, ProcessSt @returns: process id and state """ - url = f"{api_base_url}/api/v1/exp/{experiment_id}/process" + url = f"{AuthContext.api_host}/api/v1/exp/{experiment_id}/process" pid, pstate = "", ProcessState.CREATED while not pid: res = requests.get(url, headers=headers) @@ -469,7 +468,7 @@ def submit_agent_job( """ # URL to which the POST request will be sent - url = api_base_url + '/api/v1/exp/launch' + url = f"{AuthContext.api_host}/api/v1/exp/launch" # data from file min_cpu: int = 1 @@ -575,8 +574,8 @@ def fetch_logs(rt_name: str) -> tuple[str, str]: """ pid = state.all_runtimes[rt_name].processId - stdout_res = requests.get(f"{file_server_url}/download/live/{pid}/AiravataAgent.stdout") - stderr_res = requests.get(f"{file_server_url}/download/live/{pid}/AiravataAgent.stderr") + stdout_res = requests.get(f"{AuthContext.file_server_url}/download/live/{pid}/AiravataAgent.stdout") + stderr_res = requests.get(f"{AuthContext.file_server_url}/download/live/{pid}/AiravataAgent.stderr") stdout = "No STDOUT" if stdout_res.status_code != 200 else stdout_res.content.decode('utf-8').strip() stderr = "No STDERR" if stderr_res.status_code != 200 else stderr_res.content.decode('utf-8').strip() return stdout, stderr @@ -648,7 +647,7 @@ def restart_runtime_kernel(access_token: str, rt_name: str, env_name: str, runti """ - url = api_base_url + '/api/v1/agent/setup/restart' + url = f"{AuthContext.api_host}/api/v1/agent/setup/restart" decode = jwt.decode(access_token, options={"verify_signature": False}) user_id = decode['preferred_username'] @@ -678,7 +677,7 @@ def restart_runtime_kernel(access_token: str, rt_name: str, env_name: str, runti # Check if the request was successful while True: - url = api_base_url + "/api/v1/agent/setup/restart/" + executionId + url = f"{AuthContext.api_host}/api/v1/agent/setup/restart/{executionId}" res = requests.get(url, headers={'Accept': 'application/json'}) data = res.json() if data.get('restarted'): @@ -698,7 +697,7 @@ def stop_agent_job(access_token: str, runtime_name: str, runtime: RuntimeInfo): """ - url = api_base_url + '/api/v1/exp/terminate/' + runtime.experimentId + url = f"{AuthContext.api_host}/api/v1/exp/terminate/{runtime.experimentId}" decode = jwt.decode(access_token, options={"verify_signature": False}) user_id = decode['preferred_username'] @@ -734,7 +733,7 @@ def run_on_runtime(rt_name: str, code_obj: str, result: ExecutionResult) -> bool result.error_in_exec = Exception(f"Runtime {rt_name} not found.") return False - url = api_base_url + '/api/v1/agent/execute/jupyter' + url = f"{AuthContext.api_host}/api/v1/agent/execute/jupyter" data = { "agentId": rt.agentId, "envName": rt.envName, @@ -757,7 +756,7 @@ def run_on_runtime(rt_name: str, code_obj: str, result: ExecutionResult) -> bool return False while True: - url = api_base_url + "/api/v1/agent/execute/jupyter/" + execution_id + url = f"{AuthContext.api_host}/api/v1/agent/execute/jupyter/{execution_id}" response = requests.get(url, headers={'Accept': 'application/json'}) json_response = response.json() if json_response.get('executed'): @@ -915,7 +914,7 @@ def push_remote(local_path: str, remot_rt: str, remot_path: str) -> None: # upload file print(f"local:{local_path} --> {remot_rt}:{remot_path}...", end=" ", flush=True) pid = state.all_runtimes[remot_rt].processId - url = f"{file_server_url}/upload/live/{pid}/{remot_path}" + url = f"{AuthContext.file_server_url}/upload/live/{pid}/{remot_path}" with open(local_path, "rb") as file: files = {"file": file} response = requests.post(url, files=files) @@ -923,7 +922,7 @@ def push_remote(local_path: str, remot_rt: str, remot_path: str) -> None: def pull_remote_file(remot_rt: str, remot_fp: str, local_fp: str) -> None: pid = state.all_runtimes[remot_rt].processId - url = f"{file_server_url}/download/live/{pid}/{remot_fp}" + url = f"{AuthContext.file_server_url}/download/live/{pid}/{remot_fp}" print(f"GET {url}") response = requests.get(url) with open(local_fp, "wb") as file: @@ -943,7 +942,7 @@ def pull_remote(remot_rt: str, remot_path: str, local_path: Path, local_is_dir: if not state.all_runtimes.get(remot_rt, None): return print(MSG_NOT_INITIALIZED) pid = state.all_runtimes[remot_rt].processId - url = f"{file_server_url}/list/live/{pid}/{remot_path}" + url = f"{AuthContext.file_server_url}/list/live/{pid}/{remot_path}" print(f"GET {url}") response = requests.get(url) res = response.json() @@ -1055,8 +1054,8 @@ def authenticate(line: str): """ try: - authenticator = DeviceFlowAuthenticator() - authenticator.login() + context = AuthContext() + context.login() except ValueError as e: msg = f"Configuration error: {e}" print(msg) @@ -1533,9 +1532,7 @@ def open_web_terminal(line: str): if ipython is None: raise RuntimeError("airavata_jupyter_magic requires an ipython session") assert ipython is not None -api_host = "api.dev.cybershuttle.org" -api_base_url = f"https://{api_host}" -file_server_url = f"http://{api_host}:8050" + MSG_NOT_INITIALIZED = r"Runtime not found. Please run %request_runtime name= cluster= cpu= memory= queue= walltime= group= to request one." state = State(current_runtime="local", all_runtimes={}, processes={}, tunnels={}, kernel_clients={}) diff --git a/dev-tools/airavata-python-sdk/docs/index.md b/dev-tools/airavata-python-sdk/docs/index.md index 3e0fd55183..3069b8aa7d 100644 --- a/dev-tools/airavata-python-sdk/docs/index.md +++ b/dev-tools/airavata-python-sdk/docs/index.md @@ -17,7 +17,6 @@ The Apache Airavata Python SDK lets third-party clients interact with Airavata t │ ├── service/ │ └── __init__.py ├── airavata_experiments/ - │ ├── auth/ │ ├── md/ │ ├── neuro/ │ ├── __init__.py @@ -29,7 +28,8 @@ The Apache Airavata Python SDK lets third-party clients interact with Airavata t │ ├── sftp.py │ └── task.py ├── airavata_jupyter_magic/ - │ ├── __init__.py + │ └── __init__.py + ├── airavata_auth/ │ └── device_auth.py └── airavata_sdk/ ├── clients/ diff --git a/dev-tools/airavata-python-sdk/pyproject.toml b/dev-tools/airavata-python-sdk/pyproject.toml index 49c49db1a5..0b775d8384 100644 --- a/dev-tools/airavata-python-sdk/pyproject.toml +++ b/dev-tools/airavata-python-sdk/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "airavata-python-sdk" -version = "2.1.4.post4" +version = "2.1.5" description = "Apache Airavata Python SDK" readme = "README.md" license = "Apache-2.0" diff --git a/dev-tools/ansible/inventories/scigap/develop/group_vars/all/vars.yml b/dev-tools/ansible/inventories/scigap/develop/group_vars/all/vars.yml index bd011ad76c..6e853483d2 100644 --- a/dev-tools/ansible/inventories/scigap/develop/group_vars/all/vars.yml +++ b/dev-tools/ansible/inventories/scigap/develop/group_vars/all/vars.yml @@ -95,11 +95,9 @@ registry_port: 8970 default_gateway: "default" # Credential and keystore related variables -keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +keystore_src_path: "{{inventory_dir}}/files/airavata.p12" keystore_passwd: "{{ vault_keystore_passwd }}" -# client_truststore_src_path: "{{inventory_dir}}/files/airavata.jks" -# client_truststore_passwd: "{{ vault_client_truststore_passwd }}" -cred_keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +cred_keystore_src_path: "{{inventory_dir}}/files/airavata.p12" cred_keystore_passwd: "{{ vault_cred_keystore_passwd }}" cred_keystore_alias: "airavata" cred_store_server_host: "{{ groups['api-orch'][0] }}" @@ -138,7 +136,7 @@ profile_service_host: "{{ groups['api-orch'][0] }}" profile_service_port: 8962 # Keycloak -keycloak_ssl_keystore_file: "{{ inventory_dir }}/files/airavata.jks" +keycloak_ssl_keystore_file: "{{ inventory_dir }}/files/airavata.p12" keycloak_ssl_keystore_password: "{{ vault_keycloak_ssl_keystore_password }}" keycloak_db_host: "{{ groups['database'][0] }}" keycloak_db_username: "keycloak" diff --git a/dev-tools/ansible/inventories/scigap/production/group_vars/all/vars.yml b/dev-tools/ansible/inventories/scigap/production/group_vars/all/vars.yml index bf9eb0b379..9e9fe4c92d 100644 --- a/dev-tools/ansible/inventories/scigap/production/group_vars/all/vars.yml +++ b/dev-tools/ansible/inventories/scigap/production/group_vars/all/vars.yml @@ -91,11 +91,9 @@ registry_port: 8970 default_gateway: "default" # Credential and keystore related variables -keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +keystore_src_path: "{{inventory_dir}}/files/airavata.p12" keystore_passwd: "{{ vault_keystore_passwd }}" -# client_truststore_src_path: "{{inventory_dir}}/files/airavata.jks" -# client_truststore_passwd: "{{ vault_client_truststore_passwd }}" -cred_keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +cred_keystore_src_path: "{{inventory_dir}}/files/airavata.p12" cred_keystore_passwd: "{{ vault_cred_keystore_passwd }}" cred_keystore_alias: "airavata" cred_store_server_host: "{{ groups['api-orch'][0] }}" @@ -127,7 +125,7 @@ profile_service_host: "{{ groups['api-orch'][0] }}" profile_service_port: 8962 # Keycloak -keycloak_ssl_keystore_file: "{{ inventory_dir }}/files/airavata.jks" +keycloak_ssl_keystore_file: "{{ inventory_dir }}/files/airavata.p12" keycloak_ssl_keystore_password: "{{ vault_keycloak_ssl_keystore_password }}" keycloak_db_host: "localhost" keycloak_db_username: "keycloak" diff --git a/dev-tools/ansible/inventories/scigap/staging/group_vars/all/vars.yml b/dev-tools/ansible/inventories/scigap/staging/group_vars/all/vars.yml index 55aacfa900..3f4f1191f9 100644 --- a/dev-tools/ansible/inventories/scigap/staging/group_vars/all/vars.yml +++ b/dev-tools/ansible/inventories/scigap/staging/group_vars/all/vars.yml @@ -89,11 +89,9 @@ registry_port: 8970 default_gateway: "default" # Credential and keystore related variables -keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +keystore_src_path: "{{inventory_dir}}/files/airavata.p12" keystore_passwd: "{{ vault_keystore_passwd }}" -# client_truststore_src_path: "{{inventory_dir}}/files/airavata.jks" -# client_truststore_passwd: "{{ vault_client_truststore_passwd }}" -cred_keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +cred_keystore_src_path: "{{inventory_dir}}/files/airavata.p12" cred_keystore_passwd: "{{ vault_cred_keystore_passwd }}" cred_keystore_alias: "airavata" cred_store_server_host: "{{ groups['api-orch'][0] }}" @@ -133,7 +131,7 @@ profile_service_host: "{{ groups['api-orch'][0] }}" profile_service_port: 8962 # Keycloak -keycloak_ssl_keystore_file: "{{ inventory_dir }}/files/airavata.jks" +keycloak_ssl_keystore_file: "{{ inventory_dir }}/files/airavata.p12" keycloak_ssl_keystore_password: "{{ vault_keycloak_ssl_keystore_password }}" keycloak_db_host: "localhost" keycloak_db_username: "keycloak" diff --git a/dev-tools/ansible/inventories/scigap/testing/group_vars/all/vars.yml b/dev-tools/ansible/inventories/scigap/testing/group_vars/all/vars.yml index ba320c19c4..bab0334f93 100644 --- a/dev-tools/ansible/inventories/scigap/testing/group_vars/all/vars.yml +++ b/dev-tools/ansible/inventories/scigap/testing/group_vars/all/vars.yml @@ -87,11 +87,9 @@ registry_port: 8970 default_gateway: "default" # Credential and keystore related variables -keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +keystore_src_path: "{{inventory_dir}}/files/airavata.p12" keystore_passwd: "{{ vault_keystore_passwd }}" -client_truststore_src_path: "{{inventory_dir}}/files/airavata.jks" -client_truststore_passwd: "{{ vault_client_truststore_passwd }}" -cred_keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +cred_keystore_src_path: "{{inventory_dir}}/files/airavata.p12" cred_keystore_passwd: "{{ vault_cred_keystore_passwd }}" cred_keystore_alias: "airavata" cred_store_server_host: "{{ groups['api-orch'][0] }}" @@ -122,7 +120,7 @@ profile_service_host: "{{ groups['api-orch'][0] }}" profile_service_port: 8962 # Keycloak -keycloak_ssl_keystore_file: "{{ inventory_dir }}/files/airavata.jks" +keycloak_ssl_keystore_file: "{{ inventory_dir }}/files/airavata.p12" keycloak_ssl_keystore_password: "{{ vault_keycloak_ssl_keystore_password }}" keycloak_db_host: "localhost" keycloak_db_username: "keycloak" diff --git a/dev-tools/ansible/inventories/standalone/group_vars/all/vars.yml b/dev-tools/ansible/inventories/standalone/group_vars/all/vars.yml index 3c7bb56a57..97a1ebb109 100644 --- a/dev-tools/ansible/inventories/standalone/group_vars/all/vars.yml +++ b/dev-tools/ansible/inventories/standalone/group_vars/all/vars.yml @@ -99,11 +99,9 @@ default_registry_user: "default-admin" default_registry_password: "123456" # Credential and keystore related variables -keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +keystore_src_path: "{{inventory_dir}}/files/airavata.p12" keystore_passwd: "password" -client_truststore_src_path: "{{inventory_dir}}/files/airavata.jks" -client_truststore_passwd: "password" -cred_keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +cred_keystore_src_path: "{{inventory_dir}}/files/airavata.p12" cred_keystore_passwd: "123456" cred_keystore_alias: "seckey" cred_store_server_host: "{{ groups['api-orch'][0] }}" diff --git a/dev-tools/ansible/inventories/template/group_vars/all/vars.yml b/dev-tools/ansible/inventories/template/group_vars/all/vars.yml index 9b26e525c4..6a22743855 100644 --- a/dev-tools/ansible/inventories/template/group_vars/all/vars.yml +++ b/dev-tools/ansible/inventories/template/group_vars/all/vars.yml @@ -95,11 +95,9 @@ registry_port: 8970 default_gateway: "default" # Credential and keystore related variables -keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +keystore_src_path: "{{inventory_dir}}/files/airavata.p12" keystore_passwd: "airavata" -client_truststore_src_path: "{{inventory_dir}}/files/airavata.jks" -client_truststore_passwd: "airavata" -cred_keystore_src_path: "{{inventory_dir}}/files/airavata.jks" +cred_keystore_src_path: "{{inventory_dir}}/files/airavata.p12" cred_keystore_passwd: "airavata" cred_keystore_alias: "airavata" cred_store_server_host: "{{ groups['api-orch'][0] }}" diff --git a/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2 b/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2 index 107c2d32c6..1ba075d86b 100644 --- a/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2 +++ b/dev-tools/ansible/roles/api-orch/templates/airavata-server.properties.j2 @@ -115,14 +115,6 @@ sharingcatalog.validationQuery=SELECT 1 from CONFIGURATION sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer sharing.registry.server.host={{ sharing_registry_host }} sharing.registry.server.port={{ sharing_registry_port }} -sharing.tls.enabled={{ sharing_registry_tls_enabled }} - -########################################################################### -# User Profile MongoDB Configuration -########################################################################### -userprofile.mongodb.host=localhost -userprofile.mongodb.port=27017 - ########################################################################### # Server module Configuration diff --git a/dev-tools/ansible/roles/api-orch/templates/apiorch.service.j2 b/dev-tools/ansible/roles/api-orch/templates/apiorch.service.j2 index a77a1018ef..2b5ef7d491 100644 --- a/dev-tools/ansible/roles/api-orch/templates/apiorch.service.j2 +++ b/dev-tools/ansible/roles/api-orch/templates/apiorch.service.j2 @@ -29,7 +29,7 @@ Wants=rabbitmq-server.service zookeeper.service mysql.service [Service] Type=forking -ExecStart={{ api_orch_dir }}/{{ airavata_dist }}/bin/airavata-server-start.sh -d api-orch -log "{{ api_orch_log_dir }}/output.log" -enableLegacyTLS +ExecStart={{ api_orch_dir }}/{{ airavata_dist }}/bin/airavata-server-start.sh -d api-orch -log "{{ api_orch_log_dir }}/output.log" ExecStop={{ api_orch_dir }}/{{ airavata_dist }}/bin/airavata-server-stop.sh Restart=always TimeoutSec=60 diff --git a/dev-tools/ansible/roles/common/defaults/main.yml b/dev-tools/ansible/roles/common/defaults/main.yml index bc2e4d0909..c5f496d690 100644 --- a/dev-tools/ansible/roles/common/defaults/main.yml +++ b/dev-tools/ansible/roles/common/defaults/main.yml @@ -18,8 +18,8 @@ # under the License. # -keystore_src_path: "airavata.jks" -cred_keystore_src_path: "airavata.jks" +keystore_src_path: "airavata.p12" +cred_keystore_src_path: "airavata.p12" apache_maven_version: "apache-maven-3.6.3" apache_maven_url: "https://www-eu.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz" diff --git a/dev-tools/ansible/roles/common/tasks/main.yml b/dev-tools/ansible/roles/common/tasks/main.yml index d431f798c0..58a2b63b63 100644 --- a/dev-tools/ansible/roles/common/tasks/main.yml +++ b/dev-tools/ansible/roles/common/tasks/main.yml @@ -86,12 +86,12 @@ state=directory owner={{ user }} group={{ group }} -- name: Transfer airavata.jks KeyStore file +- name: Transfer airavata.p12 KeyStore file copy: src={{ keystore_src_path }} dest="{{ keystores_location }}/{{ keystore_src_path | basename }}" owner={{ user }} group={{ group }} -- name: Transfer airavata.jks KeyStore file +- name: Transfer airavata.p12 KeyStore file copy: src={{ cred_keystore_src_path }} dest="{{ keystores_location }}/{{ cred_keystore_src_path | basename }}" owner={{ user }} group={{ group }} diff --git a/dev-tools/ansible/roles/keycloak/defaults/main.yml b/dev-tools/ansible/roles/keycloak/defaults/main.yml index e8d8d2bf83..bd766c1f54 100644 --- a/dev-tools/ansible/roles/keycloak/defaults/main.yml +++ b/dev-tools/ansible/roles/keycloak/defaults/main.yml @@ -23,8 +23,8 @@ keycloak_version: "2.5.4.Final" keycloak_downlaod_url: "https://downloads.jboss.org/keycloak/{{keycloak_version}}/keycloak-{{keycloak_version}}.tar.gz" keycloak_install_dir: "keycloak-{{keycloak_version}}" keycloak_db_connector_name: "mysql-connector-j-9.3.0-bin.jar" -# keycloak_ssl_keystore_file: "airavata.jks" -# keycloak_ssl_keystore_file_name: "airavata.jks" +# keycloak_ssl_keystore_file: "airavata.p12" +# keycloak_ssl_keystore_file_name: "airavata.p12" # keycloak_ssl_keystore_password: "Airavata" mysql_db_connector_download_url: "https://dev.mysql.com/get/Downloads/Connector-J/{{keycloak_db_connector_name}}.tar.gz" keycloak_master_account_username: "username" diff --git a/dev-tools/deployment-scripts/distribution_backup.sh b/dev-tools/deployment-scripts/distribution_backup.sh index e814325bda..6719ab8cb0 100644 --- a/dev-tools/deployment-scripts/distribution_backup.sh +++ b/dev-tools/deployment-scripts/distribution_backup.sh @@ -18,4 +18,5 @@ cp -r ./apache-airavata-api-server-0.21-SNAPSHOT $BACKUP_DIR/ cp -r ./apache-airavata-agent-service-0.21-SNAPSHOT $BACKUP_DIR/ cp -r ./apache-airavata-research-service-0.21-SNAPSHOT $BACKUP_DIR/ cp -r ./apache-airavata-file-server-0.21-SNAPSHOT $BACKUP_DIR/ +cp -r ./apache-airavata-restproxy-0.21-SNAPSHOT $BACKUP_DIR/ log "Distribution backed up." diff --git a/dev-tools/deployment-scripts/distribution_update.sh b/dev-tools/deployment-scripts/distribution_update.sh index 59ba737aa1..657f295db0 100644 --- a/dev-tools/deployment-scripts/distribution_update.sh +++ b/dev-tools/deployment-scripts/distribution_update.sh @@ -27,27 +27,34 @@ rm -rf ./apache-airavata-file-server-0.21-SNAPSHOT tar -xvf ./apache-airavata-file-server-0.21-SNAPSHOT.tar.gz -C . log "File Service updated." +log "Updating the REST proxy..." +rm -rf ./apache-airavata-restproxy-0.21-SNAPSHOT +tar -xvf ./apache-airavata-restproxy-0.21-SNAPSHOT.tar.gz -C . +log "REST proxy updated." + # ================================ # Update the config files # ================================ cp vault/airavata-server.properties ./apache-airavata-api-server-0.21-SNAPSHOT/conf/airavata-server.properties -cp vault/airavata.jks ./apache-airavata-api-server-0.21-SNAPSHOT/conf/keystores/airavata.jks -cp vault/airavata_sym.jks ./apache-airavata-api-server-0.21-SNAPSHOT/conf/keystores/airavata_sym.jks -cp vault/client_truststore.jks ./apache-airavata-api-server-0.21-SNAPSHOT/conf/keystores/client_truststore.jks +cp vault/airavata.p12 ./apache-airavata-api-server-0.21-SNAPSHOT/conf/keystores/airavata.p12 cp vault/email-config.yaml ./apache-airavata-api-server-0.21-SNAPSHOT/conf/email-config.yaml cp vault/log4j2.xml ./apache-airavata-api-server-0.21-SNAPSHOT/conf/log4j2.xml log "API Server config files updated." cp vault/application-agent-service.yml ./apache-airavata-agent-service-0.21-SNAPSHOT/conf/application.yml -cp vault/airavata.jks ./apache-airavata-agent-service-0.21-SNAPSHOT/conf/airavata.jks +cp vault/airavata.p12 ./apache-airavata-agent-service-0.21-SNAPSHOT/conf/airavata.p12 cp vault/log4j2.xml ./apache-airavata-agent-service-0.21-SNAPSHOT/conf/log4j2.xml log "Agent Service config files updated." cp vault/application-research-service.yml ./apache-airavata-research-service-0.21-SNAPSHOT/conf/application.yml -cp vault/airavata.jks ./apache-airavata-research-service-0.21-SNAPSHOT/conf/airavata.jks +cp vault/airavata.p12 ./apache-airavata-research-service-0.21-SNAPSHOT/conf/airavata.p12 cp vault/log4j2.xml ./apache-airavata-research-service-0.21-SNAPSHOT/conf/log4j2.xml log "Research Service config files updated." cp vault/application-file-server.properties ./apache-airavata-file-server-0.21-SNAPSHOT/conf/application.properties cp vault/log4j2.xml ./apache-airavata-file-server-0.21-SNAPSHOT/conf/log4j2.xml -log "File Service config files updated." \ No newline at end of file +log "File Service config files updated." + +cp vault/application-restproxy.properties ./apache-airavata-restproxy-0.21-SNAPSHOT/conf/application.properties +cp vault/log4j2.xml ./apache-airavata-restproxy-0.21-SNAPSHOT/conf/log4j2.xml +log "REST proxy config files updated." \ No newline at end of file diff --git a/dev-tools/deployment-scripts/services_down.sh b/dev-tools/deployment-scripts/services_down.sh index 40d7e02e2b..e626972f47 100644 --- a/dev-tools/deployment-scripts/services_down.sh +++ b/dev-tools/deployment-scripts/services_down.sh @@ -42,4 +42,11 @@ log "Research Service stopped." # ================================ log "Stopping the File Service..." ./apache-airavata-file-server-0.21-SNAPSHOT/bin/file-service.sh -d stop -log "File Service stopped." \ No newline at end of file +log "File Service stopped." + +# ================================ +# Shutdown the REST proxy +# ================================ +log "Stopping the REST proxy..." +./apache-airavata-restproxy-0.21-SNAPSHOT/bin/restproxy.sh -d stop +log "REST proxy stopped." \ No newline at end of file diff --git a/dev-tools/deployment-scripts/services_up.sh b/dev-tools/deployment-scripts/services_up.sh index 2c23bf65b9..508637e362 100644 --- a/dev-tools/deployment-scripts/services_up.sh +++ b/dev-tools/deployment-scripts/services_up.sh @@ -44,3 +44,10 @@ log "Research Service started." log "Starting the File Service..." ./apache-airavata-file-server-0.21-SNAPSHOT/bin/file-service.sh -d start log "File Service started." + +# ================================ +# Start the REST proxy +# ================================ +log "Starting the REST proxy..." +./apache-airavata-restproxy-0.21-SNAPSHOT/bin/restproxy.sh -d start +log "REST proxy started." diff --git a/dev-tools/load-client/pom.xml b/dev-tools/load-client/pom.xml index 7cae27e7e9..a8655b3113 100644 --- a/dev-tools/load-client/pom.xml +++ b/dev-tools/load-client/pom.xml @@ -18,20 +18,31 @@ under the License. --> + + org.apache.airavata + airavata + 0.21-SNAPSHOT + ../../pom.xml + + 4.0.0 load-client Airavata Load Testing Client Puts a load to Airavata through API http://airavata.apache.org/ + jar + 0.21-SNAPSHOT org.apache.airavata airavata-api + 0.21-SNAPSHOT org.keycloak keycloak-admin-client + 26.0.5 org.eclipse.angus @@ -40,25 +51,24 @@ under the License. - org.apache.airavata - sshj-agent + org.keycloak + keycloak-authz-client + 26.0.5 org.yaml snakeyaml + 2.4 commons-cli commons-cli - - - org.keycloak - keycloak-authz-client + 1.9.0 org.bouncycastle bcpkix-jdk18on - 1.78.1 + 1.81 diff --git a/dev-tools/load-client/src/main/assembly/load-client-bin-assembly.xml b/dev-tools/load-client/src/main/assembly/load-client-bin-assembly.xml index 6b2ef1d242..646f5d9005 100644 --- a/dev-tools/load-client/src/main/assembly/load-client-bin-assembly.xml +++ b/dev-tools/load-client/src/main/assembly/load-client-bin-assembly.xml @@ -42,7 +42,7 @@ bin 777 - airavata.jks + airavata.p12 diff --git a/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/LoadClient.java b/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/LoadClient.java index 46673833a9..1620f30686 100644 --- a/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/LoadClient.java +++ b/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/LoadClient.java @@ -29,9 +29,13 @@ import java.util.concurrent.Future; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.client.AiravataClientFactory; +import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference; import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription; -import org.apache.commons.cli.*; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.GnuParser; +import org.apache.commons.cli.Options; import org.yaml.snakeyaml.Yaml; public class LoadClient { @@ -41,8 +45,7 @@ public class LoadClient { private String passPhrase = null; private String configFile; - private SecurityManager securityManager = new SecurityManager(); - private Map storageResourceManagerStore = new HashMap<>(); + private final Map storageResourceManagerStore = new HashMap<>(); private Configurations configurations; public void init() throws Exception { @@ -63,8 +66,6 @@ public void init() throws Exception { for (Configuration cfg : configurations.getConfigurations()) { cfg.getAuthzToken(); } - - securityManager.loadCertificate(configurations.getApiHost(), configurations.getApiPort()); createStorageResourceManagers(configurations); } @@ -74,16 +75,12 @@ public void start() throws Exception { UnitLoad unitLoad = new UnitLoad( configurations.getApiHost(), configurations.getApiPort(), - securityManager.getTrustStorePath(), - securityManager.getTrustStorePassword(), storageResourceManagerStore.get(configuration.getStorageResourceId()), configuration.getAuthzToken()); StatusMonitor statusMonitor = new StatusMonitor( configurations.getApiHost(), configurations.getApiPort(), - securityManager.getTrustStorePath(), - securityManager.getTrustStorePassword(), configuration.getAuthzToken()); CompletionService> completion = unitLoad.execute(configuration); @@ -105,12 +102,10 @@ public void start() throws Exception { private void createStorageResourceManagers(Configurations configurations) throws Exception { - Airavata.Client airavataClient = AiravataClientFactory.createAiravataSecureClient( + Airavata.Client airavataClient = AiravataClientFactory.createAiravataClient( configurations.getApiHost(), configurations.getApiPort(), - securityManager.getTrustStorePath(), - securityManager.getTrustStorePassword(), - 100000); + ServerSettings.isTLSEnabled()); for (Configuration configuration : configurations.getConfigurations()) { String storageResourceId = configuration.getStorageResourceId(); @@ -135,7 +130,7 @@ private void destroyStorageResourceManagers() { storageResourceManagerStore.values().forEach(StorageResourceManager::destroy); } - public static void main(String args[]) throws Exception { + public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption("config", true, "Load configuration file in yaml format"); diff --git a/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/SecurityManager.java b/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/SecurityManager.java deleted file mode 100644 index 7943258bda..0000000000 --- a/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/SecurityManager.java +++ /dev/null @@ -1,92 +0,0 @@ -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -package org.apache.airavata.tools.load; - -import java.io.*; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.*; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import javax.net.ssl.*; - -public class SecurityManager { - - private String trustStoreName = "airavata.jks"; - private String trustStorePassword = "airavata"; - - public void loadCertificate(String host, int port) - throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, - KeyManagementException, URISyntaxException { - - // It is not secure! - TrustManager[] trustAllCerts = new TrustManager[] { - new X509TrustManager() { - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } - - public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {} - - public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {} - } - }; - - SSLContext sslContext = SSLContext.getInstance("SSL"); - sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); - SSLSocket socket = (SSLSocket) sslContext.getSocketFactory().createSocket(host, port); - socket.startHandshake(); - SSLSession sslSession = socket.getSession(); - Certificate[] certificates = sslSession.getPeerCertificates(); - - FileInputStream is = new FileInputStream(getTrustStorePath()); - - KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); - keystore.load(is, trustStorePassword.toCharArray()); - is.close(); - - File keystoreFile = new File(getTrustStorePath()); - - String certificateAlias = host; - keystore.setCertificateEntry(certificateAlias, certificates[0]); - - FileOutputStream out = new FileOutputStream(keystoreFile); - keystore.store(out, trustStorePassword.toCharArray()); - out.close(); - - System.out.println("Certificates successfully loaded for " + host + ":" + port); - } - - public String getTrustStorePath() throws URISyntaxException { - URL trustStoreUrl = SecurityManager.class.getClassLoader().getResource(trustStoreName); - - String trustStorePath; - if (trustStoreUrl.toURI().getPath() != null) { - trustStorePath = trustStoreUrl.toURI().getPath(); - } else { - trustStorePath = System.getProperty("airavata.home") + "/bin/" + trustStoreName; - } - return trustStorePath; - } - - public String getTrustStorePassword() { - return trustStorePassword; - } -} diff --git a/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/StatusMonitor.java b/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/StatusMonitor.java index e25db8245b..56c8d922be 100644 --- a/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/StatusMonitor.java +++ b/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/StatusMonitor.java @@ -25,6 +25,8 @@ import java.util.Map; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.client.AiravataClientFactory; +import org.apache.airavata.common.exception.ApplicationSettingsException; +import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.error.AiravataClientException; import org.apache.airavata.model.experiment.ExperimentModel; import org.apache.airavata.model.job.JobModel; @@ -37,21 +39,15 @@ public class StatusMonitor { private String apiHost; private int apiPort; - private String trustStorePath; - private String trustStorePassword; private AuthzToken authzToken; - public StatusMonitor( - String apiHost, int apiPort, String trustStorePath, String trustStorePassword, AuthzToken authzToken) - throws AiravataClientException { + public StatusMonitor(String apiHost, int apiPort, AuthzToken authzToken) { this.apiHost = apiHost; this.apiPort = apiPort; - this.trustStorePath = trustStorePath; - this.trustStorePassword = trustStorePassword; this.authzToken = authzToken; } - public void monitorExperiments(List experiments) throws TException { + public void monitorExperiments(List experiments) throws TException, ApplicationSettingsException { Map jobModelMap = new HashMap<>(); Map experimentModelMap = new HashMap<>(); @@ -60,8 +56,7 @@ public void monitorExperiments(List experiments) throws TException { long monitoringStartTime = System.currentTimeMillis(); while (experiments.size() > jobModelMap.size()) { System.out.println("Running a monitoring round...."); - airavataClient = AiravataClientFactory.createAiravataSecureClient( - apiHost, apiPort, trustStorePath, trustStorePassword, 100000); + airavataClient = AiravataClientFactory.createAiravataClient(apiHost, apiPort, ServerSettings.isTLSEnabled()); for (String experiment : experiments) { @@ -87,8 +82,7 @@ public void monitorExperiments(List experiments) throws TException { } } - airavataClient = AiravataClientFactory.createAiravataSecureClient( - apiHost, apiPort, trustStorePath, trustStorePassword, 100000); + airavataClient = AiravataClientFactory.createAiravataClient(apiHost, apiPort, ServerSettings.isTLSEnabled()); for (String experiment : experiments) { experimentModelMap.put(experiment, airavataClient.getExperiment(authzToken, experiment)); diff --git a/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/UnitLoad.java b/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/UnitLoad.java index e168875cad..7828f8112e 100644 --- a/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/UnitLoad.java +++ b/dev-tools/load-client/src/main/java/org/apache/airavata/tools/load/UnitLoad.java @@ -28,6 +28,8 @@ import org.apache.airavata.agents.api.AgentException; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.client.AiravataClientFactory; +import org.apache.airavata.common.exception.ApplicationSettingsException; +import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.application.io.DataType; import org.apache.airavata.model.application.io.InputDataObjectType; import org.apache.airavata.model.experiment.ExperimentModel; @@ -41,22 +43,16 @@ public class UnitLoad { private String apiHost; private int apiPort; - private String trustStorePath; - private String trustStorePassword; private StorageResourceManager storageResourceManager; private AuthzToken authzToken; public UnitLoad( String apiHost, int apiPort, - String trustStorePath, - String trustStorePassword, StorageResourceManager storageResourceManager, AuthzToken authzToken) { this.apiHost = apiHost; this.apiPort = apiPort; - this.trustStorePath = trustStorePath; - this.trustStorePassword = trustStorePassword; this.storageResourceManager = storageResourceManager; this.authzToken = authzToken; } @@ -100,11 +96,7 @@ public List call() { long randomLong = (long) randomDouble; Thread.sleep(randomLong); experiments.add(submitExperiment(config, id + "-" + i)); - } catch (TException e) { - e.printStackTrace(); - } catch (AgentException e) { - e.printStackTrace(); - } catch (InterruptedException e) { + } catch (TException | ApplicationSettingsException | AgentException | InterruptedException e) { e.printStackTrace(); } } @@ -112,7 +104,7 @@ public List call() { } } - private String submitExperiment(Configuration config, String suffix) throws TException, AgentException { + private String submitExperiment(Configuration config, String suffix) throws TException, AgentException, ApplicationSettingsException { String experimentName = config.getExperimentBaseName() + suffix; @@ -145,8 +137,7 @@ private String submitExperiment(Configuration config, String suffix) throws TExc experimentModel.setUserConfigurationData(userConfigurationDataModel); - Airavata.Client airavataClient = AiravataClientFactory.createAiravataSecureClient( - apiHost, apiPort, trustStorePath, trustStorePassword, 100000); + Airavata.Client airavataClient = AiravataClientFactory.createAiravataClient(apiHost, apiPort, ServerSettings.isTLSEnabled()); List applicationInputs = airavataClient.getApplicationInputs(authzToken, config.getApplicationInterfaceId()); diff --git a/examples/airavata-api-java-client-samples/src/main/java/org/apache/airavata/client/secure/client/Properties.java b/examples/airavata-api-java-client-samples/src/main/java/org/apache/airavata/client/secure/client/Properties.java index 81ceddcea7..205d9cfc03 100644 --- a/examples/airavata-api-java-client-samples/src/main/java/org/apache/airavata/client/secure/client/Properties.java +++ b/examples/airavata-api-java-client-samples/src/main/java/org/apache/airavata/client/secure/client/Properties.java @@ -26,7 +26,7 @@ public class Properties { // trust store parameters public static final String TRUST_STORE_PATH = - "../../../../../airavata/modules/configuration/server/src/main/resources/airavata.jks"; + "../../../../../airavata/modules/configuration/server/src/main/resources/airavata.p12"; public static final String TRUST_STORE_PASSWORD = "airavata"; public static String oauthAuthzServerURL = "https://localhost:9443/services/"; diff --git a/keystores/aes.p12 b/keystores/aes.p12 new file mode 100644 index 0000000000..d5c5e2b864 Binary files /dev/null and b/keystores/aes.p12 differ diff --git a/keystores/airavata.jks b/keystores/airavata.jks deleted file mode 100644 index a199d39600..0000000000 Binary files a/keystores/airavata.jks and /dev/null differ diff --git a/keystores/generate_keystore.sh b/keystores/generate_keystore.sh index f701bab6d1..9b66510c38 100755 --- a/keystores/generate_keystore.sh +++ b/keystores/generate_keystore.sh @@ -1,9 +1,22 @@ #!/bin/bash -# Remove existing key stores -rm -f airavata.jks +# generate AES-256 key for credential encryption +keytool -genseckey -alias airavata -keyalg AES -keysize 256 -keystore aes.p12 -storepass airavata -# Generate a PKCS12 keystore with a self-signed certificate -keytool -genkey -keyalg RSA -alias selfsigned -keystore airavata.jks -storetype pkcs12 -storepass airavata -validity 360 -keysize 2048 \ - -dname "CN=airavata.host, OU=airavata.host, O=airavata.host, L=airavata.host, ST=airavata.host, C=airavata.host" \ - -ext san=dns:airavata.host +# generate self-signed key-cert pair for SSL termination +openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt \ + -subj "/CN=airavata.host/OU=airavata.host/O=airavata.host/L=airavata.host/ST=airavata.host/C=airavata.host" \ + -addext "subjectAltName=DNS:airavata.host" + +# add server.crt to java truststore +sudo keytool -cacerts -storepass changeit -delete -alias airavata +sudo keytool -cacerts -storepass changeit -importcert -alias airavata -file server.crt -trustcacerts -noprompt + +# generate airavata.p12 +rm -rf airavata.p12 +# if self-signed {server.crt, server.key} +openssl pkcs12 -export -name tls -out airavata.p12 -passout pass:airavata -in server.crt -inkey server.key +# if letsencrypt {fullchain.pem, privkey.pem} +openssl pkcs12 -export -name tls -out airavata.p12 -passout pass:airavata -in fullchain.pem -inkey privkey.pem +# add AES key to store +keytool -importkeystore -srckeystore aes.p12 -destkeystore airavata.p12 -srcstorepass airavata -deststorepass airavata diff --git a/keystores/server.crt b/keystores/server.crt new file mode 100644 index 0000000000..9ad3fa3cc4 --- /dev/null +++ b/keystores/server.crt @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIICzzCCAbegAwIBAgIJAJGb5byylzisMA0GCSqGSIb3DQEBCwUAMBgxFjAUBgNV +BAMMDWFpcmF2YXRhLmhvc3QwHhcNMjUwNzEyMjAxMDUxWhcNMjYwNzEyMjAxMDUx +WjAYMRYwFAYDVQQDDA1haXJhdmF0YS5ob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEAw82EpDELtsT+pNFrO21TP52PdwgvWY+lhtKtm1vfUEBEIUHE +b2rjT0hh1h0MfzqxK3oetLlPCjjS5kSN9xthm1ieTTekbsaKzrvC4M2uJDSBB6Fu +wQm0B4kL3q3LRZHXJSF8Wyfc4yl/7yjOXogUmQVZm0BNZ8qiFbk02PDqckB4aTqn +RSPgS+4w5Oh/fO4gSENdwNc64K9f5YZY3rpqKGbEmarA0inl+bEu93Ssc5NH8eg0 ++nvG5u5i2N4cNbv1SYaUwOsvbSU557mPkTyl2Mmgu0fknCU+r0wjY48Fq6V1hXrH +v+e155MT766YByIqxjkFZzR7UTbc0tagI86BoQIDAQABoxwwGjAYBgNVHREEETAP +gg1haXJhdmF0YS5ob3N0MA0GCSqGSIb3DQEBCwUAA4IBAQBVBII7hneF2HSPiOZN +tvCmqFI19U1k9+WTzVhsEYrO3WgSmhuXOf6F2wkvv9EG3K1o48x1CzzXwhHNK0UU +Du4O9RXBMg7vtZNnv+blvGzon5xpzqf/cQbtL1ywmz9q4Mr3wtPk2KPDFr8An99R +8wit9Hb9lpjOOlOsgJFwlYoJbInEdTHs+na4QQhDRrNdYbzjsrhLtLROXKyRtYKw +Ed5NYfRaHAcHcCELg7w0K8Iomc5lkx5EIEvcTqamqM0Y4KFMwi6hGR6eSxcpgu8x +i7ltmSk8Lq0I+R+pmqrIXncX0hucsAvQE56X6GqG5MupB+QmD+u1x52lupzwnSvN +5fm4 +-----END CERTIFICATE----- diff --git a/keystores/server.key b/keystores/server.key new file mode 100644 index 0000000000..052603b0d9 --- /dev/null +++ b/keystores/server.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDDzYSkMQu2xP6k +0Ws7bVM/nY93CC9Zj6WG0q2bW99QQEQhQcRvauNPSGHWHQx/OrEreh60uU8KONLm +RI33G2GbWJ5NN6RuxorOu8Lgza4kNIEHoW7BCbQHiQverctFkdclIXxbJ9zjKX/v +KM5eiBSZBVmbQE1nyqIVuTTY8OpyQHhpOqdFI+BL7jDk6H987iBIQ13A1zrgr1/l +hljeumooZsSZqsDSKeX5sS73dKxzk0fx6DT6e8bm7mLY3hw1u/VJhpTA6y9tJTnn +uY+RPKXYyaC7R+ScJT6vTCNjjwWrpXWFese/57XnkxPvrpgHIirGOQVnNHtRNtzS +1qAjzoGhAgMBAAECggEBAIjfwQpaMrsYKH4k2tYXDWvaA7EM6rSr4uVFnxCMf6YE +1tt8swnD6ZTBn4rikZra94DSBGcHZ0ZZBKztXWRRIsFKiJan/+1kIyJzRL6LaWFr +xosEAX02AECIP+DxErjWQ1R0fQ7n5dRybTlNCD4y2FtDzyjlIXcdwoJ3Dodcmjc0 +upLaR3wDHO1IwcS4d7vcMBPvRIZ8I6ht7MzhaqtIj5d3339hhL0Im5q68ldSG3Xq +ZK4HAahev+7ZMjz6jFaaDjfJNLEm4toNYdJdyZ77oKPucnrRLOFSS2RHtGi7FXxo +W/bsrJIdiVxUPvqz8mutbijE75xTtA4MkZkOVWFgi8ECgYEA7oJPAHT7di1IJ6p0 +02gu6zTpTD/R9hniwgdVQOnmIFJcVv70HjgpZscuUhdWnbjehtbRV6vMBTQSc4Fe +zmhxwh0JMNzY73GT6F2C0XtJw1uAJwLQWNPE2XFP21ffXMc3zpmQwLNDM6WyC3DM +fdLhRknpPgJJN1FPKBOzAiwTwKkCgYEA0il09NjTtoV1B5JWaUaE4X2X4SiX6Xjd +4GNF1ToYktvqqTK/9IXvCV5F1imw9FCl3V9xUt6rJoYkzRTIvR+3GqkQmJa1bcJm +20RgxmhO1Kf5BhDNjqQWaEGjspl6K7sj0+iNYHf7Cng1BhCvGcDrW+MvWZhusoCd +ND+lLSvZPDkCgYEAmNyVa5KOM9CTxTBfTbshDwhLWd4xYAx5I6f1gPQn1KFUo0Em +DlQqXL/dtSlWDyIUJNF7PDhUOyWDidnpfFq+Rg27/UAeHWBqzmtYU5Az12xGdzo7 +dCLNsBsKdmccNedMojIT7x01Pd29fc2ekinczeLDBUYLzNNk6yes/ABp7HkCgYAC +6JX4yYNslD5BY5IUlOhD4qQWdqRbk9OmRllyEQLEDY0a2Fv1u2DKhWZ8B0mup+sT +vD1qQzClMNgTioUYsPasxMg5BGTwZu9be3/HXywwHz8ACX1+yuCQgtAMKbmaH1Xo +meBTBHYR+AXr1pFFzviy5dsC52woxkTmszbLAD9aaQKBgEsvfmZBcGuxGp7qC9OP +x4HdE+l208H7LDyjtpuMCQNaFkXFOlhAlhcpK6QNomOW8HGSyCVIwZsUfHpLSnII +owp8m0LKZzboOJdakZKiPy+C9MM5CIAJuYsP9SlSs6yQDVud0L/waAKliFeDXja4 +8Ui2xDmdIKdTZH5GJdk1Pl0t +-----END PRIVATE KEY----- diff --git a/modules/agent-framework/agent-service/pom.xml b/modules/agent-framework/agent-service/pom.xml index a2c7d385ce..6d383f732d 100644 --- a/modules/agent-framework/agent-service/pom.xml +++ b/modules/agent-framework/agent-service/pom.xml @@ -241,7 +241,7 @@ under the License. ${project.parent.basedir}/keystores keystores - *.jks + airavata.p12 diff --git a/modules/agent-framework/agent-service/src/main/assembly/agent-service-bin-assembly.xml b/modules/agent-framework/agent-service/src/main/assembly/agent-service-bin-assembly.xml index 12747805f6..d890127838 100644 --- a/modules/agent-framework/agent-service/src/main/assembly/agent-service-bin-assembly.xml +++ b/modules/agent-framework/agent-service/src/main/assembly/agent-service-bin-assembly.xml @@ -43,7 +43,7 @@ conf application.yml - airavata.jks + airavata.p12 log4j2.xml diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/ClusterApplicationConfig.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/ClusterApplicationConfig.java index 2384f719c8..52e77b2f69 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/ClusterApplicationConfig.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/ClusterApplicationConfig.java @@ -19,7 +19,6 @@ */ package org.apache.airavata.agent.connection.service.config; -import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -27,17 +26,13 @@ @ConfigurationProperties(prefix = "airavata.cluster") public class ClusterApplicationConfig { - private Map applicationInterfaceId; + private String applicationInterfaceId; - public Map getApplicationInterfaceId() { + public String getApplicationInterfaceId() { return applicationInterfaceId; } - public void setApplicationInterfaceId(Map applicationInterfaceId) { + public void setApplicationInterfaceId(String applicationInterfaceId) { this.applicationInterfaceId = applicationInterfaceId; } - - public String getApplicationInterfaceIdByCluster(String clusterName) { - return applicationInterfaceId.get(clusterName); - } } diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java index 1ec72c095a..2d697d00ac 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java @@ -119,8 +119,7 @@ public AgentLaunchRequest filterOptimumLaunchRequest(List la AgentLaunchRequest sortedLaunchRequest = launchRequests.get(0); for (AgentLaunchRequest req : launchRequests) { - String appInterfaceId = - clusterApplicationConfig.getApplicationInterfaceIdByCluster(req.getApplicationInterfaceName()); + String appInterfaceId = clusterApplicationConfig.getApplicationInterfaceId(); ExperimentStatistics experimentStatistics = airavataService .airavata() .getExperimentStatistics( @@ -215,8 +214,7 @@ private ExperimentModel generateExperiment(AgentLaunchRequest req, String agentI AuthzToken authzToken = UserContext.authzToken(); String userName = UserContext.username(); String gatewayId = UserContext.gatewayId(); - String appInterfaceId = - clusterApplicationConfig.getApplicationInterfaceIdByCluster(req.getApplicationInterfaceName()); + String appInterfaceId = clusterApplicationConfig.getApplicationInterfaceId(); ExperimentModel experimentModel = new ExperimentModel(); experimentModel.setExperimentName(experimentName); experimentModel.setProjectId(projectId); diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java index faad300f0a..8cac7d198d 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java @@ -28,6 +28,8 @@ import org.apache.airavata.agent.connection.service.UserContext; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.client.AiravataClientFactory; +import org.apache.airavata.common.exception.ApplicationSettingsException; +import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference; import org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile; import org.apache.airavata.model.error.AiravataClientException; @@ -44,24 +46,17 @@ public class AiravataService { private static final Logger LOGGER = LoggerFactory.getLogger(AiravataService.class); - private static final int TIMEOUT = 100000; - @Value("${airavata.server.url:scigap02.sciencegateways.iu.edu}") + @Value("${airavata.server.url:airavata.host}") private String serverUrl; - @Value("${airavata.server.port:9930}") + @Value("${airavata.server.port:8930}") private int port; - @Value("${airavata.server.truststore.path}") - private String trustStorePath; - public Airavata.Client airavata() { try { - LOGGER.debug("Creating Airavata client with the TrustStore URL - " + trustStorePath); - return AiravataClientFactory.createAiravataSecureClient( - serverUrl, port, trustStorePath, "airavata", TIMEOUT); - - } catch (AiravataClientException e) { + return AiravataClientFactory.createAiravataClient(serverUrl, port, ServerSettings.isTLSEnabled()); + } catch (AiravataClientException | ApplicationSettingsException e) { LOGGER.error("Error while creating Airavata client", e); throw new RuntimeException("Error while creating Airavata client", e); } diff --git a/modules/agent-framework/agent-service/src/main/resources/application.yml b/modules/agent-framework/agent-service/src/main/resources/application.yml index 5a971cc7bc..ed863d3649 100644 --- a/modules/agent-framework/agent-service/src/main/resources/application.yml +++ b/modules/agent-framework/agent-service/src/main/resources/application.yml @@ -30,7 +30,7 @@ spring: max-request-size: 200MB datasource: url: "jdbc:mariadb://airavata.host:13306/app_catalog" - username: "root" + username: "airavata" password: "123456" driver-class-name: org.mariadb.jdbc.Driver hikari: @@ -43,18 +43,21 @@ spring: airavata: server: - url: scigap02.sciencegateways.iu.edu - port: 9930 - truststore: - path: CHANGE_ME - storageResourceId: gf4.ucs.indiana.edu_61552681-96f0-462a-a36c-a62a010bffc6 - storagePath: /var/www/portals/gateway-user-data + url: airavata.host + port: 8930 + storageResourceId: airavata.host_77116e91-f042-4d3a-ab9c-3e7b4ebcd5bd + storagePath: /tmp cluster: - applicationInterfaceId: - expanse: AiravataAgent_f4313e4d-20c2-4bf6-bff1-8aa0f0b0c1d6 - jetstream: UPDATE + applicationInterfaceId: AiravataAgent_f4313e4d-20c2-4bf6-bff1-8aa0f0b0c1d6 tunnel: - serverHost: tunnel-server + serverHost: airavata.host serverPort: 17000 - serverToken: servertoken - serverApiUrl: http://tunnel-server:8000 + serverToken: airavata + serverApiUrl: http://airavata.host:8000 + +keystore: + path: keystores/airavata.p12 + password: airavata + +TLS: + enabled: true \ No newline at end of file diff --git a/modules/agent-framework/agent-service/src/main/resources/distribution/bin/agent-service.sh b/modules/agent-framework/agent-service/src/main/resources/distribution/bin/agent-service.sh index f89493c3c2..2fbddbbbb6 100755 --- a/modules/agent-framework/agent-service/src/main/resources/distribution/bin/agent-service.sh +++ b/modules/agent-framework/agent-service/src/main/resources/distribution/bin/agent-service.sh @@ -21,6 +21,6 @@ SERVICE_NAME="agent-service" MAIN_CLASS="org.apache.airavata.agent.connection.service.AgentServiceApplication" -JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml -Dairavata.server.truststore.path=${AIRAVATA_HOME}/conf/airavata.jks -Dspring.config.location=${AIRAVATA_HOME}/conf/" +JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml -Dairavata.server.truststore.path=${AIRAVATA_HOME}/conf/airavata.p12 -Dspring.config.location=${AIRAVATA_HOME}/conf/" run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@" diff --git a/modules/agent-framework/agent-service/src/main/resources/distribution/conf/.gitkeep b/modules/agent-framework/agent-service/src/main/resources/distribution/conf/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/modules/agent-framework/agent-service/src/main/resources/distribution/conf/application.yml b/modules/agent-framework/agent-service/src/main/resources/distribution/conf/application.yml deleted file mode 100644 index 30ebe99cf7..0000000000 --- a/modules/agent-framework/agent-service/src/main/resources/distribution/conf/application.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -grpc: - server: - port: 19900 - -server: - port: 18880 - address: 0.0.0.0 - -spring: - servlet: - multipart: - max-file-size: 200MB - max-request-size: 200MB - datasource: - url: "jdbc:mariadb://airavata.host:13306/app_catalog" - username: "root" - password: "123456" - driver-class-name: org.mariadb.jdbc.Driver - hikari: - pool-name: AppCatalogPool - leak-detection-threshold: 20000 - jpa: - hibernate: - ddl-auto: create - open-in-view: false - -airavata: - server: - url: scigap02.sciencegateways.iu.edu - port: 9930 - truststore: - path: /Users/lahiruj/Projects/airavata/lahiruj/modules/agent-framework/agent-service/src/main/resources/airavata.jks - storageResourceId: gf4.ucs.indiana.edu_61552681-96f0-462a-a36c-a62a010bffc6 - cluster: - applicationInterfaceId: - expanse: AiravataAgent_f4313e4d-20c2-4bf6-bff1-8aa0f0b0c1d6 - jetstream: AiravataAgent_f4313e4d-20c2-4bf6-bff1-xcver3343 - tunnel: - serverHost: tunnel-server - serverPort: 17000 - serverToken: servertoken - serverApiUrl: http://tunnel-server:8000 \ No newline at end of file diff --git a/modules/agent-framework/agent-service/src/main/resources/distribution/conf/log4j2.xml b/modules/agent-framework/agent-service/src/main/resources/distribution/conf/log4j2.xml deleted file mode 100644 index 5ab1800e7d..0000000000 --- a/modules/agent-framework/agent-service/src/main/resources/distribution/conf/log4j2.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - %d [%t] %-5p %c{30} %X - %m%n - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/agent-framework/agent-service/src/main/resources/distribution/conf/truststore.jks b/modules/agent-framework/agent-service/src/main/resources/distribution/conf/truststore.jks deleted file mode 100644 index 7006e55ba6..0000000000 Binary files a/modules/agent-framework/agent-service/src/main/resources/distribution/conf/truststore.jks and /dev/null differ diff --git a/modules/agent-framework/agent-service/src/main/resources/log4j2.xml b/modules/agent-framework/agent-service/src/main/resources/log4j2.xml index d2857a4545..8fb27b1b68 100644 --- a/modules/agent-framework/agent-service/src/main/resources/log4j2.xml +++ b/modules/agent-framework/agent-service/src/main/resources/log4j2.xml @@ -25,18 +25,6 @@ - - - %d [%t] %-5p %c{30} %X - %m%n - - - - - - - - @@ -46,7 +34,6 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/agent-framework/agent-service/src/main/resources/truststore.jks b/modules/agent-framework/agent-service/src/main/resources/truststore.jks deleted file mode 100644 index 7006e55ba6..0000000000 Binary files a/modules/agent-framework/agent-service/src/main/resources/truststore.jks and /dev/null differ diff --git a/modules/agent-framework/airavata-agent/Makefile b/modules/agent-framework/airavata-agent/Makefile index cd483be4db..567088f296 100644 --- a/modules/agent-framework/airavata-agent/Makefile +++ b/modules/agent-framework/airavata-agent/Makefile @@ -16,7 +16,7 @@ # under the License. IMAGE_NAME=cybershuttle/remote-agent-base -AGENT_SVC_URL=api.gateway.cybershuttle.org:19900 +AGENT_SVC_URL=airavata.host:19900 AGENT_ID=test build-multiarch: diff --git a/modules/agent-framework/airavata-agent/agent.sh b/modules/agent-framework/airavata-agent/agent.sh index eaa0896d2a..23b7a10c86 100755 --- a/modules/agent-framework/airavata-agent/agent.sh +++ b/modules/agent-framework/airavata-agent/agent.sh @@ -37,7 +37,6 @@ CS_HOME=$HOME/cybershuttle AGENT="" SERVER="" -CONTAINER="" LIBRARIES="" ENVIRON="" PIP="" @@ -47,12 +46,11 @@ MOUNTS=() ln -s $CS_HOME/application $PWD/application # parse command line args -PARSED_OPTIONS=$(getopt -o '' --long server:,agent:,container:,libraries:,pip:,mounts:,environ: -n "$0" -- "$@") +PARSED_OPTIONS=$(getopt -o '' --long server:,agent:,libraries:,pip:,mounts:,environ: -n "$0" -- "$@") if [ $? -ne 0 ]; then echo "Usage: $0 \ --server SERVER \ --agent AGENT \ - --container CONTAINER \ --libraries LIBRARIES \ --pip PIP \ --mounts MOUNTS \ @@ -64,7 +62,6 @@ while true; do case "$1" in --server) SERVER="$2"; shift 2 ;; --agent) AGENT="$2"; shift 2 ;; - --container) CONTAINER="$2"; shift 2 ;; --libraries) LIBRARIES="$2"; shift 2 ;; --pip) PIP="$2"; shift 2 ;; --mounts) @@ -85,7 +82,6 @@ done echo "CS_HOME=$CS_HOME" echo "AGENT=$AGENT" echo "SERVER=$SERVER" -echo "CONTAINER=$CONTAINER" echo "LIBRARIES=$LIBRARIES" echo "PIP=$PIP" echo "MOUNTS=${MOUNTS[@]}" @@ -107,7 +103,7 @@ find $CS_HOME/workspace -mindepth 1 -maxdepth 1 -type d -ctime +3 | xargs -n1 -I # fetch binaries wget -q https://github.com/cyber-shuttle/binaries/releases/download/1.0.1/airavata-agent-linux-amd64 -O airavata-agent wget -q https://github.com/cyber-shuttle/binaries/releases/download/1.0.1/kernel.py -O kernel.py -wget -q https://github.com/mamba-org/micromamba-releases/releases/download/2.1.1-0/micromamba-linux-64 -O micromamba +wget -q https://github.com/mamba-org/micromamba-releases/releases/download/2.3.0-1/micromamba-linux-64 -O micromamba chmod +x airavata-agent micromamba diff --git a/modules/distribution/pom.xml b/modules/distribution/pom.xml deleted file mode 100644 index 02b19f17a6..0000000000 --- a/modules/distribution/pom.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - - org.apache.airavata - airavata - 0.21-SNAPSHOT - ../../pom.xml - - - 4.0.0 - apache-airavata-distribution - Airavata Distribution - pom - https://airavata.apache.org/ - - - - - org.apache.airavata - airavata-api - ${project.version} - - - - org.apache.zookeeper - zookeeper - - - org.slf4j - slf4j-log4j12 - - - log4j - log4j - - - ch.qos.logback - logback-classic - - - ch.qos.logback - logback-core - - - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - api-server-distribution-package - package - - single - - - posix - ${api.server.dist.name} - - src/main/assembly/api-server-bin-assembly.xml - - false - - - - - - maven-resources-plugin - - - copy-api-server-resources - package - - copy-resources - - - ${docker.api.server.build.directory} - - - ${docker.api.server.image.src.root} - false - - - ${session.executionRootDirectory}/distribution - - ${api.server.dist.name}.tar.gz - - - - - - - - - io.fabric8 - docker-maven-plugin - 0.46.0 - - true - - - airavata/api-server - - ${docker.api.server.build.directory}/Dockerfile - - - - - - - - - - ${project.build.directory}/api_server_docker_img_build - src/main/docker/api-server - apache-airavata-api-server-${project.version} - - - \ No newline at end of file diff --git a/modules/distribution/src/main/docker/api-server/wait-for-it.sh b/modules/distribution/src/main/docker/api-server/wait-for-it.sh deleted file mode 100644 index d990e0d364..0000000000 --- a/modules/distribution/src/main/docker/api-server/wait-for-it.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -WAITFORIT_cmdname=${0##*/} - -echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - else - echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" - fi - WAITFORIT_start_ts=$(date +%s) - while : - do - if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then - nc -z $WAITFORIT_HOST $WAITFORIT_PORT - WAITFORIT_result=$? - else - (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 - WAITFORIT_result=$? - fi - if [[ $WAITFORIT_result -eq 0 ]]; then - WAITFORIT_end_ts=$(date +%s) - echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" - break - fi - sleep 1 - done - return $WAITFORIT_result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $WAITFORIT_QUIET -eq 1 ]]; then - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - else - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - fi - WAITFORIT_PID=$! - trap "kill -INT -$WAITFORIT_PID" INT - wait $WAITFORIT_PID - WAITFORIT_RESULT=$? - if [[ $WAITFORIT_RESULT -ne 0 ]]; then - echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - fi - return $WAITFORIT_RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - WAITFORIT_hostport=(${1//:/ }) - WAITFORIT_HOST=${WAITFORIT_hostport[0]} - WAITFORIT_PORT=${WAITFORIT_hostport[1]} - shift 1 - ;; - --child) - WAITFORIT_CHILD=1 - shift 1 - ;; - -q | --quiet) - WAITFORIT_QUIET=1 - shift 1 - ;; - -s | --strict) - WAITFORIT_STRICT=1 - shift 1 - ;; - -h) - WAITFORIT_HOST="$2" - if [[ $WAITFORIT_HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - WAITFORIT_HOST="${1#*=}" - shift 1 - ;; - -p) - WAITFORIT_PORT="$2" - if [[ $WAITFORIT_PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - WAITFORIT_PORT="${1#*=}" - shift 1 - ;; - -t) - WAITFORIT_TIMEOUT="$2" - if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - WAITFORIT_TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - WAITFORIT_CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} -WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} -WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} -WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} - -# Check to see if timeout is from busybox? -WAITFORIT_TIMEOUT_PATH=$(type -p timeout) -WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) - -WAITFORIT_BUSYTIMEFLAG="" -if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then - WAITFORIT_ISBUSY=1 - # Check if busybox timeout uses -t flag - # (recent Alpine versions don't support -t anymore) - if timeout &>/dev/stdout | grep -q -e '-t '; then - WAITFORIT_BUSYTIMEFLAG="-t" - fi -else - WAITFORIT_ISBUSY=0 -fi - -if [[ $WAITFORIT_CHILD -gt 0 ]]; then - wait_for - WAITFORIT_RESULT=$? - exit $WAITFORIT_RESULT -else - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - wait_for_wrapper - WAITFORIT_RESULT=$? - else - wait_for - WAITFORIT_RESULT=$? - fi -fi - -if [[ $WAITFORIT_CLI != "" ]]; then - if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then - echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" - exit $WAITFORIT_RESULT - fi - exec "${WAITFORIT_CLI[@]}" -else - exit $WAITFORIT_RESULT -fi diff --git a/modules/distribution/src/main/docker/controller/Dockerfile b/modules/distribution/src/main/docker/controller/Dockerfile deleted file mode 100644 index 84f306d33a..0000000000 --- a/modules/distribution/src/main/docker/controller/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -FROM eclipse-temurin:17-jre - -WORKDIR /opt - -COPY ${controller.dist.name}-bin.tar.gz . -RUN tar -xzf ${controller.dist.name}-bin.tar.gz && \ - mv ${controller.dist.name} apache-airavata-controller && \ - rm ${controller.dist.name}-bin.tar.gz - - -COPY wait-for-it.sh /tmp/wait-for-it.sh -RUN chmod +x /tmp/wait-for-it.sh - -ENV JAVA_HOME=/opt/java/openjdk -ENV AIRAVATA_HOME=/opt/apache-airavata-controller - -ENTRYPOINT ["/opt/apache-airavata-controller/bin/controller.sh"] \ No newline at end of file diff --git a/modules/distribution/src/main/docker/controller/wait-for-it.sh b/modules/distribution/src/main/docker/controller/wait-for-it.sh deleted file mode 100644 index d990e0d364..0000000000 --- a/modules/distribution/src/main/docker/controller/wait-for-it.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -WAITFORIT_cmdname=${0##*/} - -echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - else - echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" - fi - WAITFORIT_start_ts=$(date +%s) - while : - do - if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then - nc -z $WAITFORIT_HOST $WAITFORIT_PORT - WAITFORIT_result=$? - else - (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 - WAITFORIT_result=$? - fi - if [[ $WAITFORIT_result -eq 0 ]]; then - WAITFORIT_end_ts=$(date +%s) - echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" - break - fi - sleep 1 - done - return $WAITFORIT_result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $WAITFORIT_QUIET -eq 1 ]]; then - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - else - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - fi - WAITFORIT_PID=$! - trap "kill -INT -$WAITFORIT_PID" INT - wait $WAITFORIT_PID - WAITFORIT_RESULT=$? - if [[ $WAITFORIT_RESULT -ne 0 ]]; then - echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - fi - return $WAITFORIT_RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - WAITFORIT_hostport=(${1//:/ }) - WAITFORIT_HOST=${WAITFORIT_hostport[0]} - WAITFORIT_PORT=${WAITFORIT_hostport[1]} - shift 1 - ;; - --child) - WAITFORIT_CHILD=1 - shift 1 - ;; - -q | --quiet) - WAITFORIT_QUIET=1 - shift 1 - ;; - -s | --strict) - WAITFORIT_STRICT=1 - shift 1 - ;; - -h) - WAITFORIT_HOST="$2" - if [[ $WAITFORIT_HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - WAITFORIT_HOST="${1#*=}" - shift 1 - ;; - -p) - WAITFORIT_PORT="$2" - if [[ $WAITFORIT_PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - WAITFORIT_PORT="${1#*=}" - shift 1 - ;; - -t) - WAITFORIT_TIMEOUT="$2" - if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - WAITFORIT_TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - WAITFORIT_CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} -WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} -WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} -WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} - -# Check to see if timeout is from busybox? -WAITFORIT_TIMEOUT_PATH=$(type -p timeout) -WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) - -WAITFORIT_BUSYTIMEFLAG="" -if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then - WAITFORIT_ISBUSY=1 - # Check if busybox timeout uses -t flag - # (recent Alpine versions don't support -t anymore) - if timeout &>/dev/stdout | grep -q -e '-t '; then - WAITFORIT_BUSYTIMEFLAG="-t" - fi -else - WAITFORIT_ISBUSY=0 -fi - -if [[ $WAITFORIT_CHILD -gt 0 ]]; then - wait_for - WAITFORIT_RESULT=$? - exit $WAITFORIT_RESULT -else - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - wait_for_wrapper - WAITFORIT_RESULT=$? - else - wait_for - WAITFORIT_RESULT=$? - fi -fi - -if [[ $WAITFORIT_CLI != "" ]]; then - if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then - echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" - exit $WAITFORIT_RESULT - fi - exec "${WAITFORIT_CLI[@]}" -else - exit $WAITFORIT_RESULT -fi diff --git a/modules/distribution/src/main/docker/email-monitor/Dockerfile b/modules/distribution/src/main/docker/email-monitor/Dockerfile deleted file mode 100644 index 61f069827e..0000000000 --- a/modules/distribution/src/main/docker/email-monitor/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -FROM eclipse-temurin:17-jre - -WORKDIR /opt - -COPY ${email.monitor.dist.name}-bin.tar.gz . -RUN tar -xzf ${email.monitor.dist.name}-bin.tar.gz && \ - mv ${email.monitor.dist.name} apache-airavata-email-monitor && \ - rm ${email.monitor.dist.name}-bin.tar.gz - -COPY wait-for-it.sh /tmp/ -RUN chmod +x /tmp/wait-for-it.sh - -ENV JAVA_HOME=/opt/java/openjdk -ENV AIRAVATA_HOME=/opt/apache-airavata-email-monitor - -ENTRYPOINT ["/opt/apache-airavata-email-monitor/bin/email-monitor.sh"] \ No newline at end of file diff --git a/modules/distribution/src/main/docker/email-monitor/wait-for-it.sh b/modules/distribution/src/main/docker/email-monitor/wait-for-it.sh deleted file mode 100644 index d990e0d364..0000000000 --- a/modules/distribution/src/main/docker/email-monitor/wait-for-it.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -WAITFORIT_cmdname=${0##*/} - -echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - else - echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" - fi - WAITFORIT_start_ts=$(date +%s) - while : - do - if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then - nc -z $WAITFORIT_HOST $WAITFORIT_PORT - WAITFORIT_result=$? - else - (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 - WAITFORIT_result=$? - fi - if [[ $WAITFORIT_result -eq 0 ]]; then - WAITFORIT_end_ts=$(date +%s) - echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" - break - fi - sleep 1 - done - return $WAITFORIT_result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $WAITFORIT_QUIET -eq 1 ]]; then - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - else - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - fi - WAITFORIT_PID=$! - trap "kill -INT -$WAITFORIT_PID" INT - wait $WAITFORIT_PID - WAITFORIT_RESULT=$? - if [[ $WAITFORIT_RESULT -ne 0 ]]; then - echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - fi - return $WAITFORIT_RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - WAITFORIT_hostport=(${1//:/ }) - WAITFORIT_HOST=${WAITFORIT_hostport[0]} - WAITFORIT_PORT=${WAITFORIT_hostport[1]} - shift 1 - ;; - --child) - WAITFORIT_CHILD=1 - shift 1 - ;; - -q | --quiet) - WAITFORIT_QUIET=1 - shift 1 - ;; - -s | --strict) - WAITFORIT_STRICT=1 - shift 1 - ;; - -h) - WAITFORIT_HOST="$2" - if [[ $WAITFORIT_HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - WAITFORIT_HOST="${1#*=}" - shift 1 - ;; - -p) - WAITFORIT_PORT="$2" - if [[ $WAITFORIT_PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - WAITFORIT_PORT="${1#*=}" - shift 1 - ;; - -t) - WAITFORIT_TIMEOUT="$2" - if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - WAITFORIT_TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - WAITFORIT_CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} -WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} -WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} -WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} - -# Check to see if timeout is from busybox? -WAITFORIT_TIMEOUT_PATH=$(type -p timeout) -WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) - -WAITFORIT_BUSYTIMEFLAG="" -if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then - WAITFORIT_ISBUSY=1 - # Check if busybox timeout uses -t flag - # (recent Alpine versions don't support -t anymore) - if timeout &>/dev/stdout | grep -q -e '-t '; then - WAITFORIT_BUSYTIMEFLAG="-t" - fi -else - WAITFORIT_ISBUSY=0 -fi - -if [[ $WAITFORIT_CHILD -gt 0 ]]; then - wait_for - WAITFORIT_RESULT=$? - exit $WAITFORIT_RESULT -else - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - wait_for_wrapper - WAITFORIT_RESULT=$? - else - wait_for - WAITFORIT_RESULT=$? - fi -fi - -if [[ $WAITFORIT_CLI != "" ]]; then - if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then - echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" - exit $WAITFORIT_RESULT - fi - exec "${WAITFORIT_CLI[@]}" -else - exit $WAITFORIT_RESULT -fi diff --git a/modules/distribution/src/main/docker/participant/Dockerfile b/modules/distribution/src/main/docker/participant/Dockerfile deleted file mode 100644 index 4f7bf5866c..0000000000 --- a/modules/distribution/src/main/docker/participant/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -FROM eclipse-temurin:17-jre - -WORKDIR /opt - -COPY ${participant.dist.name}-bin.tar.gz . -RUN tar -xzf ${participant.dist.name}-bin.tar.gz && \ - mv ${participant.dist.name} apache-airavata-participant && \ - rm ${participant.dist.name}-bin.tar.gz - -COPY wait-for-it.sh /tmp/ -RUN chmod +x /tmp/wait-for-it.sh - -ENV JAVA_HOME=/opt/java/openjdk -ENV AIRAVATA_HOME=/opt/apache-airavata-participant - -# Expose monitoring port -EXPOSE 8080 - -ENTRYPOINT ["/opt/apache-airavata-participant/bin/participant.sh"] \ No newline at end of file diff --git a/modules/distribution/src/main/docker/participant/wait-for-it.sh b/modules/distribution/src/main/docker/participant/wait-for-it.sh deleted file mode 100644 index d990e0d364..0000000000 --- a/modules/distribution/src/main/docker/participant/wait-for-it.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -WAITFORIT_cmdname=${0##*/} - -echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - else - echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" - fi - WAITFORIT_start_ts=$(date +%s) - while : - do - if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then - nc -z $WAITFORIT_HOST $WAITFORIT_PORT - WAITFORIT_result=$? - else - (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 - WAITFORIT_result=$? - fi - if [[ $WAITFORIT_result -eq 0 ]]; then - WAITFORIT_end_ts=$(date +%s) - echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" - break - fi - sleep 1 - done - return $WAITFORIT_result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $WAITFORIT_QUIET -eq 1 ]]; then - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - else - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - fi - WAITFORIT_PID=$! - trap "kill -INT -$WAITFORIT_PID" INT - wait $WAITFORIT_PID - WAITFORIT_RESULT=$? - if [[ $WAITFORIT_RESULT -ne 0 ]]; then - echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - fi - return $WAITFORIT_RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - WAITFORIT_hostport=(${1//:/ }) - WAITFORIT_HOST=${WAITFORIT_hostport[0]} - WAITFORIT_PORT=${WAITFORIT_hostport[1]} - shift 1 - ;; - --child) - WAITFORIT_CHILD=1 - shift 1 - ;; - -q | --quiet) - WAITFORIT_QUIET=1 - shift 1 - ;; - -s | --strict) - WAITFORIT_STRICT=1 - shift 1 - ;; - -h) - WAITFORIT_HOST="$2" - if [[ $WAITFORIT_HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - WAITFORIT_HOST="${1#*=}" - shift 1 - ;; - -p) - WAITFORIT_PORT="$2" - if [[ $WAITFORIT_PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - WAITFORIT_PORT="${1#*=}" - shift 1 - ;; - -t) - WAITFORIT_TIMEOUT="$2" - if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - WAITFORIT_TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - WAITFORIT_CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} -WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} -WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} -WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} - -# Check to see if timeout is from busybox? -WAITFORIT_TIMEOUT_PATH=$(type -p timeout) -WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) - -WAITFORIT_BUSYTIMEFLAG="" -if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then - WAITFORIT_ISBUSY=1 - # Check if busybox timeout uses -t flag - # (recent Alpine versions don't support -t anymore) - if timeout &>/dev/stdout | grep -q -e '-t '; then - WAITFORIT_BUSYTIMEFLAG="-t" - fi -else - WAITFORIT_ISBUSY=0 -fi - -if [[ $WAITFORIT_CHILD -gt 0 ]]; then - wait_for - WAITFORIT_RESULT=$? - exit $WAITFORIT_RESULT -else - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - wait_for_wrapper - WAITFORIT_RESULT=$? - else - wait_for - WAITFORIT_RESULT=$? - fi -fi - -if [[ $WAITFORIT_CLI != "" ]]; then - if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then - echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" - exit $WAITFORIT_RESULT - fi - exec "${WAITFORIT_CLI[@]}" -else - exit $WAITFORIT_RESULT -fi diff --git a/modules/distribution/src/main/docker/post-wm/Dockerfile b/modules/distribution/src/main/docker/post-wm/Dockerfile deleted file mode 100644 index f6cff58730..0000000000 --- a/modules/distribution/src/main/docker/post-wm/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -FROM eclipse-temurin:17-jre - -WORKDIR /opt - -COPY ${post.wm.dist.name}-bin.tar.gz . -RUN tar -xzf ${post.wm.dist.name}-bin.tar.gz && \ - mv ${post.wm.dist.name} apache-airavata-post-wm && \ - rm ${post.wm.dist.name}-bin.tar.gz - -COPY wait-for-it.sh /tmp/ -RUN chmod +x /tmp/wait-for-it.sh - -ENV JAVA_HOME=/opt/java/openjdk -ENV AIRAVATA_HOME=/opt/apache-airavata-post-wm - -# Expose monitoring port -EXPOSE 9094 - -ENTRYPOINT ["/opt/apache-airavata-post-wm/bin/post-wm.sh"] \ No newline at end of file diff --git a/modules/distribution/src/main/docker/post-wm/wait-for-it.sh b/modules/distribution/src/main/docker/post-wm/wait-for-it.sh deleted file mode 100644 index d990e0d364..0000000000 --- a/modules/distribution/src/main/docker/post-wm/wait-for-it.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -WAITFORIT_cmdname=${0##*/} - -echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - else - echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" - fi - WAITFORIT_start_ts=$(date +%s) - while : - do - if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then - nc -z $WAITFORIT_HOST $WAITFORIT_PORT - WAITFORIT_result=$? - else - (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 - WAITFORIT_result=$? - fi - if [[ $WAITFORIT_result -eq 0 ]]; then - WAITFORIT_end_ts=$(date +%s) - echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" - break - fi - sleep 1 - done - return $WAITFORIT_result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $WAITFORIT_QUIET -eq 1 ]]; then - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - else - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - fi - WAITFORIT_PID=$! - trap "kill -INT -$WAITFORIT_PID" INT - wait $WAITFORIT_PID - WAITFORIT_RESULT=$? - if [[ $WAITFORIT_RESULT -ne 0 ]]; then - echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - fi - return $WAITFORIT_RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - WAITFORIT_hostport=(${1//:/ }) - WAITFORIT_HOST=${WAITFORIT_hostport[0]} - WAITFORIT_PORT=${WAITFORIT_hostport[1]} - shift 1 - ;; - --child) - WAITFORIT_CHILD=1 - shift 1 - ;; - -q | --quiet) - WAITFORIT_QUIET=1 - shift 1 - ;; - -s | --strict) - WAITFORIT_STRICT=1 - shift 1 - ;; - -h) - WAITFORIT_HOST="$2" - if [[ $WAITFORIT_HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - WAITFORIT_HOST="${1#*=}" - shift 1 - ;; - -p) - WAITFORIT_PORT="$2" - if [[ $WAITFORIT_PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - WAITFORIT_PORT="${1#*=}" - shift 1 - ;; - -t) - WAITFORIT_TIMEOUT="$2" - if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - WAITFORIT_TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - WAITFORIT_CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} -WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} -WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} -WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} - -# Check to see if timeout is from busybox? -WAITFORIT_TIMEOUT_PATH=$(type -p timeout) -WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) - -WAITFORIT_BUSYTIMEFLAG="" -if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then - WAITFORIT_ISBUSY=1 - # Check if busybox timeout uses -t flag - # (recent Alpine versions don't support -t anymore) - if timeout &>/dev/stdout | grep -q -e '-t '; then - WAITFORIT_BUSYTIMEFLAG="-t" - fi -else - WAITFORIT_ISBUSY=0 -fi - -if [[ $WAITFORIT_CHILD -gt 0 ]]; then - wait_for - WAITFORIT_RESULT=$? - exit $WAITFORIT_RESULT -else - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - wait_for_wrapper - WAITFORIT_RESULT=$? - else - wait_for - WAITFORIT_RESULT=$? - fi -fi - -if [[ $WAITFORIT_CLI != "" ]]; then - if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then - echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" - exit $WAITFORIT_RESULT - fi - exec "${WAITFORIT_CLI[@]}" -else - exit $WAITFORIT_RESULT -fi diff --git a/modules/distribution/src/main/docker/pre-wm/wait-for-it.sh b/modules/distribution/src/main/docker/pre-wm/wait-for-it.sh deleted file mode 100644 index d990e0d364..0000000000 --- a/modules/distribution/src/main/docker/pre-wm/wait-for-it.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -WAITFORIT_cmdname=${0##*/} - -echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - else - echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" - fi - WAITFORIT_start_ts=$(date +%s) - while : - do - if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then - nc -z $WAITFORIT_HOST $WAITFORIT_PORT - WAITFORIT_result=$? - else - (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 - WAITFORIT_result=$? - fi - if [[ $WAITFORIT_result -eq 0 ]]; then - WAITFORIT_end_ts=$(date +%s) - echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" - break - fi - sleep 1 - done - return $WAITFORIT_result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $WAITFORIT_QUIET -eq 1 ]]; then - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - else - timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & - fi - WAITFORIT_PID=$! - trap "kill -INT -$WAITFORIT_PID" INT - wait $WAITFORIT_PID - WAITFORIT_RESULT=$? - if [[ $WAITFORIT_RESULT -ne 0 ]]; then - echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" - fi - return $WAITFORIT_RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - WAITFORIT_hostport=(${1//:/ }) - WAITFORIT_HOST=${WAITFORIT_hostport[0]} - WAITFORIT_PORT=${WAITFORIT_hostport[1]} - shift 1 - ;; - --child) - WAITFORIT_CHILD=1 - shift 1 - ;; - -q | --quiet) - WAITFORIT_QUIET=1 - shift 1 - ;; - -s | --strict) - WAITFORIT_STRICT=1 - shift 1 - ;; - -h) - WAITFORIT_HOST="$2" - if [[ $WAITFORIT_HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - WAITFORIT_HOST="${1#*=}" - shift 1 - ;; - -p) - WAITFORIT_PORT="$2" - if [[ $WAITFORIT_PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - WAITFORIT_PORT="${1#*=}" - shift 1 - ;; - -t) - WAITFORIT_TIMEOUT="$2" - if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - WAITFORIT_TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - WAITFORIT_CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} -WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} -WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} -WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} - -# Check to see if timeout is from busybox? -WAITFORIT_TIMEOUT_PATH=$(type -p timeout) -WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) - -WAITFORIT_BUSYTIMEFLAG="" -if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then - WAITFORIT_ISBUSY=1 - # Check if busybox timeout uses -t flag - # (recent Alpine versions don't support -t anymore) - if timeout &>/dev/stdout | grep -q -e '-t '; then - WAITFORIT_BUSYTIMEFLAG="-t" - fi -else - WAITFORIT_ISBUSY=0 -fi - -if [[ $WAITFORIT_CHILD -gt 0 ]]; then - wait_for - WAITFORIT_RESULT=$? - exit $WAITFORIT_RESULT -else - if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then - wait_for_wrapper - WAITFORIT_RESULT=$? - else - wait_for - WAITFORIT_RESULT=$? - fi -fi - -if [[ $WAITFORIT_CLI != "" ]]; then - if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then - echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" - exit $WAITFORIT_RESULT - fi - exec "${WAITFORIT_CLI[@]}" -else - exit $WAITFORIT_RESULT -fi diff --git a/modules/distribution/src/main/resources/distribution/bin/airavata-server.bat b/modules/distribution/src/main/resources/distribution/bin/airavata-server.bat deleted file mode 100644 index be2c584973..0000000000 --- a/modules/distribution/src/main/resources/distribution/bin/airavata-server.bat +++ /dev/null @@ -1,55 +0,0 @@ -@echo off -rem Licensed to the Apache Software Foundation (ASF) under one -rem or more contributor license agreements. See the NOTICE file -rem distributed with this work for additional information -rem regarding copyright ownership. The ASF licenses this file -rem to you under the Apache License, Version 2.0 (the -rem "License"); you may not use this file except in compliance -rem with the License. You may obtain a copy of the License at -rem -rem http://www.apache.org/licenses/LICENSE-2.0 -rem -rem Unless required by applicable law or agreed to in writing, -rem software distributed under the License is distributed on an -rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -rem KIND, either express or implied. See the License for the -rem specific language governing permissions and limitations -rem under the License. - -setlocal EnableDelayedExpansion - -call "%~dp0"setenv.bat - -:loop -if ""%1""==""-xdebug"" goto xdebug -if ""%1""==""-security"" goto security -if ""%1""=="""" goto run -goto help - -:xdebug -set JAVA_OPTS= %JAVA_OPTS% -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000 -shift -goto loop - -:security -set JAVA_OPTS=%JAVA_OPTS% -Djava.security.manager -Djava.security.policy=%AIRAVATA_HOME%\conf\axis2.policy -Daxis2.home=%AIRAVATA_HOME% -shift -goto loop - -:help -echo Usage: %0 [-options] -echo. -echo where options include: -echo -xdebug Start Airavata Server under JPDA debugger -echo -security Enable Java 2 security -echo -h Help -goto end - -:run -cd "%AIRAVATA_HOME%\bin" -set LOGO_FILE="logo.txt" -if exist "%LOGO_FILE%" type "%LOGO_FILE%" - -java %JAVA_OPTS% -classpath "%AIRAVATA_CLASSPATH%" org.apache.airavata.server.ServerMain %* - -:end diff --git a/modules/distribution/src/main/resources/distribution/bin/setenv.bat b/modules/distribution/src/main/resources/distribution/bin/setenv.bat deleted file mode 100644 index 5f1fda12a4..0000000000 --- a/modules/distribution/src/main/resources/distribution/bin/setenv.bat +++ /dev/null @@ -1,33 +0,0 @@ -rem Licensed to the Apache Software Foundation (ASF) under one -rem or more contributor license agreements. See the NOTICE file -rem distributed with this work for additional information -rem regarding copyright ownership. The ASF licenses this file -rem to you under the Apache License, Version 2.0 (the -rem "License"); you may not use this file except in compliance -rem with the License. You may obtain a copy of the License at -rem -rem http://www.apache.org/licenses/LICENSE-2.0 -rem -rem Unless required by applicable law or agreed to in writing, -rem software distributed under the License is distributed on an -rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -rem KIND, either express or implied. See the License for the -rem specific language governing permissions and limitations -rem under the License. - -@echo off - -:initialize -if "%AIRAVATA_HOME%"=="" set AIRAVATA_HOME=%~sdp0.. -SET curDrive=%cd:~0,1% -SET airavataDrive=%AIRAVATA_HOME:~0,1% -if not "%curDrive%" == "%airavataDrive%" %airavataDrive%: -goto updateClasspath - -rem ----- update classpath ----------------------------------------------------- -:updateClasspath -cd %AIRAVATA_HOME% -set AIRAVATA_CLASSPATH= -FOR %%C in ("%AIRAVATA_HOME%\lib\*.jar") DO set AIRAVATA_CLASSPATH=!AIRAVATA_CLASSPATH!;..\lib\%%~nC%%~xC - -:end \ No newline at end of file diff --git a/modules/distribution/src/main/resources/distribution/conf/airavata-server.properties b/modules/distribution/src/main/resources/distribution/conf/airavata-server.properties deleted file mode 100644 index 4bdb489b1f..0000000000 --- a/modules/distribution/src/main/resources/distribution/conf/airavata-server.properties +++ /dev/null @@ -1,249 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -api.secured=true -api.server.monitoring.enabled=True -api.server.monitoring.host=localhost -api.server.monitoring.port=9097 -apiserver.host=localhost -apiserver.min.threads=50 -apiserver.name=apiserver-node0 -apiserver.port=8930 -apiserver=org.apache.airavata.api.server.AiravataAPIServer - -appcatalog.jdbc.driver=org.mariadb.jdbc.Driver -appcatalog.jdbc.password=CHANGE_ME -appcatalog.jdbc.url=jdbc:mariadb://localhost:13306/app_catalog -appcatalog.jdbc.user=root -appcatalog.validationQuery=SELECT 1 from CONFIGURATION - -authz.cache.enabled=true -authz.cache.manager.class=org.apache.airavata.service.security.authzcache.DefaultAuthzCacheManager - -cache.enable=false - -cluster.status.monitoring.enable=false -cluster.status.monitoring.repeat.time=18000 - -credential.store.jdbc.driver=org.mariadb.jdbc.Driver -credential.store.jdbc.password=CHANGE_ME -credential.store.jdbc.url=jdbc:mariadb://localhost:13306/credential_store -credential.store.jdbc.user=root -credential.store.jdbc.validationQuery=SELECT 1 from CONFIGURATION -credential.store.keystore.alias=airavata -credential.store.keystore.password=airavata -credential.store.keystore.url=keystores/airavata.jks -credential.store.server.host=localhost -credential.store.server.port=8960 -credentialstore=org.apache.airavata.credential.store.server.CredentialStoreServer - -data.analyzer.job.scanning.enable=false -data.parser.delete.container=True - -db_event_manager=org.apache.airavata.db.event.manager.DBEventManagerRunner - -default.registry.gateway=default -default.registry.oauth.client.id=pga -default.registry.oauth.client.secret=GtRMiIQG5UJJdmmeM6iQS0BZR4Yj0gbt -default.registry.password.hash.method=SHA -default.registry.password=CHANGE_ME -default.registry.user=default-admin - -durable.queue=false - -email.based.monitor.address=monitoring.airavata@gmail.com -email.based.monitor.folder.name=INBOX -email.based.monitor.host=imap.gmail.com -email.based.monitor.password=CHANGE_ME -email.based.monitor.store.protocol=imaps -email.based.monitoring.period=10000 -email.expiration.minutes=60 -email.from=airavata@apache.org -email.password=CHANGE_ME -email.server.port=465 -email.server=smtp.googlemail.com -email.ssl=true -email.user=airavata - -embedded.mode=false -embedded.zk=false - -enable.kafka.logging=false -enable.realtime.monitor=False -enable.sharing=true -enable.streaming.transfer=False -enable.validation=true - -enactment.thread.pool.size=10 - -experiment.launch.queue.name=experiment.launch.queue - -helix.cluster.name=AiravataCluster -helix.controller.name=AiravataController -helix.participant.name=AiravataParticipant - -host.scheduler=org.apache.airavata.orchestrator.core.schedule.DefaultHostScheduler - -iam.server.super.admin.password=CHANGE_ME -iam.server.super.admin.username=admin -iam.server.url=https://auth.dev.cybershuttle.org - -in.memory.cache.size=1000 -isRunningOnAws=false - -job.monitor.broker.publisher.id=AiravataMonitorPublisher -job.monitor.email.publisher.id=EmailBasedProducer -job.monitor.realtime.publisher.id=RealtimeProducer - -job.monitor.broker.topic=monitoring-data -job.monitor.broker.url=localhost:9092 -job.notification.emailids= -job.notification.enable=true -job.notification.flags=abe -job.status.publish.endpoint=http://localhost:8082/topics/helix-airavata-mq -job.validators=org.apache.airavata.orchestrator.core.validator.impl.BatchQueueValidator,org.apache.airavata.orchestrator.core.validator.impl.ExperimentStatusValidator - -jpa.cache.size=-1 - -kafka.broker.consumer.group=MonitoringConsumer -kafka.broker.list=localhost:9092 -kafka.broker.topic=monitoring-data - -kafka.broker.url=localhost:9092 -kafka.parser.broker.consumer.group=CHANGE_ME -kafka.parser.topic=CHANGE_ME -kafka.parsing.broker.url=CHANGE_ME -kafka.topic.prefix=local - -keystore.password=airavata -keystore.path=keystores/airavata.jks - -local.data.location=/home/exouser/temp-storage - -metaschedluer.job.scanning.enable=false - -orchestrator.server.host=localhost -orchestrator.server.min.threads=50 -orchestrator.server.name=orchestrator-node0 -orchestrator.server.port=8940 -orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer - -parser.storage.resource.id=CHANGE_ME - -participant.monitoring.enabled=true -participant.monitoring.host=localhost -participant.monitoring.port=9096 - -post.workflow.manager.loadbalance.clusters=false -post.workflow.manager.monitoring.enabled=true -post.workflow.manager.monitoring.host=localhost -post.workflow.manager.monitoring.port=9094 -post.workflow.manager.name=AiravataPostWM - -pre.workflow.manager.loadbalance.clusters=false -pre.workflow.manager.monitoring.enabled=true -pre.workflow.manager.monitoring.host=localhost -pre.workflow.manager.monitoring.port=9093 -pre.workflow.manager.name=AiravataPreWM - -prefetch.count=200 - -process.launch.queue.name=process.launch.queue - -profile_service=org.apache.airavata.service.profile.server.ProfileServiceServer -profile.service.jdbc.driver=org.mariadb.jdbc.Driver -profile.service.jdbc.password=CHANGE_ME -profile.service.jdbc.url=jdbc:mariadb://localhost:13306/profile_service -profile.service.jdbc.user=root -profile.service.server.host=localhost -profile.service.server.port=8962 -profile.service.validationQuery=SELECT 1 - -rabbitmq.broker.url=amqp://guest:guest@localhost:5672/develop -rabbitmq.experiment.exchange.name=experiment_exchange -rabbitmq.process.exchange.name=process_exchange -rabbitmq.status.exchange.name=status_exchange - -realtime.monitor.broker.consumer.group=monitor -realtime.monitor.broker.topic=helix-airavata-mq -realtime.monitor.broker.url=localhost:9092 - -registry.jdbc.driver=org.mariadb.jdbc.Driver -registry.jdbc.password=CHANGE_ME -registry.jdbc.url=jdbc:mariadb://localhost:13306/experiment_catalog -registry.jdbc.user=root - -regserver.server.host=localhost -regserver.server.min.threads=50 -regserver.server.name=regserver-node0 -regserver.server.port=8970 -regserver=org.apache.airavata.registry.api.service.RegistryAPIServer - -replicacatalog.jdbc.driver=org.mariadb.jdbc.Driver -replicacatalog.jdbc.password=CHANGE_ME -replicacatalog.jdbc.url=jdbc:mariadb://localhost:13306/replica_catalog -replicacatalog.jdbc.user=root -replicacatalog.validationQuery=SELECT 1 from CONFIGURATION - -security.manager.class=org.apache.airavata.service.security.KeyCloakSecurityManager - -sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer -sharing.registry.server.host=localhost -sharing.registry.server.port=7878 -sharing.tls.enabled=false -sharingcatalog.jdbc.driver=org.mariadb.jdbc.Driver -sharingcatalog.jdbc.password=CHANGE_ME -sharingcatalog.jdbc.url=jdbc:mariadb://localhost:13306/sharing_catalog -sharingcatalog.jdbc.user=root -sharingcatalog.validationQuery=SELECT 1 from CONFIGURATION - -start.submitter=true -submitter.interval=10000 - -super.tenant.gatewayId=default - -threadpool.size=10 - -thrift.client.pool.abandoned.removal.enabled=true -thrift.client.pool.abandoned.removal.logged=false - -TLS.api.server.port=9930 -TLS.client.timeout=10000 -TLS.enabled=true - -trust.store.password=airavata -trust.store=keystores/airavata.jks - -usage.reporting.endpoint=https://xsede-xdcdb-api.xsede.org/gateway/v2/job_attributes -usage.reporting.key=CHANGE_ME -userprofile.mongodb.host=localhost -userprofile.mongodb.port=27017 - -validationQuery=SELECT 1 from CONFIGURATION - -workflowcatalog.jdbc.driver=org.mariadb.jdbc.Driver -workflowcatalog.jdbc.password=CHANGE_ME -workflowcatalog.jdbc.url=jdbc:mariadb://localhost:13306/workflow_catalog -workflowcatalog.jdbc.user=root -workflowcatalog.validationQuery=SELECT 1 from CONFIGURATION -workflowserver=org.apache.airavata.api.server.WorkflowServer - -zookeeper.server.connection=localhost:2181 -zookeeper.timeout=30000 diff --git a/modules/distribution/src/main/resources/distribution/conf/email-config.yaml b/modules/distribution/src/main/resources/distribution/conf/email-config.yaml deleted file mode 100644 index 3a80bf83fd..0000000000 --- a/modules/distribution/src/main/resources/distribution/conf/email-config.yaml +++ /dev/null @@ -1,56 +0,0 @@ -config: - resources: - - jobManagerType: PBS - emailParser: org.apache.airavata.monitor.email.parser.PBSEmailParser - resourceEmailAddresses: - - pbsconsult@sdsc.edu # gordon - - adm@trident.bigred2.uits.iu.edu # Bigred2 - - root # Bigred2 - - root # alamo - - root #mason - - smic3 # philip.hpc.lsu - - adm@jetstream-cloud.org - - root #alamo - - adm@s1.carbonate.uits.iu.edu - - - jobManagerType: SLURM - emailParser: org.apache.airavata.monitor.email.parser.SLURMEmailParser - resourceEmailAddresses: - - SDSC Admin # comet - - slurm@batch1.stampede.tacc.utexas.edu # stampede - - slurm@helix-slurm-headnode.novalocal - - slurm@comet-fe4.sdsc.edu - - Slurm # bridges - - Slurm Daemon # OU Schooner - - slurm@lnet28.stampede.tacc.utexas.edu # stampede2 - - Slurm service account # Utah Ember - - SLURM workload manager # JS Mark Cluster - - root@master.ls5.tacc.utexas.edu - - batch-jsc@fz-juelich.de # Jureca Email - - Slurm - - slurm@jetstream-cloud.org - - slurm@slurm-example.novalocal - - slurm@tutorial-headnode.novalocal # Jetstream Ultrascan static cluster with 10 nodes - - slurm@batch1.stampede2.tacc.utexas.edu #Stampede2 - - slurm@sra-master.jetstreamlocal #Searching SRA - - Slurm Admin #GSU cluster - - slurm@head.cluster #USD cluster - - slurm@js-169-158.jetstream-cloud.org - - slurm@joker.nmsu.edu - - - jobManagerType: UGE - emailParser: org.apache.airavata.monitor.email.parser.UGEEmailParser - resourceEmailAddresses: - - ls4.tacc.utexas.edu # contain Lonestar - - root # USD HPC Cluster - - root # SIU Little Dog - - sge@bigdog.research.siu.edu # SIU Big Dog - - root # USD HPC Cluster - - - jobManagerType: HTCONDOR - emailParser: org.apache.airavata.monitor.email.parser.HTCondorEmailParser - resourceEmailAddresses: - - condor@js-169-152.jetstream-cloud.org - - Owner of HTCondor Daemons #EHT Condor Access point - - Owner of HTCondor Daemons - - slurm@br003.ib.bridges2.psc.edu # AutoDock_Vina \ No newline at end of file diff --git a/modules/distribution/src/main/resources/distribution/conf/log4j2.xml b/modules/distribution/src/main/resources/distribution/conf/log4j2.xml deleted file mode 100644 index 2af1a20101..0000000000 --- a/modules/distribution/src/main/resources/distribution/conf/log4j2.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - %d [%t] %-5p %c{30} %X - %m%n - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/file-server/src/main/resources/application.properties b/modules/file-server/src/main/resources/application.properties index 3d5477b4dd..d6dc1ad2c7 100644 --- a/modules/file-server/src/main/resources/application.properties +++ b/modules/file-server/src/main/resources/application.properties @@ -1,12 +1,9 @@ spring.servlet.multipart.max-file-size=10MB -# max request size spring.servlet.multipart.max-request-size=10MB -# files storage location (stores all files uploaded via REST API) -storage.location=./uploads -regserver.server.host=localhost +regserver.server.host=airavata.host regserver.server.port=8970 -credential.store.server.host=localhost +credential.store.server.host=airavata.host credential.store.server.port=8960 server.port=8050 diff --git a/modules/file-server/src/main/resources/distribution/conf/.gitkeep b/modules/file-server/src/main/resources/distribution/conf/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/modules/file-server/src/main/resources/distribution/conf/application.properties b/modules/file-server/src/main/resources/distribution/conf/application.properties deleted file mode 100644 index 3d5477b4dd..0000000000 --- a/modules/file-server/src/main/resources/distribution/conf/application.properties +++ /dev/null @@ -1,12 +0,0 @@ -spring.servlet.multipart.max-file-size=10MB -# max request size -spring.servlet.multipart.max-request-size=10MB -# files storage location (stores all files uploaded via REST API) -storage.location=./uploads - -regserver.server.host=localhost -regserver.server.port=8970 -credential.store.server.host=localhost -credential.store.server.port=8960 - -server.port=8050 diff --git a/modules/file-server/src/main/resources/distribution/conf/log4j2.xml b/modules/file-server/src/main/resources/log4j2.xml similarity index 73% rename from modules/file-server/src/main/resources/distribution/conf/log4j2.xml rename to modules/file-server/src/main/resources/log4j2.xml index 29b7e7258e..8fb27b1b68 100644 --- a/modules/file-server/src/main/resources/distribution/conf/log4j2.xml +++ b/modules/file-server/src/main/resources/log4j2.xml @@ -25,18 +25,6 @@ - - - %d [%t] %-5p %c{30} %X - %m%n - - - - - - - - @@ -46,7 +34,6 @@ - \ No newline at end of file diff --git a/modules/ide-integration/README.md b/modules/ide-integration/README.md index 7c990b290d..40ab393d7d 100644 --- a/modules/ide-integration/README.md +++ b/modules/ide-integration/README.md @@ -238,12 +238,17 @@ Only needed when Keycloak certificates expire: cd modules/ide-integration/src/main/resources/keystores # Remove old keystore -rm airavata.jks +rm airavata.p12 -# Generate new keystore (airavata.jks) -keytool -genkey -keyalg RSA -alias selfsigned -keystore airavata.jks \ +# Generate new keystore (airavata.p12) +keytool -genkey -keyalg RSA -alias selfsigned -keystore airavata.p12 \ -storetype pkcs12 -storepass airavata -validity 360 -keysize 2048 \ -dname "CN=airavata.host,OU=airavata.host,O=airavata.host,L=airavata.host,ST=airavata.host,C=airavata.host" + +# Generate self-signed key-pair (for TLS) +openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt \ + -subj "/CN=airavata.host/OU=airavata.host/O=airavata.host/L=airavata.host/ST=airavata.host/C=airavata.host" \ + -addext "subjectAltName=DNS:airavata.host" ``` ## 📊 Service Status Overview diff --git a/modules/ide-integration/pom.xml b/modules/ide-integration/pom.xml index 70bad679c9..67857b0257 100644 --- a/modules/ide-integration/pom.xml +++ b/modules/ide-integration/pom.xml @@ -43,12 +43,6 @@ under the License. - - src/main/resources - - pga/** - - ../../keystores keystores diff --git a/modules/ide-integration/src/main/resources/airavata-server.properties b/modules/ide-integration/src/main/resources/airavata-server.properties deleted file mode 100644 index 4bdb489b1f..0000000000 --- a/modules/ide-integration/src/main/resources/airavata-server.properties +++ /dev/null @@ -1,249 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -api.secured=true -api.server.monitoring.enabled=True -api.server.monitoring.host=localhost -api.server.monitoring.port=9097 -apiserver.host=localhost -apiserver.min.threads=50 -apiserver.name=apiserver-node0 -apiserver.port=8930 -apiserver=org.apache.airavata.api.server.AiravataAPIServer - -appcatalog.jdbc.driver=org.mariadb.jdbc.Driver -appcatalog.jdbc.password=CHANGE_ME -appcatalog.jdbc.url=jdbc:mariadb://localhost:13306/app_catalog -appcatalog.jdbc.user=root -appcatalog.validationQuery=SELECT 1 from CONFIGURATION - -authz.cache.enabled=true -authz.cache.manager.class=org.apache.airavata.service.security.authzcache.DefaultAuthzCacheManager - -cache.enable=false - -cluster.status.monitoring.enable=false -cluster.status.monitoring.repeat.time=18000 - -credential.store.jdbc.driver=org.mariadb.jdbc.Driver -credential.store.jdbc.password=CHANGE_ME -credential.store.jdbc.url=jdbc:mariadb://localhost:13306/credential_store -credential.store.jdbc.user=root -credential.store.jdbc.validationQuery=SELECT 1 from CONFIGURATION -credential.store.keystore.alias=airavata -credential.store.keystore.password=airavata -credential.store.keystore.url=keystores/airavata.jks -credential.store.server.host=localhost -credential.store.server.port=8960 -credentialstore=org.apache.airavata.credential.store.server.CredentialStoreServer - -data.analyzer.job.scanning.enable=false -data.parser.delete.container=True - -db_event_manager=org.apache.airavata.db.event.manager.DBEventManagerRunner - -default.registry.gateway=default -default.registry.oauth.client.id=pga -default.registry.oauth.client.secret=GtRMiIQG5UJJdmmeM6iQS0BZR4Yj0gbt -default.registry.password.hash.method=SHA -default.registry.password=CHANGE_ME -default.registry.user=default-admin - -durable.queue=false - -email.based.monitor.address=monitoring.airavata@gmail.com -email.based.monitor.folder.name=INBOX -email.based.monitor.host=imap.gmail.com -email.based.monitor.password=CHANGE_ME -email.based.monitor.store.protocol=imaps -email.based.monitoring.period=10000 -email.expiration.minutes=60 -email.from=airavata@apache.org -email.password=CHANGE_ME -email.server.port=465 -email.server=smtp.googlemail.com -email.ssl=true -email.user=airavata - -embedded.mode=false -embedded.zk=false - -enable.kafka.logging=false -enable.realtime.monitor=False -enable.sharing=true -enable.streaming.transfer=False -enable.validation=true - -enactment.thread.pool.size=10 - -experiment.launch.queue.name=experiment.launch.queue - -helix.cluster.name=AiravataCluster -helix.controller.name=AiravataController -helix.participant.name=AiravataParticipant - -host.scheduler=org.apache.airavata.orchestrator.core.schedule.DefaultHostScheduler - -iam.server.super.admin.password=CHANGE_ME -iam.server.super.admin.username=admin -iam.server.url=https://auth.dev.cybershuttle.org - -in.memory.cache.size=1000 -isRunningOnAws=false - -job.monitor.broker.publisher.id=AiravataMonitorPublisher -job.monitor.email.publisher.id=EmailBasedProducer -job.monitor.realtime.publisher.id=RealtimeProducer - -job.monitor.broker.topic=monitoring-data -job.monitor.broker.url=localhost:9092 -job.notification.emailids= -job.notification.enable=true -job.notification.flags=abe -job.status.publish.endpoint=http://localhost:8082/topics/helix-airavata-mq -job.validators=org.apache.airavata.orchestrator.core.validator.impl.BatchQueueValidator,org.apache.airavata.orchestrator.core.validator.impl.ExperimentStatusValidator - -jpa.cache.size=-1 - -kafka.broker.consumer.group=MonitoringConsumer -kafka.broker.list=localhost:9092 -kafka.broker.topic=monitoring-data - -kafka.broker.url=localhost:9092 -kafka.parser.broker.consumer.group=CHANGE_ME -kafka.parser.topic=CHANGE_ME -kafka.parsing.broker.url=CHANGE_ME -kafka.topic.prefix=local - -keystore.password=airavata -keystore.path=keystores/airavata.jks - -local.data.location=/home/exouser/temp-storage - -metaschedluer.job.scanning.enable=false - -orchestrator.server.host=localhost -orchestrator.server.min.threads=50 -orchestrator.server.name=orchestrator-node0 -orchestrator.server.port=8940 -orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer - -parser.storage.resource.id=CHANGE_ME - -participant.monitoring.enabled=true -participant.monitoring.host=localhost -participant.monitoring.port=9096 - -post.workflow.manager.loadbalance.clusters=false -post.workflow.manager.monitoring.enabled=true -post.workflow.manager.monitoring.host=localhost -post.workflow.manager.monitoring.port=9094 -post.workflow.manager.name=AiravataPostWM - -pre.workflow.manager.loadbalance.clusters=false -pre.workflow.manager.monitoring.enabled=true -pre.workflow.manager.monitoring.host=localhost -pre.workflow.manager.monitoring.port=9093 -pre.workflow.manager.name=AiravataPreWM - -prefetch.count=200 - -process.launch.queue.name=process.launch.queue - -profile_service=org.apache.airavata.service.profile.server.ProfileServiceServer -profile.service.jdbc.driver=org.mariadb.jdbc.Driver -profile.service.jdbc.password=CHANGE_ME -profile.service.jdbc.url=jdbc:mariadb://localhost:13306/profile_service -profile.service.jdbc.user=root -profile.service.server.host=localhost -profile.service.server.port=8962 -profile.service.validationQuery=SELECT 1 - -rabbitmq.broker.url=amqp://guest:guest@localhost:5672/develop -rabbitmq.experiment.exchange.name=experiment_exchange -rabbitmq.process.exchange.name=process_exchange -rabbitmq.status.exchange.name=status_exchange - -realtime.monitor.broker.consumer.group=monitor -realtime.monitor.broker.topic=helix-airavata-mq -realtime.monitor.broker.url=localhost:9092 - -registry.jdbc.driver=org.mariadb.jdbc.Driver -registry.jdbc.password=CHANGE_ME -registry.jdbc.url=jdbc:mariadb://localhost:13306/experiment_catalog -registry.jdbc.user=root - -regserver.server.host=localhost -regserver.server.min.threads=50 -regserver.server.name=regserver-node0 -regserver.server.port=8970 -regserver=org.apache.airavata.registry.api.service.RegistryAPIServer - -replicacatalog.jdbc.driver=org.mariadb.jdbc.Driver -replicacatalog.jdbc.password=CHANGE_ME -replicacatalog.jdbc.url=jdbc:mariadb://localhost:13306/replica_catalog -replicacatalog.jdbc.user=root -replicacatalog.validationQuery=SELECT 1 from CONFIGURATION - -security.manager.class=org.apache.airavata.service.security.KeyCloakSecurityManager - -sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer -sharing.registry.server.host=localhost -sharing.registry.server.port=7878 -sharing.tls.enabled=false -sharingcatalog.jdbc.driver=org.mariadb.jdbc.Driver -sharingcatalog.jdbc.password=CHANGE_ME -sharingcatalog.jdbc.url=jdbc:mariadb://localhost:13306/sharing_catalog -sharingcatalog.jdbc.user=root -sharingcatalog.validationQuery=SELECT 1 from CONFIGURATION - -start.submitter=true -submitter.interval=10000 - -super.tenant.gatewayId=default - -threadpool.size=10 - -thrift.client.pool.abandoned.removal.enabled=true -thrift.client.pool.abandoned.removal.logged=false - -TLS.api.server.port=9930 -TLS.client.timeout=10000 -TLS.enabled=true - -trust.store.password=airavata -trust.store=keystores/airavata.jks - -usage.reporting.endpoint=https://xsede-xdcdb-api.xsede.org/gateway/v2/job_attributes -usage.reporting.key=CHANGE_ME -userprofile.mongodb.host=localhost -userprofile.mongodb.port=27017 - -validationQuery=SELECT 1 from CONFIGURATION - -workflowcatalog.jdbc.driver=org.mariadb.jdbc.Driver -workflowcatalog.jdbc.password=CHANGE_ME -workflowcatalog.jdbc.url=jdbc:mariadb://localhost:13306/workflow_catalog -workflowcatalog.jdbc.user=root -workflowcatalog.validationQuery=SELECT 1 from CONFIGURATION -workflowserver=org.apache.airavata.api.server.WorkflowServer - -zookeeper.server.connection=localhost:2181 -zookeeper.timeout=30000 diff --git a/modules/ide-integration/src/main/resources/email-config.yaml b/modules/ide-integration/src/main/resources/email-config.yaml deleted file mode 100644 index 1854320ff1..0000000000 --- a/modules/ide-integration/src/main/resources/email-config.yaml +++ /dev/null @@ -1,56 +0,0 @@ -config: - resources: - - jobManagerType: PBS - emailParser: org.apache.airavata.monitor.email.parser.PBSEmailParser - resourceEmailAddresses: - - pbsconsult@sdsc.edu # gordon - - adm@trident.bigred2.uits.iu.edu # Bigred2 - - root # Bigred2 - - root # alamo - - root #mason - - smic3 # philip.hpc.lsu - - adm@jetstream-cloud.org - - root #alamo - - - jobManagerType: SLURM - emailParser: org.apache.airavata.monitor.email.parser.SLURMEmailParser - resourceEmailAddresses: - - SDSC Admin # comet - - slurm@batch1.stampede.tacc.utexas.edu # stampede - - slurm@helix-slurm-headnode.novalocal - - slurm@comet-fe4.sdsc.edu - - Slurm # bridges - - Slurm Daemon # OU Schooner - - slurm@lnet28.stampede.tacc.utexas.edu # stampede2 - - Slurm service account # Utah Ember - - SLURM workload manager # JS Mark Cluster - - root@master.ls5.tacc.utexas.edu - - batch-jsc@fz-juelich.de # Jureca Email - - Slurm - - slurm@jetstream-cloud.org - - slurm@slurm-example.novalocal - - slurm@tutorial-headnode.novalocal # Jetstream Ultrascan static cluster with 10 nodes - - slurm@batch1.stampede2.tacc.utexas.edu #Stampede2 - - slurm@sra-master.jetstreamlocal #Searching SRA - - Slurm Admin #GSU cluster - - slurm@head.cluster #USD cluster - - slurm@js-169-158.jetstream-cloud.org - - slurm@joker.nmsu.edu - - root@ls5.tacc.utexas.edu - - - jobManagerType: UGE - emailParser: org.apache.airavata.monitor.email.parser.UGEEmailParser - resourceEmailAddresses: - - ls4.tacc.utexas.edu # contain Lonestar - - root # USD HPC Cluster - - root # SIU Little Dog - - sge@bigdog.research.siu.edu # SIU Big Dog - - root # USD HPC Cluster - - - jobManagerType: HTCONDOR - emailParser: org.apache.airavata.monitor.email.parser.HTCondorEmailParser - resourceEmailAddresses: - - condor@js-169-152.jetstream-cloud.org - - Owner of HTCondor Daemons #EHT Condor Access point - - Owner of HTCondor Daemons - - slurm@br003.ib.bridges2.psc.edu # AutoDock_Vina \ No newline at end of file diff --git a/modules/ide-integration/src/main/resources/log4j2.xml b/modules/ide-integration/src/main/resources/log4j2.xml deleted file mode 100644 index f817dc3655..0000000000 --- a/modules/ide-integration/src/main/resources/log4j2.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - %d [%t] %-5p %c{30} %X - %m%n - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/research-framework/research-hub/compose/Dockerfile b/modules/research-framework/research-hub/compose/Dockerfile index 91ea866fc6..16acfa9aae 100644 --- a/modules/research-framework/research-hub/compose/Dockerfile +++ b/modules/research-framework/research-hub/compose/Dockerfile @@ -16,6 +16,6 @@ RUN mkdir -p /home/jovyan/notebooks && \ ENV JUPYTERHUB_CONFIG=/srv/jupyterhub/jupyterhub_config.py ENV PYTHONPATH=/srv/jupyterhub -EXPOSE 8000 +EXPOSE 20000 CMD ["jupyterhub"] \ No newline at end of file diff --git a/modules/research-framework/research-hub/compose/custom_templates/login.html b/modules/research-framework/research-hub/compose/custom_templates/login.html index faf6fcfa52..d7834044c8 100644 --- a/modules/research-framework/research-hub/compose/custom_templates/login.html +++ b/modules/research-framework/research-hub/compose/custom_templates/login.html @@ -3,8 +3,8 @@ CyberShuttle Hub Login - - + +