1
0

#19 Release & deployment v2

This commit is contained in:
2022-05-10 22:45:49 +02:00
parent 7a06f56f94
commit 78d1f59929
8 changed files with 36 additions and 66 deletions

View File

@@ -1,54 +1,16 @@
#!/bin/bash
workspace_loc=$1
echo "$workspace_loc"
version=$1
profile=$2
echo "$profile"
echo "Create required directories"
mkdir -p ~/.local/share/java/nbscloud/
mkdir -p ~/.config/nbscloud/
mkdir -p ~/nbscloud
pwd
echo "Download nbscloud version $version to ~/.local/share/java/nbscloud/nbscloud.jar"
deploy_tmp="deploy_tmp"
target_loc="/opt/nbscloud"
wget -qO ~/.local/share/java/nbscloud/nbscloud.jar http://192.168.10.4:8100/releases/de/77zzcx7/nbs-cloud/web-container/"$version"/web-container-"$version".jar
app_props_loc="$workspace_loc/web-container/target/classes/config/application-$profile.properties"
files_prop_loc="$workspace_loc/files/target/classes/config/files-application-$profile.properties"
echo "$app_props_loc"
echo "$files_prop_loc"
deploy_path=$(grep "nbscloud.deploy.path" "$app_props_loc" | cut -d'=' -f2)
echo "$deploy_path"
base_dir=$(grep "nbs-cloud.files.baseDir" "$files_prop_loc" | cut -d'=' -f2)
echo "$base_dir"
cd tools
mkdir $deploy_tmp
cp "template-nbscloud.service" $deploy_tmp"/nbscloud.service"
cd $deploy_tmp
sed -i "s|DEPLOY_PATH_R|$deploy_path|g" nbscloud.service
sed -i "s|BASE_DIR_R|$base_dir|g" nbscloud.service
sed -i "s|PROFILE_R|$profile|g" nbscloud.service
echo ""
cat nbscloud.service
echo ""
cp nbscloud.service $target_loc"/nbscloud.service"
echo "Copied service file"
jar_path=$(find "$workspace_loc/web-container/target/" -name "*.jar")
echo "$jar_path"
cp "$jar_path" "$target_loc"/nbscloud.jar
echo "Copied jar"
echo "Finished deployment"
echo ""
echo "Manually reload service files via 'systemctl --user daemon-reload'"
echo "Then, enable the service 'systemctl --user enable --now nbscloud.service'"
echo "Or, restart the service 'systemctl --user restart nbscloud.service'"
echo "Reload and restart service"
systemctl --user daemon-reload
systemctl restart nbscloud

View File

@@ -5,10 +5,10 @@ Wants=network-online.target
[Service]
Type=simple
# Values substituted from application.properties
ExecStart=java -jar DEPLOY_PATH_R/nbscloud.jar --spring.profiles.active=PROFILE_R
ReadWritePaths=BASE_DIR_R
ExecStart=java -jar %h/.local/share/java/nbscloud/nbscloud.jar --spring.config.additional-location="file://%h/.config/nbscloud/application.properties"
ReadWritePaths=%h/nbscloud
ReadOnlyPaths=%h/.local/share/java/nbscloud/nbscloud.jar
ReadOnlyPaths=%h/.config/nbscloud/application.properties
# Hardening
ProtectHome=true