Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Introduced .appignore for excluding apps from console app list (#936)

Rich Turner7b5ac4489f60
diff --git a/.ci_cd/deploy.sh b/.ci_cd/deploy.sh
index be41d8c50..d2612a0c3 100644
--- a/.ci_cd/deploy.sh
+++ b/.ci_cd/deploy.sh
@@ -333,10 +333,30 @@ EOF
if [ $? -ne 0 ]; then
echo "Deployment failed or is unhealthy"
+ revoke_ssh
+ exit 1
+fi
+
+echo "Testing manager web server https://$OR_HOSTNAME..."
+response=$(curl --output /dev/null --silent --head --write-out "%{http_code}" https://$OR_HOSTNAME/manager/)
+count=0
+while [[ $response -ne 200 ]] && [ $count -lt 12 ]; do
+ echo "https://$OR_HOSTNAME/manager/ RESPONSE CODE: $response...Sleeping 5 seconds"
+ sleep 5
+ response=$(curl --output /dev/null --silent --head --write-out "%{http_code}" https://$OR_HOSTNAME/manager/)
+ count=$((count+1))
+done
+
+if [ $response -ne 200 ]; then
+ echo "Manager web server is unreachable https://$OR_HOSTNAME..."
+ revoke_ssh
+ exit 1
+else
+ echo "Manager web server now reachable https://$OR_HOSTNAME..."
fi
revoke_ssh
-exit 1
+exit 0
# ROLLBACK FUNCTIONALITY DISABLED FOR NOW AS WASN'T WORKING AND MANUAL INTERVENTION IS FINE AT THIS POINT
diff --git a/.gitignore b/.gitignore
index e8572deae..af2a9d99e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ bin-release/
[Tt]mp/
# Other files and folders
+deployment/manager/fcm.json
.settings/
.gradle/
.vagrant/
diff --git a/build.gradle b/build.gradle
index 9e2046995..fe0798cff 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,31 +9,29 @@ allprojects {
// Each file must be explicitly added to .gitignore otherwise git commit will fail
// When using encryption the the GFE_PASSWORD environment variable must be set or the build will fail
// use ./gradlew encryptFiles to encrypt files
-//gradleFileEncrypt {
-// // files to encrypt
-// plainFiles.from("deployment/manager/fcm.json")
-// // (optional) setup file mapping to store all encrypted files in one place for example
-// //mapping = [ 'deployment/mySensitiveFile' : 'secrets/mySensitiveFile' ]
-// // Use custom password provider as standard env mechanism doesn't seem to work
-// passwordProvider = {
-// def password = System.env.GFE_PASSWORD
-// if (!password) {
-// throw new IllegalStateException("GFE_PASSWORD environment variable must be set!")
-// }
-// return password.toCharArray()
-// }
-//}
-//task checkFilesGitIgnoredNew(type: Exec) {
-// // The provided checkFilesGitIgnored task doesn't work on Windows so here's one that does
-// def args = []
-// if (isFamily(FAMILY_WINDOWS)) {
-// args.add("cmd")
-// args.add("/c")
-// }
-// args.add("git")
-// args.add("check-ignore")
-// args.add("-q")
-// args.addAll(project.getProperties().get("gradleFileEncrypt").plainFiles)
-//
-// commandLine args
-//}
+apply plugin: "com.cherryperry.gradle-file-encrypt"
+gradleFileEncrypt {
+ // files to encrypt
+ plainFiles.from("deployment/manager/fcm.json")
+ // (optional) setup file mapping to store all encrypted files in one place for example
+ //mapping = [ 'deployment/mySensitiveFile' : 'secrets/mySensitiveFile' ]
+ // Use custom password provider as standard env mechanism doesn't seem to work
+ passwordProvider = {
+ def password = System.env.GFE_PASSWORD
+ return password != null ? password.toCharArray() : 'd'.toCharArray()
+ }
+}
+task checkFilesGitIgnoredNew(type: Exec) {
+ // The provided checkFilesGitIgnored task doesn't work on Windows so here's one that does
+ def args = []
+ if (isFamily(FAMILY_WINDOWS)) {
+ args.add("cmd")
+ args.add("/c")
+ }
+ args.add("git")
+ args.add("check-ignore")
+ args.add("-q")
+ args.addAll(project.getProperties().get("gradleFileEncrypt").plainFiles)
+
+ commandLine args
+}
diff --git a/deployment/README.md b/deployment/README.md
index 425ace940..900a00221 100644
--- a/deployment/README.md
+++ b/deployment/README.md
@@ -1,23 +1,3 @@
-## Manager customisation
-As well as the below information please see the [Manager endpoints and file paths](https://github.com/openremote/openremote/wiki/Architecture:-Manager-endpoints-and-file-paths) wiki.
-
-### Custom provisioning files (`provisioning/`)
-As an alternative to writing `java` setup code you can also provide `json` representations of Assets which will be automatically deserialized and added to the system when doing a clean install.
-
-### Console App Configurations (`consoleappconfig/`)
-Console app configurations that can be loaded by Android and iOS consoles.
-
-### Custom App Files (`app/`)
-This `app` directory is used as the `$CUSTOM_APP_DOCROOT` and can be used to store any custom static content; the Manager UI also checks the `/manager_config.json` path for a custom Manager UI configuration `json` file.
-
-### FCM Configuration (`fcm.json`)
-This is where your Firebase cloud messaging config file should be placed to enable push notification for Android/iOS.
-
-### Logging Configuration (`logging.properties`)
-Custom `JUL` logging configuration file; default log file can be found [here](https://github.com/openremote/openremote/blob/master/manager/src/main/resources/logging.properties).
-
-### Keycloak Credentials (`keycloak.json`)
-This is where custom keycloak credentials are stored/can be supplied; by default the manager will auto generate these during a clean install.
-
-### Custom Java Code (`extensions/`)
-Any custom java code should be compiled and made available in this directory; if it is compiled as part of the custom project then only the compiled code should be copied to the `deployment/build/image/manager/extensions` dir and not to this source directory.
+## Demo customisation of the OpenRemote Manager
+This directory contains customisations that are applied to our own Demo environments; for an explanation of the different customisation options see the [Manager endpoints and file paths](https://github.com/openremote/openremote/wiki/Architecture:-Manager-endpoints-and-file-paths) wiki
+and also refer to the [Custom Project Template](https://github.com/openremote/custom-project).
diff --git a/deployment/keycloak/themes/.dockerignore b/deployment/keycloak/themes/.dockerignore
new file mode 100644
index 000000000..e69de29bb
diff --git a/deployment/keycloak/themes/README.md b/deployment/keycloak/themes/README.md
deleted file mode 100644
index 277e10c40..000000000
--- a/deployment/keycloak/themes/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-## Custom Keycloak themes
-Add a directory for each custom theme (the directory name is the theme name) and add the required theme templates within; you can use the default [openremote theme](https://github.com/openremote/keycloak/tree/main/src/main/resources/theme/openremote) as a template alternatively refer to the keycloak themes documentation.
-
-This themes directory can then be volume mapped into the keycloak container at `/deployment/keycloak/themes`.
-
-### Development
-To be able to see the custom theme in development just run the `dev-testing.yml` compose profile and uncomment the deployment volume mapping.s
-
diff --git a/deployment/manager/fcm.json.encrypted b/deployment/manager/fcm.json.encrypted
new file mode 100644
index 000000000..05c49824c
Binary files /dev/null and b/deployment/manager/fcm.json.encrypted differ
diff --git a/manager/src/main/java/org/openremote/manager/apps/ConsoleAppService.java b/manager/src/main/java/org/openremote/manager/apps/ConsoleAppService.java
index 88d6c3fd9..3f974fa58 100644
--- a/manager/src/main/java/org/openremote/manager/apps/ConsoleAppService.java
+++ b/manager/src/main/java/org/openremote/manager/apps/ConsoleAppService.java
@@ -28,6 +28,7 @@ import org.openremote.manager.web.ManagerWebService;
import org.openremote.model.Container;
import org.openremote.model.ContainerService;
+import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -88,7 +89,7 @@ public class ConsoleAppService implements ContainerService {
Files.list(managerWebService.getBuiltInAppDocRoot()),
Files.list(managerWebService.getCustomAppDocRoot()))
.filter(Files::isDirectory)
- .filter(path -> !path.endsWith("shared") && !path.endsWith("swagger"))
+ .filter(path -> !new File(path.toString(), ".appignore").exists())
.map(dir -> dir.getFileName().toString())
.distinct()
.toArray(String[]::new);
diff --git a/manager/src/web/shared/.appignore b/manager/src/web/shared/.appignore
new file mode 100644
index 000000000..e69de29bb
diff --git a/project.gradle b/project.gradle
index cb4a40629..9432668ff 100644
--- a/project.gradle
+++ b/project.gradle
@@ -48,15 +48,17 @@ exit \$status
Files.setPosixFilePermissions(path, perms)
} catch (Exception ignored) {}
- // Add dependency on decrypt task for deployment installDist
- Task decryptTask = getTasksByName("decryptFiles", false)[0]
-
- try {
- def installDist = tasks.getByPath(":deployment:installDist")
- installDist.dependsOn decryptTask
- installDist.mustRunAfter(decryptTask)
- } catch (Exception ex) {
- println("Failed to add decryptFiles task dependency: " + ex)
+ // Add dependency on decrypt task for deployment installDist if custom project
+ if (isCustomProject()) {
+ Task decryptTask = getTasksByName("decryptFiles", false)[0]
+
+ try {
+ def installDist = tasks.getByPath(":deployment:installDist")
+ installDist.dependsOn decryptTask
+ installDist.mustRunAfter(decryptTask)
+ } catch (Exception ex) {
+ println("Failed to add decryptFiles task dependency: " + ex)
+ }
}
} else {
// Remove git hook
diff --git a/settings.gradle b/settings.gradle
index 7a5e6ea2c..5fe99d718 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,6 +1,6 @@
pluginManagement {
plugins {
- id "com.cherryperry.gradle-file-encrypt" version "2.0.1"
+ id "com.cherryperry.gradle-file-encrypt" version "2.0.3"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.3"
}
}
diff --git a/ui/app/console_loader/.appignore b/ui/app/console_loader/.appignore
new file mode 100644
index 000000000..e69de29bb
diff --git a/ui/app/dashboard/.appignore b/ui/app/dashboard/.appignore
new file mode 100644
index 000000000..e69de29bb
diff --git a/ui/app/swagger/.appignore b/ui/app/swagger/.appignore
new file mode 100644
index 000000000..e69de29bb
diff --git a/ui/util/webpack.util.js b/ui/util/webpack.util.js
index c96e2f3f6..145304062 100644
--- a/ui/util/webpack.util.js
+++ b/ui/util/webpack.util.js
@@ -192,6 +192,16 @@ function getAppConfig(mode, isDevServer, dirname, managerUrl, keycloakUrl, port)
}
);
}
+ //Check if .appignore file exists
+ if (fs.existsSync(path.join(dirname, ".appignore"))) {
+ patterns.push(
+ {
+ from: ".appignore",
+ to: ".appignore",
+ toType: 'file'
+ }
+ );
+ }
// Copy unprocessed files
config.plugins.push(