-
Notifications
You must be signed in to change notification settings - Fork 16
Firefly-1980: firefly standalone installation #1962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
robyww
wants to merge
4
commits into
dev
Choose a base branch
from
FIREFLY-1980-standalone
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| fi | ||
|
|
||
|
|
||
| touch "$applicationDir"/complete | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this still necessary when firefly_standalone dependencies are already defined?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will remove them |
||
| } | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
PATHenv var: