This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
The following commit(s) were added to refs/heads/master by this push:
new c94f57b32 custos distribution
c94f57b32 is described below
commit c94f57b32f9c0df9751452c0bc269ab87d0223fb
Author: lahiruj <[email protected]>
AuthorDate: Thu Dec 5 18:36:34 2024 -0500
custos distribution
---
application/pom.xml | 21 ++--
.../src/main/assembly/custos-bin-assembly.xml | 91 +++++++++++++++++
.../resources/distribution/bin/custos-daemon.sh | 112 +++++++++++++++++++++
.../src/main/resources/distribution/bin/custos.sh | 70 +++++++++++++
.../src/main/resources/distribution/bin/setenv.sh | 46 +++++++++
.../resources/distribution/conf/application.yml | 105 +++++++++++++++++++
.../resources/distribution/conf/logback-spring.xml | 58 +++++++++++
application/src/main/resources/keys/public_key.pem | 9 --
pom.xml | 1 +
9 files changed, 497 insertions(+), 16 deletions(-)
diff --git a/application/pom.xml b/application/pom.xml
index 9b37ecca5..d0b824987 100644
--- a/application/pom.xml
+++ b/application/pom.xml
@@ -66,19 +66,26 @@
<build>
<plugins>
<plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <version>${spring.boot.version}</version>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${maven.assembly.plugin}</version>
<executions>
<execution>
+ <id>custos-distribution-package</id>
+ <phase>package</phase>
<goals>
- <goal>repackage</goal>
+ <goal>single</goal>
</goals>
+ <configuration>
+ <tarLongFileMode>posix</tarLongFileMode>
+ <finalName>${custos.dist.name}</finalName>
+ <descriptors>
+
<descriptor>src/main/assembly/custos-bin-assembly.xml</descriptor>
+ </descriptors>
+ <attach>false</attach>
+ </configuration>
</execution>
</executions>
- <configuration>
- <executable>true</executable>
- </configuration>
</plugin>
</plugins>
</build>
diff --git a/application/src/main/assembly/custos-bin-assembly.xml
b/application/src/main/assembly/custos-bin-assembly.xml
new file mode 100644
index 000000000..c1d74e065
--- /dev/null
+++ b/application/src/main/assembly/custos-bin-assembly.xml
@@ -0,0 +1,91 @@
+
+<!--
+
+ 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.
+
+-->
+<!DOCTYPE assembly [
+ <!ELEMENT assembly
(id|includeBaseDirectory|baseDirectory|formats|fileSets|dependencySets)*>
+ <!ELEMENT id (#PCDATA)>
+ <!ELEMENT includeBaseDirectory (#PCDATA)>
+ <!ELEMENT baseDirectory (#PCDATA)>
+ <!ELEMENT formats (format)*>
+ <!ELEMENT format (#PCDATA)>
+ <!ELEMENT fileSets (fileSet)*>
+ <!ELEMENT fileSet (directory|outputDirectory|fileMode|includes)*>
+ <!ELEMENT directory (#PCDATA)>
+ <!ELEMENT outputDirectory (#PCDATA)>
+ <!ELEMENT includes (include)*>
+ <!ELEMENT include (#PCDATA)>
+ <!ELEMENT dependencySets (dependencySet)*>
+ <!ELEMENT dependencySet
(outputDirectory|outputFileNameMapping|includes)*>
+ ]>
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>${custos.dist.name}</baseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources/distribution/bin</directory>
+ <outputDirectory>bin</outputDirectory>
+ <fileMode>777</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources/distribution/conf</directory>
+ <outputDirectory>conf</outputDirectory>
+ <includes>
+ <include>application.yml</include>
+ <include>truststore.jks</include>
+ <include>logback-spring.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>./</directory>
+ <outputDirectory>logs</outputDirectory>
+ <excludes>
+ <exclude>*/**</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
diff --git a/application/src/main/resources/distribution/bin/custos-daemon.sh
b/application/src/main/resources/distribution/bin/custos-daemon.sh
new file mode 100755
index 000000000..089da6f0b
--- /dev/null
+++ b/application/src/main/resources/distribution/bin/custos-daemon.sh
@@ -0,0 +1,112 @@
+#!/usr/bin/env bash
+
+# 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.
+
+. `dirname $0`/setenv.sh
+# Capture user's working dir before changing directory
+CWD="$PWD"
+cd ${AIRAVATA_HOME}/bin
+LOGO_FILE="logo.txt"
+
+JAVA_OPTS="-Dspring.config.location=${AIRAVATA_HOME}/conf/
-Dairavata.home=${AIRAVATA_HOME}
-Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback-spring.xml"
+AIRAVATA_COMMAND=""
+EXTRA_ARGS=""
+SERVERS=""
+LOGO=true
+IS_SUBSET=false
+SUBSET=""
+DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/custos-daemon.out"
+LOG_FILE=$DEFAULT_LOG_FILE
+
+SERVICE_NAME="Custos Service"
+PID_PATH_NAME="${AIRAVATA_HOME}/bin/service-pid"
+
+case $1 in
+ start)
+ echo "Starting $SERVICE_NAME ..."
+ if [ ! -f $PID_PATH_NAME ]; then
+ nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+ org.apache.custos.CustosApplication ${AIRAVATA_COMMAND} $* >
$LOG_FILE 2>&1 &
+ echo $! > $PID_PATH_NAME
+ echo "$SERVICE_NAME started ..."
+ else
+ echo "$SERVICE_NAME is already running ..."
+ fi
+ ;;
+ stop)
+ if [ -f $PID_PATH_NAME ]; then
+ PID=$(cat $PID_PATH_NAME);
+ echo "$SERVICE_NAME stopping ..."
+ kill $PID;
+ RETRY=0
+ while kill -0 $PID 2> /dev/null; do
+ echo "Waiting for the process $PID to be stopped"
+ RETRY=`expr ${RETRY} + 1`
+ if [ "${RETRY}" -gt "20" ]
+ then
+ echo "Forcefully killing the process as it is not
responding ..."
+ kill -9 $PID
+ fi
+ sleep 1
+ done
+ echo "$SERVICE_NAME stopped ..."
+ rm $PID_PATH_NAME
+ else
+ echo "$SERVICE_NAME is not running ..."
+ fi
+ ;;
+ restart)
+ if [ -f $PID_PATH_NAME ]; then
+ PID=$(cat $PID_PATH_NAME);
+ echo "$SERVICE_NAME stopping ...";
+ kill $PID;
+ RETRY=0
+ while kill -0 $PID 2> /dev/null; do
+ echo "Waiting for the process $PID to be stopped"
+ RETRY=`expr ${RETRY} + 1`
+ if [ "${RETRY}" -gt "20" ]
+ then
+ echo "Forcefully killing the process as it is not
responding ..."
+ kill -9 $PID
+ fi
+ sleep 1
+ done
+ echo "$SERVICE_NAME stopped ...";
+ rm $PID_PATH_NAME
+ echo "$SERVICE_NAME starting ..."
+ nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+ org.apache.custos.CustosApplication ${AIRAVATA_COMMAND} $* >
$LOG_FILE 2>&1 &
+ echo $! > $PID_PATH_NAME
+ echo "$SERVICE_NAME started ..."
+ else
+ echo "$SERVICE_NAME is not running ..."
+ fi
+ ;;
+ -h)
+ echo "Usage: custos-daemon.sh"
+
+ echo "command options:"
+ echo " start Start server in daemon mode"
+ echo " stop Stop server running in daemon mode"
+ echo " restart Restart server in daemon mode"
+ echo " -log <LOG_FILE> Where to redirect stdout/stderr
(defaults to $DEFAULT_LOG_FILE)"
+ echo " -h Display this help and exit"
+ shift
+ exit 0
+ ;;
+esac
\ No newline at end of file
diff --git a/application/src/main/resources/distribution/bin/custos.sh
b/application/src/main/resources/distribution/bin/custos.sh
new file mode 100755
index 000000000..cd0653d62
--- /dev/null
+++ b/application/src/main/resources/distribution/bin/custos.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+
+# 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.
+
+. `dirname $0`/setenv.sh
+# Capture user's working dir before changing directory
+CWD="$PWD"
+cd ${AIRAVATA_HOME}/bin
+LOGO_FILE="logo.txt"
+
+JAVA_OPTS="-Dspring.config.location=${AIRAVATA_HOME}/conf/
-Dairavata.home=${AIRAVATA_HOME}
-Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback-spring.xml"
+AIRAVATA_COMMAND=""
+EXTRA_ARGS=""
+SERVERS=""
+IS_SUBSET=false
+SUBSET=""
+DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/custos.out"
+LOG_FILE=$DEFAULT_LOG_FILE
+
+# parse command arguments
+for var in "$@"
+do
+ case ${var} in
+ -xdebug)
+ AIRAVATA_COMMAND="${AIRAVATA_COMMAND}"
+ JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,address=*:8000"
+ shift
+ ;;
+ -log)
+ shift
+ LOG_FILE="$1"
+ shift
+ # If relative path, expand to absolute path using the user's $CWD
+ if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then
+ LOG_FILE="${CWD}/${LOG_FILE}"
+ fi
+ ;;
+ -h)
+ echo "Usage: custos.sh"
+
+ echo "command options:"
+ echo " -xdebug Start Custos Service under JPDA
debugger"
+ echo " -h Display this help and exit"
+ shift
+ exit 0
+ ;;
+ *)
+ EXTRA_ARGS="${EXTRA_ARGS} ${var}"
+ shift
+ ;;
+ esac
+done
+
+java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
+ org.apache.custos.CustosApplication ${AIRAVATA_COMMAND} $*
\ No newline at end of file
diff --git a/application/src/main/resources/distribution/bin/setenv.sh
b/application/src/main/resources/distribution/bin/setenv.sh
new file mode 100755
index 000000000..3f1d7632b
--- /dev/null
+++ b/application/src/main/resources/distribution/bin/setenv.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# 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.
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+
+# Only set AIRAVATA_HOME if not already set
+[ -z "$AIRAVATA_HOME" ] && AIRAVATA_HOME=`cd "$PRGDIR/.." ; pwd`
+
+AIRAVATA_CLASSPATH=""
+
+for f in "$AIRAVATA_HOME"/lib/*.jar
+do
+ AIRAVATA_CLASSPATH="$AIRAVATA_CLASSPATH":$f
+done
+
+export AIRAVATA_HOME
+export AIRAVATA_CLASSPATH
\ No newline at end of file
diff --git a/application/src/main/resources/distribution/conf/application.yml
b/application/src/main/resources/distribution/conf/application.yml
new file mode 100644
index 000000000..f3e563e29
--- /dev/null
+++ b/application/src/main/resources/distribution/conf/application.yml
@@ -0,0 +1,105 @@
+# 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.
+#
+
+server:
+ port: 8081
+
+custos:
+ region: "local"
+ identity:
+ auth:
+ cache:
+ enabled: false
+ size: 1024
+ credential:
+ prefix: custos-
+ tenant:
+ base:
+ uri: http://localhost/api/v1/tenant-management/oauth2/tenant
+ api:
+ domain: "http://localhost:8081"
+
+spring:
+ application:
+ name: custos-playground
+ datasource:
+ url: "jdbc:mysql://localhost:3306/custos"
+ username: admin
+ password: admin
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ jpa:
+ hibernate:
+ ddl-auto: update
+ show-sql: false
+ database-platform: org.hibernate.dialect.MySQL8Dialect
+ cloud:
+ vault:
+ token: 00000000-0000-0000-0000-000000000000 # Update this with your token
+ scheme: http
+ kv:
+ enabled: true
+ host: localhost
+ port: 8200
+ authentication: token
+ connection-timeout: 5000
+ read-timeout: 15000
+ profiles:
+ active: local
+
+logging:
+ pattern:
+ level: '%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]'
+ level:
+ root: info
+
+iam:
+ server:
+ client:
+ id: admin-cli
+ url: http://localhost:8080/
+ admin:
+ username: admin
+ password: admin
+ super:
+ admin:
+ realm:
+ id: master
+ federated:
+ cilogon:
+ authorization:
+ endpoint: https://cilogon.org/authorize
+ token:
+ endpoint: https://cilogon.org/oauth2/token
+ userinfo:
+ endpoint: https://cilogon.org/oauth2/userinfo
+ issuer: https://cilogon.org
+ jwksUri: https://cilogon.org/oauth2/certs
+
+ciLogon:
+ admin:
+ client:
+ id: abc
+ secret: 1234
+ auth:
+ endpoint: https://test.cilogon.org/oauth2/oidc-cm
+ institutions:
+ endpoint: https://cilogon.org/idplist/
+
+springdoc:
+ swagger-ui:
+ title: CUSTOS API
+ oauth:
+ use-pkce-with-authorization-code-grant: true
\ No newline at end of file
diff --git
a/application/src/main/resources/distribution/conf/logback-spring.xml
b/application/src/main/resources/distribution/conf/logback-spring.xml
new file mode 100644
index 000000000..12efe6b30
--- /dev/null
+++ b/application/src/main/resources/distribution/conf/logback-spring.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+
+<configuration>
+ <include resource="org/springframework/boot/logging/logback/base.xml"/>
+ <springProperty scope="context" name="appName"
source="spring.application.name"/>
+ <springProperty scope="context" name="regionName" source="custos.region"/>
+
+ <!-- Rolling File Appender -->
+ <appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>logs/custos-application.log</file>
+ <encoder>
+ <pattern>%date{YYYY-MM-dd HH:mm:ss.SSS} region=${regionName},
app=${appName}, host=${HOSTNAME}, traceID=%X{traceId:-NONE}, level=%-5level,
[%thread] %logger{36} - %msg%n</pattern>
+ </encoder>
+ <rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+
<fileNamePattern>logs/%d{yyyy-MM}/custos-application-log-%d{MM-dd-yyyy}-%i.log.gz</fileNamePattern>
+ <maxFileSize>10MB</maxFileSize>
+ <!-- number of days to keep the log files -->
+ <maxHistory>30</maxHistory>
+ <!-- If the total size of all log files exceeds this value, the
oldest files will be removed -->
+ <totalSizeCap>1GB</totalSizeCap>
+ </rollingPolicy>
+ </appender>
+
+ <!-- Asynchronous Rolling File Appender -->
+ <appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="FILE"/>
+ <queueSize>500</queueSize>
+ <discardingThreshold>0</discardingThreshold>
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+ <logger name="org.hibernate" level="ERROR"/>
+ <logger name="org.springframework" level="INFO"/>
+
+ <root level="INFO">
+ <appender-ref ref="ASYNC_FILE"/>
+ </root>
+</configuration>
diff --git a/application/src/main/resources/keys/public_key.pem
b/application/src/main/resources/keys/public_key.pem
deleted file mode 100644
index a0cd4531c..000000000
--- a/application/src/main/resources/keys/public_key.pem
+++ /dev/null
@@ -1,9 +0,0 @@
------BEGIN PUBLIC KEY-----
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzMeDgSU7m9R2Y8dOnGNA
-cFb5cod0Re3w02S04SCs7r1XzNT6APkDSl1YvFWVuRcjmFB1MGDiqUAyHnARruJX
-Zwvy2BlAGhEKc4mRbEkWTBn/y+pPSHPLNJ6YzIN0Pp8f9Wd3P10zzWED91b5tXcJ
-pYdaO+4pZ+rj7eb99A+Rg5mvmeiZDndUQGNORg8ofkJ5Rba5c6GDmgVuqIYvQ9cj
-SCw9mmCWbA9Sa62ulzz0oBG7KiEExyfwZRmcH5hcX4itqg5b2qPMod//VLCdap4I
-b7Jkzz0hGQ2EohBLe6thV4yFJung2yXZFK6bvJjo2WAK9DgBDEGThpx0UWqpksKx
-NwIDAQAB
------END PUBLIC KEY-----
diff --git a/pom.xml b/pom.xml
index a24453ab5..bfc59cac1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -216,6 +216,7 @@
<project.version>1.1-SNAPSHOT</project.version>
<clusterIssuer>letsencrypt-prod</clusterIssuer>
<jakarta.ws.version>4.0.0</jakarta.ws.version>
+
<custos.dist.name>apache-airavata-custos-${project.version}</custos.dist.name>
</properties>
<repositories>