Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/get-firefly
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
INSTALL_SCRIPT="https://raw.githubusercontent.com/Caltech-IPAC/firefly/refs/heads/dev/bin/install.sh"
#todo remove next line before PR merge
INSTALL_SCRIPT="https://raw.githubusercontent.com/Caltech-IPAC/firefly/refs/heads/FIREFLY-1980-standalone/bin/install.sh"

curl -s ${INSTALL_SCRIPT} > ./install.sh
chmod +x ./install.sh
./install.sh -dontConfirm "$@"
/bin/rm -f ./install.sh
173 changes: 173 additions & 0 deletions bin/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#!/bin/bash

defaultInstallRelativePath="firefly"
INSTALL_DIR="$PWD/$defaultInstallRelativePath"
fireflyDir="${HOME}/.firefly"
applicationPath="current"
url=

startScript="ff"
altUrl=
installJre="TRUE"
initialInstall="TRUE"
installType="installing"
doExit="FALSE"
doHelp="FALSE"
confirm="TRUE"
firstInvalid="TRUE"
space=" "

echo "params: " $*



isTrue() {
if [[ "$1" == "TRUE" || "$1" == "T" || "$1" == "true" || "$1" == "t" ]]; then
return 0; #true
else
return 1; #false
fi
}

while [ $# -gt 0 ]; do
arg="$1"
if [[ "$arg" == "-url" ]]; then
shift
altUrl=$1
elif [[ "$arg" == "-installDir" ]]; then
shift
enteredPath=$1
mkdir -p "$enteredPath"
INSTALL_DIR=$(realpath "$1")
elif [[ "$arg" == "-asUpdate" ]]; then
installJre="FALSE"
initialInstall="FALSE"
applicationPath="new"
installType="updating"
elif [[ "$arg" == "-dontConfirm" ]]; then
confirm="FALSE"
elif [[ "$arg" == "--help" || "$arg" == "-h" ]]; then
doHelp="TRUE"
doExit="TRUE"
else
if isTrue $firstInvalid; then
echo "Invalid arguments passed."
firstInvalid="FALSE"
fi
echo "$space" "invalid argument:" "$arg"
doHelp="TRUE"
fi
shift
done


if isTrue $doHelp; then
echo "Options:"
echo "$space -url: the url or the path to the firefly install zip"
echo "$space -installDir: the firefly install dir, defaults to ./firefly"
echo "$space -dontConfirm: the firefly install dir, defaults to ./firefly"
echo "$space -asUpdate: stage the install as an auto update"
echo "$space --help, -h: this message and exit"
exit 0;
fi

if isTrue $confirm && isTrue $initialInstall && [ "$enteredPath" == "" ]; then
read -p "Enter installation directory [${enteredPath:-$defaultInstallRelativePath}]: " enteredPath
fi


if [ "$INSTALL_DIR" != "" ]; then
mkdir -p "$INSTALL_DIR"
fi
if [[ ! -w $INSTALL_DIR ]]; then
echo "Cannot write to the installation dir ${INSTALL_DIR:-$enteredPath}"
exit 1
fi


echo "$installType in $INSTALL_DIR"

PACKAGE_ASSET_NAME="standalone.zip"
#todo remove next line before PR merge
PACKAGE_ASSET_NAME="test_standalone.zip"
applicationRoot="${INSTALL_DIR}/application"
applicationDir="${applicationRoot}/${applicationPath}"
binDir="${INSTALL_DIR}/bin"


targetPackageFile="${applicationDir}/standalone.zip"

packageUrl=$(curl -s "https://api.github.com/repos/Caltech-IPAC/firefly/releases/latest" | \
jq -r '.assets[] | [.name, .browser_download_url] | @tsv' | \
while IFS=$'\t' read -r asset_name download_url; do
if [ "$asset_name" == $PACKAGE_ASSET_NAME ]; then
echo "$download_url"
fi
done)
if [ -z "$altUrl" ]; then
url=$packageUrl
else
url=$altUrl
fi

if [ -z "$url" ]; then
echo "No package defined to download, could not find it as a github asset https://github.com/Caltech-IPAC/firefly/releases"
exit 0
fi

mkdir -p "$fireflyDir"
mkdir -p "$fireflyDir/server"
mkdir -p "$applicationDir"
mkdir -p "$binDir"
echo "$INSTALL_DIR" > "$fireflyDir/applicationPath.txt"
rm -f "$applicationDir"/complete
echo "install from: $url"
if [[ "$url" == http* ]]; then
curl -sL "$url" > "${targetPackageFile}"
else
cp "$url" "${targetPackageFile}"
fi
echo "expanding firefly $targetPackageFile..."
(cd "$applicationDir" && unzip -o "${targetPackageFile}" &> "${applicationDir}/standalone-expand.log")
mkdir -p "$applicationDir/firefly-war"
echo "expanding firefly.war..."
(cd "$applicationDir/firefly-war" && unzip -o "${applicationDir}/firefly.war" &> "${applicationDir}/war-expand.log")

scriptPath=$(realpath "$0")
cp "$scriptPath" "$applicationDir/install.sh"
chmod 775 "$applicationDir/standalone_cleanup.sh" \
"$applicationDir/$startScript" \
"$applicationDir/startFireflyServer.sh" \
"$applicationDir/javaInstaller.sh" \
"$applicationDir/updater.sh" \
"$applicationDir/install.sh"
/bin/mv "$applicationDir/updater.sh" "$applicationRoot"

cp "$applicationDir/$startScript" "$binDir"
chmod +x "$binDir/$startScript"

if isTrue $initialInstall; then
echo "8888" > "$fireflyDir/port.txt"
if [ ! -f "$fireflyDir/user_ops.sh" ]; then
echo "JAVA_OPS=" > "$fireflyDir/user_ops.sh"
fi
fi


if isTrue $installJre; then
echo "installing java..."
JAVA=$("$applicationDir"/javaInstaller.sh)
fi


if isTrue $initialInstall; then
echo
echo "Firefly successfully installed, to start Firefly use the $startScript command"
echo
echo ">>>>>>>>>>>>>>>>>>>>>> ${binDir#$PWD/}/ff start"
echo
echo "You might want to add the bin dir to your path: $binDir"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it clear that we're talking about PATH env var:

Suggested change
echo "You might want to add the bin dir to your path: $binDir"
echo "You might want to add the bin dir to your PATH: $binDir"

fi


touch "$applicationDir"/complete
2 changes: 2 additions & 0 deletions buildScript/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ dependencies {
implementation 'org.asdf-format:asdf-core:0.1-alpha-10'
implementation 'edu.stsci:roman-datamodels:0.1-alpha-3'

// tomcat for standalone

Comment on lines +111 to +112
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still necessary when firefly_standalone dependencies are already defined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove them

}


Expand Down
23 changes: 0 additions & 23 deletions config/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,6 @@
<url-pattern>/CmdSrv/async/*</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>H2Console</servlet-name>
<servlet-class>org.h2.server.web.WebServlet</servlet-class>
<init-param>
<param-name>-webAllowOthers</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>H2Console</servlet-name>
<url-pattern>/admin/db/*</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>alertviewer</servlet-name>
<jsp-file>/alertviewer.html</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>alertviewer</servlet-name>
<url-pattern>/alertviewer/*</url-pattern>
</servlet-mapping>

<!-- Resources -->

<resource-ref>
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
rootProject.name = 'firefly_root'

include 'firefly', 'firefly_data'
include 'firefly', 'firefly_data', "standalone"

project(":firefly").projectDir = file('src/firefly')
project(":firefly_data").projectDir = file('src/firefly_data')
project(":standalone").projectDir = file('src/standalone')

Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,35 @@ public static void initVersion(ServletContext context) {
}

public static void ingestVersion(ServletContext context) {

_version.setAppName(context.getServletContextName());
_version.setConfigLastModTime(ServerContext.getConfigLastModTime());

File confDir = ServerContext.getWebappConfigDir();
Properties props = new Properties();
try {
_version.setAppName(context.getServletContextName());
_version.setConfigLastModTime(ServerContext.getConfigLastModTime());

File confDir = ServerContext.getWebappConfigDir();
Properties props = new Properties();
props.load(new FileInputStream(new File(confDir, VERSION_FILE)));
_version.setMajor(getNum(props.getProperty(MAJOR)));
_version.setMinor(getNum(props.getProperty(MINOR)));
_version.setRev(props.getProperty(REV));
_version.setVersionType(Version.convertVersionType(props.getProperty(TYPE)));
_version.setBuild(getNum(props.getProperty(BUILD_NUMBER)));
_version.setBuildDate(props.getProperty(BUILD_DATE));
_version.setBuildTime(props.getProperty(BUILD_TIME));
_version.setBuildTag(props.getProperty(BUILD_TAG));
_version.setBuildCommit(props.getProperty(BUILD_COMMIT));
_version.setBuildCommitFirefly(props.getProperty(BUILD_COMMIT_FIREFLY));
_version.setBuildFireflyTag(props.getProperty(BUILD_FIREFLY_TAG));
_version.setBuildFireflyBranch(props.getProperty(BUILD_FIREFLY_BRANCH));
_version.setDevCycleTag(props.getProperty(DEV_CYCLE_TAG));
ingestVersion(props);
} catch (IOException e) {
// just ignore
}
}

public static void ingestVersion(Properties props) {
_version.setMajor(getNum(props.getProperty(MAJOR)));
_version.setMinor(getNum(props.getProperty(MINOR)));
_version.setRev(props.getProperty(REV));
_version.setVersionType(Version.convertVersionType(props.getProperty(TYPE)));
_version.setBuild(getNum(props.getProperty(BUILD_NUMBER)));
_version.setBuildDate(props.getProperty(BUILD_DATE));
_version.setBuildTime(props.getProperty(BUILD_TIME));
_version.setBuildTag(props.getProperty(BUILD_TAG));
_version.setBuildCommit(props.getProperty(BUILD_COMMIT));
_version.setBuildCommitFirefly(props.getProperty(BUILD_COMMIT_FIREFLY));
_version.setBuildFireflyTag(props.getProperty(BUILD_FIREFLY_TAG));
_version.setBuildFireflyBranch(props.getProperty(BUILD_FIREFLY_BRANCH));
_version.setDevCycleTag(props.getProperty(DEV_CYCLE_TAG));
}

public static Version getAppVersion() { return _version; }

private static int getNum(String s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class VisContext {

static public void init() {
if (_initialized) return;
System.setProperty("java.awt.headless", "true");
// System.setProperty("java.awt.headless", "true");
boolean desktop= AppProperties.getBooleanProperty("runAsDesktopApplication", false);
System.setProperty("java.awt.headless", desktop ? "false" : "true"); //todo make this smart depending on context, no PR until it is done!!!!
initFootprints();
initCounters();
_initialized = true;
Expand Down
3 changes: 0 additions & 3 deletions src/firefly/java/edu/caltech/ipac/util/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package edu.caltech.ipac.util;

import edu.caltech.ipac.firefly.core.Util;
import edu.caltech.ipac.firefly.server.util.Logger;

import javax.validation.constraints.NotNull;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -45,8 +44,6 @@ public static enum Align {LEFT, RIGHT, MIDDLE}
public static final long GIG_HUNDREDTH= GIG / 100;
public static final long K = 1024;

private static final Logger.LoggerImpl logger = Logger.getLogger();

public static String[] groupMatch(String regex, String val) {
return groupMatch(regex, val, 0);
}
Expand Down
Loading