├── CHANGELOG.md ├── LICENSE ├── README.md ├── VERSION ├── data ├── .gitignore ├── Dockerfile.template ├── index.js ├── package-lock.json └── package.json ├── docker-compose.yml ├── frontend ├── Dockerfile.template ├── index.js ├── package.json └── static │ ├── index.html │ └── js │ ├── app.js │ └── main.js ├── haproxy ├── Dockerfile.aarch64 ├── Dockerfile.amd64 ├── Dockerfile.armhf ├── Dockerfile.armv7hf ├── Dockerfile.i386 ├── Dockerfile.i386-nlp ├── Dockerfile.rpi └── haproxy.cfg └── repo.yml /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file 4 | automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! 5 | This project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | # v1.0.5 8 | ## (2022-09-16) 9 | 10 | * use bullseye instead of stretch [rcooke-warwick] 11 | 12 | # v1.0.4 13 | ## (2022-06-22) 14 | 15 | * Dockerfile: Switch to using base images by arch [Alexandru Costache] 16 | 17 | # v1.0.3 18 | ## (2021-12-15) 19 | 20 | * data/frontend: Update base images [Alexandru Costache] 21 | 22 | # v1.0.2 23 | ## (2021-10-20) 24 | 25 | * Fetch requirejs from unpkg to avoid expired certificate error on build [Thodoris Greasidis] 26 | 27 | # v1.0.1 28 | ## (2019-04-04) 29 | 30 | * frontend: highchart version was rolling before, pin it [Gergely Imreh] 31 | 32 | # v1.0.0 33 | ## (2019-04-04) 34 | 35 | * housekeeping: add repo.yml for versioning [Gergely Imreh] 36 | * haproxy: use just major version of haproxy to be more up to date [Gergely Imreh] 37 | * frontend: use "install_packages" tool to install packages [Gergely Imreh] 38 | * Dockerfile.template: Switch to new balenalib base images [Shaun Mulligan] 39 | * Fix repo URL in README [Paulo Castro] 40 | * data: socket.io update [Gergely Imreh] 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2016 Resin.io 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting started with multicontainer on balena 2 | 3 | This example will get you up and running quickly with a multicontainer setup on balena. The application creates a plot of your device's CPU load average and memory usage at the device's public URL, which is piped over using websockets. The system is composed of a simple static site server, a websocket server, and a proxy. These 3 components are defined in the [docker-compose.yml](docker-compose.yml) as services and are only given as much privilege as is needed. 4 | 5 | To get this project up and running, you'll need to [sign up](https://dashboard.balena-cloud.com/signup) for a balena account, create a microservices or starter application, and provision a device (device specific instructions can be found in our [getting started guide](https://balena.io/docs/getting-started). 6 | 7 | *Note: Multicontainer functionality requires balenaOS v2.12.0 or higher. If you do not see an option to choose a microservices or starter application type, a supported OS version has not yet been released for the selected device type.* 8 | 9 | Once you are set up, clone this repo locally: 10 | ``` 11 | $ git clone git@github.com:balena-io-projects/multicontainer-getting-started.git 12 | ``` 13 | Copy the command in the upper-right corner of your application dashboard to add your remote repository: 14 | ``` 15 | $ git remote add balena username@git.balena-cloud.com:username/myapp.git 16 | ``` 17 | Finally, push the code to the newly added remote: 18 | ``` 19 | $ git push balena master 20 | ``` 21 | It should take a few minutes for your project to build. While you wait, you can enable device URLs, so you can see the server outside of our local network. This option can be found in the *Actions* drop down in your device dashboard. 22 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.0.5 -------------------------------------------------------------------------------- /data/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /data/Dockerfile.template: -------------------------------------------------------------------------------- 1 | FROM balenalib/%%BALENA_ARCH%%-debian-node:14-bullseye-run 2 | 3 | # Defines our working directory in container 4 | WORKDIR /usr/src/app 5 | 6 | # Copies the package.json first for better cache on later pushes 7 | COPY package.json package.json 8 | 9 | # This install npm dependencies on the resin.io build server, 10 | # making sure to clean up the artifacts it creates in order to reduce the image size. 11 | RUN JOBS=MAX npm install --production 12 | # This will copy all files in our root to the working directory in the container 13 | COPY . ./ 14 | 15 | # server.js will run when container starts up on the device 16 | CMD ["npm", "start"] 17 | -------------------------------------------------------------------------------- /data/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const server = require('http').createServer(app); 4 | const io = require('socket.io')(server); 5 | const { 6 | exec 7 | } = require('child_process'); 8 | 9 | server.listen(8080); 10 | 11 | const getCpuLoad = (socket) => { 12 | exec('cat /proc/loadavg', (err, text) => { 13 | if (err) { 14 | throw err; 15 | } 16 | // Get overall average from last minute 17 | const matchLoad = text.match(/(\d+\.\d+)\s+/); 18 | if (matchLoad) { 19 | const load = parseFloat(matchLoad[1]); 20 | socket.emit('loadavg', { 21 | onemin: load 22 | }); 23 | } 24 | }); 25 | }; 26 | 27 | const getMemoryInfo = (socket) => { 28 | exec('cat /proc/meminfo', (err, text) => { 29 | if (err) { 30 | throw err; 31 | } 32 | // Get overall average from last minute 33 | const matchTotal = text.match(/MemTotal:\s+([0-9]+)/); 34 | const matchFree = text.match(/MemFree:\s+([0-9]+)/); 35 | if (matchTotal && matchFree) { 36 | const total = parseInt(matchTotal[1], 10); 37 | const free = parseInt(matchFree[1], 10); 38 | const percentageUsed = (total - free) / total * 100; 39 | socket.emit('memory', { 40 | used: percentageUsed 41 | }); 42 | } 43 | }); 44 | }; 45 | 46 | io.on('connection', function(socket) { 47 | 'use strict'; 48 | console.log('a user connected'); 49 | let dataLoop = setInterval(function() { 50 | getCpuLoad(socket); 51 | getMemoryInfo(socket); 52 | }, 1000); 53 | socket.on('disconnect', function() { 54 | console.log('a user disconnected'); 55 | clearInterval(dataLoop); 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /data/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resin-websocket", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "accepts": { 8 | "version": "1.3.5", 9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", 10 | "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", 11 | "requires": { 12 | "mime-types": "~2.1.18", 13 | "negotiator": "0.6.1" 14 | }, 15 | "dependencies": { 16 | "mime-db": { 17 | "version": "1.33.0", 18 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", 19 | "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" 20 | }, 21 | "mime-types": { 22 | "version": "2.1.18", 23 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", 24 | "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", 25 | "requires": { 26 | "mime-db": "~1.33.0" 27 | } 28 | } 29 | } 30 | }, 31 | "after": { 32 | "version": "0.8.2", 33 | "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", 34 | "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" 35 | }, 36 | "array-flatten": { 37 | "version": "1.1.1", 38 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 39 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 40 | }, 41 | "arraybuffer.slice": { 42 | "version": "0.0.7", 43 | "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", 44 | "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" 45 | }, 46 | "async-limiter": { 47 | "version": "1.0.0", 48 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", 49 | "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" 50 | }, 51 | "backo2": { 52 | "version": "1.0.2", 53 | "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", 54 | "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" 55 | }, 56 | "base64-arraybuffer": { 57 | "version": "0.1.5", 58 | "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", 59 | "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" 60 | }, 61 | "base64id": { 62 | "version": "1.0.0", 63 | "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", 64 | "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=" 65 | }, 66 | "better-assert": { 67 | "version": "1.0.2", 68 | "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", 69 | "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", 70 | "requires": { 71 | "callsite": "1.0.0" 72 | } 73 | }, 74 | "blob": { 75 | "version": "0.0.4", 76 | "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", 77 | "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=" 78 | }, 79 | "body-parser": { 80 | "version": "1.18.2", 81 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", 82 | "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", 83 | "requires": { 84 | "bytes": "3.0.0", 85 | "content-type": "~1.0.4", 86 | "debug": "2.6.9", 87 | "depd": "~1.1.1", 88 | "http-errors": "~1.6.2", 89 | "iconv-lite": "0.4.19", 90 | "on-finished": "~2.3.0", 91 | "qs": "6.5.1", 92 | "raw-body": "2.3.2", 93 | "type-is": "~1.6.15" 94 | } 95 | }, 96 | "bytes": { 97 | "version": "3.0.0", 98 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", 99 | "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" 100 | }, 101 | "callsite": { 102 | "version": "1.0.0", 103 | "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", 104 | "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" 105 | }, 106 | "component-bind": { 107 | "version": "1.0.0", 108 | "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", 109 | "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" 110 | }, 111 | "component-emitter": { 112 | "version": "1.2.1", 113 | "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", 114 | "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" 115 | }, 116 | "component-inherit": { 117 | "version": "0.0.3", 118 | "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", 119 | "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" 120 | }, 121 | "content-disposition": { 122 | "version": "0.5.2", 123 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", 124 | "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" 125 | }, 126 | "content-type": { 127 | "version": "1.0.4", 128 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 129 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 130 | }, 131 | "cookie": { 132 | "version": "0.3.1", 133 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", 134 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" 135 | }, 136 | "cookie-signature": { 137 | "version": "1.0.6", 138 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 139 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 140 | }, 141 | "debug": { 142 | "version": "2.6.9", 143 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 144 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 145 | "requires": { 146 | "ms": "2.0.0" 147 | } 148 | }, 149 | "depd": { 150 | "version": "1.1.2", 151 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 152 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 153 | }, 154 | "destroy": { 155 | "version": "1.0.4", 156 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 157 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 158 | }, 159 | "ee-first": { 160 | "version": "1.1.1", 161 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 162 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 163 | }, 164 | "encodeurl": { 165 | "version": "1.0.2", 166 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 167 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 168 | }, 169 | "engine.io": { 170 | "version": "3.2.0", 171 | "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.2.0.tgz", 172 | "integrity": "sha512-mRbgmAtQ4GAlKwuPnnAvXXwdPhEx+jkc0OBCLrXuD/CRvwNK3AxRSnqK4FSqmAMRRHryVJP8TopOvmEaA64fKw==", 173 | "requires": { 174 | "accepts": "~1.3.4", 175 | "base64id": "1.0.0", 176 | "cookie": "0.3.1", 177 | "debug": "~3.1.0", 178 | "engine.io-parser": "~2.1.0", 179 | "ws": "~3.3.1" 180 | }, 181 | "dependencies": { 182 | "debug": { 183 | "version": "3.1.0", 184 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 185 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 186 | "requires": { 187 | "ms": "2.0.0" 188 | } 189 | } 190 | } 191 | }, 192 | "engine.io-client": { 193 | "version": "3.2.1", 194 | "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.2.1.tgz", 195 | "integrity": "sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw==", 196 | "requires": { 197 | "component-emitter": "1.2.1", 198 | "component-inherit": "0.0.3", 199 | "debug": "~3.1.0", 200 | "engine.io-parser": "~2.1.1", 201 | "has-cors": "1.1.0", 202 | "indexof": "0.0.1", 203 | "parseqs": "0.0.5", 204 | "parseuri": "0.0.5", 205 | "ws": "~3.3.1", 206 | "xmlhttprequest-ssl": "~1.5.4", 207 | "yeast": "0.1.2" 208 | }, 209 | "dependencies": { 210 | "debug": { 211 | "version": "3.1.0", 212 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 213 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 214 | "requires": { 215 | "ms": "2.0.0" 216 | } 217 | } 218 | } 219 | }, 220 | "engine.io-parser": { 221 | "version": "2.1.2", 222 | "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.2.tgz", 223 | "integrity": "sha512-dInLFzr80RijZ1rGpx1+56/uFoH7/7InhH3kZt+Ms6hT8tNx3NGW/WNSA/f8As1WkOfkuyb3tnRyuXGxusclMw==", 224 | "requires": { 225 | "after": "0.8.2", 226 | "arraybuffer.slice": "~0.0.7", 227 | "base64-arraybuffer": "0.1.5", 228 | "blob": "0.0.4", 229 | "has-binary2": "~1.0.2" 230 | } 231 | }, 232 | "escape-html": { 233 | "version": "1.0.3", 234 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 235 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 236 | }, 237 | "etag": { 238 | "version": "1.8.1", 239 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 240 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 241 | }, 242 | "express": { 243 | "version": "4.16.3", 244 | "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", 245 | "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", 246 | "requires": { 247 | "accepts": "~1.3.5", 248 | "array-flatten": "1.1.1", 249 | "body-parser": "1.18.2", 250 | "content-disposition": "0.5.2", 251 | "content-type": "~1.0.4", 252 | "cookie": "0.3.1", 253 | "cookie-signature": "1.0.6", 254 | "debug": "2.6.9", 255 | "depd": "~1.1.2", 256 | "encodeurl": "~1.0.2", 257 | "escape-html": "~1.0.3", 258 | "etag": "~1.8.1", 259 | "finalhandler": "1.1.1", 260 | "fresh": "0.5.2", 261 | "merge-descriptors": "1.0.1", 262 | "methods": "~1.1.2", 263 | "on-finished": "~2.3.0", 264 | "parseurl": "~1.3.2", 265 | "path-to-regexp": "0.1.7", 266 | "proxy-addr": "~2.0.3", 267 | "qs": "6.5.1", 268 | "range-parser": "~1.2.0", 269 | "safe-buffer": "5.1.1", 270 | "send": "0.16.2", 271 | "serve-static": "1.13.2", 272 | "setprototypeof": "1.1.0", 273 | "statuses": "~1.4.0", 274 | "type-is": "~1.6.16", 275 | "utils-merge": "1.0.1", 276 | "vary": "~1.1.2" 277 | } 278 | }, 279 | "finalhandler": { 280 | "version": "1.1.1", 281 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", 282 | "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", 283 | "requires": { 284 | "debug": "2.6.9", 285 | "encodeurl": "~1.0.2", 286 | "escape-html": "~1.0.3", 287 | "on-finished": "~2.3.0", 288 | "parseurl": "~1.3.2", 289 | "statuses": "~1.4.0", 290 | "unpipe": "~1.0.0" 291 | } 292 | }, 293 | "forwarded": { 294 | "version": "0.1.2", 295 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 296 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" 297 | }, 298 | "fresh": { 299 | "version": "0.5.2", 300 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 301 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 302 | }, 303 | "has-binary2": { 304 | "version": "1.0.2", 305 | "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.2.tgz", 306 | "integrity": "sha1-6D26SfC5vk0CbSc2U1DZ8D9Uvpg=", 307 | "requires": { 308 | "isarray": "2.0.1" 309 | } 310 | }, 311 | "has-cors": { 312 | "version": "1.1.0", 313 | "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", 314 | "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" 315 | }, 316 | "http-errors": { 317 | "version": "1.6.3", 318 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", 319 | "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", 320 | "requires": { 321 | "depd": "~1.1.2", 322 | "inherits": "2.0.3", 323 | "setprototypeof": "1.1.0", 324 | "statuses": ">= 1.4.0 < 2" 325 | } 326 | }, 327 | "iconv-lite": { 328 | "version": "0.4.19", 329 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", 330 | "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" 331 | }, 332 | "indexof": { 333 | "version": "0.0.1", 334 | "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", 335 | "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" 336 | }, 337 | "inherits": { 338 | "version": "2.0.3", 339 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 340 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 341 | }, 342 | "ipaddr.js": { 343 | "version": "1.6.0", 344 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", 345 | "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" 346 | }, 347 | "isarray": { 348 | "version": "2.0.1", 349 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", 350 | "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" 351 | }, 352 | "media-typer": { 353 | "version": "0.3.0", 354 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 355 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 356 | }, 357 | "merge-descriptors": { 358 | "version": "1.0.1", 359 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 360 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 361 | }, 362 | "methods": { 363 | "version": "1.1.2", 364 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 365 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 366 | }, 367 | "mime": { 368 | "version": "1.4.1", 369 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", 370 | "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" 371 | }, 372 | "ms": { 373 | "version": "2.0.0", 374 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 375 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 376 | }, 377 | "negotiator": { 378 | "version": "0.6.1", 379 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", 380 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" 381 | }, 382 | "object-component": { 383 | "version": "0.0.3", 384 | "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", 385 | "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" 386 | }, 387 | "on-finished": { 388 | "version": "2.3.0", 389 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 390 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 391 | "requires": { 392 | "ee-first": "1.1.1" 393 | } 394 | }, 395 | "parseqs": { 396 | "version": "0.0.5", 397 | "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", 398 | "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", 399 | "requires": { 400 | "better-assert": "~1.0.0" 401 | } 402 | }, 403 | "parseuri": { 404 | "version": "0.0.5", 405 | "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", 406 | "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", 407 | "requires": { 408 | "better-assert": "~1.0.0" 409 | } 410 | }, 411 | "parseurl": { 412 | "version": "1.3.2", 413 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", 414 | "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" 415 | }, 416 | "path-to-regexp": { 417 | "version": "0.1.7", 418 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 419 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 420 | }, 421 | "proxy-addr": { 422 | "version": "2.0.3", 423 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", 424 | "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", 425 | "requires": { 426 | "forwarded": "~0.1.2", 427 | "ipaddr.js": "1.6.0" 428 | } 429 | }, 430 | "qs": { 431 | "version": "6.5.1", 432 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", 433 | "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" 434 | }, 435 | "range-parser": { 436 | "version": "1.2.0", 437 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", 438 | "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" 439 | }, 440 | "raw-body": { 441 | "version": "2.3.2", 442 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", 443 | "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", 444 | "requires": { 445 | "bytes": "3.0.0", 446 | "http-errors": "1.6.2", 447 | "iconv-lite": "0.4.19", 448 | "unpipe": "1.0.0" 449 | }, 450 | "dependencies": { 451 | "depd": { 452 | "version": "1.1.1", 453 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", 454 | "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" 455 | }, 456 | "http-errors": { 457 | "version": "1.6.2", 458 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", 459 | "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", 460 | "requires": { 461 | "depd": "1.1.1", 462 | "inherits": "2.0.3", 463 | "setprototypeof": "1.0.3", 464 | "statuses": ">= 1.3.1 < 2" 465 | } 466 | }, 467 | "setprototypeof": { 468 | "version": "1.0.3", 469 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", 470 | "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" 471 | } 472 | } 473 | }, 474 | "safe-buffer": { 475 | "version": "5.1.1", 476 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 477 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" 478 | }, 479 | "send": { 480 | "version": "0.16.2", 481 | "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", 482 | "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", 483 | "requires": { 484 | "debug": "2.6.9", 485 | "depd": "~1.1.2", 486 | "destroy": "~1.0.4", 487 | "encodeurl": "~1.0.2", 488 | "escape-html": "~1.0.3", 489 | "etag": "~1.8.1", 490 | "fresh": "0.5.2", 491 | "http-errors": "~1.6.2", 492 | "mime": "1.4.1", 493 | "ms": "2.0.0", 494 | "on-finished": "~2.3.0", 495 | "range-parser": "~1.2.0", 496 | "statuses": "~1.4.0" 497 | } 498 | }, 499 | "serve-static": { 500 | "version": "1.13.2", 501 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", 502 | "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", 503 | "requires": { 504 | "encodeurl": "~1.0.2", 505 | "escape-html": "~1.0.3", 506 | "parseurl": "~1.3.2", 507 | "send": "0.16.2" 508 | } 509 | }, 510 | "setprototypeof": { 511 | "version": "1.1.0", 512 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", 513 | "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" 514 | }, 515 | "socket.io": { 516 | "version": "2.1.0", 517 | "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.1.0.tgz", 518 | "integrity": "sha512-KS+3CNWWNtLbVN5j0/B+1hjxRzey+oTK6ejpAOoxMZis6aXeB8cUtfuvjHl97tuZx+t/qD/VyqFMjuzu2Js6uQ==", 519 | "requires": { 520 | "debug": "~3.1.0", 521 | "engine.io": "~3.2.0", 522 | "has-binary2": "~1.0.2", 523 | "socket.io-adapter": "~1.1.0", 524 | "socket.io-client": "2.1.0", 525 | "socket.io-parser": "~3.2.0" 526 | }, 527 | "dependencies": { 528 | "debug": { 529 | "version": "3.1.0", 530 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 531 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 532 | "requires": { 533 | "ms": "2.0.0" 534 | } 535 | } 536 | } 537 | }, 538 | "socket.io-adapter": { 539 | "version": "1.1.1", 540 | "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz", 541 | "integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=" 542 | }, 543 | "socket.io-client": { 544 | "version": "2.1.0", 545 | "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.1.0.tgz", 546 | "integrity": "sha512-TvKPpL0cBON5LduQfR8Rxrr+ktj70bLXGvqHCL3er5avBXruB3gpnbaud5ikFYVfANH1gCABAvo0qN8Axpg2ew==", 547 | "requires": { 548 | "backo2": "1.0.2", 549 | "base64-arraybuffer": "0.1.5", 550 | "component-bind": "1.0.0", 551 | "component-emitter": "1.2.1", 552 | "debug": "~3.1.0", 553 | "engine.io-client": "~3.2.0", 554 | "has-binary2": "~1.0.2", 555 | "has-cors": "1.1.0", 556 | "indexof": "0.0.1", 557 | "object-component": "0.0.3", 558 | "parseqs": "0.0.5", 559 | "parseuri": "0.0.5", 560 | "socket.io-parser": "~3.2.0", 561 | "to-array": "0.1.4" 562 | }, 563 | "dependencies": { 564 | "debug": { 565 | "version": "3.1.0", 566 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 567 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 568 | "requires": { 569 | "ms": "2.0.0" 570 | } 571 | } 572 | } 573 | }, 574 | "socket.io-parser": { 575 | "version": "3.2.0", 576 | "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.2.0.tgz", 577 | "integrity": "sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA==", 578 | "requires": { 579 | "component-emitter": "1.2.1", 580 | "debug": "~3.1.0", 581 | "isarray": "2.0.1" 582 | }, 583 | "dependencies": { 584 | "debug": { 585 | "version": "3.1.0", 586 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 587 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 588 | "requires": { 589 | "ms": "2.0.0" 590 | } 591 | } 592 | } 593 | }, 594 | "statuses": { 595 | "version": "1.4.0", 596 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", 597 | "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" 598 | }, 599 | "to-array": { 600 | "version": "0.1.4", 601 | "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", 602 | "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" 603 | }, 604 | "type-is": { 605 | "version": "1.6.16", 606 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", 607 | "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", 608 | "requires": { 609 | "media-typer": "0.3.0", 610 | "mime-types": "~2.1.18" 611 | }, 612 | "dependencies": { 613 | "mime-db": { 614 | "version": "1.33.0", 615 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", 616 | "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" 617 | }, 618 | "mime-types": { 619 | "version": "2.1.18", 620 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", 621 | "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", 622 | "requires": { 623 | "mime-db": "~1.33.0" 624 | } 625 | } 626 | } 627 | }, 628 | "ultron": { 629 | "version": "1.1.1", 630 | "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", 631 | "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" 632 | }, 633 | "unpipe": { 634 | "version": "1.0.0", 635 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 636 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 637 | }, 638 | "utils-merge": { 639 | "version": "1.0.1", 640 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 641 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 642 | }, 643 | "vary": { 644 | "version": "1.1.2", 645 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 646 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 647 | }, 648 | "ws": { 649 | "version": "3.3.3", 650 | "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", 651 | "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", 652 | "requires": { 653 | "async-limiter": "~1.0.0", 654 | "safe-buffer": "~5.1.0", 655 | "ultron": "~1.1.0" 656 | } 657 | }, 658 | "xmlhttprequest-ssl": { 659 | "version": "1.5.5", 660 | "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", 661 | "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" 662 | }, 663 | "yeast": { 664 | "version": "0.1.2", 665 | "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", 666 | "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" 667 | } 668 | } 669 | } 670 | -------------------------------------------------------------------------------- /data/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resin-websocket", 3 | "version": "1.0.1", 4 | "description": "Websocket example", 5 | "main": "index.js", 6 | "homepage": "https://github.com/resin-io-projects/resin-websocket", 7 | "repository": { 8 | "type": "git", 9 | "url": "git@github.com:resin-io-projects/resin-websocket.git" 10 | }, 11 | "scripts": { 12 | "start": "node index.js" 13 | }, 14 | "author": "Kostas Lekkas ", 15 | "license": "Apache-2.0", 16 | "jshintConfig": { 17 | "esversion": 6, 18 | "strict": true 19 | }, 20 | "dependencies": { 21 | "express": "^4.16.3", 22 | "socket.io": "^2.1.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | frontend: 4 | build: ./frontend 5 | expose: 6 | - "80" 7 | proxy: 8 | build: ./haproxy 9 | depends_on: 10 | - frontend 11 | - data 12 | ports: 13 | - "80:80" 14 | data: 15 | build: ./data 16 | expose: 17 | - "8080" 18 | -------------------------------------------------------------------------------- /frontend/Dockerfile.template: -------------------------------------------------------------------------------- 1 | FROM balenalib/%%BALENA_ARCH%%-debian-node:14-bullseye-run 2 | # Defines our working directory in container 3 | WORKDIR /usr/src/app 4 | 5 | RUN install_packages wget 6 | 7 | ENV JQUERY_VERSION=3.3.1 8 | ENV REQUIREJS_VERSION=2.3.6 9 | ENV HIGHCHARTS_VERSION=7.0.3 10 | RUN mkdir -p static/js && \ 11 | wget "https://code.jquery.com/jquery-${JQUERY_VERSION}.min.js" -O static/js/jquery.min.js && \ 12 | wget "https://code.highcharts.com/${HIGHCHARTS_VERSION}/highcharts.js" -O static/js/highcharts.js && \ 13 | wget "https://unpkg.com/requirejs@${REQUIREJS_VERSION}/require.js" -O static/js/require.js 14 | 15 | # Copies the package.json first for better cache on later pushes 16 | COPY package.json package.json 17 | 18 | # This install npm dependencies on the resin.io build server, 19 | # making sure to clean up the artifacts it creates in order to reduce the image size. 20 | RUN JOBS=MAX npm install --production 21 | # This will copy all files in our root to the working directory in the container 22 | COPY . ./ 23 | 24 | # server.js will run when container starts up on the device 25 | CMD ["npm", "start"] 26 | -------------------------------------------------------------------------------- /frontend/index.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | var express = require('express'); 3 | 4 | var PORT = 80; 5 | 6 | var app = express(); 7 | var server = http.createServer(app); 8 | 9 | app.use(express.static(__dirname + '/static')) 10 | server.listen(PORT, function() { 11 | console.log("server is listening on port", PORT); 12 | }); 13 | 14 | -------------------------------------------------------------------------------- /frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resin-websocket", 3 | "version": "1.0.0", 4 | "description": "Websocket example", 5 | "main": "index.js", 6 | "homepage": "https://github.com/resin-io-projects/resin-websocket", 7 | "repository": { 8 | "type": "git", 9 | "url": "git@github.com:resin-io-projects/resin-websocket.git" 10 | }, 11 | "scripts": { 12 | "start": "node index.js" 13 | }, 14 | "author": "Kostas Lekkas ", 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "express": "^4.16.2" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontend/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Live Data 4 | 8 | 9 | 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /frontend/static/js/app.js: -------------------------------------------------------------------------------- 1 | requirejs.config({ 2 | paths: { 3 | jquery: "jquery.min", 4 | highcharts: "highcharts", 5 | socketio: "../socket.io/socket.io" 6 | }, 7 | shim: { 8 | highcharts: { 9 | exports: "Highcharts", 10 | deps: ["jquery"] 11 | }, 12 | socketio: { 13 | exports: "io" 14 | } 15 | } 16 | }); 17 | 18 | // Retry failed module loading 19 | function requireWithRetry(modules) { 20 | var retryInterval = 5000; 21 | var retryCount = 0; 22 | var retryOnError = function(err) { 23 | var failedId = err.requireModules && err.requireModules[0]; 24 | // this is what tells RequireJS not to cache the previous failure status 25 | requirejs.undef(failedId); 26 | retryCount++; 27 | console.log(`Retrying module loading #${retryCount} after wait...`); 28 | setTimeout(function() { 29 | requirejs([failedId], null, retryOnError); 30 | }, retryInterval); 31 | }; 32 | requirejs(modules, null, retryOnError); 33 | } 34 | // Start our main code 35 | requireWithRetry(["main"]); 36 | -------------------------------------------------------------------------------- /frontend/static/js/main.js: -------------------------------------------------------------------------------- 1 | define(["jquery", "highcharts", "socketio"], function($, Highcharts, io) { 2 | $(document).ready(function() { 3 | var chart = new Highcharts.Chart({ 4 | chart: { 5 | zoomType: "xy", 6 | margin: [80, 80, 80, 80], 7 | renderTo: "container" 8 | }, 9 | title: { 10 | text: "CPU Load Average & Memory Usage" 11 | }, 12 | subtitle: { 13 | text: "Plotting CPU Load and Memory Info in real-time using websockets." 14 | }, 15 | xAxis: { 16 | gridLineWidth: 5, 17 | maxZoom: 60 18 | }, 19 | yAxis: [ 20 | { 21 | title: { 22 | text: "Memory %age" 23 | }, 24 | min: 0, 25 | max: 100, 26 | plotLines: [ 27 | { 28 | value: 0, 29 | width: 1, 30 | colour: "#808800" 31 | } 32 | ], 33 | opposite: true 34 | }, 35 | { 36 | title: { 37 | text: "LoadAvg" 38 | }, 39 | min: 0, 40 | plotLines: [ 41 | { 42 | value: 0, 43 | width: 1, 44 | colour: "#008888", 45 | zIndex: 0 46 | } 47 | ] 48 | } 49 | ], 50 | plotOptions: { 51 | column: { 52 | pointPadding: 0, 53 | groupPadding: 0 54 | } 55 | }, 56 | series: [ 57 | { 58 | name: "MemInfo", 59 | type: "column", 60 | color: "#008800", 61 | grouping: false, 62 | yAxis: 0, 63 | data: [] 64 | }, 65 | { 66 | name: "CpuLoad", 67 | type: "spline", 68 | yAxis: 1, 69 | data: [] 70 | } 71 | ] 72 | }); 73 | 74 | var socket = io.connect( 75 | window.location.protocol + "//" + window.location.hostname 76 | ); 77 | 78 | socket.on("loadavg", data => { 79 | var series = chart.series[1]; 80 | series.addPoint([data.onemin], true, series.data.length > 100); 81 | }); 82 | socket.on("memory", data => { 83 | var series = chart.series[0]; 84 | series.addPoint([data.used], true, series.data.length > 100); 85 | }); 86 | }); 87 | }); 88 | -------------------------------------------------------------------------------- /haproxy/Dockerfile.aarch64: -------------------------------------------------------------------------------- 1 | FROM arm64v8/haproxy:1-alpine 2 | 3 | COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg -------------------------------------------------------------------------------- /haproxy/Dockerfile.amd64: -------------------------------------------------------------------------------- 1 | FROM haproxy:1-alpine 2 | 3 | COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg -------------------------------------------------------------------------------- /haproxy/Dockerfile.armhf: -------------------------------------------------------------------------------- 1 | FROM arm32v6/haproxy:1-alpine 2 | 3 | COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg -------------------------------------------------------------------------------- /haproxy/Dockerfile.armv7hf: -------------------------------------------------------------------------------- 1 | FROM arm32v6/haproxy:1-alpine 2 | 3 | COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg -------------------------------------------------------------------------------- /haproxy/Dockerfile.i386: -------------------------------------------------------------------------------- 1 | FROM i386/haproxy:1-alpine 2 | 3 | COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg -------------------------------------------------------------------------------- /haproxy/Dockerfile.i386-nlp: -------------------------------------------------------------------------------- 1 | FROM i386/haproxy:1-alpine 2 | 3 | COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg -------------------------------------------------------------------------------- /haproxy/Dockerfile.rpi: -------------------------------------------------------------------------------- 1 | FROM arm32v6/haproxy:1-alpine 2 | 3 | COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg -------------------------------------------------------------------------------- /haproxy/haproxy.cfg: -------------------------------------------------------------------------------- 1 | global 2 | maxconn 4096 3 | 4 | defaults 5 | mode http 6 | balance roundrobin 7 | option redispatch 8 | option forwardfor 9 | timeout connect 5s 10 | timeout queue 5s 11 | timeout client 50s 12 | timeout server 50s 13 | 14 | frontend http 15 | bind *:80 16 | default_backend backend_static_server 17 | # Any URL beginning with socket.io will be flagged as 'is_websocket' 18 | acl is_websocket path_beg /socket.io 19 | acl is_websocket hdr(Upgrade) -i WebSocket 20 | acl is_websocket hdr_beg(Host) -i ws 21 | 22 | # The connection to use if 'is_websocket' is flagged 23 | use_backend backend_data if is_websocket 24 | 25 | backend backend_static_server 26 | mode http 27 | option forwardfor 28 | balance roundrobin 29 | timeout server 600s 30 | server static_1 frontend:80 check port 80 31 | 32 | backend backend_data 33 | balance source 34 | option http-server-close 35 | option forceclose 36 | server api_1 data:8080 weight 1 maxconn 1024 check 37 | -------------------------------------------------------------------------------- /repo.yml: -------------------------------------------------------------------------------- 1 | type: 'generic' 2 | --------------------------------------------------------------------------------