From 502c7cb352671a87e3ddcc49e6550c01e66ce579 Mon Sep 17 00:00:00 2001 From: kd9lsv Date: Sun, 1 Jan 2023 20:40:26 -0600 Subject: [PATCH 01/27] Create Resources to build dockerfile. --- .gitignore | 5 +++- docker/.config,users.json | 30 ++++++++++++++++++++++ docker/.config.projects.json | 4 +++ docker/Dockerfile | 49 ++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 docker/.config,users.json create mode 100644 docker/.config.projects.json create mode 100644 docker/Dockerfile diff --git a/.gitignore b/.gitignore index 3c9c01a..3815ab4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -*.backup \ No newline at end of file +*.backup +node_modules/* +package-lock.json +*.code-workspace diff --git a/docker/.config,users.json b/docker/.config,users.json new file mode 100644 index 0000000..4c2b274 --- /dev/null +++ b/docker/.config,users.json @@ -0,0 +1,30 @@ +{ + "_": { + "editor": { + "view": { + "view-store-zoom": false, + "view-store-position": false, + "view-show-grid": true, + "view-snap-grid": true, + "view-grid-size": "20", + "view-node-status": true, + "view-node-show-label": true, + "view-show-tips": true, + "view-show-welcome-tours": true + } + }, + "git": { + "user": { + "name": "nobody", + "email": "anyone@example.com" + }, + "workflow": { + "mode": "manual" + } + }, + "debug": { + "filter": "filterAll", + "filteredNodes": [] + } + } +} diff --git a/docker/.config.projects.json b/docker/.config.projects.json new file mode 100644 index 0000000..232deee --- /dev/null +++ b/docker/.config.projects.json @@ -0,0 +1,4 @@ +{ + "activeProject": "Node-Red-Contesting-Dashboard", + "projects": {} +} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..d7bee6a --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,49 @@ +FROM nodered/node-red as base +ARG QEMU_ARCH +USER root +RUN apk add sqlite grep +USER node-red +RUN curl -sL -o /data/settings.js https://raw.githubusercontent.com/radiosport-live/Node-Red-AutoScripts/master/settings.js + +RUN mkdir -p /data/projects/ + +RUN git clone https://github.com/kylekrieg/Node-Red-Contesting-Dashboard.git --quiet /data/projects/Node-Red-Contesting-Dashboard + +COPY package.json . +RUN npm install --unsafe-perm --no-update-notifier --no-fund --omit=dev +# Copy package.json to the WORKDIR so npm builds all +# of your added nodes modules for Node-RED +COPY schema.db /data + +# Copy _your_ Node-RED project files into place +# NOTE: This will only work if you DO NOT later mount /data as an external volume. +# If you need to use an external volume for persistence then +# copy your settings and flows files to that volume instead. + +RUN cd /data/projects/Node-Red-Contesting-Dashboard && for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do \ + git branch --track ${branch#remotes/origin/} $branch ; \ +done + +RUN sqlite3 /usr/src/node-red/qsos < /data/schema.db +COPY docker/.config.projects.json /data +COPY docker/.config.users.json /data +ENV NODE_RED_ENABLE_PROJECTS=true +HEALTHCHECK CMD curl http://localhost:1880/ || exit 1 + +LABEL org.label-schema.build-date=${BUILD_DATE} \ + org.label-schema.docker.dockerfile=".docker/Dockerfile" \ + org.label-schema.license="Apache-2.0" \ + org.label-schema.name="Node-RED-Contest-Dashboard" \ + org.label-schema.version=${BUILD_VERSION} \ + org.label-schema.description="Low-code programming for event-driven applications." \ + org.label-schema.url="https://github.com/kylekrieg/Node-Red-Contesting-Dashboard" \ + org.label-schema.vcs-ref=${BUILD_REF} \ + org.label-schema.vcs-type="Git" \ + org.label-schema.vcs-url="https://github.com/kylekrieg/Node-Red-Contesting-Dashboard" \ + org.label-schema.arch=${QEMU_ARCH} \ + authors="Connor Dickey KD9LSV, Kyle Krieg AA0Z" + +# You should add extra nodes via your package.json file but you can also add them here: +#WORKDIR /usr/src/node-red +#RUN npm install node-red-node-smooth + From ec52522de8fd200297af808e18ace800f7f6fab3 Mon Sep 17 00:00:00 2001 From: kd9lsv Date: Sun, 1 Jan 2023 20:41:56 -0600 Subject: [PATCH 02/27] Create Workflows to help automate CI/CD integrations. --- .github/workflows/greetings.yml | 18 +++++ .github/workflows/main.yml | 88 +++++++++++++++++++++++++ .github/workflows/npm_version.yml | 55 ++++++++++++++++ .github/workflows/updatepackagejson.yml | 20 ++++++ 4 files changed, 181 insertions(+) create mode 100644 .github/workflows/greetings.yml create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/npm_version.yml create mode 100644 .github/workflows/updatepackagejson.yml diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 0000000..f105ba1 --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,18 @@ + +name: Greetings + +on: [pull_request_target, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Hello. Thanks for submitting an issue about the Node-Red Contesting Dashboard. Please give the team some time to triage and reply with a more detailed response. \n 73, \n Connor KD9LSV" + pr-message: "Thank you for submitting a pull request. A notification has been sent to the team to review your work and see if it is adaquate for us to merge into the project. If we have any questions, we will reach out. Please be patience with the status of the PR.\n 73,\n Connor KD9LSV" + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..c8119c1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,88 @@ +# This is a basic workflow to help you get started with Actions + +name: Docker Build + +# Controls when the action will run. +on: + release: + types: [released] + pull_request: + branches: + - 'master' + - 'dev' + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + env: + # Setting the defaults up front + LATEST_NODE: 16 + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + runs-on: ubuntu-latest + + strategy: + matrix: + node: [16, 18] + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - + name: Checkout + uses: actions/checkout@v3 + - name: Show Env + run: env + - name: Docker Metadata + id: meta + uses: docker/metadata-action@v4 + with: + flavor: | + latest=auto + suffix=-${{matrix.node}} + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=semver,pattern={{raw}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern=v{{major}} + type=semver,pattern=v{{major}}.{{minor}} + + - + name: Setup QEMU + uses: docker/setup-qemu-action@v2 + - + name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + - name: Get Date + id: date + run: echo "dateval=$(date +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: Login to Github Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + id: build-push + uses: docker/build-push-action@v3 + continue-on-error: true + with: + context: . + platforms: linux/amd64, linux/arm64, linux/armhf + file: docker/Dockerfile + build-args: | + NODE_VERSION=${{ matrix.node }} + BUILD_DATE=${{ env.dateval }} + BUILD_REF=${{ github.ref_name }} + CONTEST_DASHBOARD_VERSION=${{ steps.meta.outpus.tags }} + TAG_SUFFIX=${{ github.ref_type }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + diff --git a/.github/workflows/npm_version.yml b/.github/workflows/npm_version.yml new file mode 100644 index 0000000..5b5542e --- /dev/null +++ b/.github/workflows/npm_version.yml @@ -0,0 +1,55 @@ +on: + push: + branches: + - master + - dev + paths-ignore: + - '.gitignore' + - '.github/**/.yml' + +jobs: + + Create-Version-Tag: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + token : ${{ secrets.GITHUB_TOKEN }} + - name: version value + id: versioning + run: | + git config --global user.name 'kd9lsv' + git config --global user.email 'connor@kd9lsv.me' + echo "npmversion=$(npm version patch -m "[RELEASE] %s")" >> $GITHUB_ENV + git push + - name: Get Date + id: date + run: echo "dateval::$(date +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: Create an Tag + uses: simpleactions/create-tag@v1.0.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + sha: ${{ github.sha }} + # The tag name + tag: ${{env.npmversion}} + # The message + message: ${{env.npmversion}} Update on ${{env.dateval}} + - name: Generate changelog + id: changelog + uses: heinrichreimer/action-github-changelog-generator@v2.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: ncipollo/release-action@v1 + if: steps.changelog.outputs.changelog + with: + allowUpdates: true + token: ${{ secrets.GITHUB_TOKEN }} + name: ${{env.npmversion}} + tag: ${{env.npmversion}} + body: | + ```bash + See docker package for updated version ${{env.npmversion}} updated on ${{env.dateval}} + ``` + ${{ steps.changelog.outputs.changelog }} diff --git a/.github/workflows/updatepackagejson.yml b/.github/workflows/updatepackagejson.yml new file mode 100644 index 0000000..4686a79 --- /dev/null +++ b/.github/workflows/updatepackagejson.yml @@ -0,0 +1,20 @@ + +on: workflow_dispatch +name: Update +jobs: + package-update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: set remote url + run: git remote set-url --push origin https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY + - name: package-update + uses: taichi/actions-package-update@master + env: + AUTHOR_EMAIL: connor@kd9lsv.me + AUTHOR_NAME: kd9lsv + EXECUTE: "true" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LOG_LEVEL: debug + with: + args: -u --packageFile package.json --loglevel verbose From c129ab04560a477194f3ae40b98c4d3dd1489e02 Mon Sep 17 00:00:00 2001 From: kd9lsv Date: Sun, 1 Jan 2023 20:49:54 -0600 Subject: [PATCH 03/27] Correct File name typo. --- docker/{.config,users.json => .config.users.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker/{.config,users.json => .config.users.json} (100%) diff --git a/docker/.config,users.json b/docker/.config.users.json similarity index 100% rename from docker/.config,users.json rename to docker/.config.users.json From c27fc5ee9a2b24166a256ff26b46f3613eeeda35 Mon Sep 17 00:00:00 2001 From: kd9lsv Date: Sun, 1 Jan 2023 20:57:11 -0600 Subject: [PATCH 04/27] Add Node-Red to dependencies. --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b33d79c..adeac5c 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "description": "Dashboard for N1MM Contesting", "version": "0.0.1", "dependencies": { + "node-red": "3.0.2", "node-red-contrib-hourglass": "1.5.0", "node-red-contrib-msg-speed": "2.1.0", "node-red-contrib-play-audio": "2.5.0", @@ -24,4 +25,4 @@ "credentialsFile": "flow_cred.json" } } -} \ No newline at end of file +} From 0c2b98efebc395b5541d3fdd0a8e8ec886d784a1 Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Thu, 21 Jul 2022 01:19:51 +0000 Subject: [PATCH 05/27] Upload settings.js for NodeRed See https://gist.github.com/kd9lsv/b114c87eb3f30b4d3cc53009d486978f for reference. --- settings.js | 542 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 542 insertions(+) create mode 100644 settings.js diff --git a/settings.js b/settings.js new file mode 100644 index 0000000..6035c5d --- /dev/null +++ b/settings.js @@ -0,0 +1,542 @@ +/** + * This is the default settings file provided by Node-RED. + * + * It can contain any valid JavaScript code that will get run when Node-RED + * is started. + * + * Lines that start with // are commented out. + * Each entry should be separated from the entries above and below by a comma ',' + * + * For more information about individual settings, refer to the documentation: + * https://nodered.org/docs/user-guide/runtime/configuration + * + * The settings are split into the following sections: + * - Flow File and User Directory Settings + * - Security + * - Server Settings + * - Runtime Settings + * - Editor Settings + * - Node Settings + * + **/ + +module.exports = { + +/******************************************************************************* + * Flow File and User Directory Settings + * - flowFile + * - credentialSecret + * - flowFilePretty + * - userDir + * - nodesDir + ******************************************************************************/ + + /** The file containing the flows. If not set, defaults to flows_.json **/ + flowFile: 'flows.json', + + /** By default, credentials are encrypted in storage using a generated key. To + * specify your own secret, set the following property. + * If you want to disable encryption of credentials, set this property to false. + * Note: once you set this property, do not change it - doing so will prevent + * node-red from being able to decrypt your existing credentials and they will be + * lost. + */ + //credentialSecret: "a-secret-key", + + /** By default, the flow JSON will be formatted over multiple lines making + * it easier to compare changes when using version control. + * To disable pretty-printing of the JSON set the following property to false. + */ + flowFilePretty: true, + + /** By default, all user data is stored in a directory called `.node-red` under + * the user's home directory. To use a different location, the following + * property can be used + */ + //userDir: '/home/nol/.node-red/', + + /** Node-RED scans the `nodes` directory in the userDir to find local node files. + * The following property can be used to specify an additional directory to scan. + */ + //nodesDir: '/home/nol/.node-red/nodes', + +/******************************************************************************* + * Security + * - adminAuth + * - https + * - httpsRefreshInterval + * - requireHttps + * - httpNodeAuth + * - httpStaticAuth + ******************************************************************************/ + + /** To password protect the Node-RED editor and admin API, the following + * property can be used. See http://nodered.org/docs/security.html for details. + */ + //adminAuth: { + // type: "credentials", + // users: [{ + // username: "admin", + // password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.", + // permissions: "*" + // }] + //}, + + /** The following property can be used to enable HTTPS + * This property can be either an object, containing both a (private) key + * and a (public) certificate, or a function that returns such an object. + * See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener + * for details of its contents. + */ + + /** Option 1: static object */ + //https: { + // key: require("fs").readFileSync('privkey.pem'), + // cert: require("fs").readFileSync('cert.pem') + //}, + + /** Option 2: function that returns the HTTP configuration object */ + // https: function() { + // // This function should return the options object, or a Promise + // // that resolves to the options object + // return { + // key: require("fs").readFileSync('privkey.pem'), + // cert: require("fs").readFileSync('cert.pem') + // } + // }, + + /** If the `https` setting is a function, the following setting can be used + * to set how often, in hours, the function will be called. That can be used + * to refresh any certificates. + */ + //httpsRefreshInterval : 12, + + /** The following property can be used to cause insecure HTTP connections to + * be redirected to HTTPS. + */ + //requireHttps: true, + + /** To password protect the node-defined HTTP endpoints (httpNodeRoot), + * including node-red-dashboard, or the static content (httpStatic), the + * following properties can be used. + * The `pass` field is a bcrypt hash of the password. + * See http://nodered.org/docs/security.html#generating-the-password-hash + */ + //httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."}, + //httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."}, + +/******************************************************************************* + * Server Settings + * - uiPort + * - uiHost + * - apiMaxLength + * - httpServerOptions + * - httpAdminRoot + * - httpAdminMiddleware + * - httpNodeRoot + * - httpNodeCors + * - httpNodeMiddleware + * - httpStatic + * - httpStaticRoot + ******************************************************************************/ + + /** the tcp port that the Node-RED web server is listening on */ + uiPort: process.env.PORT || 1880, + + /** By default, the Node-RED UI accepts connections on all IPv4 interfaces. + * To listen on all IPv6 addresses, set uiHost to "::", + * The following property can be used to listen on a specific interface. For + * example, the following would only allow connections from the local machine. + */ + //uiHost: "127.0.0.1", + + /** The maximum size of HTTP request that will be accepted by the runtime api. + * Default: 5mb + */ + //apiMaxLength: '5mb', + + /** The following property can be used to pass custom options to the Express.js + * server used by Node-RED. For a full list of available options, refer + * to http://expressjs.com/en/api.html#app.settings.table + */ + //httpServerOptions: { }, + + /** By default, the Node-RED UI is available at http://localhost:1880/ + * The following property can be used to specify a different root path. + * If set to false, this is disabled. + */ + //httpAdminRoot: '/admin', + + /** The following property can be used to add a custom middleware function + * in front of all admin http routes. For example, to set custom http + * headers. It can be a single function or an array of middleware functions. + */ + // httpAdminMiddleware: function(req,res,next) { + // // Set the X-Frame-Options header to limit where the editor + // // can be embedded + // //res.set('X-Frame-Options', 'sameorigin'); + // next(); + // }, + + + /** Some nodes, such as HTTP In, can be used to listen for incoming http requests. + * By default, these are served relative to '/'. The following property + * can be used to specifiy a different root path. If set to false, this is + * disabled. + */ + //httpNodeRoot: '/red-nodes', + + /** The following property can be used to configure cross-origin resource sharing + * in the HTTP nodes. + * See https://github.com/troygoode/node-cors#configuration-options for + * details on its contents. The following is a basic permissive set of options: + */ + //httpNodeCors: { + // origin: "*", + // methods: "GET,PUT,POST,DELETE" + //}, + + /** If you need to set an http proxy please set an environment variable + * called http_proxy (or HTTP_PROXY) outside of Node-RED in the operating system. + * For example - http_proxy=http://myproxy.com:8080 + * (Setting it here will have no effect) + * You may also specify no_proxy (or NO_PROXY) to supply a comma separated + * list of domains to not proxy, eg - no_proxy=.acme.co,.acme.co.uk + */ + + /** The following property can be used to add a custom middleware function + * in front of all http in nodes. This allows custom authentication to be + * applied to all http in nodes, or any other sort of common request processing. + * It can be a single function or an array of middleware functions. + */ + //httpNodeMiddleware: function(req,res,next) { + // // Handle/reject the request, or pass it on to the http in node by calling next(); + // // Optionally skip our rawBodyParser by setting this to true; + // //req.skipRawBodyParser = true; + // next(); + //}, + + /** When httpAdminRoot is used to move the UI to a different root path, the + * following property can be used to identify a directory of static content + * that should be served at http://localhost:1880/. + * When httpStaticRoot is set differently to httpAdminRoot, there is no need + * to move httpAdminRoot + */ + //httpStatic: '/home/nol/node-red-static/', //single static source + /* OR multiple static sources can be created using an array of objects... */ + //httpStatic: [ + // {path: '/home/nol/pics/', root: "/img/"}, + // {path: '/home/nol/reports/', root: "/doc/"}, + //], + + /** + * All static routes will be appended to httpStaticRoot + * e.g. if httpStatic = "/home/nol/docs" and httpStaticRoot = "/static/" + * then "/home/nol/docs" will be served at "/static/" + * e.g. if httpStatic = [{path: '/home/nol/pics/', root: "/img/"}] + * and httpStaticRoot = "/static/" + * then "/home/nol/pics/" will be served at "/static/img/" + */ + //httpStaticRoot: '/static/', + +/******************************************************************************* + * Runtime Settings + * - lang + * - runtimeState + * - diagnostics + * - logging + * - contextStorage + * - exportGlobalContextKeys + * - externalModules + ******************************************************************************/ + + /** Uncomment the following to run node-red in your preferred language. + * Available languages include: en-US (default), ja, de, zh-CN, zh-TW, ru, ko + * Some languages are more complete than others. + */ + //lang: "de", + + /** Configure diagnostics options + * - enabled: When `enabled` is `true` (or unset), diagnostics data will + * be available at http://localhost:1880/diagnostics + * - ui: When `ui` is `true` (or unset), the action `show-system-info` will + * be available to logged in users of node-red editor + */ + diagnostics: { + /** enable or disable diagnostics endpoint. Must be set to `false` to disable */ + enabled: true, + /** enable or disable diagnostics display in the node-red editor. Must be set to `false` to disable */ + ui: true, + }, + /** Configure runtimeState options + * - enabled: When `enabled` is `true` flows runtime can be Started/Stoped + * by POSTing to available at http://localhost:1880/flows/state + * - ui: When `ui` is `true`, the action `core:start-flows` and + * `core:stop-flows` will be available to logged in users of node-red editor + * Also, the deploy menu (when set to default) will show a stop or start button + */ + runtimeState: { + /** enable or disable flows/state endpoint. Must be set to `false` to disable */ + enabled: false, + /** show or hide runtime stop/start options in the node-red editor. Must be set to `false` to hide */ + ui: false, + }, + /** Configure the logging output */ + logging: { + /** Only console logging is currently supported */ + console: { + /** Level of logging to be recorded. Options are: + * fatal - only those errors which make the application unusable should be recorded + * error - record errors which are deemed fatal for a particular request + fatal errors + * warn - record problems which are non fatal + errors + fatal errors + * info - record information about the general running of the application + warn + error + fatal errors + * debug - record information which is more verbose than info + info + warn + error + fatal errors + * trace - record very detailed logging + debug + info + warn + error + fatal errors + * off - turn off all logging (doesn't affect metrics or audit) + */ + level: "info", + /** Whether or not to include metric events in the log output */ + metrics: false, + /** Whether or not to include audit events in the log output */ + audit: false + } + }, + + /** Context Storage + * The following property can be used to enable context storage. The configuration + * provided here will enable file-based context that flushes to disk every 30 seconds. + * Refer to the documentation for further options: https://nodered.org/docs/api/context/ + */ + //contextStorage: { + // default: { + // module:"localfilesystem" + // }, + //}, + + /** `global.keys()` returns a list of all properties set in global context. + * This allows them to be displayed in the Context Sidebar within the editor. + * In some circumstances it is not desirable to expose them to the editor. The + * following property can be used to hide any property set in `functionGlobalContext` + * from being list by `global.keys()`. + * By default, the property is set to false to avoid accidental exposure of + * their values. Setting this to true will cause the keys to be listed. + */ + exportGlobalContextKeys: false, + + /** Configure how the runtime will handle external npm modules. + * This covers: + * - whether the editor will allow new node modules to be installed + * - whether nodes, such as the Function node are allowed to have their + * own dynamically configured dependencies. + * The allow/denyList options can be used to limit what modules the runtime + * will install/load. It can use '*' as a wildcard that matches anything. + */ + externalModules: { + // autoInstall: false, /** Whether the runtime will attempt to automatically install missing modules */ + // autoInstallRetry: 30, /** Interval, in seconds, between reinstall attempts */ + // palette: { /** Configuration for the Palette Manager */ + // allowInstall: true, /** Enable the Palette Manager in the editor */ + // allowUpdate: true, /** Allow modules to be updated in the Palette Manager */ + // allowUpload: true, /** Allow module tgz files to be uploaded and installed */ + // allowList: ['*'], + // denyList: [], + // allowUpdateList: ['*'], + // denyUpdateList: [] + // }, + // modules: { /** Configuration for node-specified modules */ + // allowInstall: true, + // allowList: [], + // denyList: [] + // } + }, + + +/******************************************************************************* + * Editor Settings + * - disableEditor + * - editorTheme + ******************************************************************************/ + + /** The following property can be used to disable the editor. The admin API + * is not affected by this option. To disable both the editor and the admin + * API, use either the httpRoot or httpAdminRoot properties + */ + //disableEditor: false, + + /** Customising the editor + * See https://nodered.org/docs/user-guide/runtime/configuration#editor-themes + * for all available options. + */ + editorTheme: { + /** The following property can be used to set a custom theme for the editor. + * See https://github.com/node-red-contrib-themes/theme-collection for + * a collection of themes to chose from. + */ + // theme: "tokyo-night", + + /** To disable the 'Welcome to Node-RED' tour that is displayed the first + * time you access the editor for each release of Node-RED, set this to false + */ + tours: false, + + palette: { + /** The following property can be used to order the categories in the editor + * palette. If a node's category is not in the list, the category will get + * added to the end of the palette. + * If not set, the following default order is used: + */ + //categories: ['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'], + }, + + projects: { + /** To enable the Projects feature, set this value to true */ + enabled: true, + workflow: { + /** Set the default projects workflow mode. + * - manual - you must manually commit changes + * - auto - changes are automatically committed + * This can be overridden per-user from the 'Git config' + * section of 'User Settings' within the editor + */ + mode: "manual" + } + }, + + codeEditor: { + /** Select the text editor component used by the editor. + * As of Node-RED V3, this defaults to "monaco", but can be set to "ace" if desired + */ + lib: "monaco", + options: { + /** The follow options only apply if the editor is set to "monaco" + * + * theme - must match the file name of a theme in + * packages/node_modules/@node-red/editor-client/src/vendor/monaco/dist/theme + * e.g. "tomorrow-night", "upstream-sunburst", "github", "my-theme" + */ + // theme: "vs", + /** other overrides can be set e.g. fontSize, fontFamily, fontLigatures etc. + * for the full list, see https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IStandaloneEditorConstructionOptions.html + */ + //fontSize: 14, + //fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace", + //fontLigatures: true, + } + } + }, + +/******************************************************************************* + * Node Settings + * - fileWorkingDirectory + * - functionGlobalContext + * - functionExternalModules + * - nodeMessageBufferMaxLength + * - ui (for use with Node-RED Dashboard) + * - debugUseColors + * - debugMaxLength + * - execMaxBufferSize + * - httpRequestTimeout + * - mqttReconnectTime + * - serialReconnectTime + * - socketReconnectTime + * - socketTimeout + * - tcpMsgQueueSize + * - inboundWebSocketTimeout + * - tlsConfigDisableLocalFiles + * - webSocketNodeVerifyClient + ******************************************************************************/ + + /** The working directory to handle relative file paths from within the File nodes + * defaults to the working directory of the Node-RED process. + */ + //fileWorkingDirectory: "", + + /** Allow the Function node to load additional npm modules directly */ + functionExternalModules: true, + + /** The following property can be used to set predefined values in Global Context. + * This allows extra node modules to be made available with in Function node. + * For example, the following: + * functionGlobalContext: { os:require('os') } + * will allow the `os` module to be accessed in a Function node using: + * global.get("os") + */ + functionGlobalContext: { + // os:require('os'), + }, + + /** The maximum number of messages nodes will buffer internally as part of their + * operation. This applies across a range of nodes that operate on message sequences. + * defaults to no limit. A value of 0 also means no limit is applied. + */ + //nodeMessageBufferMaxLength: 0, + + /** If you installed the optional node-red-dashboard you can set it's path + * relative to httpNodeRoot + * Other optional properties include + * readOnly:{boolean}, + * middleware:{function or array}, (req,res,next) - http middleware + * ioMiddleware:{function or array}, (socket,next) - socket.io middleware + */ + //ui: { path: "ui" }, + + /** Colourise the console output of the debug node */ + //debugUseColors: true, + + /** The maximum length, in characters, of any message sent to the debug sidebar tab */ + debugMaxLength: 1000, + + /** Maximum buffer size for the exec node. Defaults to 10Mb */ + //execMaxBufferSize: 10000000, + + /** Timeout in milliseconds for HTTP request connections. Defaults to 120s */ + //httpRequestTimeout: 120000, + + /** Retry time in milliseconds for MQTT connections */ + mqttReconnectTime: 15000, + + /** Retry time in milliseconds for Serial port connections */ + serialReconnectTime: 15000, + + /** Retry time in milliseconds for TCP socket connections */ + //socketReconnectTime: 10000, + + /** Timeout in milliseconds for TCP server socket connections. Defaults to no timeout */ + //socketTimeout: 120000, + + /** Maximum number of messages to wait in queue while attempting to connect to TCP socket + * defaults to 1000 + */ + //tcpMsgQueueSize: 2000, + + /** Timeout in milliseconds for inbound WebSocket connections that do not + * match any configured node. Defaults to 5000 + */ + //inboundWebSocketTimeout: 5000, + + /** To disable the option for using local files for storing keys and + * certificates in the TLS configuration node, set this to true. + */ + //tlsConfigDisableLocalFiles: true, + + /** The following property can be used to verify websocket connection attempts. + * This allows, for example, the HTTP request headers to be checked to ensure + * they include valid authentication information. + */ + //webSocketNodeVerifyClient: function(info) { + // /** 'info' has three properties: + // * - origin : the value in the Origin header + // * - req : the HTTP request + // * - secure : true if req.connection.authorized or req.connection.encrypted is set + // * + // * The function should return true if the connection should be accepted, false otherwise. + // * + // * Alternatively, if this function is defined to accept a second argument, callback, + // * it can be used to verify the client asynchronously. + // * The callback takes three arguments: + // * - result : boolean, whether to accept the connection or not + // * - code : if result is false, the HTTP error status to return + // * - reason: if result is false, the HTTP reason string to return + // */ + //}, +} From a933dc5e796b4754258a9f7be8e6965221c12460 Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Wed, 20 Jul 2022 20:36:39 -0500 Subject: [PATCH 06/27] Initial Upload for Contesting Script. --- contesting_script.sh | 196 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 contesting_script.sh diff --git a/contesting_script.sh b/contesting_script.sh new file mode 100644 index 0000000..875eea8 --- /dev/null +++ b/contesting_script.sh @@ -0,0 +1,196 @@ +#!/bin/bash +clear +printf "Welcome to the NodeRed Dashboards.\nPlease hit enter to continue. " +read +echo "Are you wanting to update Node-Red?" +echo -n "Only choose no if you have installed Node-red all ready on this machine. Most people will choose Yes." +read -p "(Y/n) " flag_update +# Are you a dev? +read -p "Are you planning to help develop any of the dashboards? (y/N)" flag_dev +if [[ $flag_dev == 'Y' || $flag_dev == 'y' ]] ; then +read -p "What is your Github Username?" git_username +read -p "What is your Github Email?" git_email +else +git_username=nobody +git_email=example@example.com +fi +# Ask which Dashboard are you looking for? + +# Update RPI +if [[ $flag_update != 'n' ]] && [[ $flag_update != 'N' ]]; then +echo "Updating and Upgrading your Pi to newest standards" +sudo apt-get update -qq > /dev/null && sudo apt-get full-upgrade -qq -y > /dev/null && sudo apt-get clean > /dev/null +wait + +#Install Node-Red +bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) < /dev/null +printf "Install Git & Sqlite Y\n" +fi +wait +# Configure SQLITE +cd /home/pi +if [[ ! -f qsos ]] ; then + +sqlite3 qsos< .config.users.json < /dev/null +cd ~/.node-red/ +cat > .config.projects.json < Date: Wed, 3 Aug 2022 21:33:25 -0500 Subject: [PATCH 07/27] Fix for clear wording up. & Home Directory --- contesting_script.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/contesting_script.sh b/contesting_script.sh index 875eea8..b5500fa 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -29,17 +29,19 @@ y ! wait clear -printf "**NodeRed Dashboard Status**\nUpdating and Upgrading your Pi to newest standards Y\nInstall and Update NodeRed Y\n" +echo "**NodeRed Dashboard Status**" +echo "Updating and Upgrading your Pi to newest standards Y" +echo "Install and Update NodeRed Y" # Start NodeRed sudo systemctl start nodered.service sudo systemctl enable nodered.service # Install git & Sqlite3 sudo apt-get install git sqlite3 -qq > /dev/null -printf "Install Git & Sqlite Y\n" +echo "Install Git & Sqlite Y" fi wait # Configure SQLITE -cd /home/pi +cd $HOME if [[ ! -f qsos ]] ; then sqlite3 qsos< /dev/null curl -s -o settings.js https://settings.nodered.kd9lsv.me if [[ ! -d projects ]] ; then mkdir projects @@ -177,8 +179,10 @@ cat > .config.users.json < /dev/null +echo " Y" +echo "**The next step will take around 10 minutes. Please be patient.**" +echo -n "Install modules for Contesting Dashboard." +npm --prefix ~/.node-red/ install ~/.node-red/projects/Node-Red-Contesting-Dashboard/ --silent &> /dev/null cd ~/.node-red/ cat > .config.projects.json < Date: Mon, 26 Sep 2022 03:21:29 +0000 Subject: [PATCH 08/27] Add Progress bar --- contesting_script.sh | 51 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/contesting_script.sh b/contesting_script.sh index b5500fa..9b2f49a 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -1,10 +1,35 @@ #!/bin/bash +# 1. Create ProgressBar function +# 1.1 Input is currentState($1) and totalState($2) +function ProgressBar { +# Process data + let _progress=(${1}*100/${2}*100)/100 + let _done=(${_progress}*4)/10 + let _left=40-$_done +# Build progressbar string lengths + _done=$(printf "%${_done}s") + _left=$(printf "%${_left}s") + +# 1.2 Build progressbar strings and print the ProgressBar line +# 1.2.1 Output example: +# 1.2.1.1 Progress : [########################################] 100% +printf "\rProgress : [${_done// /#}${_left// /-}] ${_progress}%%" + +} +# Variables +_start=1 + +# This accounts as the "totalState" variable for the ProgressBar function +_end=100 clear printf "Welcome to the NodeRed Dashboards.\nPlease hit enter to continue. " read echo "Are you wanting to update Node-Red?" echo -n "Only choose no if you have installed Node-red all ready on this machine. Most people will choose Yes." read -p "(Y/n) " flag_update + +echo "Are you wanting to update the Dashboard? Note this will not delete your data." +read -p "(Y/n) " dashboard_update # Are you a dev? read -p "Are you planning to help develop any of the dashboards? (y/N)" flag_dev if [[ $flag_dev == 'Y' || $flag_dev == 'y' ]] ; then @@ -19,9 +44,17 @@ fi # Update RPI if [[ $flag_update != 'n' ]] && [[ $flag_update != 'N' ]]; then echo "Updating and Upgrading your Pi to newest standards" +for number in $(seq ${_start} ${_end}) +do + sleep 2 + ProgressBar ${number} ${_end} +done & +bgid=$! sudo apt-get update -qq > /dev/null && sudo apt-get full-upgrade -qq -y > /dev/null && sudo apt-get clean > /dev/null wait +ProgressBar ${_end} ${_end} + #Install Node-Red bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) < /dev/null +sudo apt-get install gityy sqlite3 -qq > /dev/null echo "Install Git & Sqlite Y" fi wait # Configure SQLITE cd $HOME -if [[ ! -f qsos ]] ; then - sqlite3 qsos< /dev/null -curl -s -o settings.js https://settings.nodered.kd9lsv.me +curl -sL -o settings.js https://settings.nodered.kd9lsv.me if [[ ! -d projects ]] ; then mkdir projects fi @@ -177,11 +207,21 @@ cat > .config.users.json < /dev/null cd ~/.node-red/ cat > .config.projects.json < .config.projects.json < Date: Mon, 26 Sep 2022 03:31:13 +0000 Subject: [PATCH 09/27] logic error fix --- contesting_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contesting_script.sh b/contesting_script.sh index 9b2f49a..e73a402 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -207,7 +207,7 @@ cat > .config.users.json < Date: Mon, 26 Sep 2022 03:33:40 +0000 Subject: [PATCH 10/27] Add Wait command for SQLITE --- contesting_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contesting_script.sh b/contesting_script.sh index e73a402..1f65071 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -223,6 +223,7 @@ done & bgid=$! npm --prefix ~/.node-red/ install ~/.node-red/projects/Node-Red-Contesting-Dashboard/ --silent &> /dev/null +wait cd ~/.node-red/ cat > .config.projects.json < Date: Sat, 1 Oct 2022 11:14:49 -0500 Subject: [PATCH 11/27] Split Schema and able to Update to latest version --- contesting_script.sh | 125 ++++++++----------------------------------- 1 file changed, 22 insertions(+), 103 deletions(-) diff --git a/contesting_script.sh b/contesting_script.sh index 1f65071..165b905 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -1,6 +1,8 @@ #!/bin/bash -# 1. Create ProgressBar function -# 1.1 Input is currentState($1) and totalState($2) + +## ---- Functions ----- ## +#Create ProgressBar function + function ProgressBar { # Process data let _progress=(${1}*100/${2}*100)/100 @@ -9,19 +11,17 @@ function ProgressBar { # Build progressbar string lengths _done=$(printf "%${_done}s") _left=$(printf "%${_left}s") - -# 1.2 Build progressbar strings and print the ProgressBar line -# 1.2.1 Output example: -# 1.2.1.1 Progress : [########################################] 100% -printf "\rProgress : [${_done// /#}${_left// /-}] ${_progress}%%" - +# Output example: +# Progress : [########################################] 100% + printf "\rProgress : [${_done// /#}${_left// /-}] ${_progress}%%" } + # Variables _start=1 - -# This accounts as the "totalState" variable for the ProgressBar function _end=100 clear + +## ---- Initial Questioning ---- ## printf "Welcome to the NodeRed Dashboards.\nPlease hit enter to continue. " read echo "Are you wanting to update Node-Red?" @@ -39,9 +39,8 @@ else git_username=nobody git_email=example@example.com fi -# Ask which Dashboard are you looking for? -# Update RPI +## ---- Update RPI ---- ## if [[ $flag_update != 'n' ]] && [[ $flag_update != 'N' ]]; then echo "Updating and Upgrading your Pi to newest standards" for number in $(seq ${_start} ${_end}) @@ -55,7 +54,7 @@ wait ProgressBar ${_end} ${_end} -#Install Node-Red +# -- Install Node-Red -- # bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) < /dev/null echo "Install Git & Sqlite Y" fi wait # Configure SQLITE cd $HOME -sqlite3 qsos< schema_init.db +sqlite3 qsos < schema_init.db + #configure NodeRed sudo systemctl stop nodered.service wait @@ -208,8 +122,13 @@ cat > .config.users.json < Date: Sat, 1 Oct 2022 11:57:41 -0500 Subject: [PATCH 12/27] Kill progress bar. --- contesting_script.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/contesting_script.sh b/contesting_script.sh index 165b905..cfc4554 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -50,6 +50,7 @@ do done & bgid=$! sudo apt-get update -qq > /dev/null && sudo apt-get full-upgrade -qq -y > /dev/null && sudo apt-get clean > /dev/null +kill $bgid wait ProgressBar ${_end} ${_end} @@ -72,8 +73,8 @@ fi wait # Configure SQLITE cd $HOME -curl -sL https://raw.githubusercontent.com/kylekrieg/Node-Red-Contesting-Dashboard/master/schema.db > schema_init.db -sqlite3 qsos < schema_init.db +curl -sL https://raw.githubusercontent.com/kylekrieg/Node-Red-Contesting-Dashboard/master/schema.db > schema_init +sqlite3 qsos < schema_init #configure NodeRed sudo systemctl stop nodered.service @@ -139,9 +140,13 @@ do sleep 5 ProgressBar ${number} ${_end} done & + bgid=$! +ProgressBar ${_end} ${_end} npm --prefix ~/.node-red/ install ~/.node-red/projects/Node-Red-Contesting-Dashboard/ --silent &> /dev/null +kill $bgid + wait cd ~/.node-red/ cat > .config.projects.json < Date: Sat, 1 Oct 2022 12:00:59 -0500 Subject: [PATCH 13/27] install git and Sqlite fix. --- contesting_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contesting_script.sh b/contesting_script.sh index cfc4554..6392e4a 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -67,7 +67,7 @@ echo "Updating and Upgrading your Pi to newest standards Y" echo "Install and Update NodeRed Y" # -- Install git & Sqlite3 -- # -sudo apt-get install gityy sqlite3 -qq > /dev/null +sudo apt-get install git sqlite3 -y -qq > /dev/null echo "Install Git & Sqlite Y" fi wait From 2a4d125539a182aa8f8171d057fb841005e74d60 Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Sat, 1 Oct 2022 12:01:52 -0500 Subject: [PATCH 14/27] Update SQLITE and git regardless of node-red. --- contesting_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contesting_script.sh b/contesting_script.sh index 6392e4a..974d4b3 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -65,11 +65,11 @@ clear echo "**NodeRed Dashboard Status**" echo "Updating and Upgrading your Pi to newest standards Y" echo "Install and Update NodeRed Y" - +fi # -- Install git & Sqlite3 -- # sudo apt-get install git sqlite3 -y -qq > /dev/null echo "Install Git & Sqlite Y" -fi + wait # Configure SQLITE cd $HOME From 5b214460fa8ed12fba8221d12e1537c263a15b66 Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Sat, 1 Oct 2022 12:06:53 -0500 Subject: [PATCH 15/27] Moved Progress Bars. --- contesting_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contesting_script.sh b/contesting_script.sh index 974d4b3..da234e2 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -53,7 +53,7 @@ sudo apt-get update -qq > /dev/null && sudo apt-get full-upgrade -qq -y > /dev/n kill $bgid wait -ProgressBar ${_end} ${_end} +ProgressBar ${_end} ${_end} # -- Install Node-Red -- # bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) < /dev/null +ProgressBar ${_end} ${_end} kill $bgid wait From 24e0f5394adf2782a44b989237326cde96f63c5c Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Sat, 1 Oct 2022 12:27:14 -0500 Subject: [PATCH 16/27] Relative to Absolute Paths. --- contesting_script.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contesting_script.sh b/contesting_script.sh index da234e2..0eb588a 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -125,9 +125,10 @@ EOL if [[ $dashboard_update != 'n' ]] && [[ $dashboard_update != 'N' ]]; then if [[ ! -d Node-Red-Contesting-Dashboard ]] ; then git clone https://github.com/kylekrieg/Node-Red-Contesting-Dashboard.git --quiet -cd Node-Red-Contesting-Dashboard +cd ~/.node-red/projects/Node-Red-Contesting-Dashboard else -cd Node-Red-Contesting-Dashboard +cd ~/.node-red/projects/Node-Red-Contesting-Dashboard +git config pull.rebase true git pull fi echo " Y" From 754a4acdb6f04c7b4861dafd582ceab8fc2dc79a Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Sat, 1 Oct 2022 12:36:39 -0500 Subject: [PATCH 17/27] Git Pull to Null --- contesting_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contesting_script.sh b/contesting_script.sh index 0eb588a..8e15bbb 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -129,7 +129,7 @@ cd ~/.node-red/projects/Node-Red-Contesting-Dashboard else cd ~/.node-red/projects/Node-Red-Contesting-Dashboard git config pull.rebase true -git pull +git pull &> /dev/null fi echo " Y" echo "**The next step will take around 10 minutes. Please be patient.**" From 5f94c32e6616628450b6e03591fde5b02436397e Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Wed, 26 Oct 2022 02:03:10 +0000 Subject: [PATCH 18/27] Allow git to pull without any issues. --- contesting_script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contesting_script.sh b/contesting_script.sh index 8e15bbb..66f34ac 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -129,6 +129,7 @@ cd ~/.node-red/projects/Node-Red-Contesting-Dashboard else cd ~/.node-red/projects/Node-Red-Contesting-Dashboard git config pull.rebase true +git restore flow.json git pull &> /dev/null fi echo " Y" From 87349c5232cb8a6d09c9ce083b9d52875bae3e1b Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Sat, 5 Nov 2022 14:13:04 -0500 Subject: [PATCH 19/27] Changed to enable from restart This shouldn't change anything but more for sanity checks --- contesting_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contesting_script.sh b/contesting_script.sh index 66f34ac..65e759e 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -160,7 +160,7 @@ EOL echo " Y" fi -sudo systemctl restart nodered.service +sudo systemctl enable nodered.service HOSTIP=`hostname -I | cut -d ' ' -f 1` if [ "$HOSTIP" = "" ]; then HOSTIP="127.0.0.1" From ca7c71b263ca9a7c25583ab2f6785ba2b1c6cfc3 Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Sat, 5 Nov 2022 15:43:27 -0500 Subject: [PATCH 20/27] update on command. --- contesting_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contesting_script.sh b/contesting_script.sh index 65e759e..6a5a0e5 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -160,7 +160,7 @@ EOL echo " Y" fi -sudo systemctl enable nodered.service +sudo systemctl enable --now nodered.service HOSTIP=`hostname -I | cut -d ' ' -f 1` if [ "$HOSTIP" = "" ]; then HOSTIP="127.0.0.1" From d2043dd095a3d0dc3c9be368c482ce75f5b8507d Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Wed, 16 Nov 2022 23:40:04 +0000 Subject: [PATCH 21/27] Linked settings file directly to github. --- contesting_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contesting_script.sh b/contesting_script.sh index 6a5a0e5..8059cc7 100644 --- a/contesting_script.sh +++ b/contesting_script.sh @@ -81,7 +81,7 @@ sudo systemctl stop nodered.service wait cd $HOME/.node-red npm install @node-red-contrib-themes/theme-collection --silent &> /dev/null -curl -sL -o settings.js https://settings.nodered.kd9lsv.me +curl -sL -o settings.js https://raw.githubusercontent.com/kd9lsv/Node-Red-AutoScripts/master/settings.js if [[ ! -d projects ]] ; then mkdir projects fi From 1cdd753f1bdb8ced395f6aaf8e031cb226ba5828 Mon Sep 17 00:00:00 2001 From: AA0Z <66072956+kylekrieg@users.noreply.github.com> Date: Thu, 29 Dec 2022 19:39:12 -0600 Subject: [PATCH 22/27] Update Context Storage Enable (#7) --- settings.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/settings.js b/settings.js index 6035c5d..2ddf2e2 100644 --- a/settings.js +++ b/settings.js @@ -307,11 +307,11 @@ module.exports = { * provided here will enable file-based context that flushes to disk every 30 seconds. * Refer to the documentation for further options: https://nodered.org/docs/api/context/ */ - //contextStorage: { - // default: { - // module:"localfilesystem" - // }, - //}, + contextStorage: { + default: { + module:"localfilesystem" + }, + }, /** `global.keys()` returns a list of all properties set in global context. * This allows them to be displayed in the Context Sidebar within the editor. From 96e25197dfbc30e8ef227a8a4f10c8d797a81cbb Mon Sep 17 00:00:00 2001 From: kd9lsv Date: Sun, 1 Jan 2023 06:37:12 -0600 Subject: [PATCH 23/27] Modified Install script and create assoicated docker-compose. --- contesting_script.sh | 274 ++++++++++++++++++++++++------------------- docker-compose.yml | 21 ++++ 2 files changed, 176 insertions(+), 119 deletions(-) mode change 100644 => 100755 contesting_script.sh create mode 100644 docker-compose.yml diff --git a/contesting_script.sh b/contesting_script.sh old mode 100644 new mode 100755 index 8059cc7..3c53d9f --- a/contesting_script.sh +++ b/contesting_script.sh @@ -4,16 +4,16 @@ #Create ProgressBar function function ProgressBar { -# Process data - let _progress=(${1}*100/${2}*100)/100 - let _done=(${_progress}*4)/10 - let _left=40-$_done -# Build progressbar string lengths - _done=$(printf "%${_done}s") - _left=$(printf "%${_left}s") -# Output example: -# Progress : [########################################] 100% - printf "\rProgress : [${_done// /#}${_left// /-}] ${_progress}%%" + # Process data + let _progress=(${1}*100/${2}*100)/100 + let _done=(${_progress}*4)/10 + let _left=40-$_done + # Build progressbar string lengths + _done=$(printf "%${_done}s") + _left=$(printf "%${_left}s") + # Output example: + # Progress : [########################################] 100% + printf "\rProgress : [${_done// /#}${_left// /-}] ${_progress}%%" } # Variables @@ -24,145 +24,181 @@ clear ## ---- Initial Questioning ---- ## printf "Welcome to the NodeRed Dashboards.\nPlease hit enter to continue. " read -echo "Are you wanting to update Node-Red?" -echo -n "Only choose no if you have installed Node-red all ready on this machine. Most people will choose Yes." -read -p "(Y/n) " flag_update +echo "Are you installing via Docker? *Recommended way* (Y/n)" +read docker_value +if [[ $docker_value == 'n' ]] || [[ $docker_value == 'N' ]]; then + NR_Path=$HOME/.node-red + echo "Are you wanting to update Node-Red?" + echo -n "Only choose no if you have installed Node-red all ready on this machine. Most people will choose Yes." + read -p "(Y/n) " flag_update -echo "Are you wanting to update the Dashboard? Note this will not delete your data." -read -p "(Y/n) " dashboard_update + echo "Are you wanting to update the Dashboard? Note this will not delete your data." + read -p "(Y/n) " dashboard_update +else + NR_Path=$HOME/Contest_Dashboard + flag_update='Y' + dashboard_update='Y' +fi # Are you a dev? read -p "Are you planning to help develop any of the dashboards? (y/N)" flag_dev + if [[ $flag_dev == 'Y' || $flag_dev == 'y' ]] ; then -read -p "What is your Github Username?" git_username -read -p "What is your Github Email?" git_email + read -p "What is your Github Username?" git_username + read -p "What is your Github Email?" git_email else -git_username=nobody -git_email=example@example.com + git_username=nobody + git_email=example@example.com fi ## ---- Update RPI ---- ## if [[ $flag_update != 'n' ]] && [[ $flag_update != 'N' ]]; then -echo "Updating and Upgrading your Pi to newest standards" -for number in $(seq ${_start} ${_end}) -do - sleep 2 - ProgressBar ${number} ${_end} -done & -bgid=$! -sudo apt-get update -qq > /dev/null && sudo apt-get full-upgrade -qq -y > /dev/null && sudo apt-get clean > /dev/null -kill $bgid -wait + echo "Updating and Upgrading your Pi to newest standards" + for number in $(seq ${_start} ${_end}) + do + sleep 2 + ProgressBar ${number} ${_end} + done & + bgid=$! + sudo apt-get update -qq > /dev/null && sudo apt-get full-upgrade -qq -y > /dev/null && sudo apt-get clean > /dev/null + kill $bgid + wait -ProgressBar ${_end} ${_end} + ProgressBar ${_end} ${_end} -# -- Install Node-Red -- # -bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) < /dev/null -echo "Install Git & Sqlite Y" + wait + clear + echo "Install and Update NodeRed Y" + sudo systemctl stop nodered.service + fi + clear + echo "Updating and Upgrading your Pi to newest standards Y" +fi +# -- Install git & Sqlite3 / Docker -- # +if [[ $docker_value == 'n' ]] || [[ $docker_value == 'N' ]]; then + sudo apt-get install git sqlite3 -y -qq > /dev/null + echo "Install Git & Sqlite Y" +else + sudo apt-get install git sqlite3 docker.io docker-compose -y -qq + echo "Install Git Sqlite & Docker Y" +fi wait -# Configure SQLITE -cd $HOME -curl -sL https://raw.githubusercontent.com/kylekrieg/Node-Red-Contesting-Dashboard/master/schema.db > schema_init -sqlite3 qsos < schema_init #configure NodeRed -sudo systemctl stop nodered.service -wait -cd $HOME/.node-red -npm install @node-red-contrib-themes/theme-collection --silent &> /dev/null -curl -sL -o settings.js https://raw.githubusercontent.com/kd9lsv/Node-Red-AutoScripts/master/settings.js +if [[ ! -d $NR_Path ]] ; then + mkdir $NR_Path +fi +cd $NR_Path/ if [[ ! -d projects ]] ; then mkdir projects fi -cd projects -echo -n "Cloning the Node-Red Dashboard" -cat > .config.users.json < /dev/null + curl -sL -o settings.js https://raw.githubusercontent.com/kd9lsv/Node-Red-AutoScripts/master/settings.js + cd projects + echo -n "Cloning the Node-Red Dashboard" + cat > .config.users.json << EOL + { + "_": { + "editor": { + "view": { + "view-store-zoom": false, + "view-store-position": false, + "view-show-grid": true, + "view-snap-grid": true, + "view-grid-size": "20", + "view-node-status": true, + "view-node-show-label": true, + "view-show-tips": true, + "view-show-welcome-tours": true + }, + "tours": { + "welcome": "3.0.0" + } }, - "tours": { - "welcome": "3.0.0" - } - }, - "git": { - "user": { - "name": "$git_username", - "email": "$git_email" + "git": { + "user": { + "name": "$git_username", + "email": "$git_email" + }, + "workflow": { + "mode": "manual" + } }, - "workflow": { - "mode": "manual" + "debug": { + "filter": "filterAll", + "filteredNodes": [] } - }, - "debug": { - "filter": "filterAll", - "filteredNodes": [] } } -} EOL -if [[ $dashboard_update != 'n' ]] && [[ $dashboard_update != 'N' ]]; then -if [[ ! -d Node-Red-Contesting-Dashboard ]] ; then -git clone https://github.com/kylekrieg/Node-Red-Contesting-Dashboard.git --quiet -cd ~/.node-red/projects/Node-Red-Contesting-Dashboard -else -cd ~/.node-red/projects/Node-Red-Contesting-Dashboard -git config pull.rebase true -git restore flow.json -git pull &> /dev/null -fi -echo " Y" -echo "**The next step will take around 10 minutes. Please be patient.**" -echo -n "Install modules for Contesting Dashboard." -npm config set jobs 4 - -for number in $(seq ${_start} ${_end}) -do - sleep 5 - ProgressBar ${number} ${_end} -done & + if [[ $dashboard_update != 'n' ]] && [[ $dashboard_update != 'N' ]]; then + if [[ ! -d Node-Red-Contesting-Dashboard ]] ; then + git clone https://github.com/kylekrieg/Node-Red-Contesting-Dashboard.git --quiet + cd ~/.node-red/projects/Node-Red-Contesting-Dashboard + else + cd ~/.node-red/projects/Node-Red-Contesting-Dashboard + git config pull.rebase true + git restore flow.json + git pull &> /dev/null + fi + echo " Y" + echo "**The next step will take around 10 minutes. Please be patient.**" + echo -n "Install modules for Contesting Dashboard." + npm config set jobs 4 -bgid=$! + for number in $(seq ${_start} ${_end}) + do + sleep 5 + ProgressBar ${number} ${_end} + done & -npm --prefix ~/.node-red/ install ~/.node-red/projects/Node-Red-Contesting-Dashboard/ --silent &> /dev/null -ProgressBar ${_end} ${_end} -kill $bgid + bgid=$! -wait -cd ~/.node-red/ -cat > .config.projects.json < /dev/null + ProgressBar ${_end} ${_end} + kill $bgid + wait + cd ~/.node-red/ + cat > .config.projects.json < Date: Sun, 1 Jan 2023 23:00:26 -0600 Subject: [PATCH 24/27] Moved script to Main Repo. --- docker/Dockerfile | 20 +++++++++---------- .../contesting_script.sh | 0 .../docker-compose.yml | 6 +++--- settings.js => docker/settings.js | 0 4 files changed, 12 insertions(+), 14 deletions(-) rename contesting_script.sh => docker/contesting_script.sh (100%) rename docker-compose.yml => docker/docker-compose.yml (76%) rename settings.js => docker/settings.js (100%) diff --git a/docker/Dockerfile b/docker/Dockerfile index d7bee6a..e3c2e38 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,30 +3,28 @@ ARG QEMU_ARCH USER root RUN apk add sqlite grep USER node-red -RUN curl -sL -o /data/settings.js https://raw.githubusercontent.com/radiosport-live/Node-Red-AutoScripts/master/settings.js -RUN mkdir -p /data/projects/ +COPY docker/settings.js /data/settings.js +COPY docker/.config.projects.json /data +COPY docker/.config.users.json /data +COPY schema.db /data -RUN git clone https://github.com/kylekrieg/Node-Red-Contesting-Dashboard.git --quiet /data/projects/Node-Red-Contesting-Dashboard +RUN mkdir -p /data/projects && mkdir -p /data/node_modules/ COPY package.json . +COPY . /data/projects/Node-Red-Contesting-Dashboard/ + RUN npm install --unsafe-perm --no-update-notifier --no-fund --omit=dev # Copy package.json to the WORKDIR so npm builds all # of your added nodes modules for Node-RED -COPY schema.db /data + # Copy _your_ Node-RED project files into place # NOTE: This will only work if you DO NOT later mount /data as an external volume. # If you need to use an external volume for persistence then # copy your settings and flows files to that volume instead. - -RUN cd /data/projects/Node-Red-Contesting-Dashboard && for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do \ - git branch --track ${branch#remotes/origin/} $branch ; \ -done - RUN sqlite3 /usr/src/node-red/qsos < /data/schema.db -COPY docker/.config.projects.json /data -COPY docker/.config.users.json /data + ENV NODE_RED_ENABLE_PROJECTS=true HEALTHCHECK CMD curl http://localhost:1880/ || exit 1 diff --git a/contesting_script.sh b/docker/contesting_script.sh similarity index 100% rename from contesting_script.sh rename to docker/contesting_script.sh diff --git a/docker-compose.yml b/docker/docker-compose.yml similarity index 76% rename from docker-compose.yml rename to docker/docker-compose.yml index 5e9c2be..5322844 100644 --- a/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.2" services: node-red: - image: ghcr.io/kd9lsv/node-red-contesting-dashboard:latest + image: ghcr.io/kylekrieg/node-red-contesting-dashboard ports: - "1880:1880" - "12060:12060/udp" @@ -13,9 +13,9 @@ services: - node-red-net volumes: - /etc/timezone:/etc/timezone:ro - - NR_DATA:/data:ro + - NR_DATA:/data:rw networks: node-red-net: volumes: NR_DATA: - \ No newline at end of file + diff --git a/settings.js b/docker/settings.js similarity index 100% rename from settings.js rename to docker/settings.js From 36679829c414ba3304cc17012c5c9d8614dd3e45 Mon Sep 17 00:00:00 2001 From: kd9lsv Date: Sun, 1 Jan 2023 23:44:52 -0600 Subject: [PATCH 25/27] Add Watchtower to Docker-Compose. --- docker/docker-compose.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 5322844..2debcbb 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -14,6 +14,21 @@ services: volumes: - /etc/timezone:/etc/timezone:ro - NR_DATA:/data:rw + watchtower: + image: containrrr/watchtower + environment: + - WATCHTOWER_CLEANUP=TRUE + - WATCHTOWER_INCLUDE_RESTARTING = TRUE + - WATCHTOWER_INCLUDE_STOPPED = TRUE + - WATCHTOWER_REVIVE_STOPPED = TRUE + - WATCHTOWER_POLL_INTERVAL = 86400 + - WATCHTOWER_ROLLING_RESTART = TRUE + - WATCHTOWER_TIMEOUT = 60 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /etc/timezone:/etc/timezone:ro + command: --interval 30 + networks: node-red-net: volumes: From 2b996b2095394b662ee9de9ad147a90a02cf1013 Mon Sep 17 00:00:00 2001 From: kd9lsv Date: Mon, 2 Jan 2023 00:13:00 -0600 Subject: [PATCH 26/27] Update Docker-Compose and Script --- docker/contesting_script.sh | 4 ++-- docker/docker-compose.yml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/contesting_script.sh b/docker/contesting_script.sh index 3c53d9f..3be1154 100755 --- a/docker/contesting_script.sh +++ b/docker/contesting_script.sh @@ -188,8 +188,8 @@ EOL fi else - cd $NR_Path - curl -L -o ./docker-compose.yml https://github.com/radiosport-live/Node-Red-AutoScripts/docker/docker-compose.yml + cd NR_Path + curl -L -o ./docker-compose.yml https://raw.githubusercontent.com/kylekrieg/Node-Red-Contesting-Dashboard/docker/docker/docker-compose.yml read -p "Are you wanting to config the docker container ? (y/N) " docker_config if [[ $docker_config == 'Y' || $docker_config == 'y' ]] ; then echo "$(pwd)" diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 2debcbb..b25a5df 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -18,12 +18,12 @@ services: image: containrrr/watchtower environment: - WATCHTOWER_CLEANUP=TRUE - - WATCHTOWER_INCLUDE_RESTARTING = TRUE - - WATCHTOWER_INCLUDE_STOPPED = TRUE - - WATCHTOWER_REVIVE_STOPPED = TRUE - - WATCHTOWER_POLL_INTERVAL = 86400 - - WATCHTOWER_ROLLING_RESTART = TRUE - - WATCHTOWER_TIMEOUT = 60 + - WATCHTOWER_INCLUDE_RESTARTING=TRUE + - WATCHTOWER_INCLUDE_STOPPED=TRUE + - WATCHTOWER_REVIVE_STOPPED=TRUE + - WATCHTOWER_POLL_INTERVAL=86400 + - WATCHTOWER_ROLLING_RESTART=TRUE + - WATCHTOWER_TIMEOUT=60 volumes: - /var/run/docker.sock:/var/run/docker.sock - /etc/timezone:/etc/timezone:ro From 5147c157880fb6f06191df237a55a3b2e060585e Mon Sep 17 00:00:00 2001 From: Connor Dickey Date: Sat, 12 Aug 2023 18:19:47 +0000 Subject: [PATCH 27/27] Remove 32bit Arm Due to .net capable of 64bit arm. All hardware should be 64bit. If 32bit, user will have to manually compile. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8119c1..ae3881a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: continue-on-error: true with: context: . - platforms: linux/amd64, linux/arm64, linux/armhf + platforms: linux/amd64, linux/arm64 file: docker/Dockerfile build-args: | NODE_VERSION=${{ matrix.node }}