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

19
README.md Normal file
View File

@@ -0,0 +1,19 @@
# NoBullShit-cloud
A personal cloud without bullshit
## Prerequisites
nbscloud requires `java>=18`
## Install
### systemd service
### `deploy.sh`
## Config
To adjust the default configuration create the file `~/.config/nbscloud/application.properties`. It allows overwriting
properties from every configuration file of nbscloud. To get a full list of existing properties look at the following
files:
|File|Description|
|----|-----------|
|[application.properties](./web-container/src/main/resources/config/application.properties)|Main config file providing general app properties|
|[shared-application.properties](./web-container-config/src/main/resources/config/shared-application.properties)|Properties shared by all apps|
|[files-application.properties](./files/src/main/resources/config/files-application.properties)|Config file for the files app|

View File

@@ -7,7 +7,6 @@ import org.springframework.context.annotation.PropertySource;
@Configuration @Configuration
@ConfigurationProperties(prefix = "nbs-cloud.files") @ConfigurationProperties(prefix = "nbs-cloud.files")
@PropertySource("classpath:/config/files-application.properties") @PropertySource("classpath:/config/files-application.properties")
@PropertySource(value = "classpath:/config/files-application-${spring.profiles.active}.properties", ignoreResourceNotFound = true)
public class FilesConfig { public class FilesConfig {
private String baseDir; private String baseDir;
private boolean filterHidden; private boolean filterHidden;

View File

@@ -1 +0,0 @@
nbs-cloud.files.baseDir=/opt/nextcloud_data/marius/files

10
pom.xml
View File

@@ -32,7 +32,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>18</java.version> <java.version>18</java.version>
<scmDeveloperConnectionProp /> <scmDeveloperConnectionProp />
<deploymentProfile />
</properties> </properties>
<distributionManagement> <distributionManagement>
@@ -195,13 +194,4 @@
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>release</id>
<properties>
<activeProfiles>${deploymentProfile}</activeProfiles>
</properties>
</profile>
</profiles>
</project> </project>

View File

@@ -1,54 +1,16 @@
#!/bin/bash #!/bin/bash
workspace_loc=$1 version=$1
echo "$workspace_loc"
profile=$2 echo "Create required directories"
echo "$profile" 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" 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
target_loc="/opt/nbscloud"
app_props_loc="$workspace_loc/web-container/target/classes/config/application-$profile.properties" echo "Reload and restart service"
files_prop_loc="$workspace_loc/files/target/classes/config/files-application-$profile.properties" systemctl --user daemon-reload
systemctl restart nbscloud
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'"

View File

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

View File

@@ -1,2 +0,0 @@
nbscloud.deploy.service.user=marius
nbscloud.deploy.path=/opt/nbscloud

View File

@@ -1,3 +1,6 @@
v13 -> v14:
- #19 Release & deployment v2
v12 - v13: v12 - v13:
- #18 Add profiles - #18 Add profiles