-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add deployment script #1793
Add deployment script #1793
Conversation
WalkthroughThe new script Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Script
participant Jetty
User->>Script: Provide version parameter
Script->>Jetty: Stop service
Script->>Script: Construct download URL
Script->>Script: Download WAR file
Script->>Jetty: Place WAR file in deployment directory
Script->>Jetty: Restart service
Jetty-->>Script: Service started
Script-->>User: Deployment complete
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1793 +/- ##
=========================================
Coverage 15.19% 15.19%
Complexity 450 450
=========================================
Files 249 249
Lines 7627 7627
Branches 798 798
=========================================
Hits 1159 1159
Misses 6418 6418
Partials 50 50 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 4
echo "Stopping Jetty..." | ||
systemctl stop jetty | ||
|
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.
Add error handling for stopping the Jetty service.
The script does not handle errors if the Jetty service fails to stop.
- echo "Stopping Jetty..."
- systemctl stop jetty
+ echo "Stopping Jetty..."
+ if ! systemctl stop jetty; then
+ echo "Error: Failed to stop Jetty service."
+ exit 1
+ fi
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
echo "Stopping Jetty..." | |
systemctl stop jetty | |
echo "Stopping Jetty..." | |
if ! systemctl stop jetty; then | |
echo "Error: Failed to stop Jetty service." | |
exit 1 | |
fi |
#!/bin/bash | ||
|
||
VERSION=$1 | ||
echo "VERSION: $VERSION" | ||
|
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.
Add validation for the VERSION variable.
The script does not validate the VERSION variable, which could lead to issues if it is not provided or is invalid.
- VERSION=$1
- echo "VERSION: $VERSION"
+ if [ -z "$1" ]; then
+ echo "Error: VERSION argument is required."
+ exit 1
+ fi
+ VERSION=$1
+ echo "VERSION: $VERSION"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
#!/bin/bash | |
VERSION=$1 | |
echo "VERSION: $VERSION" | |
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Error: VERSION argument is required." | |
exit 1 | |
fi | |
VERSION=$1 | |
echo "VERSION: $VERSION" | |
echo "Starting Jetty" | ||
systemctl start jetty |
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.
Add error handling for starting the Jetty service.
The script does not handle errors if the Jetty service fails to start.
- echo "Starting Jetty"
- systemctl start jetty
+ echo "Starting Jetty"
+ if ! systemctl start jetty; then
+ echo "Error: Failed to start Jetty service."
+ exit 1
+ fi
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
echo "Starting Jetty" | |
systemctl start jetty | |
echo "Starting Jetty" | |
if ! systemctl start jetty; then | |
echo "Error: Failed to start Jetty service." | |
exit 1 | |
fi |
WAR_FILE_URL=https://jitpack.io/com/github/elimu-ai/webapp/webapp-$VERSION/webapp-webapp-$VERSION.war | ||
echo "Downloading WAR file from $WAR_FILE_URL" | ||
wget -O /opt/jetty-base/webapps/webapp.war $WAR_FILE_URL | ||
|
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.
Add error handling for the wget
command.
The script does not handle errors if the wget
command fails to download the WAR file.
- echo "Downloading WAR file from $WAR_FILE_URL"
- wget -O /opt/jetty-base/webapps/webapp.war $WAR_FILE_URL
+ echo "Downloading WAR file from $WAR_FILE_URL"
+ if ! wget -O /opt/jetty-base/webapps/webapp.war $WAR_FILE_URL; then
+ echo "Error: Failed to download WAR file."
+ exit 1
+ fi
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
WAR_FILE_URL=https://jitpack.io/com/github/elimu-ai/webapp/webapp-$VERSION/webapp-webapp-$VERSION.war | |
echo "Downloading WAR file from $WAR_FILE_URL" | |
wget -O /opt/jetty-base/webapps/webapp.war $WAR_FILE_URL | |
WAR_FILE_URL=https://jitpack.io/com/github/elimu-ai/webapp/webapp-$VERSION/webapp-webapp-$VERSION.war | |
echo "Downloading WAR file from $WAR_FILE_URL" | |
if ! wget -O /opt/jetty-base/webapps/webapp.war $WAR_FILE_URL; then | |
echo "Error: Failed to download WAR file." | |
exit 1 | |
fi |
Usage:
./deploy-webapp 2.4.23
refs #1792