├── .env ├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── README.md ├── cacert.pem ├── compose.yaml ├── openc3-redis └── users.acl ├── openc3-traefik ├── traefik-allow-http.yaml ├── traefik-letsencrypt.yaml ├── traefik-ssl.yaml └── traefik.yaml ├── openc3.bat ├── openc3.sh ├── plugins ├── DEFAULT │ └── README.md └── README.md └── scripts ├── linux ├── openc3_util.sh └── sync_openc3.sh └── windows └── openc3_util.bat /.env: -------------------------------------------------------------------------------- 1 | # Which TAG to deploy, latest or specific version, e.g. 5.4.2 2 | OPENC3_TAG=6.4.2 3 | # Comment this variable to disable local mode (don't set it to 0) 4 | OPENC3_LOCAL_MODE=1 5 | # Comment this variable to disable installing the Demo (don't set it to 0) 6 | OPENC3_DEMO=1 7 | # Docker repo settings on where to get COSMOS containers 8 | OPENC3_REGISTRY=docker.io 9 | OPENC3_NAMESPACE=openc3inc 10 | OPENC3_DEPENDENCY_REGISTRY=docker.io 11 | OPENC3_ENTERPRISE_REGISTRY=ghcr.io 12 | OPENC3_ENTERPRISE_NAMESPACE=openc3 13 | OPENC3_UBI_REGISTRY=registry1.dso.mil 14 | OPENC3_UBI_IMAGE=ironbank/redhat/ubi/ubi9-minimal 15 | OPENC3_UBI_TAG=9.5 16 | # Defined here as blank to avoid warnings. Used in the compose.yaml to pass '-ubi'. 17 | OPENC3_IMAGE_SUFFIX= 18 | # Bucket & Volume configuration 19 | OPENC3_BUCKET_URL=http://openc3-minio:9000 20 | OPENC3_LOGS_BUCKET=logs 21 | OPENC3_TOOLS_BUCKET=tools 22 | OPENC3_CONFIG_BUCKET=config 23 | OPENC3_GEMS_VOLUME=/gems 24 | OPENC3_PLUGIN_DEFAULT_VOLUME=/plugins/DEFAULT 25 | # Add additional buckets and volumes using the same convention: 26 | # OPENC3_TEST_BUCKET=test_bucket 27 | # This would add a new bucket called "test". Note the middle section OPENC3_(TEST)_BUCKET 28 | # is the displayed name of the bucket and the value is the actual bucket name in MINIO, S3, GCP, etc. 29 | # OPENC3_TEST_VOLUME=/path/to/somewhere 30 | # This would add a new volume called "test". Note the middle section OPENC3_(TEST)_VOLUME 31 | # is the displayed name of the volume and the value is the actual root path of the volume. 32 | 33 | # Redis configuration 34 | OPENC3_REDIS_HOSTNAME=openc3-redis 35 | OPENC3_REDIS_PORT=6379 36 | OPENC3_REDIS_EPHEMERAL_HOSTNAME=openc3-redis-ephemeral 37 | OPENC3_REDIS_EPHEMERAL_PORT=6380 38 | # Usernames and passwords 39 | # These lines can be removed from this file if available in the host computer environment variables 40 | OPENC3_REDIS_USERNAME=openc3 41 | OPENC3_REDIS_PASSWORD=openc3password 42 | OPENC3_BUCKET_USERNAME=openc3minio 43 | OPENC3_BUCKET_PASSWORD=openc3miniopassword 44 | OPENC3_SR_REDIS_USERNAME=scriptrunner 45 | OPENC3_SR_REDIS_PASSWORD=scriptrunnerpassword 46 | OPENC3_SR_BUCKET_USERNAME=scriptrunnerminio 47 | OPENC3_SR_BUCKET_PASSWORD=scriptrunnerminiopassword 48 | OPENC3_SERVICE_PASSWORD=openc3service 49 | # Build and repository settings 50 | ALPINE_VERSION=3.21 51 | ALPINE_BUILD=3 52 | APK_URL=https://dl-cdn.alpinelinux.org 53 | RUBYGEMS_URL=https://rubygems.org 54 | PYPI_URL=https://pypi.org 55 | NPM_URL=https://registry.npmjs.org 56 | SECRET_KEY_BASE=bdb4300d46c9d4f116ce3dbbd54cac6b20802d8be1c2333cf5f6f90b1627799ac5d043e8460744077bc0bd6aacdd5c4bf53f499a68303c6752e7f327b874b96a 57 | OPENC3_CLOUD=local 58 | # Change to arn:aws-us-gov for deploying to AWS Gov Cloud 59 | OPENC3_AWS_ARN_PREFIX=arn:aws 60 | 61 | # This can be used to set the default language for generators 62 | # OPENC3_LANGUAGE=ruby 63 | 64 | # Don't automatically make the tools bucket public read 65 | # OPENC3_NO_BUCKET_POLICY=1 66 | 67 | # Log warnings and higher to stderr instead of stdout 68 | # OPENC3_LOG_STDERR=1 69 | 70 | # Prevent default tools from being installed by uncommenting the following environment variables: 71 | # OPENC3_NO_CMDTLMSERVER=1 72 | # OPENC3_NO_LIMITSMONITOR=1 73 | # OPENC3_NO_CMDSENDER=1 74 | # OPENC3_NO_SCRIPTRUNNER=1 75 | # OPENC3_NO_PACKETVIEWER=1 76 | # OPENC3_NO_TLMVIEWER=1 77 | # OPENC3_NO_TLMGRAPHER=1 78 | # OPENC3_NO_DATAEXTRACTOR=1 79 | # OPENC3_NO_DATAVIEWER=1 80 | # OPENC3_NO_HANDBOOKS=1 81 | # OPENC3_NO_TABLEMANAGER=1 82 | # OPENC3_NO_TOOLADMIN=1 83 | # OPENC3_NO_BUCKETEXPLORER=1 84 | # OPENC3_NO_DOCS=1 85 | 86 | # Enables the --trusted-host flag when downloading python package from the PYPI_URL 87 | # PIP_ENABLE_TRUSTED_HOST=1 88 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Declare all ruby files should always have LF line endings on checkout. 2 | *.rb text eol=lf 3 | # Declare all sh files should always have LF line endings on checkout. 4 | *.sh text eol=lf 5 | # Declare all c files should always have LF line endings on checkout. 6 | *.c text eol=lf 7 | # Declare all yaml files should always have LF line endings on checkout. 8 | *.yaml text eol=lf 9 | *.yml text eol=lf 10 | # Declare all js files should always have LF line endings on checkout. 11 | *.js text eol=lf 12 | # Declare all json files should always have LF line endings on checkout. 13 | *.json text eol=lf 14 | # Declare all md files should always have LF line endings on checkout. 15 | *.md text eol=lf 16 | # Declare all conf files should always have LF line endings on checkout. 17 | *.conf text eol=lf 18 | # Declare all redis acl files should always have LF line endings on checkout. 19 | *.acl text eol=lf 20 | # Declare files that will always have CRLF line endings on checkout. 21 | *.bat text eol=crlf 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.def 3 | *.so 4 | *.bundle 5 | Makefile 6 | *Gemfile.lock 7 | .yardoc 8 | .DS_Store 9 | desktop.ini 10 | .idea 11 | .rubocop-http* 12 | .nyc_output 13 | openc3/*_exception.txt 14 | openc3/*_unexpected.txt 15 | openc3/openc3/ 16 | openc3/spec/install/outputs 17 | openc3/spec/examples.txt 18 | coverage/ 19 | profile/ 20 | 21 | # local env files 22 | .env.local 23 | .env.*.local 24 | 25 | # Log files 26 | npm-debug.log* 27 | yarn-debug.log* 28 | yarn-error.log* 29 | 30 | # Ignore bundler config. 31 | /.bundle 32 | 33 | # Ignore the default SQLite database. 34 | /db/*.sqlite3 35 | /db/*.sqlite3-journal 36 | 37 | # Ignore all logfiles and tempfiles. 38 | /log/* 39 | /tmp/* 40 | !/log/.keep 41 | !/tmp/.keep 42 | 43 | # Ignore Byebug command history file. 44 | .byebug_history 45 | 46 | # Ignore node modules 47 | node_modules 48 | 49 | typescript 50 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The OpenC3 COSMOS software program is a derived work based on the 2 | Ball Aerospace COSMOS software licensed under the 3 | GNU Affero General Public License, version 3 with the Addendums listed below. 4 | 5 | Commercial licensing is also available for purchase from OpenC3, Inc. 6 | 7 | Please note that the verbiage of the AGPL below are copyrighted 8 | by the Free Software Foundation, but the instance of code to which the 9 | licenses refer (the OpenC3 COSMOS software) is copyrighted by 10 | OpenC3 Inc. and/or Ball Aerospace and Technologies Corp as marked in each file. 11 | 12 | Also please note that the only valid versions of the AGPL 13 | that pertain to OpenC3 COSMOS are the particular versions of 14 | the license reproduced below (i.e., versions 3, rather than any other 15 | versions of the AGPL), unless explicitly otherwise stated. 16 | 17 | OpenC3 AGPL, version 3 LICENSE ADDENDUMS 18 | OpenC3 COSMOS Version 5, 16 July 2022 19 | 20 | The following addendums are made under section 7 of the GNU Affero General 21 | Public License, version 3. 22 | 23 | 1. The OpenC3, Inc. copyright and legal notices 24 | on all user interfaces and source files must be preserved or 25 | duplicated on any derivative works. 26 | 2. Modified applications and source files must be clearly marked as 27 | "modified" with the modification author and company indicated 28 | immediately following the copyright and legal notices. 29 | 3. OpenC3, and OpenC3 COSMOS are trademarks of OpenC3, Inc. and may be used for publicity purposes 30 | only in a manner that constitutes "fair use" under applicable trademark 31 | law, except with the express, written permission of OpenC3 Inc. 32 | 33 | ----------------------------------------------------------------------------- 34 | 35 | Original Ball Aerospace COSMOS 5 License Text: 36 | 37 | The Ball Aerospace COSMOS software program is licensed under the 38 | GNU Affero General Public License, version 3 with the Addendums listed below. 39 | 40 | Please note that the verbiage of the AGPL below are copyrighted 41 | by the Free Software Foundation, but the instance of code to which the 42 | licenses refer (the Ball Aerospace COSMOS software) is copyrighted by 43 | Ball Aerospace & Technologies Corp. 44 | 45 | Also please note that the only valid versions of the AGPL 46 | that pertain to Ball Aerospace COSMOS are the particular versions of 47 | the license reproduced below (i.e., versions 3, rather than any other 48 | versions of the AGPL), unless explicitly otherwise stated. 49 | 50 | BALL AGPL, version 3 LICENSE ADDENDUMS 51 | Ball Aerospace COSMOS Version 5, 8 January 2020 52 | 53 | The following addendums are made under section 7 of the GNU Affero General 54 | Public License, version 3. 55 | 56 | 1. The Ball Aerospace & Technologies Corp. copyright and legal notices 57 | on all user interfaces and source files must be preserved or 58 | duplicated on any derivative works. 59 | 2. Modified applications and source files must be clearly marked as 60 | "modified" with the modification author and company indicated 61 | immediately following the copyright and legal notices. 62 | 3. Ball Aerospace COSMOS, Ball, and Ball Aerospace are trademarks of 63 | Ball Corporation and may be used for publicity purposes only in a 64 | manner that constitutes "fair use" under applicable trademark law, 65 | except with the express, written permission of Ball Corporation. 66 | 67 | The AGPL license text follows: 68 | 69 | GNU AFFERO GENERAL PUBLIC LICENSE 70 | Version 3, 19 November 2007 71 | 72 | Copyright (C) 2007 Free Software Foundation, Inc. 73 | Everyone is permitted to copy and distribute verbatim copies 74 | of this license document, but changing it is not allowed. 75 | 76 | Preamble 77 | 78 | The GNU Affero General Public License is a free, copyleft license for 79 | software and other kinds of works, specifically designed to ensure 80 | cooperation with the community in the case of network server software. 81 | 82 | The licenses for most software and other practical works are designed 83 | to take away your freedom to share and change the works. By contrast, 84 | our General Public Licenses are intended to guarantee your freedom to 85 | share and change all versions of a program--to make sure it remains free 86 | software for all its users. 87 | 88 | When we speak of free software, we are referring to freedom, not 89 | price. Our General Public Licenses are designed to make sure that you 90 | have the freedom to distribute copies of free software (and charge for 91 | them if you wish), that you receive source code or can get it if you 92 | want it, that you can change the software or use pieces of it in new 93 | free programs, and that you know you can do these things. 94 | 95 | Developers that use our General Public Licenses protect your rights 96 | with two steps: (1) assert copyright on the software, and (2) offer 97 | you this License which gives you legal permission to copy, distribute 98 | and/or modify the software. 99 | 100 | A secondary benefit of defending all users' freedom is that 101 | improvements made in alternate versions of the program, if they 102 | receive widespread use, become available for other developers to 103 | incorporate. Many developers of free software are heartened and 104 | encouraged by the resulting cooperation. However, in the case of 105 | software used on network servers, this result may fail to come about. 106 | The GNU General Public License permits making a modified version and 107 | letting the public access it on a server without ever releasing its 108 | source code to the public. 109 | 110 | The GNU Affero General Public License is designed specifically to 111 | ensure that, in such cases, the modified source code becomes available 112 | to the community. It requires the operator of a network server to 113 | provide the source code of the modified version running there to the 114 | users of that server. Therefore, public use of a modified version, on 115 | a publicly accessible server, gives the public access to the source 116 | code of the modified version. 117 | 118 | An older license, called the Affero General Public License and 119 | published by Affero, was designed to accomplish similar goals. This is 120 | a different license, not a version of the Affero GPL, but Affero has 121 | released a new version of the Affero GPL which permits relicensing under 122 | this license. 123 | 124 | The precise terms and conditions for copying, distribution and 125 | modification follow. 126 | 127 | TERMS AND CONDITIONS 128 | 129 | 0. Definitions. 130 | 131 | "This License" refers to version 3 of the GNU Affero General Public License. 132 | 133 | "Copyright" also means copyright-like laws that apply to other kinds of 134 | works, such as semiconductor masks. 135 | 136 | "The Program" refers to any copyrightable work licensed under this 137 | License. Each licensee is addressed as "you". "Licensees" and 138 | "recipients" may be individuals or organizations. 139 | 140 | To "modify" a work means to copy from or adapt all or part of the work 141 | in a fashion requiring copyright permission, other than the making of an 142 | exact copy. The resulting work is called a "modified version" of the 143 | earlier work or a work "based on" the earlier work. 144 | 145 | A "covered work" means either the unmodified Program or a work based 146 | on the Program. 147 | 148 | To "propagate" a work means to do anything with it that, without 149 | permission, would make you directly or secondarily liable for 150 | infringement under applicable copyright law, except executing it on a 151 | computer or modifying a private copy. Propagation includes copying, 152 | distribution (with or without modification), making available to the 153 | public, and in some countries other activities as well. 154 | 155 | To "convey" a work means any kind of propagation that enables other 156 | parties to make or receive copies. Mere interaction with a user through 157 | a computer network, with no transfer of a copy, is not conveying. 158 | 159 | An interactive user interface displays "Appropriate Legal Notices" 160 | to the extent that it includes a convenient and prominently visible 161 | feature that (1) displays an appropriate copyright notice, and (2) 162 | tells the user that there is no warranty for the work (except to the 163 | extent that warranties are provided), that licensees may convey the 164 | work under this License, and how to view a copy of this License. If 165 | the interface presents a list of user commands or options, such as a 166 | menu, a prominent item in the list meets this criterion. 167 | 168 | 1. Source Code. 169 | 170 | The "source code" for a work means the preferred form of the work 171 | for making modifications to it. "Object code" means any non-source 172 | form of a work. 173 | 174 | A "Standard Interface" means an interface that either is an official 175 | standard defined by a recognized standards body, or, in the case of 176 | interfaces specified for a particular programming language, one that 177 | is widely used among developers working in that language. 178 | 179 | The "System Libraries" of an executable work include anything, other 180 | than the work as a whole, that (a) is included in the normal form of 181 | packaging a Major Component, but which is not part of that Major 182 | Component, and (b) serves only to enable use of the work with that 183 | Major Component, or to implement a Standard Interface for which an 184 | implementation is available to the public in source code form. A 185 | "Major Component", in this context, means a major essential component 186 | (kernel, window system, and so on) of the specific operating system 187 | (if any) on which the executable work runs, or a compiler used to 188 | produce the work, or an object code interpreter used to run it. 189 | 190 | The "Corresponding Source" for a work in object code form means all 191 | the source code needed to generate, install, and (for an executable 192 | work) run the object code and to modify the work, including scripts to 193 | control those activities. However, it does not include the work's 194 | System Libraries, or general-purpose tools or generally available free 195 | programs which are used unmodified in performing those activities but 196 | which are not part of the work. For example, Corresponding Source 197 | includes interface definition files associated with source files for 198 | the work, and the source code for shared libraries and dynamically 199 | linked subprograms that the work is specifically designed to require, 200 | such as by intimate data communication or control flow between those 201 | subprograms and other parts of the work. 202 | 203 | The Corresponding Source need not include anything that users 204 | can regenerate automatically from other parts of the Corresponding 205 | Source. 206 | 207 | The Corresponding Source for a work in source code form is that 208 | same work. 209 | 210 | 2. Basic Permissions. 211 | 212 | All rights granted under this License are granted for the term of 213 | copyright on the Program, and are irrevocable provided the stated 214 | conditions are met. This License explicitly affirms your unlimited 215 | permission to run the unmodified Program. The output from running a 216 | covered work is covered by this License only if the output, given its 217 | content, constitutes a covered work. This License acknowledges your 218 | rights of fair use or other equivalent, as provided by copyright law. 219 | 220 | You may make, run and propagate covered works that you do not 221 | convey, without conditions so long as your license otherwise remains 222 | in force. You may convey covered works to others for the sole purpose 223 | of having them make modifications exclusively for you, or provide you 224 | with facilities for running those works, provided that you comply with 225 | the terms of this License in conveying all material for which you do 226 | not control copyright. Those thus making or running the covered works 227 | for you must do so exclusively on your behalf, under your direction 228 | and control, on terms that prohibit them from making any copies of 229 | your copyrighted material outside their relationship with you. 230 | 231 | Conveying under any other circumstances is permitted solely under 232 | the conditions stated below. Sublicensing is not allowed; section 10 233 | makes it unnecessary. 234 | 235 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 236 | 237 | No covered work shall be deemed part of an effective technological 238 | measure under any applicable law fulfilling obligations under article 239 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 240 | similar laws prohibiting or restricting circumvention of such 241 | measures. 242 | 243 | When you convey a covered work, you waive any legal power to forbid 244 | circumvention of technological measures to the extent such circumvention 245 | is effected by exercising rights under this License with respect to 246 | the covered work, and you disclaim any intention to limit operation or 247 | modification of the work as a means of enforcing, against the work's 248 | users, your or third parties' legal rights to forbid circumvention of 249 | technological measures. 250 | 251 | 4. Conveying Verbatim Copies. 252 | 253 | You may convey verbatim copies of the Program's source code as you 254 | receive it, in any medium, provided that you conspicuously and 255 | appropriately publish on each copy an appropriate copyright notice; 256 | keep intact all notices stating that this License and any 257 | non-permissive terms added in accord with section 7 apply to the code; 258 | keep intact all notices of the absence of any warranty; and give all 259 | recipients a copy of this License along with the Program. 260 | 261 | You may charge any price or no price for each copy that you convey, 262 | and you may offer support or warranty protection for a fee. 263 | 264 | 5. Conveying Modified Source Versions. 265 | 266 | You may convey a work based on the Program, or the modifications to 267 | produce it from the Program, in the form of source code under the 268 | terms of section 4, provided that you also meet all of these conditions: 269 | 270 | a) The work must carry prominent notices stating that you modified 271 | it, and giving a relevant date. 272 | 273 | b) The work must carry prominent notices stating that it is 274 | released under this License and any conditions added under section 275 | 7. This requirement modifies the requirement in section 4 to 276 | "keep intact all notices". 277 | 278 | c) You must license the entire work, as a whole, under this 279 | License to anyone who comes into possession of a copy. This 280 | License will therefore apply, along with any applicable section 7 281 | additional terms, to the whole of the work, and all its parts, 282 | regardless of how they are packaged. This License gives no 283 | permission to license the work in any other way, but it does not 284 | invalidate such permission if you have separately received it. 285 | 286 | d) If the work has interactive user interfaces, each must display 287 | Appropriate Legal Notices; however, if the Program has interactive 288 | interfaces that do not display Appropriate Legal Notices, your 289 | work need not make them do so. 290 | 291 | A compilation of a covered work with other separate and independent 292 | works, which are not by their nature extensions of the covered work, 293 | and which are not combined with it such as to form a larger program, 294 | in or on a volume of a storage or distribution medium, is called an 295 | "aggregate" if the compilation and its resulting copyright are not 296 | used to limit the access or legal rights of the compilation's users 297 | beyond what the individual works permit. Inclusion of a covered work 298 | in an aggregate does not cause this License to apply to the other 299 | parts of the aggregate. 300 | 301 | 6. Conveying Non-Source Forms. 302 | 303 | You may convey a covered work in object code form under the terms 304 | of sections 4 and 5, provided that you also convey the 305 | machine-readable Corresponding Source under the terms of this License, 306 | in one of these ways: 307 | 308 | a) Convey the object code in, or embodied in, a physical product 309 | (including a physical distribution medium), accompanied by the 310 | Corresponding Source fixed on a durable physical medium 311 | customarily used for software interchange. 312 | 313 | b) Convey the object code in, or embodied in, a physical product 314 | (including a physical distribution medium), accompanied by a 315 | written offer, valid for at least three years and valid for as 316 | long as you offer spare parts or customer support for that product 317 | model, to give anyone who possesses the object code either (1) a 318 | copy of the Corresponding Source for all the software in the 319 | product that is covered by this License, on a durable physical 320 | medium customarily used for software interchange, for a price no 321 | more than your reasonable cost of physically performing this 322 | conveying of source, or (2) access to copy the 323 | Corresponding Source from a network server at no charge. 324 | 325 | c) Convey individual copies of the object code with a copy of the 326 | written offer to provide the Corresponding Source. This 327 | alternative is allowed only occasionally and noncommercially, and 328 | only if you received the object code with such an offer, in accord 329 | with subsection 6b. 330 | 331 | d) Convey the object code by offering access from a designated 332 | place (gratis or for a charge), and offer equivalent access to the 333 | Corresponding Source in the same way through the same place at no 334 | further charge. You need not require recipients to copy the 335 | Corresponding Source along with the object code. If the place to 336 | copy the object code is a network server, the Corresponding Source 337 | may be on a different server (operated by you or a third party) 338 | that supports equivalent copying facilities, provided you maintain 339 | clear directions next to the object code saying where to find the 340 | Corresponding Source. Regardless of what server hosts the 341 | Corresponding Source, you remain obligated to ensure that it is 342 | available for as long as needed to satisfy these requirements. 343 | 344 | e) Convey the object code using peer-to-peer transmission, provided 345 | you inform other peers where the object code and Corresponding 346 | Source of the work are being offered to the general public at no 347 | charge under subsection 6d. 348 | 349 | A separable portion of the object code, whose source code is excluded 350 | from the Corresponding Source as a System Library, need not be 351 | included in conveying the object code work. 352 | 353 | A "User Product" is either (1) a "consumer product", which means any 354 | tangible personal property which is normally used for personal, family, 355 | or household purposes, or (2) anything designed or sold for incorporation 356 | into a dwelling. In determining whether a product is a consumer product, 357 | doubtful cases shall be resolved in favor of coverage. For a particular 358 | product received by a particular user, "normally used" refers to a 359 | typical or common use of that class of product, regardless of the status 360 | of the particular user or of the way in which the particular user 361 | actually uses, or expects or is expected to use, the product. A product 362 | is a consumer product regardless of whether the product has substantial 363 | commercial, industrial or non-consumer uses, unless such uses represent 364 | the only significant mode of use of the product. 365 | 366 | "Installation Information" for a User Product means any methods, 367 | procedures, authorization keys, or other information required to install 368 | and execute modified versions of a covered work in that User Product from 369 | a modified version of its Corresponding Source. The information must 370 | suffice to ensure that the continued functioning of the modified object 371 | code is in no case prevented or interfered with solely because 372 | modification has been made. 373 | 374 | If you convey an object code work under this section in, or with, or 375 | specifically for use in, a User Product, and the conveying occurs as 376 | part of a transaction in which the right of possession and use of the 377 | User Product is transferred to the recipient in perpetuity or for a 378 | fixed term (regardless of how the transaction is characterized), the 379 | Corresponding Source conveyed under this section must be accompanied 380 | by the Installation Information. But this requirement does not apply 381 | if neither you nor any third party retains the ability to install 382 | modified object code on the User Product (for example, the work has 383 | been installed in ROM). 384 | 385 | The requirement to provide Installation Information does not include a 386 | requirement to continue to provide support service, warranty, or updates 387 | for a work that has been modified or installed by the recipient, or for 388 | the User Product in which it has been modified or installed. Access to a 389 | network may be denied when the modification itself materially and 390 | adversely affects the operation of the network or violates the rules and 391 | protocols for communication across the network. 392 | 393 | Corresponding Source conveyed, and Installation Information provided, 394 | in accord with this section must be in a format that is publicly 395 | documented (and with an implementation available to the public in 396 | source code form), and must require no special password or key for 397 | unpacking, reading or copying. 398 | 399 | 7. Additional Terms. 400 | 401 | "Additional permissions" are terms that supplement the terms of this 402 | License by making exceptions from one or more of its conditions. 403 | Additional permissions that are applicable to the entire Program shall 404 | be treated as though they were included in this License, to the extent 405 | that they are valid under applicable law. If additional permissions 406 | apply only to part of the Program, that part may be used separately 407 | under those permissions, but the entire Program remains governed by 408 | this License without regard to the additional permissions. 409 | 410 | When you convey a copy of a covered work, you may at your option 411 | remove any additional permissions from that copy, or from any part of 412 | it. (Additional permissions may be written to require their own 413 | removal in certain cases when you modify the work.) You may place 414 | additional permissions on material, added by you to a covered work, 415 | for which you have or can give appropriate copyright permission. 416 | 417 | Notwithstanding any other provision of this License, for material you 418 | add to a covered work, you may (if authorized by the copyright holders of 419 | that material) supplement the terms of this License with terms: 420 | 421 | a) Disclaiming warranty or limiting liability differently from the 422 | terms of sections 15 and 16 of this License; or 423 | 424 | b) Requiring preservation of specified reasonable legal notices or 425 | author attributions in that material or in the Appropriate Legal 426 | Notices displayed by works containing it; or 427 | 428 | c) Prohibiting misrepresentation of the origin of that material, or 429 | requiring that modified versions of such material be marked in 430 | reasonable ways as different from the original version; or 431 | 432 | d) Limiting the use for publicity purposes of names of licensors or 433 | authors of the material; or 434 | 435 | e) Declining to grant rights under trademark law for use of some 436 | trade names, trademarks, or service marks; or 437 | 438 | f) Requiring indemnification of licensors and authors of that 439 | material by anyone who conveys the material (or modified versions of 440 | it) with contractual assumptions of liability to the recipient, for 441 | any liability that these contractual assumptions directly impose on 442 | those licensors and authors. 443 | 444 | All other non-permissive additional terms are considered "further 445 | restrictions" within the meaning of section 10. If the Program as you 446 | received it, or any part of it, contains a notice stating that it is 447 | governed by this License along with a term that is a further 448 | restriction, you may remove that term. If a license document contains 449 | a further restriction but permits relicensing or conveying under this 450 | License, you may add to a covered work material governed by the terms 451 | of that license document, provided that the further restriction does 452 | not survive such relicensing or conveying. 453 | 454 | If you add terms to a covered work in accord with this section, you 455 | must place, in the relevant source files, a statement of the 456 | additional terms that apply to those files, or a notice indicating 457 | where to find the applicable terms. 458 | 459 | Additional terms, permissive or non-permissive, may be stated in the 460 | form of a separately written license, or stated as exceptions; 461 | the above requirements apply either way. 462 | 463 | 8. Termination. 464 | 465 | You may not propagate or modify a covered work except as expressly 466 | provided under this License. Any attempt otherwise to propagate or 467 | modify it is void, and will automatically terminate your rights under 468 | this License (including any patent licenses granted under the third 469 | paragraph of section 11). 470 | 471 | However, if you cease all violation of this License, then your 472 | license from a particular copyright holder is reinstated (a) 473 | provisionally, unless and until the copyright holder explicitly and 474 | finally terminates your license, and (b) permanently, if the copyright 475 | holder fails to notify you of the violation by some reasonable means 476 | prior to 60 days after the cessation. 477 | 478 | Moreover, your license from a particular copyright holder is 479 | reinstated permanently if the copyright holder notifies you of the 480 | violation by some reasonable means, this is the first time you have 481 | received notice of violation of this License (for any work) from that 482 | copyright holder, and you cure the violation prior to 30 days after 483 | your receipt of the notice. 484 | 485 | Termination of your rights under this section does not terminate the 486 | licenses of parties who have received copies or rights from you under 487 | this License. If your rights have been terminated and not permanently 488 | reinstated, you do not qualify to receive new licenses for the same 489 | material under section 10. 490 | 491 | 9. Acceptance Not Required for Having Copies. 492 | 493 | You are not required to accept this License in order to receive or 494 | run a copy of the Program. Ancillary propagation of a covered work 495 | occurring solely as a consequence of using peer-to-peer transmission 496 | to receive a copy likewise does not require acceptance. However, 497 | nothing other than this License grants you permission to propagate or 498 | modify any covered work. These actions infringe copyright if you do 499 | not accept this License. Therefore, by modifying or propagating a 500 | covered work, you indicate your acceptance of this License to do so. 501 | 502 | 10. Automatic Licensing of Downstream Recipients. 503 | 504 | Each time you convey a covered work, the recipient automatically 505 | receives a license from the original licensors, to run, modify and 506 | propagate that work, subject to this License. You are not responsible 507 | for enforcing compliance by third parties with this License. 508 | 509 | An "entity transaction" is a transaction transferring control of an 510 | organization, or substantially all assets of one, or subdividing an 511 | organization, or merging organizations. If propagation of a covered 512 | work results from an entity transaction, each party to that 513 | transaction who receives a copy of the work also receives whatever 514 | licenses to the work the party's predecessor in interest had or could 515 | give under the previous paragraph, plus a right to possession of the 516 | Corresponding Source of the work from the predecessor in interest, if 517 | the predecessor has it or can get it with reasonable efforts. 518 | 519 | You may not impose any further restrictions on the exercise of the 520 | rights granted or affirmed under this License. For example, you may 521 | not impose a license fee, royalty, or other charge for exercise of 522 | rights granted under this License, and you may not initiate litigation 523 | (including a cross-claim or counterclaim in a lawsuit) alleging that 524 | any patent claim is infringed by making, using, selling, offering for 525 | sale, or importing the Program or any portion of it. 526 | 527 | 11. Patents. 528 | 529 | A "contributor" is a copyright holder who authorizes use under this 530 | License of the Program or a work on which the Program is based. The 531 | work thus licensed is called the contributor's "contributor version". 532 | 533 | A contributor's "essential patent claims" are all patent claims 534 | owned or controlled by the contributor, whether already acquired or 535 | hereafter acquired, that would be infringed by some manner, permitted 536 | by this License, of making, using, or selling its contributor version, 537 | but do not include claims that would be infringed only as a 538 | consequence of further modification of the contributor version. For 539 | purposes of this definition, "control" includes the right to grant 540 | patent sublicenses in a manner consistent with the requirements of 541 | this License. 542 | 543 | Each contributor grants you a non-exclusive, worldwide, royalty-free 544 | patent license under the contributor's essential patent claims, to 545 | make, use, sell, offer for sale, import and otherwise run, modify and 546 | propagate the contents of its contributor version. 547 | 548 | In the following three paragraphs, a "patent license" is any express 549 | agreement or commitment, however denominated, not to enforce a patent 550 | (such as an express permission to practice a patent or covenant not to 551 | sue for patent infringement). To "grant" such a patent license to a 552 | party means to make such an agreement or commitment not to enforce a 553 | patent against the party. 554 | 555 | If you convey a covered work, knowingly relying on a patent license, 556 | and the Corresponding Source of the work is not available for anyone 557 | to copy, free of charge and under the terms of this License, through a 558 | publicly available network server or other readily accessible means, 559 | then you must either (1) cause the Corresponding Source to be so 560 | available, or (2) arrange to deprive yourself of the benefit of the 561 | patent license for this particular work, or (3) arrange, in a manner 562 | consistent with the requirements of this License, to extend the patent 563 | license to downstream recipients. "Knowingly relying" means you have 564 | actual knowledge that, but for the patent license, your conveying the 565 | covered work in a country, or your recipient's use of the covered work 566 | in a country, would infringe one or more identifiable patents in that 567 | country that you have reason to believe are valid. 568 | 569 | If, pursuant to or in connection with a single transaction or 570 | arrangement, you convey, or propagate by procuring conveyance of, a 571 | covered work, and grant a patent license to some of the parties 572 | receiving the covered work authorizing them to use, propagate, modify 573 | or convey a specific copy of the covered work, then the patent license 574 | you grant is automatically extended to all recipients of the covered 575 | work and works based on it. 576 | 577 | A patent license is "discriminatory" if it does not include within 578 | the scope of its coverage, prohibits the exercise of, or is 579 | conditioned on the non-exercise of one or more of the rights that are 580 | specifically granted under this License. You may not convey a covered 581 | work if you are a party to an arrangement with a third party that is 582 | in the business of distributing software, under which you make payment 583 | to the third party based on the extent of your activity of conveying 584 | the work, and under which the third party grants, to any of the 585 | parties who would receive the covered work from you, a discriminatory 586 | patent license (a) in connection with copies of the covered work 587 | conveyed by you (or copies made from those copies), or (b) primarily 588 | for and in connection with specific products or compilations that 589 | contain the covered work, unless you entered into that arrangement, 590 | or that patent license was granted, prior to 28 March 2007. 591 | 592 | Nothing in this License shall be construed as excluding or limiting 593 | any implied license or other defenses to infringement that may 594 | otherwise be available to you under applicable patent law. 595 | 596 | 12. No Surrender of Others' Freedom. 597 | 598 | If conditions are imposed on you (whether by court order, agreement or 599 | otherwise) that contradict the conditions of this License, they do not 600 | excuse you from the conditions of this License. If you cannot convey a 601 | covered work so as to satisfy simultaneously your obligations under this 602 | License and any other pertinent obligations, then as a consequence you may 603 | not convey it at all. For example, if you agree to terms that obligate you 604 | to collect a royalty for further conveying from those to whom you convey 605 | the Program, the only way you could satisfy both those terms and this 606 | License would be to refrain entirely from conveying the Program. 607 | 608 | 13. Remote Network Interaction; Use with the GNU General Public License. 609 | 610 | Notwithstanding any other provision of this License, if you modify the 611 | Program, your modified version must prominently offer all users 612 | interacting with it remotely through a computer network (if your version 613 | supports such interaction) an opportunity to receive the Corresponding 614 | Source of your version by providing access to the Corresponding Source 615 | from a network server at no charge, through some standard or customary 616 | means of facilitating copying of software. This Corresponding Source 617 | shall include the Corresponding Source for any work covered by version 3 618 | of the GNU General Public License that is incorporated pursuant to the 619 | following paragraph. 620 | 621 | Notwithstanding any other provision of this License, you have 622 | permission to link or combine any covered work with a work licensed 623 | under version 3 of the GNU General Public License into a single 624 | combined work, and to convey the resulting work. The terms of this 625 | License will continue to apply to the part which is the covered work, 626 | but the work with which it is combined will remain governed by version 627 | 3 of the GNU General Public License. 628 | 629 | 14. Revised Versions of this License. 630 | 631 | The Free Software Foundation may publish revised and/or new versions of 632 | the GNU Affero General Public License from time to time. Such new versions 633 | will be similar in spirit to the present version, but may differ in detail to 634 | address new problems or concerns. 635 | 636 | Each version is given a distinguishing version number. If the 637 | Program specifies that a certain numbered version of the GNU Affero General 638 | Public License "or any later version" applies to it, you have the 639 | option of following the terms and conditions either of that numbered 640 | version or of any later version published by the Free Software 641 | Foundation. If the Program does not specify a version number of the 642 | GNU Affero General Public License, you may choose any version ever published 643 | by the Free Software Foundation. 644 | 645 | If the Program specifies that a proxy can decide which future 646 | versions of the GNU Affero General Public License can be used, that proxy's 647 | public statement of acceptance of a version permanently authorizes you 648 | to choose that version for the Program. 649 | 650 | Later license versions may give you additional or different 651 | permissions. However, no additional obligations are imposed on any 652 | author or copyright holder as a result of your choosing to follow a 653 | later version. 654 | 655 | 15. Disclaimer of Warranty. 656 | 657 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 658 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 659 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 660 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 661 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 662 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 663 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 664 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 665 | 666 | 16. Limitation of Liability. 667 | 668 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 669 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 670 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 671 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 672 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 673 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 674 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 675 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 676 | SUCH DAMAGES. 677 | 678 | 17. Interpretation of Sections 15 and 16. 679 | 680 | If the disclaimer of warranty and limitation of liability provided 681 | above cannot be given local legal effect according to their terms, 682 | reviewing courts shall apply local law that most closely approximates 683 | an absolute waiver of all civil liability in connection with the 684 | Program, unless a warranty or assumption of liability accompanies a 685 | copy of the Program in return for a fee. 686 | 687 | END OF TERMS AND CONDITIONS 688 | 689 | How to Apply These Terms to Your New Programs 690 | 691 | If you develop a new program, and you want it to be of the greatest 692 | possible use to the public, the best way to achieve this is to make it 693 | free software which everyone can redistribute and change under these terms. 694 | 695 | To do so, attach the following notices to the program. It is safest 696 | to attach them to the start of each source file to most effectively 697 | state the exclusion of warranty; and each file should have at least 698 | the "copyright" line and a pointer to where the full notice is found. 699 | 700 | 701 | Copyright (C) 702 | 703 | This program is free software: you can redistribute it and/or modify 704 | it under the terms of the GNU Affero General Public License as published 705 | by the Free Software Foundation, either version 3 of the License, or 706 | (at your option) any later version. 707 | 708 | This program is distributed in the hope that it will be useful, 709 | but WITHOUT ANY WARRANTY; without even the implied warranty of 710 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 711 | GNU Affero General Public License for more details. 712 | 713 | You should have received a copy of the GNU Affero General Public License 714 | along with this program. If not, see . 715 | 716 | Also add information on how to contact you by electronic and paper mail. 717 | 718 | If your software can interact with users remotely through a computer 719 | network, you should also make sure that it provides a way for users to 720 | get its source. For example, if your program is a web application, its 721 | interface could display a "Source" link that leads users to an archive 722 | of the code. There are many ways you could offer source, and different 723 | solutions will be better for different programs; see section 13 for the 724 | specific requirements. 725 | 726 | You should also get your employer (if you work as a programmer) or school, 727 | if any, to sign a "copyright disclaimer" for the program, if necessary. 728 | For more information on this, and how to apply and follow the GNU AGPL, see 729 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenC3 COSMOS Project 2 | 3 | This git repo is used as a starting point for running and configuring OpenC3 COSMOS for your specific project. 4 | It includes the necessary scripts to run OpenC3 COSMOS, but does not come with all the source code and relies on 5 | running released containers rather than building containers from source. This is the recommended starting 6 | place for any project who wants to use OpenC3 COSMOS, but not develop the core system. 7 | 8 | ## Quick Start 9 | 10 | 1. git clone https://github.com/openc3/cosmos-project.git cosmos-myprojectname 11 | 2. Edit .env and change OPENC3_TAG to the specific version you would like to run (ie. OPENC3_TAG=5.3.0) 12 | 1. This will allow you to upgrade versions when you choose rather than following latest 13 | 3. Start OpenC3 COSMOS 14 | 1. On Linux/Mac: ./openc3.sh run 15 | 2. On Windows: openc3.bat run 16 | 4. After approximately 2 minutes, open a web browser to http://localhost:2900 17 | 1. If you run "docker ps", you can watch until the openc3-init container completes, at which point the system should be fully configured and ready to use. 18 | 19 | ## Run without the Demo project 20 | 21 | 1. Edit .env and remove the OPENC3_DEMO line 22 | 2. If you have already ran with the demo also uninstall the demo plugin from the Admin tool. 23 | 24 | ## Upgrade to a Specific Version 25 | 26 | 1. Stop OpenC3 27 | 1. On Linux/Mac: ./openc3.sh stop 28 | 2. On Windows: openc3.bat stop 29 | 2. Edit .env and change OPENC3_TAG to the specific version you would like to run (ie. OPENC3_TAG=5.0.8) 30 | 3. Start OpenC3 31 | 1. On Linux/Mac: ./openc3.sh run 32 | 2. On Windows: openc3.bat run 33 | 34 | NOTE: Downgrades are not necessarily supported. When upgrading COSMOS we need to upgrade databases and sometimes migrate internal data structures. While we perform a full regression test on every release, we recommend upgrading an individual machine with your specific plugins and do local testing before rolling out the upgrade to your production system. 35 | 36 | ## Change all default credentials and secrets 37 | 38 | 1. Edit .env and change: 39 | 1. SECRET_KEY_BASE 40 | 2. OPENC3_SERVICE_PASSWORD 41 | 3. OPENC3_REDIS_PASSWORD 42 | 4. OPENC3_BUCKET_PASSWORD 43 | 5. OPENC3_SR_REDIS_PASSWORD 44 | 6. OPENC3_SR_BUCKET_PASSWORD 45 | 2. Edit ./openc3-redis/users.acl and change the password for each account. Note passwords for openc3/scriptrunner must match the REDIS passwords in the .env file: 46 | 1. openc3 47 | 2. admin 48 | 3. scriptrunner 49 | 50 | Passwords stored in `./openc3-redis/users.acl` use a sha256 hash. 51 | To generate a new hash use the following method, and then copy / paste into users.acl 52 | 53 | ```bash 54 | echo -n 'adminpassword' | openssl dgst -sha256 55 | SHA2-256(stdin)= 749f09bade8aca755660eeb17792da880218d4fbdc4e25fbec279d7fe9f65d70 56 | ``` 57 | 58 | ## Opening to the Network 59 | 60 | Important: Before exposing OpenC3 COSMOS to any network, even a local network, make sure you have changed all default credentials and secrets!!! 61 | 62 | ### Open to the network using https/SSL and your own certificates 63 | 64 | 1. Copy your public SSL certicate to ./openc3-traefik/cert.crt 65 | 2. Copy your private SSL certicate to ./openc3-traefik/cert.key 66 | 3. Edit compose.yaml 67 | 1. Comment out this openc3-traefik line: `- "./openc3-traefik/traefik.yaml:/etc/traefik/traefik.yaml:z"` 68 | 2. Uncomment this openc3-traefik line: `- "./openc3-traefik/traefik-ssl.yaml:/etc/traefik/traefik.yaml"` 69 | 3. Uncomment this openc3-traefik line: `- "./openc3-traefik/cert.key:/etc/traefik/cert.key"` 70 | 4. Uncomment this openc3-traefik line: `- "./openc3-traefik/cert.crt:/etc/traefik/cert.crt"` 71 | 4. If you are able to run as the standard browser ports 80/443, edit compose.yaml: 72 | 1. Comment out this openc3-traefik line: `- "127.0.0.1:2900:2900"` 73 | 2. Comment out this openc3-traefik line: `- "127.0.0.1:2943:2943"` 74 | 3. Uncomment out this openc3-traefik line: `- "80:2900"` 75 | 4. Uncomment out this openc3-traefik line: `- "443:2943"` 76 | 5. If not, edit compose.yaml: 77 | 1. Remove 127.0.0.1 from this line: `- "127.0.0.1:2900:2900"` 78 | 2. Remove 127.0.0.1 from this line: `- "127.0.0.1:2943:2943"` 79 | 6. Edit ./openc3-traefik/traefik-ssl.yaml 80 | 1. Update line 14 to the first port number in step 4 or 5: to: ":2943" # This should match port forwarding in your compose.yaml 81 | 2. Update line 22 to your domain: - main: "mydomain.com" # Update with your domain 82 | 7. Start OpenC3 83 | 1. On Linux/Mac: ./openc3.sh run 84 | 2. On Windows: openc3.bat run 85 | 8. After approximately 2 minutes, open a web browser to `https://` (or `https://:2943` if you can't use standard ports) 86 | 1. If you run "docker ps", you can watch until the openc3-init container completes, at which point the system should be fully configured and ready to use. 87 | 88 | ### Open to the network using a global certificate from Let's Encrypt 89 | 90 | Warning: These directions only work when exposing OpenC3 to the internet. Make sure you understand the risks and have properly configured your server settings and firewall. 91 | 92 | 1. Make sure that your DNS settings are mapping your domain name to your server 93 | 2. Edit compose.yaml 94 | 1. Comment out this openc3-traefik line: `- "./openc3-traefik/traefik.yaml:/etc/traefik/traefik.yaml:z"` 95 | 2. Uncomment this openc3-traefik line: `- "./openc3-traefik/traefik-letsencrypt.yaml:/etc/traefik/traefik.yaml"` 96 | 3. Edit compose.yaml: 97 | 1. Comment out this openc3-traefik line: `- "127.0.0.1:2900:2900"` 98 | 2. Comment out this openc3-traefik line: `- "127.0.0.1:2943:2943"` 99 | 3. Uncomment out this openc3-traefik line: `- "80:2900"` 100 | 4. Uncomment out this openc3-traefik line: `- "443:2943"` 101 | 4. Start OpenC3 102 | 1. On Linux/Mac: ./openc3.sh run 103 | 2. On Windows: openc3.bat run 104 | 5. After approximately a few minutes, open a web browser to `https://` 105 | 1. If you run "docker ps", you can watch until the openc3-init container completes, at which point the system should be fully configured and ready to use. 106 | 107 | ### Open to the network insecurely using http 108 | 109 | Warning: This is not recommended except for temporary testing on a local network. This will send plain text passwords over the network! 110 | 111 | 1. Edit compose.yaml 112 | 1. Comment out this openc3-traefik line: `- "./openc3-traefik/traefik.yaml:/etc/traefik/traefik.yaml:z"` 113 | 2. Uncomment this openc3-traefik line: `- "./openc3-traefik/traefik-allow-http.yaml:/etc/traefik/traefik.yaml"` 114 | 3. Remove 127.0.0.1 from this line: `- "127.0.0.1:2900:2900"` 115 | 2. Start OpenC3 116 | 1. On Linux/Mac: ./openc3.sh run 117 | 2. On Windows: openc3.bat run 118 | 3. After approximately 2 minutes, open a web browser to `https://:2900` 119 | 1. If you run "docker ps", you can watch until the openc3-cosmos-init container completes, at which point the system should be fully configured and ready to use. 120 | -------------------------------------------------------------------------------- /compose.yaml: -------------------------------------------------------------------------------- 1 | # encoding: ascii-8bit 2 | 3 | # Copyright 2022 Ball Aerospace & Technologies Corp. 4 | # All Rights Reserved. 5 | # 6 | # This program is free software; you can modify and/or redistribute it 7 | # under the terms of the GNU Affero General Public License 8 | # as published by the Free Software Foundation; version 3 with 9 | # attribution addendums as found in the LICENSE.txt 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Affero General Public License for more details. 15 | 16 | # Modified by OpenC3, Inc. 17 | # All changes Copyright 2023, OpenC3, Inc. 18 | # All Rights Reserved 19 | # 20 | # This file may also be used under the terms of a commercial license 21 | # if purchased from OpenC3, Inc. 22 | 23 | services: 24 | openc3-minio: 25 | user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}" 26 | image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-minio${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}" 27 | # Uncomment to run unit tests against the minio server 28 | # ports: 29 | # - "127.0.0.1:9000:9000" 30 | volumes: 31 | - "openc3-bucket-v:/data" 32 | - "./cacert.pem:/devel/cacert.pem:z" 33 | command: server --address ":9000" --console-address ":9001" /data 34 | restart: "unless-stopped" 35 | logging: 36 | driver: "json-file" 37 | options: 38 | max-size: "10m" 39 | max-file: "3" 40 | environment: 41 | MINIO_ROOT_USER: "${OPENC3_BUCKET_USERNAME}" 42 | MINIO_ROOT_PASSWORD: "${OPENC3_BUCKET_PASSWORD}" 43 | # Domain doesn't really matter but it's required. We really want the /minio path. 44 | # This is handled by our traefik configuration via rule: PathPrefix(`/minio`) 45 | # and forwarded on to the console at http://openc3-minio:9001 46 | MINIO_BROWSER_REDIRECT_URL: "http://openc3.com/minio" 47 | SSL_CERT_FILE: "/devel/cacert.pem" 48 | CURL_CA_BUNDLE: "/devel/cacert.pem" 49 | REQUESTS_CA_BUNDLE: "/devel/cacert.pem" 50 | NODE_EXTRA_CA_CERTS: "/devel/cacert.pem" 51 | 52 | openc3-redis: 53 | user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}" 54 | image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-redis${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}" 55 | volumes: 56 | - "openc3-redis-v:${OPENC3_REDIS_VOLUME:-/data}" 57 | - "./cacert.pem:/devel/cacert.pem:z" 58 | - "./openc3-redis/users.acl:/config/users.acl:z" 59 | restart: "unless-stopped" 60 | logging: 61 | driver: "json-file" 62 | options: 63 | max-size: "10m" 64 | max-file: "3" 65 | environment: 66 | SSL_CERT_FILE: "/devel/cacert.pem" 67 | CURL_CA_BUNDLE: "/devel/cacert.pem" 68 | REQUESTS_CA_BUNDLE: "/devel/cacert.pem" 69 | NODE_EXTRA_CA_CERTS: "/devel/cacert.pem" 70 | 71 | openc3-redis-ephemeral: 72 | user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}" 73 | image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-redis${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}" 74 | volumes: 75 | - "openc3-redis-ephemeral-v:${OPENC3_REDIS_VOLUME:-/data}" 76 | - "./cacert.pem:/devel/cacert.pem:z" 77 | - "./openc3-redis/users.acl:/config/users.acl:z" 78 | restart: "unless-stopped" 79 | command: ["redis-server", "/config/redis_ephemeral.conf"] 80 | logging: 81 | driver: "json-file" 82 | options: 83 | max-size: "10m" 84 | max-file: "3" 85 | environment: 86 | SSL_CERT_FILE: "/devel/cacert.pem" 87 | CURL_CA_BUNDLE: "/devel/cacert.pem" 88 | REQUESTS_CA_BUNDLE: "/devel/cacert.pem" 89 | NODE_EXTRA_CA_CERTS: "/devel/cacert.pem" 90 | 91 | openc3-cosmos-cmd-tlm-api: 92 | user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}" 93 | image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-cmd-tlm-api${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}" 94 | restart: "unless-stopped" 95 | depends_on: 96 | - "openc3-redis" 97 | - "openc3-redis-ephemeral" 98 | - "openc3-minio" 99 | volumes: 100 | - "openc3-gems-v:/gems" 101 | - "./plugins:/plugins:z" 102 | - "./cacert.pem:/devel/cacert.pem:z" 103 | logging: 104 | driver: "json-file" 105 | options: 106 | max-size: "10m" 107 | max-file: "3" 108 | environment: 109 | RAILS_ENV: "production" 110 | GEM_HOME: "/gems" 111 | PYTHONUSERBASE: "/gems/python_packages" 112 | OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}" 113 | OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}" 114 | OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}" 115 | OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}" 116 | OPENC3_SERVICE_PASSWORD: "${OPENC3_SERVICE_PASSWORD}" 117 | ANYCABLE_REDIS_URL: "redis://${OPENC3_REDIS_USERNAME}:${OPENC3_REDIS_PASSWORD}@${OPENC3_REDIS_HOSTNAME}:${OPENC3_REDIS_PORT}" 118 | env_file: 119 | - .env 120 | 121 | openc3-cosmos-script-runner-api: 122 | user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}" 123 | image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-script-runner-api${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}" 124 | restart: "unless-stopped" 125 | depends_on: 126 | - "openc3-redis" 127 | - "openc3-redis-ephemeral" 128 | - "openc3-minio" 129 | volumes: 130 | - "openc3-gems-v:/gems:ro" 131 | - "./plugins:/plugins:z" 132 | - "./cacert.pem:/devel/cacert.pem:z" 133 | logging: 134 | driver: "json-file" 135 | options: 136 | max-size: "10m" 137 | max-file: "3" 138 | environment: 139 | RAILS_ENV: "production" 140 | GEM_HOME: "/gems" 141 | PYTHONUSERBASE: "/gems/python_packages" 142 | OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}" 143 | OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}" 144 | OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}" 145 | OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}" 146 | OPENC3_SR_REDIS_USERNAME: "${OPENC3_SR_REDIS_USERNAME}" 147 | OPENC3_SR_REDIS_PASSWORD: "${OPENC3_SR_REDIS_PASSWORD}" 148 | OPENC3_SR_BUCKET_USERNAME: "${OPENC3_SR_BUCKET_USERNAME}" 149 | OPENC3_SR_BUCKET_PASSWORD: "${OPENC3_SR_BUCKET_PASSWORD}" 150 | OPENC3_SERVICE_PASSWORD: "${OPENC3_SERVICE_PASSWORD}" 151 | ANYCABLE_REDIS_URL: "redis://${OPENC3_REDIS_USERNAME}:${OPENC3_REDIS_PASSWORD}@${OPENC3_REDIS_HOSTNAME}:${OPENC3_REDIS_PORT}" 152 | env_file: 153 | - .env 154 | 155 | openc3-operator: 156 | user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}" 157 | image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-operator${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}" 158 | restart: "unless-stopped" 159 | # ports: 160 | # - "127.0.0.1:7779:7779" # Open port for the demo router 161 | # - "127.0.0.1:8081:8081/udp" # Open a udp port 162 | depends_on: 163 | - "openc3-redis" 164 | - "openc3-redis-ephemeral" 165 | - "openc3-minio" 166 | volumes: 167 | - "openc3-gems-v:/gems:ro" 168 | - "./plugins:/plugins:z" 169 | - "./cacert.pem:/devel/cacert.pem:z" 170 | # Add access to the entire C drive on Windows 171 | # - "/c:/c" 172 | # Create a dropbox and archive folder for ingest by FileInterface and PreidentifiedRouter 173 | # - /Users/jmthomas/dropbox:/dropbox 174 | # - /Users/jmthomas/archive:/archive 175 | logging: 176 | driver: "json-file" 177 | options: 178 | max-size: "10m" 179 | max-file: "3" 180 | environment: 181 | # CI in set in Github actions, changes the Demo TLM_LOG_CYCLE_TIME 182 | # By not setting a value it pases the environment variable from the shell 183 | # straight to the container and doesn't complain if CI is not set 184 | - CI 185 | - GEM_HOME=/gems 186 | - PYTHONUSERBASE=/gems/python_packages 187 | - OPENC3_REDIS_USERNAME=${OPENC3_REDIS_USERNAME} 188 | - OPENC3_REDIS_PASSWORD=${OPENC3_REDIS_PASSWORD} 189 | - OPENC3_BUCKET_USERNAME=${OPENC3_BUCKET_USERNAME} 190 | - OPENC3_BUCKET_PASSWORD=${OPENC3_BUCKET_PASSWORD} 191 | - OPENC3_SERVICE_PASSWORD=${OPENC3_SERVICE_PASSWORD} 192 | env_file: 193 | - .env 194 | extra_hosts: 195 | - host.docker.internal:host-gateway 196 | 197 | openc3-traefik: 198 | user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}" 199 | image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-traefik${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}" 200 | volumes: 201 | - "./cacert.pem:/devel/cacert.pem:z" 202 | - "./openc3-traefik/traefik.yaml:/etc/traefik/traefik.yaml:z" 203 | # - "./openc3-traefik/traefik-allow-http.yaml:/etc/traefik/traefik.yaml:z" 204 | # - "./openc3-traefik/traefik-ssl.yaml:/etc/traefik/traefik.yaml:z" 205 | # - "./openc3-traefik/traefik-letsencrypt.yaml:/etc/traefik/traefik.yaml:z" 206 | # - "./openc3-traefik/cert.key:/etc/traefik/cert.key:z" 207 | # - "./openc3-traefik/cert.crt:/etc/traefik/cert.crt:z" 208 | ports: 209 | - "127.0.0.1:2900:2900" 210 | - "127.0.0.1:2943:2943" 211 | # - "80:2900" 212 | # - "443:2943" 213 | restart: "unless-stopped" 214 | depends_on: 215 | - "openc3-redis" 216 | - "openc3-redis-ephemeral" 217 | - "openc3-minio" 218 | logging: 219 | driver: "json-file" 220 | options: 221 | max-size: "10m" 222 | max-file: "3" 223 | environment: 224 | SSL_CERT_FILE: "/devel/cacert.pem" 225 | CURL_CA_BUNDLE: "/devel/cacert.pem" 226 | REQUESTS_CA_BUNDLE: "/devel/cacert.pem" 227 | NODE_EXTRA_CA_CERTS: "/devel/cacert.pem" 228 | 229 | openc3-cosmos-init: 230 | user: "${OPENC3_USER_ID:-1001}:${OPENC3_GROUP_ID:-1001}" 231 | image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-init${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}" 232 | restart: on-failure 233 | depends_on: 234 | - "openc3-traefik" 235 | - "openc3-redis" 236 | - "openc3-redis-ephemeral" 237 | - "openc3-minio" 238 | volumes: 239 | - "openc3-gems-v:/gems" 240 | - "./plugins:/plugins:z" 241 | - "./cacert.pem:/devel/cacert.pem:z" 242 | logging: 243 | driver: "json-file" 244 | options: 245 | max-size: "10m" 246 | max-file: "3" 247 | environment: 248 | # CI in set in Github actions, changes the Demo TLM_LOG_CYCLE_TIME 249 | # By not setting a value it pases the environment variable from the shell 250 | # straight to the container and doesn't complain if CI is not set 251 | - CI 252 | - GEM_HOME=/gems 253 | - PYTHONUSERBASE=/gems/python_packages 254 | - OPENC3_REDIS_USERNAME=${OPENC3_REDIS_USERNAME} 255 | - OPENC3_REDIS_PASSWORD=${OPENC3_REDIS_PASSWORD} 256 | - OPENC3_BUCKET_USERNAME=${OPENC3_BUCKET_USERNAME} 257 | - OPENC3_BUCKET_PASSWORD=${OPENC3_BUCKET_PASSWORD} 258 | - OPENC3_SR_BUCKET_USERNAME=${OPENC3_SR_BUCKET_USERNAME} 259 | - OPENC3_SR_BUCKET_PASSWORD=${OPENC3_SR_BUCKET_PASSWORD} 260 | env_file: 261 | - .env 262 | 263 | volumes: 264 | openc3-redis-v: {} 265 | openc3-redis-ephemeral-v: {} 266 | openc3-bucket-v: {} 267 | openc3-gems-v: {} 268 | -------------------------------------------------------------------------------- /openc3-redis/users.acl: -------------------------------------------------------------------------------- 1 | user healthcheck on nopass -@all +cluster|info +ping 2 | user openc3 on #022bd57403439b2a3ec0c081cdd35d40a199bbd4ee6fc0e5113edd4fe1c10071 allkeys allchannels -@all +@read +@write +@pubsub +@connection +@transaction +info 3 | user scriptrunner on #e808c74e210256ee7cf3ec165271544167de776d526f7fa94243e5cdcc08b0c1 resetkeys resetchannels ~running-script* ~*script-locks ~*script-breakpoints ~*openc3_log_messages &__anycable__ &_action_cable_internal &script-api:* -@all +@read +@write +@pubsub +@hash +@connection 4 | user admin on #749f09bade8aca755660eeb17792da880218d4fbdc4e25fbec279d7fe9f65d70 +@admin 5 | user default off 6 | -------------------------------------------------------------------------------- /openc3-traefik/traefik-allow-http.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Listen for everything coming in on the standard HTTP port 3 | entrypoints: 4 | web: 5 | address: ":2900" 6 | http: 7 | middlewares: 8 | # Removes the first part of the url before passing onto the service 9 | # ie. /openc3-api/api becomes /api 10 | removeFirst: 11 | replacePathRegex: 12 | regex: "^/([^/]*)/(.*)" 13 | replacement: "/$2" 14 | # Serve /tools/base/index.html 15 | gotoToolsBaseIndex: 16 | replacePath: 17 | path: "/tools/base/index-allow-http.html" 18 | # Adds /tools/base to the beginning of the given url 19 | # ie. /index.html becomes /tools/base/index.html 20 | addToolsBase: 21 | replacePathRegex: 22 | regex: "^/(.*)" 23 | replacement: "/tools/base/$1" 24 | # Adds index.html to the end of the given url 25 | # ie. /tools/staticdocs/ becomes /tools/staticdocs/index.html 26 | addIndexHtml: 27 | replacePathRegex: 28 | regex: "^(.*)/$" 29 | replacement: "$1/index.html" 30 | # Adds .html to the end of the given url 31 | # ie. /tools/staticdocs/docs becomes /tools/staticdocs/docs.html 32 | addDotHtml: 33 | replacePathRegex: 34 | regex: "^(.*)$" 35 | replacement: "$1.html" 36 | routers: 37 | # Note: Priorities control router check order with highest priority evaluated first 38 | # Route to the openc3 cmd/tlm api websockets 39 | api-cable-router: 40 | rule: PathPrefix(`/openc3-api/cable`) 41 | service: service-api-cable 42 | priority: 10 43 | # Route to the openc3 script api websockets 44 | script-cable-router: 45 | rule: PathPrefix(`/script-api/cable`) 46 | service: service-script-cable 47 | priority: 9 48 | # Route to the openc3 cmd/tlm api 49 | api-router: 50 | rule: PathPrefix(`/openc3-api`) 51 | service: service-api 52 | priority: 8 53 | # Route to the script api 54 | script-router: 55 | rule: PathPrefix(`/script-api`) 56 | service: service-script 57 | priority: 7 58 | # Route to other tool plugins hosted statically in Minio 59 | # Matches any path with a file extension which is assumed to be 60 | # a static file 61 | tools-router: 62 | rule: PathRegexp(`/tools/.*/.*[.](ttf|otf|woff|woff2|html|js|css|png|jpg|jpeg|gif|svg|ico|json|xml|txt|pdf|zip|tar|gz|tgz|csv|tsv|md|yaml|yml|bin|doc|docx|xls|xlsx|ppt|pptx|mp4|mp3|wav|avi|mov|flv|swf|apk|ipa|deb|rpm|exe|msi|dmg|pkg|sh|bat|cmd|ps1|py|pl|rb|php|java|class|jar|war|ear|so|dll|lib|a|o|obj|pdb|pdb|lib|dylib|framework)`) 63 | service: service-minio 64 | priority: 6 65 | # Route to other tool plugins hosted statically in Minio 66 | # Where we need to add index.html to the path 67 | # Matches any tool name that starts with static and ends with slash 68 | statictools-index-router: 69 | rule: PathRegexp(`/tools/static.*/`) 70 | middlewares: 71 | # add index.html to the end 72 | - "addIndexHtml" 73 | service: service-minio 74 | priority: 5 75 | # Route to other tool plugins hosted statically in Minio 76 | # Where we need to add .html to the path 77 | # Matches any tool name that starts with static 78 | statictools-dothtml-router: 79 | rule: PathRegexp(`/tools/static.*`) 80 | middlewares: 81 | # add .html to the end 82 | - "addDotHtml" 83 | service: service-minio 84 | priority: 4 85 | # Route to any path in minio 86 | files-router: 87 | rule: PathPrefix(`/files`) 88 | middlewares: 89 | # remove /files from the beginning 90 | - "removeFirst" 91 | service: service-minio 92 | priority: 3 93 | # Route to base files hosted statically in Minio 94 | # Matches any path with a file extension which is assumed to be 95 | # a static file 96 | base-router: 97 | rule: PathRegexp(`/.*[.].*`) 98 | middlewares: 99 | # add /tools/base to the beginning 100 | - "addToolsBase" 101 | service: service-minio 102 | priority: 2 103 | # This is the default route for everything that doesn't match a more specific route 104 | # It gets us to the base openc3 application 105 | web-router: 106 | rule: HostRegexp(`.*`) 107 | middlewares: 108 | # Serve /tools/base/index.html from minio 109 | - "gotoToolsBaseIndex" 110 | service: service-minio 111 | priority: 1 112 | services: 113 | # The OpenC3 cmd/tlm api cable service 114 | service-api-cable: 115 | loadBalancer: 116 | passHostHeader: false 117 | servers: 118 | - url: "http://openc3-cosmos-cmd-tlm-api:3901" 119 | # The OpenC3 script api cable service 120 | service-script-cable: 121 | loadBalancer: 122 | passHostHeader: false 123 | servers: 124 | - url: "http://openc3-cosmos-script-runner-api:3902" 125 | # The OpenC3 cmd/tlm api service 126 | service-api: 127 | loadBalancer: 128 | passHostHeader: false 129 | servers: 130 | - url: "http://openc3-cosmos-cmd-tlm-api:2901" 131 | # The OpenC3 script api service 132 | service-script: 133 | loadBalancer: 134 | passHostHeader: false 135 | servers: 136 | - url: "http://openc3-cosmos-script-runner-api:2902" 137 | # The Minio S3 file server 138 | service-minio: 139 | loadBalancer: 140 | passHostHeader: false 141 | servers: 142 | - url: "http://openc3-minio:9000" 143 | # Declare the routes are currently coming from this file, not dynamically 144 | providers: 145 | file: 146 | filename: /etc/traefik/traefik.yaml 147 | http: 148 | endpoint: "http://openc3-cosmos-cmd-tlm-api:2901/openc3-api/traefik" 149 | pollInterval: "5s" 150 | accessLog: {} 151 | # api: 152 | # dashboard: true 153 | # insecure: true 154 | # log: 155 | # filePath: '/etc/traefik/traefik.log' 156 | # level: 'DEBUG' 157 | # accessLog: 158 | # filePath: '/etc/traefik/access.log' 159 | # fields: 160 | # defaultMode: keep 161 | # headers: 162 | # defaultMode: keep 163 | -------------------------------------------------------------------------------- /openc3-traefik/traefik-letsencrypt.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | entrypoints: 3 | web: 4 | address: ":2900" 5 | http: 6 | redirections: 7 | entryPoint: 8 | to: websecure 9 | scheme: https 10 | permanent: false 11 | websecure: 12 | address: ":2943" 13 | http: 14 | tls: 15 | domains: 16 | - main: "mydomain.com" # Update with your domain 17 | certificatesResolvers: 18 | myresolver: 19 | acme: 20 | email: me@mydomain.com 21 | storage: "/tmp/acme.json" 22 | tlsChallenge: {} 23 | http: 24 | middlewares: 25 | # Removes the first part of the url before passing onto the service 26 | # ie. /openc3-api/api becomes /api 27 | removeFirst: 28 | replacePathRegex: 29 | regex: "^/([^/]*)/(.*)" 30 | replacement: "/$2" 31 | # Serve /tools/base/index.html 32 | gotoToolsBaseIndex: 33 | replacePath: 34 | path: "/tools/base/index.html" 35 | # Adds /tools/base to the beginning of the given url 36 | # ie. /index.html becomes /tools/base/index.html 37 | addToolsBase: 38 | replacePathRegex: 39 | regex: "^/(.*)" 40 | replacement: "/tools/base/$1" 41 | # Adds index.html to the end of the given url 42 | # ie. /tools/staticdocs/ becomes /tools/staticdocs/index.html 43 | addIndexHtml: 44 | replacePathRegex: 45 | regex: "^(.*)/$" 46 | replacement: "$1/index.html" 47 | # Adds .html to the end of the given url 48 | # ie. /tools/staticdocs/docs becomes /tools/staticdocs/docs.html 49 | addDotHtml: 50 | replacePathRegex: 51 | regex: "^(.*)$" 52 | replacement: "$1.html" 53 | routers: 54 | # Note: Priorities control router check order with highest priority evaluated first 55 | # Route to the openc3 cmd/tlm api websockets 56 | api-cable-router: 57 | rule: PathPrefix(`/openc3-api/cable`) 58 | service: service-api-cable 59 | priority: 10 60 | tls: 61 | certResolver: myresolver 62 | domains: 63 | - main: "mydomain.com" 64 | # Route to the openc3 script api websockets 65 | script-cable-router: 66 | rule: PathPrefix(`/script-api/cable`) 67 | service: service-script-cable 68 | priority: 9 69 | tls: 70 | certResolver: myresolver 71 | domains: 72 | - main: "mydomain.com" 73 | # Route to the openc3 cmd/tlm api 74 | api-router: 75 | rule: PathPrefix(`/openc3-api`) 76 | service: service-api 77 | priority: 8 78 | tls: 79 | certResolver: myresolver 80 | domains: 81 | - main: "mydomain.com" 82 | # Route to the script api 83 | script-router: 84 | rule: PathPrefix(`/script-api`) 85 | service: service-script 86 | priority: 7 87 | tls: 88 | certResolver: myresolver 89 | domains: 90 | - main: "mydomain.com" 91 | # Route to other tool plugins hosted statically in Minio 92 | # Matches any path with a file extension which is assumed to be 93 | # a static file 94 | tools-router: 95 | rule: PathRegexp(`/tools/.*/.*[.](ttf|otf|woff|woff2|html|js|css|png|jpg|jpeg|gif|svg|ico|json|xml|txt|pdf|zip|tar|gz|tgz|csv|tsv|md|yaml|yml|bin|doc|docx|xls|xlsx|ppt|pptx|mp4|mp3|wav|avi|mov|flv|swf|apk|ipa|deb|rpm|exe|msi|dmg|pkg|sh|bat|cmd|ps1|py|pl|rb|php|java|class|jar|war|ear|so|dll|lib|a|o|obj|pdb|pdb|lib|dylib|framework)`) 96 | service: service-minio 97 | priority: 6 98 | tls: 99 | certResolver: myresolver 100 | domains: 101 | - main: "mydomain.com" 102 | # Route to other tool plugins hosted statically in Minio 103 | # Where we need to add index.html to the path 104 | # Matches any tool name that starts with static and ends with slash 105 | statictools-index-router: 106 | rule: PathRegexp(`/tools/static.*/`) 107 | middlewares: 108 | # add index.html to the end 109 | - "addIndexHtml" 110 | service: service-minio 111 | priority: 5 112 | tls: 113 | certResolver: myresolver 114 | domains: 115 | - main: "mydomain.com" 116 | # Route to other tool plugins hosted statically in Minio 117 | # Where we need to add .html to the path 118 | # Matches any tool name that starts with static 119 | statictools-dothtml-router: 120 | rule: PathRegexp(`/tools/static.*`) 121 | middlewares: 122 | # add .html to the end 123 | - "addDotHtml" 124 | service: service-minio 125 | priority: 4 126 | tls: 127 | certResolver: myresolver 128 | domains: 129 | - main: "mydomain.com" 130 | # Route to any path in minio 131 | files-router: 132 | rule: PathPrefix(`/files`) 133 | middlewares: 134 | # remove /files from the beginning 135 | - "removeFirst" 136 | service: service-minio 137 | priority: 3 138 | tls: 139 | certResolver: myresolver 140 | domains: 141 | - main: "mydomain.com" 142 | # Route to base files hosted statically in Minio 143 | # Matches any path with a file extension which is assumed to be 144 | # a static file 145 | base-router: 146 | rule: PathRegexp(`/.*[.].*`) 147 | middlewares: 148 | # add /tools/base to the beginning 149 | - "addToolsBase" 150 | service: service-minio 151 | priority: 2 152 | tls: 153 | certResolver: myresolver 154 | domains: 155 | - main: "mydomain.com" 156 | # This is the default route for everything that doesn't match a more specific route 157 | # It gets us to the base openc3 application 158 | web-router: 159 | rule: HostRegexp(`.*`) 160 | middlewares: 161 | # Serve /tools/base/index.html from minio 162 | - "gotoToolsBaseIndex" 163 | service: service-minio 164 | priority: 1 165 | tls: 166 | certResolver: myresolver 167 | domains: 168 | - main: "mydomain.com" 169 | services: 170 | # The OpenC3 cmd/tlm api cable service 171 | service-api-cable: 172 | loadBalancer: 173 | passHostHeader: false 174 | servers: 175 | - url: "http://openc3-cosmos-cmd-tlm-api:3901" 176 | # The OpenC3 script api cable service 177 | service-script-cable: 178 | loadBalancer: 179 | passHostHeader: false 180 | servers: 181 | - url: "http://openc3-cosmos-script-runner-api:3902" 182 | # The OpenC3 cmd/tlm api service 183 | service-api: 184 | loadBalancer: 185 | passHostHeader: false 186 | servers: 187 | - url: "http://openc3-cosmos-cmd-tlm-api:2901" 188 | # The OpenC3 script api service 189 | service-script: 190 | loadBalancer: 191 | passHostHeader: false 192 | servers: 193 | - url: "http://openc3-cosmos-script-runner-api:2902" 194 | # The Minio S3 file server 195 | service-minio: 196 | loadBalancer: 197 | passHostHeader: false 198 | servers: 199 | - url: "http://openc3-minio:9000" 200 | # Declare the routes are currently coming from this file, not dynamically 201 | providers: 202 | file: 203 | filename: /etc/traefik/traefik.yaml 204 | http: 205 | endpoint: "http://openc3-cosmos-cmd-tlm-api:2901/openc3-api/traefik" 206 | pollInterval: "5s" 207 | accessLog: {} 208 | # api: 209 | # dashboard: true 210 | # insecure: true 211 | #log: 212 | # filePath: "/etc/traefik/traefik.log" 213 | # level: "DEBUG" 214 | # accessLog: 215 | # filePath: '/etc/traefik/access.log' 216 | # fields: 217 | # defaultMode: keep 218 | # headers: 219 | # defaultMode: keep 220 | -------------------------------------------------------------------------------- /openc3-traefik/traefik-ssl.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | tls: 3 | stores: 4 | default: 5 | defaultCertificate: 6 | certFile: "/etc/traefik/cert.crt" 7 | keyFile: "/etc/traefik/cert.key" 8 | entrypoints: 9 | web: 10 | address: ":2900" 11 | http: 12 | redirections: 13 | entryPoint: 14 | to: ":2943" # This should match port forwarding in your compose.yaml 15 | scheme: https 16 | permanent: false 17 | websecure: 18 | address: ":2943" 19 | http: 20 | tls: 21 | domains: 22 | - main: "mydomain.com" # Update with your domain 23 | http: 24 | middlewares: 25 | # Removes the first part of the url before passing onto the service 26 | # ie. /openc3-api/api becomes /api 27 | removeFirst: 28 | replacePathRegex: 29 | regex: "^/([^/]*)/(.*)" 30 | replacement: "/$2" 31 | # Serve /tools/base/index.html 32 | gotoToolsBaseIndex: 33 | replacePath: 34 | path: "/tools/base/index.html" 35 | # Adds /tools/base to the beginning of the given url 36 | # ie. /index.html becomes /tools/base/index.html 37 | addToolsBase: 38 | replacePathRegex: 39 | regex: "^/(.*)" 40 | replacement: "/tools/base/$1" 41 | # Adds index.html to the end of the given url 42 | # ie. /tools/staticdocs/ becomes /tools/staticdocs/index.html 43 | addIndexHtml: 44 | replacePathRegex: 45 | regex: "^(.*)/$" 46 | replacement: "$1/index.html" 47 | # Adds .html to the end of the given url 48 | # ie. /tools/staticdocs/docs becomes /tools/staticdocs/docs.html 49 | addDotHtml: 50 | replacePathRegex: 51 | regex: "^(.*)$" 52 | replacement: "$1.html" 53 | routers: 54 | # Note: Priorities control router check order with highest priority evaluated first 55 | # Route to the openc3 cmd/tlm api websockets 56 | api-cable-router: 57 | rule: PathPrefix(`/openc3-api/cable`) 58 | service: service-api-cable 59 | priority: 10 60 | tls: {} 61 | # Route to the openc3 script api websockets 62 | script-cable-router: 63 | rule: PathPrefix(`/script-api/cable`) 64 | service: service-script-cable 65 | priority: 9 66 | tls: {} 67 | # Route to the openc3 cmd/tlm api 68 | api-router: 69 | rule: PathPrefix(`/openc3-api`) 70 | service: service-api 71 | priority: 8 72 | tls: {} 73 | # Route to the script api 74 | script-router: 75 | rule: PathPrefix(`/script-api`) 76 | service: service-script 77 | priority: 7 78 | tls: {} 79 | # Route to other tool plugins hosted statically in Minio 80 | # Matches any path with a file extension which is assumed to be 81 | # a static file 82 | tools-router: 83 | rule: PathRegexp(`/tools/.*/.*[.](ttf|otf|woff|woff2|html|js|css|png|jpg|jpeg|gif|svg|ico|json|xml|txt|pdf|zip|tar|gz|tgz|csv|tsv|md|yaml|yml|bin|doc|docx|xls|xlsx|ppt|pptx|mp4|mp3|wav|avi|mov|flv|swf|apk|ipa|deb|rpm|exe|msi|dmg|pkg|sh|bat|cmd|ps1|py|pl|rb|php|java|class|jar|war|ear|so|dll|lib|a|o|obj|pdb|pdb|lib|dylib|framework)`) 84 | service: service-minio 85 | priority: 6 86 | tls: {} 87 | # Route to other tool plugins hosted statically in Minio 88 | # Where we need to add index.html to the path 89 | # Matches any tool name that starts with static and ends with slash 90 | statictools-index-router: 91 | rule: PathRegexp(`/tools/static.*/`) 92 | middlewares: 93 | # add index.html to the end 94 | - "addIndexHtml" 95 | service: service-minio 96 | priority: 5 97 | tls: {} 98 | # Route to other tool plugins hosted statically in Minio 99 | # Where we need to add .html to the path 100 | # Matches any tool name that starts with static 101 | statictools-dothtml-router: 102 | rule: PathRegexp(`/tools/static.*`) 103 | middlewares: 104 | # add .html to the end 105 | - "addDotHtml" 106 | service: service-minio 107 | priority: 4 108 | tls: {} 109 | # Route to any path in minio 110 | files-router: 111 | rule: PathPrefix(`/files`) 112 | middlewares: 113 | # remove /files from the beginning 114 | - "removeFirst" 115 | service: service-minio 116 | priority: 3 117 | tls: {} 118 | # Route to base files hosted statically in Minio 119 | # Matches any path with a file extension which is assumed to be 120 | # a static file 121 | base-router: 122 | rule: PathRegexp(`/.*[.].*`) 123 | middlewares: 124 | # add /tools/base to the beginning 125 | - "addToolsBase" 126 | service: service-minio 127 | priority: 2 128 | tls: {} 129 | # This is the default route for everything that doesn't match a more specific route 130 | # It gets us to the base openc3 application 131 | web-router: 132 | rule: HostRegexp(`.*`) 133 | middlewares: 134 | # Serve /tools/base/index.html from minio 135 | - "gotoToolsBaseIndex" 136 | service: service-minio 137 | priority: 1 138 | tls: {} 139 | services: 140 | # The OpenC3 cmd/tlm api cable service 141 | service-api-cable: 142 | loadBalancer: 143 | passHostHeader: false 144 | servers: 145 | - url: "http://openc3-cosmos-cmd-tlm-api:3901" 146 | # The OpenC3 script api cable service 147 | service-script-cable: 148 | loadBalancer: 149 | passHostHeader: false 150 | servers: 151 | - url: "http://openc3-cosmos-script-runner-api:3902" 152 | # The OpenC3 cmd/tlm api service 153 | service-api: 154 | loadBalancer: 155 | passHostHeader: false 156 | servers: 157 | - url: "http://openc3-cosmos-cmd-tlm-api:2901" 158 | # The OpenC3 script api service 159 | service-script: 160 | loadBalancer: 161 | passHostHeader: false 162 | servers: 163 | - url: "http://openc3-cosmos-script-runner-api:2902" 164 | # The Minio S3 file server 165 | service-minio: 166 | loadBalancer: 167 | passHostHeader: false 168 | servers: 169 | - url: "http://openc3-minio:9000" 170 | # Declare the routes are currently coming from this file, not dynamically 171 | providers: 172 | file: 173 | filename: /etc/traefik/traefik.yaml 174 | http: 175 | endpoint: "http://openc3-cosmos-cmd-tlm-api:2901/openc3-api/traefik" 176 | pollInterval: "5s" 177 | accessLog: {} 178 | # api: 179 | # dashboard: true 180 | # insecure: true 181 | # log: 182 | # filePath: '/etc/traefik/traefik.log' 183 | # level: 'DEBUG' 184 | # accessLog: 185 | # filePath: '/etc/traefik/access.log' 186 | # fields: 187 | # defaultMode: keep 188 | # headers: 189 | # defaultMode: keep 190 | -------------------------------------------------------------------------------- /openc3-traefik/traefik.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Listen for everything coming in on the standard HTTP port 3 | entrypoints: 4 | web: 5 | address: ":2900" 6 | http: 7 | middlewares: 8 | # Removes the first part of the url before passing onto the service 9 | # ie. /openc3-api/api becomes /api 10 | removeFirst: 11 | replacePathRegex: 12 | regex: "^/([^/]*)/(.*)" 13 | replacement: "/$2" 14 | # Serve /tools/base/index.html 15 | gotoToolsBaseIndex: 16 | replacePath: 17 | path: "/tools/base/index.html" 18 | # Adds /tools/base to the beginning of the given url 19 | # ie. /index.html becomes /tools/base/index.html 20 | addToolsBase: 21 | replacePathRegex: 22 | regex: "^/(.*)" 23 | replacement: "/tools/base/$1" 24 | # Adds index.html to the end of the given url 25 | # ie. /tools/staticdocs/ becomes /tools/staticdocs/index.html 26 | addIndexHtml: 27 | replacePathRegex: 28 | regex: "^(.*)/$" 29 | replacement: "$1/index.html" 30 | # Adds .html to the end of the given url 31 | # ie. /tools/staticdocs/docs becomes /tools/staticdocs/docs.html 32 | addDotHtml: 33 | replacePathRegex: 34 | regex: "^(.*)$" 35 | replacement: "$1.html" 36 | routers: 37 | # Note: Priorities control router check order with highest priority evaluated first 38 | # Route to the openc3 cmd/tlm api websockets 39 | api-cable-router: 40 | rule: PathPrefix(`/openc3-api/cable`) 41 | service: service-api-cable 42 | priority: 10 43 | # Route to the openc3 script api websockets 44 | script-cable-router: 45 | rule: PathPrefix(`/script-api/cable`) 46 | service: service-script-cable 47 | priority: 9 48 | # Route to the openc3 cmd/tlm api 49 | api-router: 50 | rule: PathPrefix(`/openc3-api`) 51 | service: service-api 52 | priority: 8 53 | # Route to the script api 54 | script-router: 55 | rule: PathPrefix(`/script-api`) 56 | service: service-script 57 | priority: 7 58 | # Route to other tool plugins hosted statically in Minio 59 | # Matches any path with a valid file extension which is assumed to be a static file 60 | # TODO: We need to make all static tool files use a fixed route (apply to all traefik.yaml files) 61 | tools-router: 62 | rule: PathRegexp(`/tools/.*/.*[.](ttf|otf|woff|woff2|html|js|css|png|jpg|jpeg|gif|svg|ico|json|xml|txt|pdf|zip|tar|gz|tgz|csv|tsv|md|yaml|yml|bin|doc|docx|xls|xlsx|ppt|pptx|mp4|mp3|wav|avi|mov|flv|swf|apk|ipa|deb|rpm|exe|msi|dmg|pkg|sh|bat|cmd|ps1|py|pl|rb|php|java|class|jar|war|ear|so|dll|lib|a|o|obj|pdb|pdb|lib|dylib|framework)`) 63 | service: service-minio 64 | priority: 6 65 | # Route to other tool plugins hosted statically in Minio 66 | # Where we need to add index.html to the path 67 | # Matches any tool name that starts with static and ends with slash 68 | statictools-index-router: 69 | rule: PathRegexp(`/tools/static.*/`) 70 | middlewares: 71 | # add index.html to the end 72 | - "addIndexHtml" 73 | service: service-minio 74 | priority: 5 75 | # Route to other tool plugins hosted statically in Minio 76 | # Where we need to add .html to the path 77 | # Matches any tool name that starts with static 78 | statictools-dothtml-router: 79 | rule: PathRegexp(`/tools/static.*`) 80 | middlewares: 81 | # add .html to the end 82 | - "addDotHtml" 83 | service: service-minio 84 | priority: 4 85 | # Route to any path in minio 86 | files-router: 87 | rule: PathPrefix(`/files`) 88 | middlewares: 89 | # remove /files from the beginning 90 | - "removeFirst" 91 | service: service-minio 92 | priority: 3 93 | # Route to base files hosted statically in Minio 94 | # Matches any path with a valid file extension which is assumed to be a static file 95 | # TODO: We need to make all static tool files use a fixed route (apply to all traefik.yaml files) 96 | base-router: 97 | rule: PathRegexp(`/.*[.](ttf|otf|woff|woff2|html|js|css|png|jpg|jpeg|gif|svg|ico|json|xml|txt|pdf|zip|tar|gz|tgz|csv|tsv|md|yaml|yml|bin|doc|docx|xls|xlsx|ppt|pptx|mp4|mp3|wav|avi|mov|flv|swf|apk|ipa|deb|rpm|exe|msi|dmg|pkg|sh|bat|cmd|ps1|py|pl|rb|php|java|class|jar|war|ear|so|dll|lib|a|o|obj|pdb|pdb|lib|dylib|framework)`) 98 | middlewares: 99 | # add /tools/base to the beginning 100 | - "addToolsBase" 101 | service: service-minio 102 | priority: 2 103 | # This is the default route for everything that doesn't match a more specific route 104 | # It gets us to the base openc3 application 105 | web-router: 106 | rule: HostRegexp(`.*`) 107 | middlewares: 108 | # Serve /tools/base/index.html from minio 109 | - "gotoToolsBaseIndex" 110 | service: service-minio 111 | priority: 1 112 | services: 113 | # The OpenC3 cmd/tlm api cable service 114 | service-api-cable: 115 | loadBalancer: 116 | passHostHeader: false 117 | servers: 118 | - url: "http://openc3-cosmos-cmd-tlm-api:3901" 119 | # The OpenC3 script api cable service 120 | service-script-cable: 121 | loadBalancer: 122 | passHostHeader: false 123 | servers: 124 | - url: "http://openc3-cosmos-script-runner-api:3902" 125 | # The OpenC3 cmd/tlm api service 126 | service-api: 127 | loadBalancer: 128 | passHostHeader: false 129 | servers: 130 | - url: "http://openc3-cosmos-cmd-tlm-api:2901" 131 | # The OpenC3 script api service 132 | service-script: 133 | loadBalancer: 134 | passHostHeader: false 135 | servers: 136 | - url: "http://openc3-cosmos-script-runner-api:2902" 137 | # The Minio S3 file server 138 | service-minio: 139 | loadBalancer: 140 | passHostHeader: false 141 | servers: 142 | - url: "http://openc3-minio:9000" 143 | # Declare the routes are currently coming from this file, not dynamically 144 | providers: 145 | file: 146 | filename: /etc/traefik/traefik.yaml 147 | http: 148 | endpoint: "http://openc3-cosmos-cmd-tlm-api:2901/openc3-api/traefik" 149 | pollInterval: "5s" 150 | 151 | accessLog: {} 152 | # api: 153 | # dashboard: true 154 | # insecure: true 155 | # log: 156 | # filePath: '/etc/traefik/traefik.log' 157 | # level: 'DEBUG' 158 | # accessLog: 159 | # filePath: '/etc/traefik/access.log' 160 | # fields: 161 | # defaultMode: keep 162 | # headers: 163 | # defaultMode: keep 164 | -------------------------------------------------------------------------------- /openc3.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal ENABLEDELAYEDEXPANSION 3 | 4 | if "%1" == "" ( 5 | GOTO usage 6 | ) 7 | if "%1" == "cli" ( 8 | REM tokens=* means process the full line 9 | REM findstr /V = print lines that don't match, /B beginning of line, /L literal search string, /C:# match # 10 | FOR /F "tokens=*" %%i in ('findstr /V /B /L /C:# %~dp0.env') do SET %%i 11 | set params=%* 12 | call set params=%%params:*%1=%% 13 | REM Start (and remove when done --rm) the openc3-cosmos-cmd-tlm-api container with the current working directory 14 | REM mapped as volume (-v) /openc3/local and container working directory (-w) also set to /openc3/local. 15 | REM This allows tools running in the container to have a consistent path to the current working directory. 16 | REM Run the command "ruby /openc3/bin/openc3cli" with all parameters ignoring the first. 17 | docker compose -f %~dp0compose.yaml run -it --rm -v %cd%:/openc3/local -w /openc3/local -e OPENC3_API_PASSWORD=!OPENC3_API_PASSWORD! --no-deps openc3-cosmos-cmd-tlm-api ruby /openc3/bin/openc3cli !params! 18 | GOTO :EOF 19 | ) 20 | if "%1" == "cliroot" ( 21 | FOR /F "tokens=*" %%i in ('findstr /V /B /L /C:# %~dp0.env') do SET %%i 22 | set params=%* 23 | call set params=%%params:*%1=%% 24 | docker compose -f %~dp0compose.yaml run -it --rm --user=root -v %cd%:/openc3/local -w /openc3/local -e OPENC3_API_PASSWORD=!OPENC3_API_PASSWORD! --no-deps openc3-cosmos-cmd-tlm-api ruby /openc3/bin/openc3cli !params! 25 | GOTO :EOF 26 | ) 27 | if "%1" == "start" ( 28 | REM start is an alias for run in the project 29 | GOTO run 30 | ) 31 | if "%1" == "stop" ( 32 | GOTO stop 33 | ) 34 | if "%1" == "cleanup" ( 35 | GOTO cleanup 36 | ) 37 | if "%1" == "run" ( 38 | GOTO run 39 | ) 40 | if "%1" == "util" ( 41 | FOR /F "tokens=*" %%i in ('findstr /V /B /L /C:# %~dp0.env') do SET %%i 42 | GOTO util 43 | ) 44 | 45 | GOTO usage 46 | 47 | :stop 48 | docker compose stop openc3-operator 49 | docker compose stop openc3-cosmos-script-runner-api 50 | docker compose stop openc3-cosmos-cmd-tlm-api 51 | timeout /t 5 /nobreak 52 | docker compose -f compose.yaml down -t 30 53 | @echo off 54 | GOTO :EOF 55 | 56 | :cleanup 57 | if "%2" == "force" ( 58 | goto :cleanup_y 59 | ) 60 | if "%3" == "force" ( 61 | goto :cleanup_y 62 | ) 63 | 64 | :try_cleanup 65 | set /P c=Are you sure? Cleanup removes ALL docker volumes and all COSMOS data! [Y/N]? 66 | if /I "!c!" EQU "Y" goto :cleanup_y 67 | if /I "!c!" EQU "N" goto :EOF 68 | goto :try_cleanup 69 | 70 | :cleanup_y 71 | docker compose -f compose.yaml down -t 30 -v 72 | 73 | if "%2" == "local" ( 74 | FOR /d %%a IN (%~dp0plugins\DEFAULT\*) DO RD /S /Q "%%a" 75 | FOR %%a IN (%~dp0plugins\DEFAULT\*) DO IF /i NOT "%%~nxa"=="README.md" DEL "%%a" 76 | ) 77 | @echo off 78 | GOTO :EOF 79 | 80 | :run 81 | docker compose -f compose.yaml up -d 82 | @echo off 83 | GOTO :EOF 84 | 85 | :util 86 | REM Send the remaining arguments to openc3_util 87 | set args=%* 88 | call set args=%%args:*%1=%% 89 | CALL scripts\windows\openc3_util %args% || exit /b 90 | @echo off 91 | GOTO :EOF 92 | 93 | :usage 94 | @echo Usage: %0 [cli, cliroot, start, stop, cleanup, run, util] 1>&2 95 | @echo * cli: run a cli command as the default user ('cli help' for more info) 1>&2 96 | @echo * cliroot: run a cli command as the root user ('cli help' for more info) 1>&2 97 | @echo * start: alias for run 1>&2 98 | @echo * stop: stop the containers (compose stop) 1>&2 99 | @echo * cleanup [local] [force]: REMOVE volumes / data (compose down -v) 1>&2 100 | @echo * run: run the containers (compose up) 1>&2 101 | @echo * util: various helper commands 1>&2 102 | 103 | @echo on 104 | -------------------------------------------------------------------------------- /openc3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set +e 4 | 5 | if ! command -v docker &> /dev/null 6 | then 7 | if command -v podman &> /dev/null 8 | then 9 | function docker() { 10 | podman $@ 11 | } 12 | else 13 | echo "Neither docker nor podman found!!!" 14 | exit 1 15 | fi 16 | fi 17 | 18 | export DOCKER_COMPOSE_COMMAND="docker compose" 19 | ${DOCKER_COMPOSE_COMMAND} version &> /dev/null 20 | if [ "$?" -ne 0 ]; then 21 | export DOCKER_COMPOSE_COMMAND="docker-compose" 22 | fi 23 | 24 | docker info | grep -e "rootless$" -e "rootless: true" 25 | if [ "$?" -ne 0 ]; then 26 | export OPENC3_ROOTFUL=1 27 | export OPENC3_USER_ID=`id -u` 28 | export OPENC3_GROUP_ID=`id -g` 29 | else 30 | export OPENC3_ROOTLESS=1 31 | export OPENC3_USER_ID=0 32 | export OPENC3_GROUP_ID=0 33 | fi 34 | 35 | set -e 36 | 37 | usage() { 38 | echo "Usage: $1 [cli, start, stop, cleanup, run, util]" >&2 39 | echo "* cli: run a cli command as the default user ('cli help' for more info)" 1>&2 40 | echo "* start: alias for run" >&2 41 | echo "* stop: stop the containers (compose stop)" >&2 42 | echo "* cleanup [local] [force]: REMOVE volumes / data (compose down -v)" >&2 43 | echo "* run: run the containers (compose up)" >&2 44 | echo "* util: various helper commands" >&2 45 | exit 1 46 | } 47 | 48 | if [ "$#" -eq 0 ]; then 49 | usage $0 50 | fi 51 | 52 | case $1 in 53 | cli ) 54 | # Source the .env file to setup environment variables 55 | set -a 56 | . "$(dirname -- "$0")/.env" 57 | # Start (and remove when done --rm) the openc3-cosmos-cmd-tlm-api container with the current working directory 58 | # mapped as volume (-v) /openc3/local and container working directory (-w) also set to /openc3/local. 59 | # This allows tools running in the container to have a consistent path to the current working directory. 60 | # Run the command "ruby /openc3/bin/openc3cli" with all parameters starting at 2 since the first is 'openc3' 61 | args=`echo $@ | { read _ args; echo $args; }` 62 | ${DOCKER_COMPOSE_COMMAND} -f "$(dirname -- "$0")/compose.yaml" run -it --rm -v `pwd`:/openc3/local:z -w /openc3/local -e OPENC3_API_PASSWORD=$OPENC3_API_PASSWORD --no-deps openc3-cosmos-cmd-tlm-api ruby /openc3/bin/openc3cli $args 63 | set +a 64 | ;; 65 | stop ) 66 | ${DOCKER_COMPOSE_COMMAND} stop openc3-operator 67 | ${DOCKER_COMPOSE_COMMAND} stop openc3-cosmos-script-runner-api 68 | ${DOCKER_COMPOSE_COMMAND} stop openc3-cosmos-cmd-tlm-api 69 | sleep 5 70 | ${DOCKER_COMPOSE_COMMAND} -f compose.yaml down -t 30 71 | ;; 72 | cleanup ) 73 | # They can specify 'cleanup force' or 'cleanup local force' 74 | if [ "$2" == "force" ] || [ "$3" == "force" ] 75 | then 76 | ${DOCKER_COMPOSE_COMMAND} -f compose.yaml down -t 30 -v 77 | else 78 | echo "Are you sure? Cleanup removes ALL docker volumes and all COSMOS data! (1-Yes / 2-No)" 79 | select yn in "Yes" "No"; do 80 | case $yn in 81 | Yes ) ${DOCKER_COMPOSE_COMMAND} -f compose.yaml down -t 30 -v; break;; 82 | No ) exit;; 83 | esac 84 | done 85 | fi 86 | if [ "$2" == "local" ] 87 | then 88 | cd plugins/DEFAULT 89 | ls | grep -xv "README.md" | xargs rm -r 90 | cd ../.. 91 | fi 92 | ;; 93 | start | run ) 94 | ${DOCKER_COMPOSE_COMMAND} -f compose.yaml up -d 95 | ;; 96 | run-ubi ) 97 | OPENC3_IMAGE_SUFFIX=-ubi OPENC3_REDIS_VOLUME=/home/data ${DOCKER_COMPOSE_COMMAND} -f compose.yaml up -d 98 | ;; 99 | util ) 100 | set -a 101 | . "$(dirname -- "$0")/.env" 102 | scripts/linux/openc3_util.sh "${@:2}" 103 | set +a 104 | ;; 105 | * ) 106 | usage $0 107 | ;; 108 | esac 109 | -------------------------------------------------------------------------------- /plugins/DEFAULT/README.md: -------------------------------------------------------------------------------- 1 | # Plugins Configuration Folder 2 | 3 | Warning: This folder is read/write with the OpenC3 system and is meant to be kept configuration controlled 4 | 5 | First level folders are scope names, and should be all caps. For open source OpenC3, the only first level folder will be DEFAULT. 6 | 7 | Inside of each scope folder, are folders that can be arbitrarily named with one folder for each instance of an installed plugin. 8 | 9 | The one exception is an optional folder called "targets_modified" that contains any changes made to plugins by the online system. 10 | This folder can also be used to make local edits to scripts and other configuration that will automatically be picked up by the online system. 11 | This folder is only supported by the Docker versions of OpenC3 and will not function in the Kubernetes versions. 12 | 13 | Folder Structure 14 | * plugins 15 | * DEFAULT 16 | * PluginName1 17 | * plugin_name.gem 18 | * plugin_instance.json 19 | * PluginName2 20 | * plugin_name.gem 21 | * plugin_instance.json 22 | * PluginName3 23 | * targets_modified 24 | * targetname 25 | * procedures 26 | * screens 27 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # Plugins Configuration Folder 2 | 3 | Warning: This folder is read/write with the OpenC3 system and is meant to be kept configuration controlled 4 | 5 | First level folders are scope names, and should be all caps. For COSMOS Core, there is only 1 first level folder / scope: DEFAULT. 6 | 7 | Inside of each scope folder, are folders that can be arbitrarily named with one folder for each instance of an installed plugin. 8 | 9 | The one exception is an optional folder called "targets_modified" that contains any changes made to plugins by the online system. 10 | This folder can also be used to make local edits to scripts and other configuration that will automatically be picked up by the online system. 11 | This folder is only supported by the Docker versions of OpenC3 and will not function in the Kubernetes versions. 12 | 13 | Folder Structure 14 | 15 | - plugins 16 | - DEFAULT 17 | - PluginName1 18 | - plugin_name.gem 19 | - plugin_instance.json 20 | - PluginName2 21 | - plugin_name.gem 22 | - plugin_instance.json 23 | - PluginName3 24 | - targets_modified 25 | - targetname 26 | - procedures 27 | - screens 28 | -------------------------------------------------------------------------------- /scripts/linux/openc3_util.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if ! command -v docker &> /dev/null 6 | then 7 | if command -v podman &> /dev/null 8 | then 9 | function docker() { 10 | podman $@ 11 | } 12 | else 13 | echo "Neither docker nor podman found!!!" 14 | exit 1 15 | fi 16 | fi 17 | 18 | usage() { 19 | echo "Usage: $1 [encode, hash, save, load, tag, push, clean, hostsetup]" >&2 20 | echo "* encode: encode a string to base64" >&2 21 | echo "* hash: hash a string using SHA-256" >&2 22 | echo "* save: save images to a tar file" >&2 23 | echo "* load: load images from a tar file" >&2 24 | echo "* tag: tag images" >&2 25 | echo "* push: push images" >&2 26 | echo "* clean: remove node_modules, coverage, etc" >&2 27 | echo "* hostsetup: configure host for redis" >&2 28 | echo "* hostenter: sh into vm host" >&2 29 | exit 1 30 | } 31 | 32 | saveTar() { 33 | if [ "$#" -lt 3 ]; then 34 | echo "Usage: save " >&2 35 | echo "e.g. save docker.io openc3inc 5.1.0" >&2 36 | fi 37 | repo=$1 38 | namespace=$2 39 | tag=$3 40 | suffix="" 41 | if [[ -n "$4" ]]; then 42 | suffix=$4 43 | fi 44 | mkdir -p tmp 45 | 46 | set -x 47 | docker pull $repo/$namespace/openc3-ruby$suffix:$tag 48 | docker pull $repo/$namespace/openc3-node$suffix:$tag 49 | docker pull $repo/$namespace/openc3-base$suffix:$tag 50 | docker pull $repo/$namespace/openc3-operator$suffix:$tag 51 | docker pull $repo/$namespace/openc3-cosmos-cmd-tlm-api$suffix:$tag 52 | docker pull $repo/$namespace/openc3-cosmos-script-runner-api$suffix:$tag 53 | docker pull $repo/$namespace/openc3-traefik$suffix:$tag 54 | docker pull $repo/$namespace/openc3-redis$suffix:$tag 55 | docker pull $repo/$namespace/openc3-minio$suffix:$tag 56 | docker pull $repo/$namespace/openc3-cosmos-init$suffix:$tag 57 | 58 | docker save $repo/$namespace/openc3-ruby$suffix:$tag -o tmp/openc3-ruby$suffix-$tag.tar 59 | docker save $repo/$namespace/openc3-node$suffix:$tag -o tmp/openc3-node$suffix-$tag.tar 60 | docker save $repo/$namespace/openc3-base$suffix:$tag -o tmp/openc3-base$suffix-$tag.tar 61 | docker save $repo/$namespace/openc3-operator$suffix:$tag -o tmp/openc3-operator$suffix-$tag.tar 62 | docker save $repo/$namespace/openc3-cosmos-cmd-tlm-api$suffix:$tag -o tmp/openc3-cosmos-cmd-tlm-api$suffix-$tag.tar 63 | docker save $repo/$namespace/openc3-cosmos-script-runner-api$suffix:$tag -o tmp/openc3-cosmos-script-runner-api$suffix-$tag.tar 64 | docker save $repo/$namespace/openc3-traefik$suffix:$tag -o tmp/openc3-traefik$suffix-$tag.tar 65 | docker save $repo/$namespace/openc3-redis$suffix:$tag -o tmp/openc3-redis$suffix-$tag.tar 66 | docker save $repo/$namespace/openc3-minio$suffix:$tag -o tmp/openc3-minio$suffix-$tag.tar 67 | docker save $repo/$namespace/openc3-cosmos-init$suffix:$tag -o tmp/openc3-cosmos-init$suffix-$tag.tar 68 | set +x 69 | } 70 | 71 | loadTar() { 72 | if [ -z "$1" ]; then 73 | tag="latest" 74 | else 75 | tag=$1 76 | fi 77 | suffix="" 78 | if [[ -n "$2" ]]; then 79 | suffix=$2 80 | fi 81 | set -x 82 | docker load -i tmp/openc3-ruby$suffix-$tag.tar 83 | docker load -i tmp/openc3-node$suffix-$tag.tar 84 | docker load -i tmp/openc3-base$suffix-$tag.tar 85 | docker load -i tmp/openc3-operator$suffix-$tag.tar 86 | docker load -i tmp/openc3-cosmos-cmd-tlm-api$suffix-$tag.tar 87 | docker load -i tmp/openc3-cosmos-script-runner-api$suffix-$tag.tar 88 | docker load -i tmp/openc3-traefik$suffix-$tag.tar 89 | docker load -i tmp/openc3-redis$suffix-$tag.tar 90 | docker load -i tmp/openc3-minio$suffix-$tag.tar 91 | docker load -i tmp/openc3-cosmos-init$suffix-$tag.tar 92 | set +x 93 | } 94 | 95 | tag() { 96 | if [ "$#" -lt 4 ]; then 97 | echo "Usage: tag " >&2 98 | echo "e.g. tag docker.io localhost:12345 openc3 latest" >&2 99 | echo "Note: NAMESPACE2 and TAG2 default to NAMESPACE1 and TAG1 if not given" >&2 100 | exit 1 101 | fi 102 | 103 | repo1=$1 104 | repo2=$2 105 | namespace1=$3 106 | tag1=$4 107 | namespace2=$namespace1 108 | if [[ -n "$5" ]]; then 109 | namespace2=$5 110 | fi 111 | tag2=$tag1 112 | if [[ -n "$6" ]]; then 113 | tag2=$6 114 | fi 115 | suffix="" 116 | if [[ -n "$7" ]]; then 117 | suffix=$7 118 | fi 119 | 120 | set -x 121 | docker tag $repo1/$namespace1/openc3-ruby$suffix:$tag1 $repo2/$namespace2/openc3-ruby$suffix:$tag2 122 | docker tag $repo1/$namespace1/openc3-node$suffix:$tag1 $repo2/$namespace2/openc3-node$suffix:$tag2 123 | docker tag $repo1/$namespace1/openc3-base$suffix:$tag1 $repo2/$namespace2/openc3-base$suffix:$tag2 124 | docker tag $repo1/$namespace1/openc3-operator$suffix:$tag1 $repo2/$namespace2/openc3-operator$suffix:$tag2 125 | docker tag $repo1/$namespace1/openc3-cosmos-cmd-tlm-api$suffix:$tag1 $repo2/$namespace2/openc3-cosmos-cmd-tlm-api$suffix:$tag2 126 | docker tag $repo1/$namespace1/openc3-cosmos-script-runner-api$suffix:$tag1 $repo2/$namespace2/openc3-cosmos-script-runner-api$suffix:$tag2 127 | docker tag $repo1/$namespace1/openc3-traefik$suffix:$tag1 $repo2/$namespace2/openc3-traefik$suffix:$tag2 128 | docker tag $repo1/$namespace1/openc3-redis$suffix:$tag1 $repo2/$namespace2/openc3-redis$suffix:$tag2 129 | docker tag $repo1/$namespace1/openc3-minio$suffix:$tag1 $repo2/$namespace2/openc3-minio$suffix:$tag2 130 | docker tag $repo1/$namespace1/openc3-cosmos-init$suffix:$tag1 $repo2/$namespace2/openc3-cosmos-init$suffix:$tag2 131 | set +x 132 | } 133 | 134 | push() { 135 | if [ "$#" -lt 3 ]; then 136 | echo "Usage: push " >&2 137 | echo "e.g. push localhost:12345 openc3 latest" >&2 138 | exit 1 139 | fi 140 | repo=$1 141 | namespace=$2 142 | tag=$3 143 | suffix="" 144 | if [[ -n "$4" ]]; then 145 | suffix=$4 146 | fi 147 | 148 | set -x 149 | docker push $repo/$namespace/openc3-ruby$suffix:$tag 150 | docker push $repo/$namespace/openc3-node$suffix:$tag 151 | docker push $repo/$namespace/openc3-base$suffix:$tag 152 | docker push $repo/$namespace/openc3-operator$suffix:$tag 153 | docker push $repo/$namespace/openc3-cosmos-cmd-tlm-api$suffix:$tag 154 | docker push $repo/$namespace/openc3-cosmos-script-runner-api$suffix:$tag 155 | docker push $repo/$namespace/openc3-traefik$suffix:$tag 156 | docker push $repo/$namespace/openc3-redis$suffix:$tag 157 | docker push $repo/$namespace/openc3-minio$suffix:$tag 158 | docker push $repo/$namespace/openc3-cosmos-init$suffix:$tag 159 | set +x 160 | } 161 | 162 | cleanFiles() { 163 | find . -type d -name "node_modules" | xargs -I {} echo "Removing {}"; rm -rf {} 164 | find . -type d -name "coverage" | xargs -I {} echo "Removing {}"; rm -rf {} 165 | # Prompt for removing yarn.lock files 166 | find . -type f -name "yarn.lock" | xargs -I {} rm -i {} 167 | # Prompt for removing Gemfile.lock files 168 | find . -type f -name "Gemfile.lock" | xargs -I {} rm -i {} 169 | } 170 | 171 | if [ "$#" -eq 0 ]; then 172 | usage $0 173 | fi 174 | 175 | case $1 in 176 | encode ) 177 | echo -n $2 | base64 178 | ;; 179 | hash ) 180 | echo -n $2 | shasum -a 256 | sed 's/-//' 181 | ;; 182 | save ) 183 | saveTar "${@:2}" 184 | ;; 185 | load ) 186 | loadTar "${@:2}" 187 | ;; 188 | tag ) 189 | tag "${@:2}" 190 | ;; 191 | push ) 192 | push "${@:2}" 193 | ;; 194 | clean ) 195 | cleanFiles 196 | ;; 197 | hostsetup ) 198 | if [ "$#" -ne 4 ]; then 199 | echo "Usage: hostsetup " >&2 200 | echo "e.g. hostsetup docker.io openc3inc latest" >&2 201 | exit 1 202 | fi 203 | repo=$2 204 | namespace=$3 205 | tag=$4 206 | docker run --rm --privileged --pid=host --entrypoint='' --user root $repo/$namespace/openc3-operator:$tag nsenter -t 1 -m -u -n -i -- sh -c "echo never > /sys/kernel/mm/transparent_hugepage/enabled" 207 | docker run --rm --privileged --pid=host --entrypoint='' --user root $repo/$namespace/openc3-operator:$tag nsenter -t 1 -m -u -n -i -- sh -c "echo never > /sys/kernel/mm/transparent_hugepage/defrag" 208 | docker run --rm --privileged --pid=host --entrypoint='' --user root $repo/$namespace/openc3-operator:$tag nsenter -t 1 -m -u -n -i -- sh -c "sysctl -w vm.max_map_count=262144" 209 | ;; 210 | hostenter ) 211 | docker run -it --rm --privileged --pid=host ${OPENC3_DEPENDENCY_REGISTRY}/alpine:${ALPINE_VERSION}.${ALPINE_BUILD} nsenter -t 1 -m -u -n -i sh 212 | ;; 213 | * ) 214 | usage $0 215 | ;; 216 | esac 217 | -------------------------------------------------------------------------------- /scripts/linux/sync_openc3.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | echo "Usage: scripts/linux/sync_openc3.sh" 6 | 7 | cp ../cosmos/compose.yaml . 8 | cp ../cosmos/LICENSE.txt . 9 | cp ../cosmos/cacert.pem . 10 | cp ../cosmos/openc3-redis/users.acl openc3-redis/. 11 | cp ../cosmos/openc3-traefik/traefik-allow-http.yaml openc3-traefik/. 12 | cp ../cosmos/openc3-traefik/traefik-letsencrypt.yaml openc3-traefik/. 13 | cp ../cosmos/openc3-traefik/traefik-ssl.yaml openc3-traefik/. 14 | cp ../cosmos/openc3-traefik/traefik.yaml openc3-traefik/. 15 | cp ../cosmos/plugins/README.md plugins/. 16 | cp ../cosmos/plugins/DEFAULT/README.md plugins/DEFAULT/. 17 | cp ../cosmos/scripts/linux/openc3_util.sh scripts/linux/. 18 | cp ../cosmos/scripts/windows/openc3_util.bat scripts/windows/. 19 | cp ../cosmos/.env . 20 | 21 | echo "Must manually sync applicable parts of openc3.sh and openc3.bat" -------------------------------------------------------------------------------- /scripts/windows/openc3_util.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if "%1" == "" ( 4 | GOTO usage 5 | ) 6 | if "%1" == "encode" ( 7 | GOTO encode 8 | ) 9 | if "%1" == "hash" ( 10 | GOTO hash 11 | ) 12 | if "%1" == "save" ( 13 | GOTO save 14 | ) 15 | if "%1" == "load" ( 16 | GOTO load 17 | ) 18 | if "%1" == "tag" ( 19 | GOTO tag 20 | ) 21 | if "%1" == "push" ( 22 | GOTO push 23 | ) 24 | if "%1" == "zip" ( 25 | GOTO zip 26 | ) 27 | if "%1" == "clean" ( 28 | GOTO clean 29 | ) 30 | if "%1" == "hostsetup" ( 31 | GOTO hostsetup 32 | ) 33 | if "%1" == "hostenter" ( 34 | GOTO hostenter 35 | ) 36 | 37 | GOTO usage 38 | 39 | :encode 40 | powershell -c "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("""%2"""))" 41 | GOTO :EOF 42 | 43 | :hash 44 | powershell -c "new-object System.Security.Cryptography.SHA256Managed | ForEach-Object {$_.ComputeHash([System.Text.Encoding]::UTF8.GetBytes("""%2"""))} | ForEach-Object {$_.ToString("""x2""")} | Write-Host -NoNewline" 45 | GOTO :EOF 46 | 47 | :save 48 | if "%5" == "" ( 49 | set repo=%~2 50 | set namespace=%~3 51 | set tag=%~4 52 | if not exist tmp md tmp 53 | 54 | echo on 55 | docker pull !repo!/!namespace!/openc3-operator:!tag! || exit /b 56 | docker pull !repo!/!namespace!/openc3-cosmos-cmd-tlm-api:!tag! || exit /b 57 | docker pull !repo!/!namespace!/openc3-cosmos-script-runner-api:!tag! || exit /b 58 | docker pull !repo!/!namespace!/openc3-traefik:!tag! || exit /b 59 | docker pull !repo!/!namespace!/openc3-redis:!tag! || exit /b 60 | docker pull !repo!/!namespace!/openc3-minio:!tag! || exit /b 61 | docker pull !repo!/!namespace!/openc3-cosmos-init:!tag! || exit /b 62 | 63 | docker save !repo!/!namespace!/openc3-operator:!tag! -o tmp/openc3-operator-!tag!.tar || exit /b 64 | docker save !repo!/!namespace!/openc3-cosmos-cmd-tlm-api:!tag! -o tmp/openc3-cosmos-cmd-tlm-api-!tag!.tar || exit /b 65 | docker save !repo!/!namespace!/openc3-cosmos-script-runner-api:!tag! -o tmp/openc3-cosmos-script-runner-api-!tag!.tar || exit /b 66 | docker save !repo!/!namespace!/openc3-traefik:!tag! -o tmp/openc3-traefik-!tag!.tar || exit /b 67 | docker save !repo!/!namespace!/openc3-redis:!tag! -o tmp/openc3-redis-!tag!.tar || exit /b 68 | docker save !repo!/!namespace!/openc3-minio:!tag! -o tmp/openc3-minio-!tag!.tar || exit /b 69 | docker save !repo!/!namespace!/openc3-cosmos-init:!tag! -o tmp/openc3-cosmos-init-!tag!.tar || exit /b 70 | echo off 71 | ) else ( 72 | @echo "Usage: save " 1>&2 73 | @echo "e.g. save docker.io openc3inc 5.1.0" 1>&2 74 | ) 75 | GOTO :EOF 76 | 77 | :load 78 | if "%2" == "" ( 79 | set tag=latest 80 | ) else ( 81 | set tag=%~2 82 | ) 83 | echo on 84 | docker load -i tmp/openc3-operator-!tag!.tar || exit /b 85 | docker load -i tmp/openc3-cosmos-cmd-tlm-api-!tag!.tar || exit /b 86 | docker load -i tmp/openc3-cosmos-script-runner-api-!tag!.tar || exit /b 87 | docker load -i tmp/openc3-traefik-!tag!.tar || exit /b 88 | docker load -i tmp/openc3-redis-!tag!.tar || exit /b 89 | docker load -i tmp/openc3-minio-!tag!.tar || exit /b 90 | docker load -i tmp/openc3-cosmos-init-!tag!.tar || exit /b 91 | echo off 92 | GOTO :EOF 93 | 94 | :tag 95 | if "%5" == "" ( 96 | @echo "Usage: tag " 1>&2 97 | @echo "e.g. tag docker.io localhost:12345 openc3 latest" 1>&2 98 | @echo "Note: NAMESPACE2 and TAG2 default to NAMESPACE1 and TAG1 if not given" 1>&2 99 | GOTO :EOF 100 | ) 101 | 102 | set repo1=%~2 103 | set repo2=%~3 104 | set namespace1=%~4 105 | set tag1=%~5 106 | if "%6" == "" ( 107 | set namespace2=!namespace1! 108 | ) else ( 109 | set namespace2=%~6 110 | ) 111 | if "%7" == "" ( 112 | set tag2=!tag1! 113 | ) else ( 114 | set tag2=%~7 115 | ) 116 | 117 | echo on 118 | docker tag !repo1!/!namespace1!/openc3-operator:!tag1! !repo2!/!namespace2!/openc3-operator:!tag2! 119 | docker tag !repo1!/!namespace1!/openc3-cosmos-cmd-tlm-api:!tag1! !repo2!/!namespace2!/openc3-cosmos-cmd-tlm-api:!tag2! 120 | docker tag !repo1!/!namespace1!/openc3-cosmos-script-runner-api:!tag1! !repo2!/!namespace2!/openc3-cosmos-script-runner-api:!tag2! 121 | docker tag !repo1!/!namespace1!/openc3-traefik:!tag1! !repo2!/!namespace2!/openc3-traefik:!tag2! 122 | docker tag !repo1!/!namespace1!/openc3-redis:!tag1! !repo2!/!namespace2!/openc3-redis:!tag2! 123 | docker tag !repo1!/!namespace1!/openc3-minio:!tag1! !repo2!/!namespace2!/openc3-minio:!tag2! 124 | docker tag !repo1!/!namespace1!/openc3-cosmos-init:!tag1! !repo2!/!namespace2!/openc3-cosmos-init:!tag2! 125 | echo off 126 | GOTO :EOF 127 | 128 | :push 129 | if "%5" == "" ( 130 | set repo=%~2 131 | set namespace=%~3 132 | set tag=%~4 133 | if not exist tmp md tmp 134 | 135 | echo on 136 | docker push !repo!/!namespace!/openc3-operator:!tag! 137 | docker push !repo!/!namespace!/openc3-cosmos-cmd-tlm-api:!tag! 138 | docker push !repo!/!namespace!/openc3-cosmos-script-runner-api:!tag! 139 | docker push !repo!/!namespace!/openc3-traefik:!tag! 140 | docker push !repo!/!namespace!/openc3-redis:!tag! 141 | docker push !repo!/!namespace!/openc3-minio:!tag! 142 | docker push !repo!/!namespace!/openc3-cosmos-init:!tag! 143 | echo off 144 | ) else ( 145 | @echo "Usage: push " 1>&2 146 | @echo "e.g. push localhost:12345 openc3 latest" 1>&2 147 | ) 148 | GOTO :EOF 149 | 150 | :zip 151 | zip -r openc3.zip *.* -x "*.git*" -x "*coverage*" -x "*tmp/cache*" -x "*node_modules*" -x "*yarn.lock" 152 | GOTO :EOF 153 | 154 | :clean 155 | for /d /r %%i in (*node_modules*) do ( 156 | echo Removing "%%i" 157 | @rmdir /s /q "%%i" 158 | ) 159 | for /d /r %%i in (*coverage*) do ( 160 | echo Removing "%%i" 161 | @rmdir /s /q "%%i" 162 | ) 163 | REM Prompt for removing yarn.lock files 164 | forfiles /S /M yarn.lock /C "cmd /c del /P @path" 165 | REM Prompt for removing Gemfile.lock files 166 | forfiles /S /M Gemfile.lock /C "cmd /c del /P @path" 167 | GOTO :EOF 168 | 169 | :hostsetup 170 | if "%5" == "" ( 171 | set repo=%~2 172 | set namespace=%~3 173 | set tag=%~4 174 | 175 | echo on 176 | docker run --rm --privileged --pid=host --entrypoint='' --user root !repo!/!namespace!/openc3-operator:!tag! nsenter -t 1 -m -u -n -i -- sh -c "echo never > /sys/kernel/mm/transparent_hugepage/enabled" || exit /b 177 | docker run --rm --privileged --pid=host --entrypoint='' --user root !repo!/!namespace!/openc3-operator:!tag! nsenter -t 1 -m -u -n -i -- sh -c "echo never > /sys/kernel/mm/transparent_hugepage/defrag" || exit /b 178 | docker run --rm --privileged --pid=host --entrypoint='' --user root !repo!/!namespace!/openc3-operator:!tag! nsenter -t 1 -m -u -n -i -- sh -c "sysctl -w vm.max_map_count=262144" || exit /b 179 | echo off 180 | ) else ( 181 | @echo "Usage: hostsetup " 1>&2 182 | @echo "e.g. hostsetup docker.io openc3inc latest" 1>&2 183 | ) 184 | GOTO :EOF 185 | 186 | :hostenter 187 | docker run -it --rm --privileged --pid=host !OPENC3_DEPENDENCY_REGISTRY!/alpine:!ALPINE_VERSION!.!ALPINE_BUILD! nsenter -t 1 -m -u -n -i sh 188 | GOTO :EOF 189 | 190 | :usage 191 | @echo Usage: %1 [encode, hash, save, load, tag, push, zip, clean, hostsetup] 1>&2 192 | @echo * encode: encode a string to base64 1>&2 193 | @echo * hash: hash a string using SHA-256 1>&2 194 | @echo * save: save openc3 to tar files 1>&2 195 | @echo * load: load openc3 tar files 1>&2 196 | @echo * tag: tag images 1>&2 197 | @echo * push: push images 1>&2 198 | @echo * zip: create openc3 zipfile 1>&2 199 | @echo * clean: remove node_modules, coverage, etc 1>&2 200 | @echo * hostsetup: configure host for redis 1>&2 201 | @echo * hostenter: sh into vm host 1>&2 202 | 203 | @echo on 204 | --------------------------------------------------------------------------------