Compare commits

..
547 Commits
Author SHA1 Message Date
beckerinj b1e2328d54 allow stats view when server is not ok or disabled 2022-09-27 19:38:32 -04:00
beckerinj abfa6dbf65 change container start to stop on restarting loop 2022-09-25 03:22:10 -04:00
beckerinj 3668b6b765 show deployment options when restarting 2022-09-24 22:19:40 -04:00
beckerinj 22a641c07e fix selecting build for deployment when search for build 2022-09-22 14:15:32 -04:00
beckerinj 87548b577f server shows disabled on home 2022-08-25 10:55:22 -04:00
beckerinj de008d7829 unneeded import 2022-08-19 17:37:33 -04:00
beckerinj c5c9171fda remove unneeded import 2022-08-19 00:17:42 -04:00
beckerinj 53447fc605 add enter animation for updates 2022-08-18 14:14:06 -04:00
beckerinj 97f933ee32 improve daily updates with emojis pointing to warning location 2022-08-17 10:12:28 -04:00
beckerinj ada8169c2e replace solid-apexcharts with easy made one 2022-08-16 14:52:41 -04:00
beckerinj ec4c83b2dd add build-development 2022-08-15 00:43:22 -04:00
beckerinj c00d404d30 remove console log 2022-08-15 00:37:32 -04:00
beckerinj 0920499358 tabs gap evened out 2022-08-14 23:59:01 -04:00
beckerinj a197307101 add filter to servers 2022-08-14 23:33:23 -04:00
beckerinj 2b571bfd0f change default loading size 2022-08-14 03:07:26 -04:00
beckerinj de59295f5a cant do this skip thing bc stats not collected at even time frames 2022-08-14 02:31:24 -04:00
beckerinj 71f33e4f33 fix loggin message at startup 2022-08-13 15:19:19 -04:00
beckerinj 94486f1e14 lazy load graph jsx 2022-08-13 14:54:09 -04:00
beckerinj 244436251d make dev easier with frontend env vars 2022-08-13 14:43:14 -04:00
beckerinj 13745ea6e7 daily update utc hour from env (default 10am est) 2022-08-13 03:57:03 -04:00
beckerinj 44d1420fd6 wait until 11 and wait for even 5 minute to start stat check 2022-08-13 02:57:28 -04:00
beckerinj 9936084a0e add return to front 2022-08-12 15:24:41 -04:00
beckerinj a676797358 move left and right on stat graphs 2022-08-11 23:41:05 -04:00
beckerinj 5691715647 stat graphs working 2022-08-11 11:49:14 -04:00
beckerinj 3a78de0b57 fix stats not having custom model. start making graph 2022-08-10 23:06:51 -04:00
beckerinj eed36b22de create setup for stat graph center menu 2022-08-09 23:53:12 -04:00
beckerinj 908bf583b8 fix to remove server 2022-08-09 12:15:31 -04:00
beckerinj eb4add5199 click on build in deployment actions navigates to build 2022-08-09 01:51:10 -04:00
beckerinj 7b1c01f402 add prune containers functionality 2022-08-09 01:46:05 -04:00
beckerinj d1b1fa40e6 filter server stats by id 2022-08-09 01:20:10 -04:00
beckerinj 54800a7d2e fix search 2022-08-09 00:52:42 -04:00
beckerinj 00fe14bae0 collect stats, frontend query 2022-08-07 23:06:51 -04:00
beckerinj a667c8cc3a replace with slackNotifier2 + statCollection 2022-08-07 22:59:13 -04:00
beckerinj 49729e8ea9 back to localhost 2022-08-07 22:13:28 -04:00
beckerinj c7f3e376e6 responsive frontend 2022-08-07 15:57:42 -04:00
beckerinj 8522ef7edb try this 2022-08-07 15:20:08 -04:00
beckerinj 6fa851b6f8 nav home with shift + h 2022-08-07 04:26:20 -04:00
beckerinj 25b6468ac5 only load stats if server is OK 2022-08-06 14:47:35 -04:00
beckerinj f8c85e733f get build updates on relevant deployment over ws 2022-08-06 14:28:15 -04:00
beckerinj b5b3d79e53 pull buildID on getDeployments 2022-08-06 14:15:54 -04:00
beckerinj d2cb8b0627 cache stats correctly 2022-08-06 13:34:42 -04:00
beckerinj 44ecda3c67 cleanup 2022-08-06 11:14:40 -04:00
beckerinj 05fa885753 fix to showing build on deployment page 2022-08-06 11:09:59 -04:00
beckerinj ba95b8267b unneccesary import 2022-08-06 02:53:15 -04:00
beckerinj 55ada6fccc should build updates on attached deployment / build action from deployment page 2022-08-06 02:51:52 -04:00
beckerinj f4590fee93 remake update card for home 2022-08-06 02:17:29 -04:00
beckerinj 3ce02ef01a clean 2022-08-06 01:49:16 -04:00
beckerinj d7b5966f8b back to localhost 2022-08-06 01:49:02 -04:00
beckerinj 52543644ea stats tofixed 2022-08-06 01:48:11 -04:00
beckerinj dc70562675 increase server name font size and remove opacity 2022-08-06 01:43:58 -04:00
beckerinj 0299645ba3 new monitor home screen 2022-08-06 01:35:19 -04:00
beckerinj 150aeae285 add monitor_mount to ignore 2022-08-06 00:11:41 -04:00
beckerinj d25f3dfde7 ignore secrets dir 2022-08-06 00:10:09 -04:00
beckerinj 28505343c9 remove stats interval 2022-08-01 00:50:24 -04:00
beckerinj a8e933d4d0 start record server stats 2022-07-31 23:42:15 -04:00
beckerinj dc647b88ad account for "unknown" state 2022-07-31 18:36:26 -04:00
beckerinj 5e67a0346a fix container stats scrolling 2022-07-29 11:46:18 -04:00
beckerinj d4ad4fe5ff summary doesnt show zeros and docker stats scrolling 2022-07-29 01:00:52 -04:00
beckerinj 2e16d58f5d fix slack not notifying when toNotify is empty 2022-07-29 00:19:24 -04:00
beckerinj 7314cab3ea add colors to summary 2022-07-26 23:44:45 -04:00
beckerinj 4aa04c774b rename repo actions to frontend 2022-07-26 16:44:53 -04:00
beckerinj d24b661983 auth the websocket messages 2022-07-26 00:01:56 -04:00
beckerinj 904ce56610 periphery prune networks should work 2022-07-25 23:13:52 -04:00
beckerinj c876eb63bb add basic summary for home 2022-07-25 00:13:54 -04:00
beckerinj d881b50154 Merge branch 'main' of https://github.com/mbecker20/monitor 2022-07-19 23:28:52 -04:00
beckerinj 91434914fd fix parseDotEnvToEnvVars when value includes = sign 2022-07-19 23:28:50 -04:00
beckerinj 5ec0e06308 toNotify could be undefined 2022-07-15 13:19:46 -04:00
beckerinj f287836f0b fix slack notify failing bc toNotify undefined 2022-07-12 20:38:10 -04:00
beckerinj 6c59e0b60b add host env var 2022-07-11 23:26:54 -04:00
beckerinj ed46c17422 add delete deployment rest api 2022-07-11 11:44:11 -04:00
beckerinj df303288c2 unneeded deployment busy check 2022-07-11 11:06:38 -04:00
beckerinj 60351b6111 create doesnt auto nav to that new deployment 2022-07-11 10:33:25 -04:00
beckerinj ccc60bdb1b add create buttons 2022-07-10 23:25:02 -04:00
beckerinj dc9e79307a home2 passable. remove sidebar 2022-07-10 23:14:46 -04:00
beckerinj 11f03fbebf create user observable to filter published message by authorization 2022-07-09 03:08:37 -04:00
beckerinj 3cfcc65398 broadcast create deployment 2022-07-09 02:57:02 -04:00
beckerinj 60cf2efdec rename repo mount to frontend 2022-07-09 02:42:34 -04:00
beckerinj 5e14ed5d31 fix to multi search 2022-07-09 02:34:21 -04:00
beckerinj 275753b793 topbar doesn't say monitor 2022-07-09 01:50:24 -04:00
beckerinj e3d3b79e9b fix when toNotify is not defined 2022-07-08 16:44:40 -04:00
beckerinj b14053725b topbar search splits query by space 2022-07-08 09:49:34 -04:00
beckerinj a40e368533 emojis in slack alerts and unreachable alerting 2022-07-06 00:06:40 -04:00
beckerinj b5e65cbb32 24 hr default clear notify limit 2022-07-05 17:35:21 -04:00
beckerinj 9cf422c0b8 added rest routes to create / deploy deployment 2022-07-04 17:19:15 -04:00
beckerinj 1ac3fce257 Merge branch 'main' of https://github.com/mbecker20/monitor 2022-06-30 16:48:02 -04:00
beckerinj c14fcf617d only use helmet if host is https 2022-06-30 16:48:00 -04:00
beckerinj 9373c7eaa1 seperate clear already alerted interval (hours) 2022-06-13 19:59:31 +03:00
beckerinj f80a54497e trim down daily interval 2022-06-10 19:24:43 +03:00
beckerinj 4f3ac512f4 clean up messages 2022-06-10 19:18:57 +03:00
beckerinj a815ddc2ae fix slack notifier formatting? 2022-06-10 19:05:39 +03:00
beckerinj d05703cf04 change all types to plain_text 2022-06-10 18:43:24 +03:00
beckerinj d14ae83cfa try adding blocks under attachments 2022-06-10 18:30:43 +03:00
beckerinj 7ca0f02883 change emphasis 2022-06-10 16:52:34 +03:00
beckerinj 306db2ee1e advanced slack messages 2022-06-10 16:28:03 +03:00
beckerinj 9c37cff49f try catch jwt verify 2022-06-04 21:10:59 +03:00
beckerinj 8137b175c4 info when log actually refreshes 2022-06-03 11:40:55 +03:00
beckerinj b33181edbe fix local url 2022-05-31 23:12:39 +03:00
beckerinj 9443cffe77 log / env var style 2022-05-31 23:12:06 +03:00
beckerinj 406be5128b configure environment 2022-05-31 22:54:03 +03:00
beckerinj 9a734f1381 parse dotenv frontend 2022-05-31 20:06:09 +03:00
beckerinj 4ca689df7e : 2022-05-31 17:39:26 +03:00
beckerinj 499e3b835b dotenv 2022-05-31 17:39:14 +03:00
beckerinj c0d84ed92b parse dot env vars 2022-05-31 17:20:19 +03:00
beckerinj bbd51dac00 clean 2022-05-30 21:36:11 +03:00
beckerinj b1def791ca add pm2 flush support 2022-05-30 13:35:33 +03:00
beckerinj 72faf36719 Merge branch 'main' of https://github.com/mbecker20/monitor 2022-05-29 21:35:26 +03:00
beckerinj e838e139d1 add name to log 2022-05-29 21:35:20 +03:00
mbecker20 7bffef3d00 update next cli version 2022-05-29 21:14:42 +03:00
beckerinj 0866f1c011 support variable number of lines pm2 log 2022-05-29 21:03:15 +03:00
beckerinj 5db44a69a4 github listener auth and branch filtering 2022-05-29 13:54:29 +03:00
beckerinj 12dcbbc956 navigate home on mobile 2022-05-27 20:38:18 +03:00
beckerinj fc8cdd5c58 rename "deployments" to "servers" in sidebar 2022-05-27 20:25:50 +03:00
beckerinj 8493fed2dc daily interval tells when server unreachable 2022-05-27 18:27:57 +03:00
beckerinj a367bcbe95 add post image config 2022-05-27 12:45:05 +03:00
beckerinj 4df5e0b4cd don't need this env 2022-05-27 00:07:28 +03:00
beckerinjandGitHub 214a44eb19 Merge pull request #3 from mbecker20/pm2-frontend
Pm2 frontend
2022-05-26 20:40:21 +03:00
beckerinj 22e2b4785d log looking ok 2022-05-26 20:39:53 +03:00
beckerinj aeb5dd8f9a remove pm2 mount 2022-05-26 19:51:16 +03:00
beckerinj 598ecefc11 add host communication to periphery deploy 2022-05-26 19:51:01 +03:00
beckerinj f164f276ee change host 2022-05-26 19:22:31 +03:00
beckerinj f5190389bb look for pm2 client at 0.0.0.0 2022-05-26 19:13:48 +03:00
beckerinj 3e2d271be2 503 error if can not reach pm2 client 2022-05-26 19:08:35 +03:00
beckerinj 6d3f56a906 fix Log type import 2022-05-26 18:36:36 +03:00
beckerinj 57e6288e05 fix to scss location 2022-05-26 18:35:31 +03:00
beckerinj 63bb0bbd16 remove pm2 from util-node 2022-05-26 18:31:54 +03:00
beckerinj 2df5005ec0 basic frontend 2022-05-26 18:27:51 +03:00
beckerinj d54d1950d9 pm2 updates 2022-05-26 13:42:27 +03:00
beckerinj 0631de0585 pm2 deployment type 2022-05-26 11:37:12 +03:00
beckerinj c2c3e3affd get pm2 commands routed through pipeline 2022-05-26 11:01:35 +03:00
beckerinj 0fe7553f85 remove pm2 locally from periphery (in favor of monitor-pm2 extension 2022-05-25 16:53:55 +03:00
beckerinj 895aeee057 slack username is actually slack user id 2022-05-20 15:56:21 -04:00
beckerinj 6e7a2d51ec fix to region not being updated, and fill out server changelog view fields 2022-05-20 15:52:09 -04:00
beckerinj 1aea53ed5a improve stats view 2022-05-20 13:41:50 -04:00
mbecker20 01afe72e07 add pm2 to core deps 2022-05-20 10:58:04 -04:00
mbecker20 ee5f2ff5c0 update cli version 2022-05-20 10:46:30 -04:00
beckerinj 005c3e6e2d fix to color resolve scss 2022-05-20 10:35:24 -04:00
beckerinj d6d55aaf13 fix to duplicate type / function name 2022-05-20 10:34:00 -04:00
beckerinj b7404cc5be frontend for pm2 processes 2022-05-19 17:25:12 -04:00
beckerinj d8196e81d6 periphery cli deploy mounts the pm2 directory 2022-05-19 17:18:13 -04:00
beckerinj 3827468848 get pm2 process query 2022-05-19 16:26:41 -04:00
beckerinj 7c81f6ad32 remove unneeded dep 2022-05-19 16:09:58 -04:00
beckerinj 55e826ef6f backend to retrieve pm2 processes from periphery 2022-05-19 15:56:52 -04:00
beckerinj 2b1d4149d1 improve slack notifier region readability 2022-05-18 12:51:53 -04:00
beckerinj f7212f5048 search server status smaller font size 2022-05-18 12:46:42 -04:00
beckerinj 861d1066a5 show region on home screen 2022-05-18 11:19:32 -04:00
beckerinj 8ddf1e39d5 remove "region: " its clear enough 2022-05-18 11:12:50 -04:00
beckerinj bb8f65ab57 utilize region in slack notifications 2022-05-18 11:02:43 -04:00
beckerinj cb88af1fad utilize region in views 2022-05-18 10:56:05 -04:00
beckerinj 412d49bd46 Info (region, instance ID) 2022-05-18 10:29:06 -04:00
beckerinj d0ab454e7b disallow non-admins from updating cli commands (security issue) 2022-05-17 17:08:00 -04:00
beckerinj f681e9f057 correct formatting for @ users 2022-05-17 12:54:41 -04:00
beckerinj a562cf825d to notify server 2022-05-17 12:22:54 -04:00
beckerinj 017d863aa2 only usage alert once 2022-05-17 10:55:58 -04:00
beckerinj 1bc68bbb5a only get deployments user has access to 2022-05-13 15:50:11 -04:00
beckerinj 693e5c307a limit access to builds 2022-05-13 15:11:36 -04:00
beckerinj 75a5c0da4f permissioned github / docker accounts 2022-05-13 15:05:44 -04:00
mbecker20 1fb7fce8ce more auth on recieving deployments 2022-05-13 13:51:37 -04:00
beckerinj 185dd5c17d optional custom passkey 2022-05-12 14:04:56 -04:00
mbecker20 a8b9297ae1 stats styling 2022-05-12 12:48:19 -04:00
mbecker20 c44751e82b better docker stats 2022-05-12 12:44:44 -04:00
mbecker20 bedf4fad70 docker stats json 2022-05-12 12:38:56 -04:00
beckerinj 43da0cc6db docker stats json 2022-05-12 12:07:40 -04:00
mbecker20 9b3c9115e1 alert config styling 2022-05-12 11:16:21 -04:00
beckerinj c8dedb8980 customize alert thresholds 2022-05-12 10:55:18 -04:00
beckerinj 98f254263e only show things relevant to user in sidebar 2022-05-11 15:00:49 -04:00
beckerinj 8c1119734a seperate daily servers with ----- 2022-05-11 11:51:34 -04:00
beckerinj 3e5ffb8902 daily interval fix 2022-05-11 11:33:18 -04:00
beckerinj 9cd8897a24 daily interval style 2022-05-11 11:32:23 -04:00
mbecker20 1bacc53e75 daily interval on startup 2022-05-11 11:08:16 -04:00
beckerinj dfd0c57781 daily interval 2022-05-11 11:04:32 -04:00
mbecker20 64a4d002e0 stats view 2022-05-10 14:06:44 -04:00
beckerinj 86c154fb3f fix 2022-05-10 13:50:20 -04:00
beckerinj bf8f4fccdb move slack token to secrets 2022-05-10 13:49:26 -04:00
mbecker20 e43b60143b sys stats frontend 2022-05-10 13:42:57 -04:00
beckerinj 5d2b10fdb9 notify slack on startup 2022-05-10 13:26:28 -04:00
beckerinj 7fe05d7c8a slack notifier 2022-05-10 13:24:27 -04:00
beckerinj 1acf4d989e add node os utils 2022-05-10 10:24:04 -04:00
beckerinj e9f917cc12 add route to retrieve system stats 2022-05-10 10:18:32 -04:00
mbecker20 81d0d2ad42 cli periphery / core deploy pulls latest image every time 2022-05-08 20:26:37 -04:00
mbecker20 4d089c1e60 server stats 2022-05-08 01:44:04 -04:00
mbecker20 44a1a9e324 fix potentially unintialized onClone commands 2022-05-03 14:50:55 -04:00
mbecker20 c2c70366cc no access to deployments / updates outside of users scope 2022-05-02 22:58:31 -04:00
mbecker20 6752a539aa fix add server menu (make tabs move with left css prop 2022-04-27 03:42:38 -04:00
mbecker20 9140035a6e show username in account menu when isMobile 2022-04-23 04:17:08 -07:00
mbecker20 d9cdf0358c fix mobile topbar button theme 2022-04-23 04:10:31 -07:00
mbecker20 6d230a3efd collapsable updates in mobile 2022-04-23 04:06:50 -07:00
mbecker20 b1a4481688 fix tabs centering and widen sidebar elements 2022-04-23 01:16:16 -07:00
mbecker20 0bc3238393 differentiate textred / textgreen when dark 2022-04-22 19:36:09 -07:00
mbecker20 f1ec284bea update scroller 2022-04-22 13:56:48 -07:00
mbecker20 b3b53a4950 load more 2022-04-22 13:43:47 -07:00
mbecker20 73e6c0bd8e fix? 2022-04-22 13:40:51 -07:00
mbecker20 63c687c4ef fix users page dark theme 2022-04-22 13:26:09 -07:00
mbecker20 dd1fecdce1 hover menu dark 2022-04-22 13:20:44 -07:00
mbecker20 51cd8d07c1 cli 0.0.27 2022-04-22 13:14:52 -07:00
mbecker20 16515591b2 cli 0.2.26 2022-04-22 13:07:55 -07:00
mbecker20 9e58e5f198 fix center menu and update themeClass 2022-04-22 12:55:02 -07:00
mbecker20 733fae804d bring up grey brightness 2022-04-22 02:48:43 -07:00
mbecker20 d2654eb496 shift light theme greys a bit away from blue 2022-04-22 02:44:01 -07:00
mbecker20 6122b1b570 invert color of icons with filter 2022-04-22 02:35:35 -07:00
mbecker20 c36d878535 implement light / dark theme toggle 2022-04-22 02:23:09 -07:00
mbecker20 ae5a7023cb state for dark / light theme 2022-04-21 01:03:43 -07:00
mbecker20 59e81c0bec add commented out light theme 2022-04-20 22:23:44 -07:00
mbecker20 53df4b204b fix periphery dependen 2022-04-20 03:25:23 -07:00
mbecker20 6086f0db05 fix clone 2022-04-20 03:16:36 -07:00
mbecker20 09b5245972 build actions 2022-04-20 03:14:17 -07:00
mbecker20 1d8ac0a0c2 deployment reclone 2022-04-20 03:12:07 -07:00
mbecker20 58049472cb search for deployments also considers server name 2022-04-20 02:26:03 -07:00
mbecker20 1fa5eb6eb4 pull isCore from deployments 2022-04-19 10:17:20 -07:00
mbecker20 26cae6422c dont show actions on monitor core 2022-04-18 23:04:48 -07:00
mbecker20 b884a38781 update cli to take advantage of storing isCore on deployment 2022-04-18 23:00:20 -07:00
mbecker20 7f01ad1a28 improve log height when log doesnt fill whole height 2022-04-18 22:27:18 -07:00
mbecker20 1de3c89a9c fix deployment config tabs 2022-04-18 22:16:39 -07:00
mbecker20 56cba378e5 fix build given util-node dependency 2022-04-18 18:38:20 -07:00
mbecker20 cfba96fbc0 nice tab animation 2022-04-18 18:31:34 -07:00
mbecker20 e7b3d08ce4 remove ugly effect in useSelected 2022-04-18 05:59:06 -07:00
mbecker20 3adf31612a Not found and some random changes 2022-04-18 04:05:52 -07:00
mbecker20 d135f43727 enable util to be used by frontend 2022-04-18 02:58:20 -07:00
mbecker20 7b68301008 switch stderr and stdout in updates 2022-04-18 01:30:23 -07:00
mbecker20 81e3f0df28 fix to mergeCommandLogError 2022-04-18 00:27:50 -07:00
mbecker20 bf34a47d4f mid size 1200px 2022-04-16 11:29:03 -07:00
mbecker20 d3c665a930 more mobile improvements 2022-04-16 11:17:38 -07:00
mbecker20 859c163900 unneeded import 2022-04-15 23:43:15 -07:00
mbecker20 58cec42422 download log or error log specifically 2022-04-15 23:25:23 -07:00
mbecker20 ef2a112274 home moved to wrapping flex 2022-04-15 21:40:28 -07:00
mbecker20 45f95f252b loop around search 2022-04-15 21:19:48 -07:00
mbecker20 52b8129f19 unknown status 2022-04-15 20:53:13 -07:00
mbecker20 60d75ae0de simplify 2022-04-15 18:55:48 -07:00
mbecker20 970b8f1ed7 fix mobile updates 2022-04-15 05:20:37 -07:00
mbecker20 be6b7eed60 hover menu and home width 2022-04-15 05:11:28 -07:00
mbecker20 489128e52d mobile search 2022-04-15 04:57:57 -07:00
mbecker20 fe9c64eac6 correct connect-src 2022-04-15 03:33:33 -07:00
mbecker20 cf1950f31a connect-src security directive for websockets 2022-04-15 03:26:21 -07:00
mbecker20 9d7f0f8bd1 quick fix 2022-04-15 02:39:30 -07:00
mbecker20 ee3e6f5471 fix to search and enter when input not focussed 2022-04-15 02:35:44 -07:00
mbecker20 eb15987395 new search and status 2022-04-15 02:27:21 -07:00
mbecker20 fe215d49c0 only show delete when you have permission to delete 2022-04-14 20:50:24 -07:00
mbecker20 d31508142c useWindowKeyDown for global keyboard shortcuts 2022-04-14 13:40:55 -07:00
mbecker20 61cac54088 remove auto open of menu 2022-04-14 07:27:35 -07:00
mbecker20 55243f122d pull down log container size 2022-04-14 07:21:53 -07:00
mbecker20 b9a19f0261 fix log sizing and make topbar icons smaller 2022-04-14 07:15:11 -07:00
mbecker20 c926d4d13d cli v 0.0.25 2022-04-14 07:01:32 -07:00
mbecker20 491819b01b add pull latest to cli 2022-04-14 06:58:18 -07:00
mbecker20 3025809175 activate search with shift + s 2022-04-14 06:42:18 -07:00
mbecker20 d0c5cdf892 clean up search and add shift+m sidebar toggle 2022-04-14 06:32:17 -07:00
mbecker20 42fcd0fee0 do only show download log when user can update 2022-04-14 05:31:06 -07:00
mbecker20 cb5f88adb0 select log length 2022-04-14 05:24:29 -07:00
mbecker20 12926678c4 cli v 0.0.24 2022-04-13 23:15:09 -07:00
mbecker20 81bbcf10b9 configure host env cli 2022-04-13 23:14:13 -07:00
mbecker20 17a255a106 default all owners to empty array 2022-04-13 13:24:25 -07:00
mbecker20 38320a4f8b servers owners defaults to empty array 2022-04-13 13:22:35 -07:00
mbecker20 961f4d640c fix new input too wide 2022-04-13 05:52:18 -07:00
mbecker20 6eeed044ec initialize server action states 2022-04-13 05:46:30 -07:00
mbecker20 f801e0f0d1 connection close code unneeded 2022-04-13 05:20:46 -07:00
mbecker20 c33553808d fix to remove network from periphery 2022-04-13 05:09:36 -07:00
mbecker20 92dae9e7e0 remove monitor network from periphery install 2022-04-13 05:05:32 -07:00
mbecker20 f444920c69 fixed error with docker account image 2022-04-13 04:42:29 -07:00
mbecker20 80ca84c683 add health check route 2022-04-13 03:54:23 -07:00
mbecker20 5004753c09 add ws connect state 2022-04-13 03:43:27 -07:00
mbecker20 63cf7df2ad add docker account to db 2022-04-13 02:48:24 -07:00
mbecker20 67c1bebe59 update cli version 2022-04-13 00:26:10 -07:00
mbecker20 2c35d66b96 clean 2022-04-13 00:25:31 -07:00
mbecker20 47089161eb dynamic url for development and production 2022-04-13 00:17:18 -07:00
mbecker20 5454d1a909 paginated updates loading 2022-04-12 22:55:32 -07:00
mbecker20 1c1fa26db9 move start / stop into deploy actions 2022-04-12 05:23:44 -07:00
mbecker20 e11180a6ca add download log button 2022-04-12 04:59:23 -07:00
mbecker20 f820373488 navigation with search 2022-04-12 01:33:38 -07:00
mbecker20 97d7fcdc32 broadcast when container actions happend 2022-04-12 00:09:01 -07:00
mbecker20 c6f685ff23 copy listener url 2022-04-11 23:27:29 -07:00
mbecker20 6bdb0cb705 make frontend slightly responsive to dimensions 2022-04-11 03:51:20 -07:00
mbecker20 2cea99de96 add can edit indicator in the sidebar + username in topbar 2022-04-10 13:04:50 -07:00
mbecker20 596c7feeda dont allow breaking simultaneous actions using actionStates 2022-04-10 11:11:59 -07:00
mbecker20 fe644f4e94 load all deployments in one 2022-04-09 23:54:15 -07:00
mbecker20 753de978c0 add simple home screen 2022-04-09 15:12:34 -07:00
mbecker20 b7851f2a3c browser back working 2022-04-08 23:11:42 -07:00
mbecker20 6144901bf2 server permissions start 2022-04-08 18:33:29 -07:00
mbecker20 e0385cc47c canUserUpdate build and build owner config 2022-04-08 15:11:22 -07:00
mbecker20 43342fb9bf manage deployment owners 2022-04-08 13:07:37 -07:00
mbecker20 36a636129f remove owners whose account have been deleted 2022-04-08 01:59:29 -07:00
mbecker20 a0109c35de manage deployment owners / collaborators 2022-04-08 01:47:15 -07:00
mbecker20 cf8ce414ea userCanUpdate config 2022-04-07 21:00:23 -07:00
mbecker20 0e5c298199 useCollection filter 2022-04-07 05:20:11 -07:00
mbecker20 806afc7fa8 manage users 2022-04-07 04:59:43 -07:00
mbecker20 f4a57235ce seems to be working 2022-04-05 14:44:22 -07:00
mbecker20 bf4d759ae7 pull action 2022-04-05 06:20:59 -07:00
mbecker20 32b5e46959 fix the listener 2022-04-05 05:32:06 -07:00
mbecker20 ca8aa46287 turn on periphery log 2022-04-05 04:59:58 -07:00
mbecker20 29c663b4e2 deploy not working 2022-04-05 04:48:29 -07:00
mbecker20 e70ca668f5 fix query 2022-04-05 04:00:54 -07:00
mbecker20 69b8b2a810 join to make builds dir 2022-04-05 03:01:37 -07:00
mbecker20 ebde89862f fix 2022-04-05 01:21:27 -07:00
mbecker20 8c39a0e86c core pull before deploy 2022-04-05 01:05:46 -07:00
mbecker20 0e85398ad1 fix repo root 2022-04-05 00:57:33 -07:00
mbecker20 84484b40ac log steps of deployment clone 2022-04-05 00:44:48 -07:00
mbecker20 c572087e9c ActionStateProvider 2022-04-05 00:37:26 -07:00
mbecker20 1cd5f6cee3 sidebar tab localstorage 2022-04-04 18:10:43 -07:00
mbecker20 b556d194c8 color the statuses and only show log when created 2022-04-04 13:55:32 -07:00
mbecker20 8da46462ae make selected tab grey 2022-04-04 05:05:25 -07:00
mbecker20 b6ff569c61 fix to merge command log error 2022-04-04 04:58:42 -07:00
mbecker20 75d31c1779 grey screenshots 2022-04-04 04:56:22 -07:00
mbecker20 cec2231139 grey out 2022-04-04 04:30:43 -07:00
mbecker20 607a550941 sidebar scrolls 2022-04-04 02:33:30 -07:00
mbecker20 be200b39f9 screenshots 2022-04-04 02:19:17 -07:00
mbecker20 2aa8724829 mobile pic 2022-04-04 02:12:55 -07:00
mbecker20 f43680e8d5 readme 2022-04-04 02:12:16 -07:00
mbecker20 6cbd8be1ac new screenshots 2022-04-04 02:11:13 -07:00
mbecker20 9d3fe1cbea darker blue 2022-04-04 01:50:55 -07:00
mbecker20 2f0822c6f6 consolidate theme 2022-04-03 21:46:30 -07:00
mbecker20 d3c7e74562 add some color variables 2022-04-03 03:38:55 -07:00
mbecker20 ff90854be2 move to sass 2022-04-03 03:29:40 -07:00
mbecker20 c17967e4a9 make validations file 2022-04-03 02:31:56 -07:00
mbecker20 e5fc4117ec config justify 2022-04-02 23:36:05 -07:00
mbecker20 2ee204d4c8 fix remote clone 2022-04-02 15:53:31 -07:00
mbecker20 43e18f93be config deployment mount repo 2022-04-02 15:29:10 -07:00
mbecker20 135674600b New 2022-04-02 14:18:51 -07:00
mbecker20 8a1b732bde forgot to call done() 2022-04-02 13:38:27 -07:00
mbecker20 8e51b91a79 hide actions without appropriate permissions + deplopyment git 2022-04-02 12:59:50 -07:00
mbecker20 d7eb162799 shore up github listener 2022-04-02 01:54:45 -07:00
mbecker20 5588553a37 login page and "no builds" 2022-04-01 22:08:00 -07:00
mbecker20 41d5e48c17 fix command for log implementation 2022-04-01 00:02:58 -07:00
mbecker20 bfb69b0207 Merge branch 'main' of https://github.com/mbecker20/monitor 2022-04-01 00:01:48 -07:00
mbecker20 b1ad9f95c0 new create build / deployment 2022-04-01 00:01:46 -07:00
mbecker20 a899a87305 tiny 2022-03-31 16:48:43 -07:00
mbecker20 ba3ecc1143 fix scrolling 2022-03-31 14:18:54 -07:00
mbecker20 d2e2e405e3 sidebar tabs 2022-03-31 14:11:29 -07:00
mbecker20 a4fe524784 refactor reused css between deployments / builds / servers 2022-03-31 07:22:56 -07:00
mbecker20 46af953df9 small stuff 2022-03-31 06:50:00 -07:00
mbecker20 28622390e9 pretty stringify logs 2022-03-31 06:26:45 -07:00
mbecker20 efdce511bb push to docker hub working 2022-03-31 06:19:02 -07:00
mbecker20 0000d2a938 update 2022-03-31 06:14:52 -07:00
mbecker20 57700fc5c2 fix clone error 2022-03-31 06:02:29 -07:00
mbecker20 5e35d989b3 refresh secrets 2022-03-31 05:41:54 -07:00
mbecker20 b637ba1860 config sysroot 2022-03-31 03:50:07 -07:00
mbecker20 297b8735a5 implement sysroot mount in cli 2022-03-31 03:39:37 -07:00
mbecker20 aa4f160946 config width 2022-03-31 03:20:44 -07:00
mbecker20 0219aef6d5 add 100vw 100vh background to menu for close on click outside 2022-03-31 03:13:59 -07:00
mbecker20 9debdc422f build, deploy, add server working 2022-03-31 02:45:24 -07:00
mbecker20 9aad9ee163 fix reclone and add some action state 2022-03-31 02:15:46 -07:00
mbecker20 9c5547fd36 fix to local deployment 2022-03-31 01:25:50 -07:00
mbecker20 b810e38bb0 only push if docker account exits 2022-03-31 01:01:29 -07:00
mbecker20 c0ffcacc4e working with accounts 2022-03-31 00:53:47 -07:00
mbecker20 4fa1393a96 make changes for github / docker accounts 2022-03-30 23:19:22 -07:00
mbecker20 f54f194b6e remove registry from this stack. can be managed externally 2022-03-30 18:26:14 -07:00
mbecker20 9667085a7d fix deploy actions 2022-03-30 03:23:53 -07:00
mbecker20 aa920f742a build cloning 2022-03-30 03:15:41 -07:00
mbecker20 870e047e1e fix 2022-03-30 02:09:50 -07:00
mbecker20 bbc7036bfe fix 2022-03-30 01:37:14 -07:00
mbecker20 3f1e7e6e62 deploy 2022-03-30 01:24:01 -07:00
mbecker20 7141530c86 build responsive 2022-03-29 23:57:41 -07:00
mbecker20 db09836981 fix build changelog 2022-03-29 23:49:34 -07:00
mbecker20 eface85e1f saving 2022-03-29 23:48:08 -07:00
mbecker20 78814198d2 fix here as well 2022-03-29 23:09:11 -07:00
mbecker20 f6e15ea495 fix to onclone 2022-03-29 23:07:31 -07:00
mbecker20 1895a0edd9 configure builds 2022-03-29 22:16:11 -07:00
mbecker20 3e3aa21069 deployment action state loaders 2022-03-29 19:06:15 -07:00
mbecker20 9487deed99 loading component 2022-03-29 18:14:39 -07:00
mbecker20 d611a45f60 implement clone onClone command 2022-03-29 09:06:21 -07:00
mbecker20 9765cb2b74 implement sparse clone 2022-03-29 08:43:02 -07:00
mbecker20 4b83e9343c archetecture of build service 2022-03-29 08:00:17 -07:00
mbecker20 09c2551a71 fix to periphery deploy 2022-03-29 05:06:44 -07:00
mbecker20 a15bea9569 remove useSystemRoot from volumes 2022-03-29 04:48:43 -07:00
mbecker20 7dfaccc1f1 rename not created to not deployed, server enable 2022-03-28 16:53:09 -07:00
mbecker20 a13a3f7f17 change periphery routes to not prefix http:// 2022-03-28 16:28:15 -07:00
mbecker20 ef44f226ff network create, delete, prune working 2022-03-28 16:23:39 -07:00
mbecker20 459739f209 add network create and delete util 2022-03-28 15:47:35 -07:00
mbecker20 49335230bf server page prog 2022-03-28 05:02:54 -07:00
mbecker20 64f9405670 start on server page 2022-03-28 04:24:33 -07:00
mbecker20 4d7cb1444c connect to periphery working 2022-03-28 01:27:29 -07:00
mbecker20 a5e1e6867e fix host for periphery 2022-03-28 01:17:40 -07:00
mbecker20 06947d8612 add server 2022-03-28 00:44:16 -07:00
mbecker20andGitHub 4add8edaa8 Merge pull request #2 from karamvirsingh98/main
fix docker build arm
2022-03-27 21:12:38 -07:00
Karamvir Singh 925f07b6e6 fix docker build arm 2022-03-27 20:55:32 -07:00
mbecker20 0a917c1471 log reload 2022-03-27 20:02:30 -07:00
mbecker20 cb32e3c2bb add important css 2022-03-27 17:55:51 -07:00
mbecker20 ba7da33300 delete unneeded css 2022-03-27 17:55:30 -07:00
mbecker20 c3550c31e9 log working 2022-03-27 05:41:07 -07:00
mbecker20 24e58d36de updates 2022-03-27 04:05:02 -07:00
mbecker20 fbd895e9c2 fix deployment delete update log 2022-03-27 00:26:43 -07:00
mbecker20 bafb808780 fix command and log icon 2022-03-26 23:26:26 -07:00
mbecker20 df13897497 fix core logic of whether container action on core or periphery server 2022-03-26 19:41:00 -07:00
mbecker20 84b1b4e57b updates 2022-03-26 06:37:18 -07:00
mbecker20 68cb92a7dc move update to its own component 2022-03-26 02:44:20 -07:00
mbecker20 0d3b5ce005 fix 2022-03-26 01:20:59 -07:00
mbecker20 b4c712d7d0 can create and delete 2022-03-26 00:54:51 -07:00
mbecker20 7f1421604b delete deployment actually deletes 2022-03-26 00:39:06 -07:00
mbecker20 4efd443c04 creating working 2022-03-26 00:02:29 -07:00
mbecker20 2d49eb79c9 creating is broken 2022-03-25 21:38:08 -07:00
mbecker20 9d25af0a68 fix to backend status 2022-03-25 21:29:43 -07:00
mbecker20 6fd0143495 image 2022-03-25 19:11:11 -07:00
mbecker20 2f78f8f3e2 config actually configs 2022-03-25 19:04:21 -07:00
mbecker20 c23e195127 add minus to conversions and add shadows 2022-03-25 03:58:55 -07:00
mbecker20 962a1c327e dont see why network needs id 2022-03-25 03:50:54 -07:00
mbecker20 c6acbb54ff add routes to get networks on server 2022-03-25 03:41:32 -07:00
mbecker20 2245f3f501 add list network functionality 2022-03-25 03:16:58 -07:00
mbecker20 1942c9c6d9 config conversions 2022-03-25 02:29:05 -07:00
mbecker20 764e230b6e base of more config 2022-03-24 22:40:31 -07:00
mbecker20 65d647e2fd fix menu bottom center 2022-03-24 21:45:12 -07:00
mbecker20 3a04d23116 something 2022-03-24 21:31:24 -07:00
mbecker20andGitHub bdc645785b Merge pull request #1 from karamvirsingh98/main
take it and go
2022-03-24 21:28:41 -07:00
Karamvir Singh 35c110817d it format now 2022-03-24 21:26:52 -07:00
Karamvir Singh 1b6b6fddfd take it and go 2022-03-24 21:16:57 -07:00
mbecker20 f227506f45 width of screenshot 2022-03-24 12:23:11 -07:00
mbecker20andGitHub 739003a7f3 Update readme.md 2022-03-24 12:21:22 -07:00
mbecker20 e1a60881bc add cropped mobile 2022-03-24 12:20:32 -07:00
mbecker20 6210ab20fc remove mobile 2022-03-24 12:20:11 -07:00
mbecker20 c45670f908 crop 2022-03-24 12:19:07 -07:00
mbecker20 81bb06bb5b Merge branch 'main' of https://github.com/mbecker20/monitor into main 2022-03-24 12:17:14 -07:00
mbecker20 01a87c7f89 mobile jpeg 2022-03-24 12:17:12 -07:00
mbecker20andGitHub beab48287b Update readme.md 2022-03-24 10:42:51 -07:00
mbecker20 fa4f24f5ed new ss2 2022-03-24 10:42:02 -07:00
mbecker20 eb3c173f89 reset 2022-03-24 10:41:18 -07:00
mbecker20 3c1f245995 Merge branch 'main' of https://github.com/mbecker20/monitor into main 2022-03-24 10:40:03 -07:00
mbecker20 ec079b732e screenshot2 2022-03-24 10:40:02 -07:00
mbecker20andGitHub 09ad6daa67 Update readme.md 2022-03-24 10:38:42 -07:00
mbecker20andGitHub ce7322010f Update readme.md 2022-03-24 10:36:21 -07:00
mbecker20 054e896243 screenshot2 2022-03-24 10:34:03 -07:00
mbecker20 163b83bbc1 screenshots 2022-03-24 10:32:01 -07:00
mbecker20 e871262da8 config image start and start on create menus 2022-03-24 00:16:22 -07:00
mbecker20 73b408d7a3 mogh favicon 2022-03-23 23:42:43 -07:00
mbecker20 02cd1379a0 deployment tabs and updates 2022-03-23 22:06:29 -07:00
mbecker20 ca9678b346 Merge branch 'main' of https://github.com/mbecker20/monitor into main 2022-03-23 18:59:21 -07:00
mbecker20 8b049bd802 modify licence to GPL v3.0 2022-03-23 18:59:19 -07:00
mbecker20andGitHub f6cfc0dda6 Create LICENSE 2022-03-23 18:57:33 -07:00
mbecker20 8fb821b2f5 owners 2022-03-23 18:26:40 -07:00
mbecker20 2f4ad66206 cli will create initial update for start of monitor 2022-03-23 17:34:44 -07:00
mbecker20 523201c993 topbar and deployment 2022-03-23 16:26:41 -07:00
mbecker20 18e8131102 serve the frontend correctly 2022-03-23 03:32:51 -07:00
mbecker20 7c913276e1 login 2022-03-23 02:26:54 -07:00
mbecker20 8ae5464771 font 2022-03-23 02:25:08 -07:00
mbecker20 d059d7fb30 selected state deployment and server / deployment status 2022-03-23 02:20:02 -07:00
mbecker20 e54b7633bc mount the docker sock 2022-03-23 01:26:39 -07:00
mbecker20 5d9c6aabf2 asdf 2022-03-22 23:22:42 -07:00
mbecker20 6351c1362c interesting 2022-03-22 22:52:55 -07:00
mbecker20 23ef4bbc32 frontend sidebar 2022-03-22 22:16:59 -07:00
mbecker20 466586a580 basic frontend layout 2022-03-22 21:35:58 -07:00
mbecker20 7ca5806703 add structure for handling socket messages 2022-03-21 22:11:02 -07:00
mbecker20 b81b9aa58b frontend structure 2022-03-21 21:11:07 -07:00
mbecker20 858ce7263a add some util stuff 2022-03-21 13:52:09 -07:00
mbecker20 bd8f022546 fix restart default 2022-03-21 11:20:24 -07:00
mbecker20 e6f7af81d7 improve description of restart 2022-03-21 11:01:27 -07:00
mbecker20 c7357b7ddf lowercase App -> app 2022-03-21 10:55:33 -07:00
mbecker20 0a4dd709eb allow restart with flags specifying name and mongo url 2022-03-21 03:19:01 -07:00
mbecker20 8fe2ab2aab restart default flag 2022-03-21 03:07:23 -07:00
mbecker20 f2f626f367 restat in cli and fix ws 2022-03-21 02:46:24 -07:00
mbecker20 875d1e6976 looks like ws connect login stream working 2022-03-20 23:09:54 -07:00
mbecker20 cd6263a6c5 add user route to core 2022-03-20 22:24:41 -07:00
mbecker20 8832993386 update version 2022-03-20 22:11:18 -07:00
mbecker20 35da67b981 get deploy working using monitor network 2022-03-20 22:10:27 -07:00
mbecker20 f984520746 the cli sets up a network 2022-03-20 21:59:51 -07:00
mbecker20 b4f5c71589 default address 2022-03-20 21:19:14 -07:00
mbecker20 f469bbe3bc copy frontend into core for docker bundle 2022-03-20 21:04:42 -07:00
mbecker20 6a53ecc8b5 next version 2022-03-20 20:33:57 -07:00
mbecker20 a92d33de84 fix to esc behavior 2022-03-20 20:33:01 -07:00
mbecker20 1d96430c6f fix 2022-03-20 20:25:48 -07:00
mbecker20 33347d963c fixes for 0.0.17 2022-03-20 20:24:24 -07:00
mbecker20 8c376b615a update 2022-03-20 13:49:35 -07:00
mbecker20 d4f63cab36 remove spinner from setup (causes flashes) 2022-03-20 13:48:57 -07:00
mbecker20 74402c7048 version 2022-03-20 13:42:24 -07:00
mbecker20 9c2be628c8 make reg and mongo volume mounts not used default 2022-03-20 13:41:38 -07:00
mbecker20 6f55207a76 update 2022-03-20 13:39:48 -07:00
mbecker20 cbb3be2532 remove - 2022-03-20 13:39:04 -07:00
mbecker20 0d35edb20b make host network yes default 2022-03-20 13:38:07 -07:00
mbecker20 e4c34b92fb fix total in setup and update version 2022-03-20 13:36:36 -07:00
mbecker20 34cbdf6129 0.0.13 2022-03-20 13:31:49 -07:00
mbecker20 9851269066 fix to spinner 2022-03-20 13:29:54 -07:00
mbecker20 34bd2eff19 version 2022-03-20 13:10:25 -07:00
mbecker20 833a7bf5c8 remove docker install support, linking to install docs instead 2022-03-20 13:08:18 -07:00
mbecker20 00dd601461 show logs by switching to installing stage 2022-03-20 12:42:01 -07:00
mbecker20 715a7ec3cf version 2022-03-20 11:26:30 -07:00
mbecker20 34014875e8 move docker install pushing commands to before early returns 2022-03-20 11:25:41 -07:00
mbecker20 bcf2aada0b just use node 10 it doesnt work on older versions 2022-03-20 11:06:41 -07:00
mbecker20 b26210b476 target node10 2022-03-20 11:05:08 -07:00
mbecker20 6e402aca0f update cli version 2022-03-20 10:49:09 -07:00
mbecker20 2985b4ce3f setup 2022-03-20 10:45:40 -07:00
mbecker20 5e802fb9d9 push 2022-03-20 10:27:44 -07:00
mbecker20 6d7c8a6141 title 2022-03-20 10:13:49 -07:00
mbecker20 e6f047ee27 reverse order of these 2022-03-20 10:09:33 -07:00
mbecker20 c92f4bed4e begin on frontend state 2022-03-20 05:49:18 -07:00
mbecker20 469ff2fbd0 version 2022-03-20 04:34:56 -07:00
mbecker20 3973e8d75a handle error in setup 2022-03-20 04:29:17 -07:00
mbecker20 c24f0a728c add server id to mongo deployment 2022-03-20 04:24:00 -07:00
mbecker20 5bc5727dfb setup apparently wokring 2022-03-20 04:21:36 -07:00
mbecker20 75777de32a add setup scripts 2022-03-20 03:48:05 -07:00
mbecker20 0bfa6de526 ssr option vite 2022-03-19 18:29:41 -07:00
mbecker20 d8a1e61070 remove legacy cli from main 2022-03-19 18:28:16 -07:00
mbecker20 db9226aaef add mongoose util 2022-03-19 18:26:49 -07:00
mbecker20 1a0bfbbcf9 add deploy funcs 2022-03-19 18:26:06 -07:00
mbecker20 c2941327a5 add periphery config 2022-03-19 17:47:26 -07:00
mbecker20 befd249663 monitor core config 2022-03-19 17:39:59 -07:00
mbecker20 1be679745a confirm page show config 2022-03-19 16:38:08 -07:00
mbecker20 3d60bb16ec setup the registry config 2022-03-19 15:40:15 -07:00
mbecker20 048905997a deployment config 2022-03-19 14:59:36 -07:00
mbecker20 9c09d10352 help flag 2022-03-19 12:42:22 -07:00
mbecker20 72c624f691 setup jotai and restructure a bit 2022-03-19 03:15:19 -07:00
mbecker20 b855155043 support flags 2022-03-19 02:33:18 -07:00
mbecker20 d64da60d4e begin cli v2 2022-03-18 23:02:51 -07:00
mbecker20 2db166ddb3 rename transform to post-build for clarity 2022-03-18 18:10:49 -07:00
mbecker20 0cbb90760b add initial docs 2022-03-18 08:59:12 -07:00
mbecker20 7130da485b fix to publish command 2022-03-18 05:31:06 -07:00
mbecker20 adf31cc75e publish the cli 2022-03-18 05:12:13 -07:00
mbecker20 3d8f783068 add vite build into one file 2022-03-18 03:47:09 -07:00
mbecker20 a3044c4991 start the registry 2022-03-18 03:13:52 -07:00
mbecker20 d8ae664ece description of mongo mount 2022-03-18 02:45:06 -07:00
mbecker20 e0b9869733 detect whether docker installed 2022-03-18 02:31:15 -07:00
mbecker20 3bd9cfcdda docker install with cli 2022-03-18 01:56:22 -07:00
mbecker20 b716fdae4c setup mongo 2022-03-17 19:00:08 -07:00
mbecker20 678a09a524 mongo install working 2022-03-17 17:20:53 -07:00
mbecker20 65dd347496 fixes 2022-03-17 13:42:08 -07:00
mbecker20 c355abbc1d add monitor cli 2022-03-17 13:09:49 -07:00
mbecker20 ab1b9d2d5a core running 2022-03-17 04:01:10 -07:00
mbecker20 99a22614c0 dockerizer periphery 2022-03-17 02:45:00 -07:00
mbecker20 2c043ff80b dont need this 2022-03-17 02:37:06 -07:00
mbecker20 ac3ce30e5d figure out docker build with local modules 2022-03-17 02:36:52 -07:00
mbecker20 a737027783 added routes to get data 2022-03-17 00:19:02 -07:00
mbecker20 66adf8cb87 move actions to util 2022-03-16 23:18:21 -07:00
mbecker20 049689c1d2 fix deployment command for monitor image / latest 2022-03-16 23:07:47 -07:00
mbecker20 06470dc776 the messages / actions are mostly done 2022-03-16 22:51:51 -07:00
mbecker20 c5e667051c deploy deployment 2022-03-16 14:59:28 -07:00
mbecker20 4250e93b60 improve queries to just take server as input 2022-03-16 14:40:21 -07:00
mbecker20 6f1479e9ae deployment and server message progress 2022-03-16 13:41:45 -07:00
mbecker20 ae6736cae5 periphery functions and core-side queries 2022-03-16 00:52:11 -07:00
mbecker20 505f57fcab prog on periphery 2022-03-15 18:45:33 -07:00
mbecker20 aebe6c5c2b add repoMount to docker run 2022-03-15 13:52:31 -07:00
mbecker20 0c1c925e18 add start commands 2022-03-15 13:35:07 -07:00
mbecker20 3e7734522e move permissions check to top level early return 2022-03-15 13:17:50 -07:00
mbecker20 a36d7ba912 start on deployments 2022-03-15 04:33:35 -07:00
mbecker20 82371db1c3 refactor build messages into seperate files 2022-03-15 04:00:15 -07:00
mbecker20 0da2bf732f add action states and build messages 2022-03-15 03:18:32 -07:00
mbecker20 2e623505d9 github listener 2022-03-14 13:06:51 -07:00
mbecker20 3b2a8e7683 add helmet 2022-03-14 12:37:21 -07:00
mbecker20 ba791bf381 pass the client socket into message handler 2022-03-14 12:25:36 -07:00
mbecker20 439d4f7c3a start setting up action messages 2022-03-14 11:32:10 -07:00
mbecker20 b997d3153c updates helpers 2022-03-14 11:13:31 -07:00
mbecker20 137be095c3 change structure for plugins / util 2022-03-14 10:00:13 -07:00
mbecker20 1a70a39365 some helpers 2022-03-14 09:55:05 -07:00
mbecker20 282cfcc7b0 add some db helpers 2022-03-14 01:19:59 -07:00
mbecker20 12ca36f108 create servers, docker commands 2022-03-14 01:07:17 -07:00
mbecker20 1bd5e8675a add db schema 2022-03-14 00:14:37 -07:00
mbecker20 37c2f6a203 action types 2022-03-13 22:37:22 -07:00
mbecker20 0a80f83cc8 add the monitor types 2022-03-13 22:30:14 -07:00
mbecker20 eba85c3c11 add permissions to users 2022-03-13 22:04:34 -07:00
mbecker20 9442dacacc setup websockets 2022-03-13 21:58:02 -07:00
mbecker20 3095ae9983 setup db and auth in new monitor core 2022-03-13 21:45:26 -07:00
mbecker20 8352f460b4 more setup 2022-03-13 13:38:28 -07:00
mbecker20 dd935ce147 add more deps 2022-03-13 01:50:52 -08:00
mbecker20 31d79fb67b some changes / fixes 2022-03-13 01:26:26 -08:00
mbecker20 b73149516a add readme (still out of date slightly) 2022-03-13 01:19:44 -08:00
mbecker20 449dd9a868 add folder structure of monitorv2 2022-03-13 01:18:24 -08:00
446 changed files with 28343 additions and 1506 deletions
+7
View File
@@ -0,0 +1,7 @@
.DS_Store
node_modules
build
secrets
bundle.*
monitor_mount
.env*
View File
+60
View File
@@ -0,0 +1,60 @@
{
"service": {
"scope": "typescript",
"prefix": "plugin",
"body": [
"import { FastifyInstance } from \"fastify\";",
"import fp from \"fastify-plugin\";",
"",
"const ${1:$TM_FILENAME_BASE} = fp((app: FastifyInstance, _: {}, done: () => void) => {",
"\t${0}",
"\tdone();",
"});",
"",
"export default ${1:$TM_FILENAME_BASE};"
]
},
"schema": {
"scope": "typescript",
"prefix": "schema",
"body": [
"import { FastifyInstance } from \"fastify\";",
"import fp from \"fastify-plugin\";",
"import { Schema } from \"mongoose\";",
"import model from \"../../util/model\";",
"",
"const ${2:$TM_FILENAME_BASE} = fp((app: FastifyInstance, _: {}, done: () => void) => {",
"\tconst schema = new Schema({",
"\t\t${0}",
"\t});",
"\t",
"\tapp.decorate(\"${2:$TM_FILENAME_BASE}\", model(app, \"${1}\", schema));",
"\t",
"\tdone();",
"});",
"",
"export default ${2:$TM_FILENAME_BASE};"
]
},
"get-auth": {
"scope": "typescript",
"prefix": "get-auth",
"body": [
"app.get(\"/${1}\", { onRequest: [app.auth, app.userEnabled] }, async (req, res) => {",
"\t${0}",
"});"
]
},
"post-auth": {
"scope": "typescript",
"prefix": "post-auth",
"body": [
"app.post(\"/${1}\", { onRequest: [app.auth, app.userEnabled] }, async (req, res) => {",
"\t${0}",
"});"
]
}
}
+21
View File
@@ -0,0 +1,21 @@
{
"ink-comp": {
"scope": "typescriptreact,javascriptreact",
"prefix": "ink-comp",
"body": [
"import React from \"react\";",
"import { Box } from \"ink\";",
"",
"const ${1:$TM_FILENAME_BASE} = ({}: {}) => {",
"\treturn (",
"\t\t<Box>",
"\t\t\t${0}",
"\t\t</Box>",
"\t);",
"}",
"",
"export default ${1:$TM_FILENAME_BASE};"
]
},
}
+3
View File
@@ -0,0 +1,3 @@
{
"npm.exclude": "**/monitor/**"
}
+64
View File
@@ -0,0 +1,64 @@
{
"component": {
"scope": "typescriptreact,javascriptreact",
"prefix": "comp",
"body": [
"import { Component } from \"solid-js\";",
"",
"const ${1:$TM_FILENAME_BASE}: Component<{}> = (p) => {",
"\treturn (",
"\t\t<div>",
"\t\t\t${0}",
"\t\t</div>",
"\t);",
"}",
"",
"export default ${1:$TM_FILENAME_BASE};"
]
},
"component-with-css": {
"scope": "typescriptreact,javascriptreact",
"prefix": "css-comp",
"body": [
"import { Component } from \"solid-js\";",
"import s from \"./${1:$TM_FILENAME_BASE}.module.scss\";",
"",
"const ${2:$TM_FILENAME_BASE}: Component<{}> = (p) => {",
"\treturn (",
"\t\t<div class={s.${2:$TM_FILENAME_BASE}} >",
"\t\t\t${0}",
"\t\t</div>",
"\t);",
"}",
"",
"export default ${2:$TM_FILENAME_BASE};"
]
},
"context": {
"scope": "typescriptreact,javascriptreact",
"prefix": "provider",
"body": [
"import { Component, createContext, useContext } from \"solid-js\";",
"",
"const value = () => {",
"\treturn {};",
"}",
"",
"export type Value = ReturnType<typeof value>;",
"",
"const context = createContext<Value>();",
"",
"export const Provider: Component<{}> = (p) => {",
"\treturn (",
"\t\t<context.Provider value={value()}>",
"\t\t\t{p.children}",
"\t\t</context.Provider>",
"\t);",
"}",
"",
"export function useValue() {",
"\treturn useContext(context) as Value;",
"}"
]
}
}
-16
View File
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
komo.do
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[583],{7143:(e,t,s)=>{s.r(t),s.d(t,{default:()=>g});var n=s(4164),o=s(8774),i=s(4586),r=s(1656),c=s(1107);const l={features:"features_t9lD",featureSvg:"featureSvg_GfXr"};var a=s(4848);const d=[{title:"Automated builds \ud83d\udee0\ufe0f",description:(0,a.jsx)(a.Fragment,{children:"Build auto versioned docker images from git repos, trigger builds on git push"})},{title:"Deploy docker containers \ud83d\ude80",description:(0,a.jsx)(a.Fragment,{children:"Deploy containers, deploy docker compose, see uptime and logs across all your servers"})},{title:"Powered by Rust \ud83e\udd80",description:(0,a.jsx)(a.Fragment,{children:"The core API and periphery agent are written in Rust"})}];function h({title:e,description:t}){return(0,a.jsx)("div",{className:(0,n.A)("col col--4"),children:(0,a.jsxs)("div",{className:"text--center padding-horiz--md",children:[(0,a.jsx)(c.A,{as:"h3",children:e}),(0,a.jsx)("p",{children:t})]})})}function u(){return(0,a.jsx)("section",{className:l.features,children:(0,a.jsx)("div",{className:"container",children:(0,a.jsx)("div",{className:"row",children:d.map((e,t)=>(0,a.jsx)(h,{...e},t))})})})}const m={heroBanner:"heroBanner_qdFl",buttons:"buttons_AeoN"};s(6540);function x({width:e="4rem"}){return(0,a.jsx)("img",{style:{width:e,height:"auto",opacity:.7},src:"img/monitor-lizard.png",alt:"monitor-lizard"})}function p(){const{siteConfig:e}=(0,i.A)();return(0,a.jsx)("header",{className:(0,n.A)("hero hero--primary",m.heroBanner),children:(0,a.jsxs)("div",{className:"container",children:[(0,a.jsx)("div",{style:{display:"flex",gap:"1rem",justifyContent:"center"},children:(0,a.jsxs)("div",{style:{position:"relative"},children:[(0,a.jsx)(x,{width:"600px"}),(0,a.jsx)("h1",{className:"hero__title",style:{margin:0,position:"absolute",top:"40%",left:"50%",transform:"translate(-50%, -50%)"},children:"Komodo"})]})}),(0,a.jsx)("p",{className:"hero__subtitle",children:e.tagline}),(0,a.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:(0,a.jsxs)("div",{className:m.buttons,children:[(0,a.jsx)(o.A,{className:"button button--secondary button--lg",to:"/docs/intro",children:"Docs"}),(0,a.jsx)(o.A,{className:"button button--secondary button--lg",to:"https://github.com/moghtech/komodo",children:"Github"}),(0,a.jsx)(o.A,{className:"button button--secondary button--lg",to:"https://github.com/moghtech/komodo#screenshots",style:{width:"100%",boxSizing:"border-box",gridColumn:"span 2"},children:"Screenshots"}),(0,a.jsx)(o.A,{className:"button button--secondary button--lg",to:"https://demo.komo.do",style:{width:"100%",boxSizing:"border-box",gridColumn:"span 2"},children:"Demo"})]})})]})})}function g(){const{siteConfig:e}=(0,i.A)();return(0,a.jsxs)(r.A,{title:"Home",description:e.tagline,children:[(0,a.jsx)(p,{}),(0,a.jsx)("main",{children:(0,a.jsx)(u,{})})]})}}}]);
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[237],{2237:(e,t,i)=>{i.r(t),i.d(t,{default:()=>d});i(6540);var n=i(1312),o=i(5500),s=i(1656),r=i(3363),a=i(4848);function d(){const e=(0,n.T)({id:"theme.NotFound.title",message:"Page Not Found"});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.be,{title:e}),(0,a.jsx)(s.A,{children:(0,a.jsx)(r.A,{})})]})}},3363:(e,t,i)=>{i.d(t,{A:()=>a});i(6540);var n=i(4164),o=i(1312),s=i(1107),r=i(4848);function a({className:e}){return(0,r.jsx)("main",{className:(0,n.A)("container margin-vert--xl",e),children:(0,r.jsx)("div",{className:"row",children:(0,r.jsxs)("div",{className:"col col--6 col--offset-3",children:[(0,r.jsx)(s.A,{as:"h1",className:"hero__title",children:(0,r.jsx)(o.A,{id:"theme.NotFound.title",description:"The title of the 404 page",children:"Page Not Found"})}),(0,r.jsx)("p",{children:(0,r.jsx)(o.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page",children:"We could not find what you were looking for."})}),(0,r.jsx)("p",{children:(0,r.jsx)(o.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page",children:"Please contact the owner of the site that linked you to the original URL and let them know their link is broken."})})]})})})}}}]);
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[345],{4689:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"resources/build-images/versioning","title":"Image Versioning","description":"Komodo uses a major.minor.patch versioning scheme to Build versioning. By default, every RunBuild will auto increment the Build\'s version patch number, and push the image to docker hub with the version tag, as well as the latest tag. A tag containing the latest short commit hash at the time the repo was cloned will also be created.","source":"@site/docs/resources/build-images/versioning.md","sourceDirName":"resources/build-images","slug":"/resources/build-images/versioning","permalink":"/docs/resources/build-images/versioning","draft":false,"unlisted":false,"editUrl":"https://github.com/moghtech/komodo/tree/main/docsite/docs/resources/build-images/versioning.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"Builders","permalink":"/docs/resources/build-images/builders"},"next":{"title":"Deploy Containers","permalink":"/docs/resources/deploy-containers/"}}');var i=n(4848),o=n(8453);const r={},a="Image Versioning",c={},d=[];function l(e){const t={code:"code",h1:"h1",header:"header",p:"p",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.header,{children:(0,i.jsx)(t.h1,{id:"image-versioning",children:"Image Versioning"})}),"\n",(0,i.jsxs)(t.p,{children:["Komodo uses a major.minor.patch versioning scheme to Build versioning. By default, every RunBuild will auto increment the Build's version patch number, and push the image to docker hub with the version tag, as well as the ",(0,i.jsx)(t.code,{children:"latest"})," tag. A tag containing the latest short commit hash at the time the repo was cloned will also be created."]}),"\n",(0,i.jsxs)(t.p,{children:['You can also turn off the auto incrementing feature, and manage the version yourself. In addition, you can configure a "version tag" on the build. This will postfix the version tag / commit hash tag with a custom label. For example, an image tag of ',(0,i.jsx)(t.code,{children:"dev"})," will produce tags like ",(0,i.jsx)(t.code,{children:"image_name:1.1.1-dev"})," and ",(0,i.jsx)(t.code,{children:"image_name:h3c87c-dev"}),"."]})]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>a});var s=n(6540);const i={},o=s.createContext(i);function r(e){const t=s.useContext(o);return s.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[771],{483:(e,t,o)=>{o.r(t),o.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"resources/auto-update","title":"Automatic Updates","description":"Starting from v1.19.0, new Komodo installs will automatically create the","source":"@site/docs/resources/auto-update.md","sourceDirName":"resources","slug":"/resources/auto-update","permalink":"/docs/resources/auto-update","draft":false,"unlisted":false,"editUrl":"https://github.com/moghtech/komodo/tree/main/docsite/docs/resources/auto-update.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"Docker Compose","permalink":"/docs/resources/docker-compose"},"next":{"title":"Variables and Secrets","permalink":"/docs/resources/variables"}}');var s=o(4848),r=o(8453);const a={},i="Automatic Updates",c={},l=[{value:"How does it work?",id:"how-does-it-work",level:3}];function d(e){const t={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h3:"h3",header:"header",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.header,{children:(0,s.jsx)(t.h1,{id:"automatic-updates",children:"Automatic Updates"})}),"\n",(0,s.jsxs)(t.p,{children:["Starting from ",(0,s.jsx)(t.strong,{children:"v1.19.0"}),", new Komodo installs will automatically create the\n",(0,s.jsx)(t.strong,{children:"Global Auto Update"})," ",(0,s.jsx)(t.a,{href:"../resources/procedures#procedures",children:"Procedure"}),", scheduled daily.\nIf you don't have it, this is the Toml:"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-toml",children:'[[procedure]]\nname = "Global Auto Update"\ndescription = "Pulls and auto updates Stacks and Deployments using \'poll_for_updates\' or \'auto_update\'."\ntags = ["system"]\nconfig.schedule = "Every day at 03:00"\n\n[[procedure.config.stage]]\nname = "Stage 1"\nenabled = true\nexecutions = [\n { execution.type = "GlobalAutoUpdate", execution.params = {}, enabled = true }\n]\n'})}),"\n",(0,s.jsx)(t.admonition,{type:"info",children:(0,s.jsxs)(t.p,{children:["You are also able to integrate ",(0,s.jsx)(t.code,{children:"GlobalAutoUpdate"})," into other Procedures\nto coordinate the timing with other processes, such as backup. There is\nnothing special about this Procedure, it's just created by default for\nguidance / convenience."]})}),"\n",(0,s.jsx)(t.h3,{id:"how-does-it-work",children:"How does it work?"}),"\n",(0,s.jsxs)(t.p,{children:["Both Stacks and Deployments allow you to configure ",(0,s.jsx)(t.strong,{children:"Poll for Updates"})," or ",(0,s.jsx)(t.strong,{children:"Auto Update"}),".\nWhen ",(0,s.jsx)(t.a,{href:"https://docs.rs/komodo_client/latest/komodo_client/api/execute/struct.GlobalAutoUpdate.html",children:(0,s.jsx)(t.strong,{children:"GlobalAutoUpdate"})}),"\nis run, Komodo will loop through all the resources with either of these options enabled,\nand run ",(0,s.jsx)(t.a,{href:"https://docs.rs/komodo_client/latest/komodo_client/api/execute/struct.PullStack.html",children:(0,s.jsx)(t.strong,{children:"PullStack"})})," / ",(0,s.jsx)(t.a,{href:"https://docs.rs/komodo_client/latest/komodo_client/api/execute/struct.PullDeployment.html",children:(0,s.jsx)(t.strong,{children:"PullDeployment"})}),"\nin order to pick up any newer images ",(0,s.jsx)(t.strong,{children:"at the same tag"}),'.\nNote that in order to work, it requires use of a "Rolling" image tag, such as ',(0,s.jsx)(t.code,{children:":latest"}),"."]}),"\n",(0,s.jsx)(t.admonition,{type:"info",children:(0,s.jsxs)(t.p,{children:["If you use git sources Stacks and want to automatically update image tags, check out\n",(0,s.jsx)(t.a,{href:"https://github.com/renovatebot/renovate?tab=readme-ov-file#what-is-the-mend-renovate-cli",children:"Renovate"})]})}),"\n",(0,s.jsxs)(t.p,{children:["For resources with ",(0,s.jsx)(t.strong,{children:"Poll for Updates"})," enabled and an Alerter configured, it will\nsend an alert that a newer image is available, and display the update available indicator in the UI"]}),"\n",(0,s.jsxs)(t.p,{children:["For resource with ",(0,s.jsx)(t.strong,{children:"Auto Update"})," enabled, it will go ahead and Redeploy ",(0,s.jsx)(t.em,{children:"just the services"})," with\nnewer images (by default). If an Alerter is configured, it will also send an alert that this occured."]})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,t,o)=>{o.d(t,{R:()=>a,x:()=>i});var n=o(6540);const s={},r=n.createContext(s);function a(e){const t=n.useContext(r);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),n.createElement(r.Provider,{value:t},e.children)}}}]);
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[122],{8453:(e,s,n)=>{n.d(s,{R:()=>t,x:()=>c});var o=n(6540);const r={},i=o.createContext(r);function t(e){const s=o.useContext(i);return o.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function c(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:t(e.components),o.createElement(i.Provider,{value:s},e.children)}},9749:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>d,contentTitle:()=>c,default:()=>a,frontMatter:()=>t,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"resources/build-images/pre-build","title":"Pre-build command","description":"Sometimes a command needs to be run before running `docker build`, you can configure this in the pre build section.","source":"@site/docs/resources/build-images/pre-build.md","sourceDirName":"resources/build-images","slug":"/resources/build-images/pre-build","permalink":"/docs/resources/build-images/pre-build","draft":false,"unlisted":false,"editUrl":"https://github.com/moghtech/komodo/tree/main/docsite/docs/resources/build-images/pre-build.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"Configuration","permalink":"/docs/resources/build-images/configuration"},"next":{"title":"Builders","permalink":"/docs/resources/build-images/builders"}}');var r=n(4848),i=n(8453);const t={},c="Pre-build command",d={},l=[];function u(e){const s={code:"code",em:"em",h1:"h1",header:"header",p:"p",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.header,{children:(0,r.jsx)(s.h1,{id:"pre-build-command",children:"Pre-build command"})}),"\n",(0,r.jsxs)(s.p,{children:["Sometimes a command needs to be run before running ",(0,r.jsx)(s.code,{children:"docker build"}),", you can configure this in the ",(0,r.jsx)(s.em,{children:"pre build"})," section."]}),"\n",(0,r.jsxs)(s.p,{children:["There are two fields to pass for ",(0,r.jsx)(s.em,{children:"pre build"}),". the first is ",(0,r.jsx)(s.em,{children:"path"}),", which changes the working directory. To run the command in the root of the repo, just pass ",(0,r.jsx)(s.code,{children:"."}),". The second field is ",(0,r.jsx)(s.em,{children:"command"}),", this is the shell command to be executed after the repo is cloned."]}),"\n",(0,r.jsxs)(s.p,{children:["For example, say your repo had a folder in it called ",(0,r.jsx)(s.code,{children:"scripts"})," with a shell script ",(0,r.jsx)(s.code,{children:"on-clone.sh"}),". You would give ",(0,r.jsx)(s.em,{children:"path"})," as ",(0,r.jsx)(s.code,{children:"scripts"})," and command as ",(0,r.jsx)(s.code,{children:"sh on-clone.sh"}),". Or you could make ",(0,r.jsx)(s.em,{children:"path"})," just ",(0,r.jsx)(s.code,{children:"."})," and then the command would be ",(0,r.jsx)(s.code,{children:"sh scripts/on-clone.sh"}),". Either way works fine."]})]})}function a(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}}}]);
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[647],{7121:(e,s,r)=>{r.r(s),r.d(s,{default:()=>i});r(6540);var c=r(4164),t=r(7559),u=r(5500),a=r(2831),d=r(1656),n=r(4848);function i(e){return(0,n.jsx)(u.e3,{className:(0,c.A)(t.G.wrapper.docsPages),children:(0,n.jsx)(d.A,{children:(0,a.v)(e.route.routes)})})}}}]);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[464],{185:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>r,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"resources/deploy-containers/lifetime-management","title":"Container Management","description":"The lifetime of a docker container is more like a virtual machine. They can be created, started, stopped, and destroyed. Komodo will display the state of the container and provides an API to manage all your container\'s lifetimes.","source":"@site/docs/resources/deploy-containers/lifetime-management.md","sourceDirName":"resources/deploy-containers","slug":"/resources/deploy-containers/lifetime-management","permalink":"/docs/resources/deploy-containers/lifetime-management","draft":false,"unlisted":false,"editUrl":"https://github.com/moghtech/komodo/tree/main/docsite/docs/resources/deploy-containers/lifetime-management.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"Configuration","permalink":"/docs/resources/deploy-containers/configuration"},"next":{"title":"Docker Compose","permalink":"/docs/resources/docker-compose"}}');var i=n(4848),a=n(8453);const r={},s="Container Management",c={},l=[{value:"Stopping a Container",id:"stopping-a-container",level:3},{value:"Container Redeploy",id:"container-redeploy",level:3}];function d(e){const t={em:"em",h1:"h1",h3:"h3",header:"header",p:"p",...(0,a.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.header,{children:(0,i.jsx)(t.h1,{id:"container-management",children:"Container Management"})}),"\n",(0,i.jsx)(t.p,{children:"The lifetime of a docker container is more like a virtual machine. They can be created, started, stopped, and destroyed. Komodo will display the state of the container and provides an API to manage all your container's lifetimes."}),"\n",(0,i.jsx)(t.p,{children:"This is achieved internally by running the appropriate docker command for the requested action (docker stop, docker start, etc)."}),"\n",(0,i.jsx)(t.h3,{id:"stopping-a-container",children:"Stopping a Container"}),"\n",(0,i.jsxs)(t.p,{children:["Sometimes you want to stop a running application but preserve its logs and configuration, either to be restarted later or to view the logs at a later time. It is more like ",(0,i.jsx)(t.em,{children:"pausing"})," the application with its current config, as no configuration (like environment variable, volume mounts, etc.) will be changed when the container is started again."]}),"\n",(0,i.jsxs)(t.p,{children:["Note that in order to restart an application with updated configuration, it must be ",(0,i.jsx)(t.em,{children:"redeployed"}),". stopping and starting a container again will keep all configuration as it was when the container was initially created."]}),"\n",(0,i.jsx)(t.h3,{id:"container-redeploy",children:"Container Redeploy"}),"\n",(0,i.jsx)(t.p,{children:"Redeploying is the action of destroying a container and recreating it. If you update deployment config, these changes will not take effect until the container is redeployed. Just note this will destroy the previous containers logs along with the container itself."})]})}function p(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>s});var o=n(6540);const i={},a=o.createContext(i);function r(e){const t=o.useContext(a);return o.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),o.createElement(a.Provider,{value:t},e.children)}}}]);
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[339],{4191:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>r,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"ecosystem/api","title":"API and Clients","description":"Komodo Core exposes an RPC-like HTTP API to read data, write configuration, and execute actions.","source":"@site/docs/ecosystem/api.md","sourceDirName":"ecosystem","slug":"/ecosystem/api","permalink":"/docs/ecosystem/api","draft":false,"unlisted":false,"editUrl":"https://github.com/moghtech/komodo/tree/main/docsite/docs/ecosystem/api.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"Komodo CLI","permalink":"/docs/ecosystem/cli"},"next":{"title":"Community","permalink":"/docs/ecosystem/community"}}');var o=n(4848),c=n(8453);const i={},a="API and Clients",r={},d=[{value:"Rust Client",id:"rust-client",level:2},{value:"Typescript Client",id:"typescript-client",level:2}];function l(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,c.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"api-and-clients",children:"API and Clients"})}),"\n",(0,o.jsxs)(t.p,{children:["Komodo Core exposes an RPC-like HTTP API to read data, write configuration, and execute actions.\nThere are typesafe clients available in\n",(0,o.jsx)(t.a,{href:"/docs/ecosystem/api#rust-client",children:(0,o.jsx)(t.strong,{children:"Rust"})})," and ",(0,o.jsx)(t.a,{href:"/docs/ecosystem/api#typescript-client",children:(0,o.jsx)(t.strong,{children:"Typescript"})}),"."]}),"\n",(0,o.jsxs)(t.p,{children:["The full API documentation is ",(0,o.jsx)(t.a,{href:"https://docs.rs/komodo_client/latest/komodo_client/api/index.html",children:(0,o.jsx)(t.strong,{children:"available here"})}),"."]}),"\n",(0,o.jsx)(t.h2,{id:"rust-client",children:"Rust Client"}),"\n",(0,o.jsxs)(t.p,{children:["The Rust client is published to crates.io at ",(0,o.jsx)(t.a,{href:"https://crates.io/crates/komodo_client",children:"komodo_client"}),"."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-rust",children:'let komodo = KomodoClient::new("https://demo.komo.do", "your_key", "your_secret")\n .with_healthcheck()\n .await?;\n\nlet stacks = komodo.read(ListStacks::default()).await?;\n\nlet update = komodo\n .execute(DeployStack {\n stack: stacks[0].name.clone(),\n stop_time: None\n })\n .await?;\n'})}),"\n",(0,o.jsx)(t.h2,{id:"typescript-client",children:"Typescript Client"}),"\n",(0,o.jsxs)(t.p,{children:["The Typescript client is published to NPM at ",(0,o.jsx)(t.a,{href:"https://www.npmjs.com/package/komodo_client",children:"komodo_client"}),"."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:'import { KomodoClient, Types } from "komodo_client";\n\nconst komodo = KomodoClient("https://demo.komo.do", {\n type: "api-key",\n params: {\n key: "your_key",\n secret: "your secret",\n },\n});\n\n// Inferred as Types.StackListItem[]\nconst stacks = await komodo.read("ListStacks", {});\n\n// Inferred as Types.Update\nconst update = await komodo.execute("DeployStack", {\n stack: stacks[0].name,\n});\n'})})]})}function p(e={}){const{wrapper:t}={...(0,c.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const o={},c=s.createContext(o);function i(e){const t=s.useContext(c);return s.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(c.Provider,{value:t},e.children)}}}]);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[235],{8552:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-pages","id":"default"}')}}]);
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[98],{1723:(n,e,s)=>{s.r(e),s.d(e,{default:()=>l});s(6540);var r=s(5500);function o(n,e){return`docs-${n}-${e}`}var t=s(3025),c=s(2831),i=s(1463),u=s(4848);function a(n){const{version:e}=n;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(i.A,{version:e.version,tag:o(e.pluginId,e.version)}),(0,u.jsx)(r.be,{children:e.noIndex&&(0,u.jsx)("meta",{name:"robots",content:"noindex, nofollow"})})]})}function d(n){const{version:e,route:s}=n;return(0,u.jsx)(r.e3,{className:e.className,children:(0,u.jsx)(t.n,{version:e,children:(0,c.v)(s.routes)})})}function l(n){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a,{...n}),(0,u.jsx)(d,{...n})]})}}}]);
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[742],{7093:e=>{e.exports=JSON.parse('{"name":"docusaurus-plugin-content-docs","id":"default"}')}}]);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[39],{3021:(e,t,s)=>{s.d(t,{A:()=>b});var n=s(6540),r=s(4164),o=s(6972),c=s(8774),i=s(4586);const a=["zero","one","two","few","many","other"];function l(e){return a.filter(t=>e.includes(t))}const u={locale:"en",pluralForms:l(["one","other"]),select:e=>1===e?"one":"other"};function d(){const{i18n:{currentLocale:e}}=(0,i.A)();return(0,n.useMemo)(()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:l(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),u}},[e])}function m(){const e=d();return{selectMessage:(t,s)=>function(e,t,s){const n=e.split("|");if(1===n.length)return n[0];n.length>s.pluralForms.length&&console.error(`For locale=${s.locale}, a maximum of ${s.pluralForms.length} plural forms are expected (${s.pluralForms.join(",")}), but the message contains ${n.length}: ${e}`);const r=s.select(t),o=s.pluralForms.indexOf(r);return n[Math.min(o,n.length-1)]}(s,t,e)}}var h=s(6654),f=s(1312),p=s(1107);const x={cardContainer:"cardContainer_fWXF",cardTitle:"cardTitle_rnsV",cardDescription:"cardDescription_PWke"};var g=s(4848);function y({className:e,href:t,children:s}){return(0,g.jsx)(c.A,{href:t,className:(0,r.A)("card padding--lg",x.cardContainer,e),children:s})}function j({className:e,href:t,icon:s,title:n,description:o}){return(0,g.jsxs)(y,{href:t,className:e,children:[(0,g.jsxs)(p.A,{as:"h2",className:(0,r.A)("text--truncate",x.cardTitle),title:n,children:[s," ",n]}),o&&(0,g.jsx)("p",{className:(0,r.A)("text--truncate",x.cardDescription),title:o,children:o})]})}function N({item:e}){const t=(0,o.Nr)(e),s=function(){const{selectMessage:e}=m();return t=>e(t,(0,f.T)({message:"1 item|{count} items",id:"theme.docs.DocCard.categoryDescription.plurals",description:"The default description for a category card in the generated index about how many items this category includes"},{count:t}))}();return t?(0,g.jsx)(j,{className:e.className,href:t,icon:"\ud83d\uddc3\ufe0f",title:e.label,description:e.description??s(e.items.length)}):null}function C({item:e}){const t=(0,h.A)(e.href)?"\ud83d\udcc4\ufe0f":"\ud83d\udd17",s=(0,o.cC)(e.docId??void 0);return(0,g.jsx)(j,{className:e.className,href:e.href,icon:t,title:e.label,description:e.description??s?.description})}function w({item:e}){switch(e.type){case"link":return(0,g.jsx)(C,{item:e});case"category":return(0,g.jsx)(N,{item:e});default:throw new Error(`unknown item type ${JSON.stringify(e)}`)}}const k={docCardListItem:"docCardListItem_W1sv"};function v({className:e}){const t=(0,o.a4)();return(0,g.jsx)(b,{items:t,className:e})}function A({item:e}){return(0,g.jsx)("article",{className:(0,r.A)(k.docCardListItem,"col col--6"),children:(0,g.jsx)(w,{item:e})})}function b(e){const{items:t,className:s}=e;if(!t)return(0,g.jsx)(v,{...e});const n=(0,o.d1)(t);return(0,g.jsx)("section",{className:(0,r.A)("row",s),children:n.map((e,t)=>(0,g.jsx)(A,{item:e},t))})}},7350:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>m,frontMatter:()=>i,metadata:()=>n,toc:()=>u});const n=JSON.parse('{"id":"ecosystem/index","title":"Ecosystem","description":"","source":"@site/docs/ecosystem/index.mdx","sourceDirName":"ecosystem","slug":"/ecosystem","permalink":"/docs/ecosystem","draft":false,"unlisted":false,"editUrl":"https://github.com/moghtech/komodo/tree/main/docsite/docs/ecosystem/index.mdx","tags":[],"version":"current","frontMatter":{"slug":"/ecosystem"},"sidebar":"docs","previous":{"title":"Permissioning","permalink":"/docs/resources/permissioning"},"next":{"title":"Komodo CLI","permalink":"/docs/ecosystem/cli"}}');var r=s(4848),o=s(8453),c=s(3021);const i={slug:"/ecosystem"},a="Ecosystem",l={},u=[];function d(e){const t={h1:"h1",header:"header",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.header,{children:(0,r.jsx)(t.h1,{id:"ecosystem",children:"Ecosystem"})}),"\n","\n",(0,r.jsx)(c.A,{})]})}function m(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,s)=>{s.d(t,{R:()=>c,x:()=>i});var n=s(6540);const r={},o=n.createContext(r);function c(e){const t=n.useContext(o);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]);
-1
View File
@@ -1 +0,0 @@
"use strict";(self.webpackChunkdocsite=self.webpackChunkdocsite||[]).push([[847],{4817:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"setup/version-upgrades","title":"Version Upgrades","description":"Most version upgrades only require a redeployment of the Core container after pulling the latest version, and are fully backward compatible with the periphery clients, which may be updated later on as convenient. This is the default, and will be the case unless specifically mentioned in the version release notes.","source":"@site/docs/setup/version-upgrades.md","sourceDirName":"setup","slug":"/setup/version-upgrades","permalink":"/docs/setup/version-upgrades","draft":false,"unlisted":false,"editUrl":"https://github.com/moghtech/komodo/tree/main/docsite/docs/setup/version-upgrades.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"Advanced Configuration","permalink":"/docs/setup/advanced"},"next":{"title":"Resources","permalink":"/docs/resources/"}}');var r=n(4848),o=n(8453);const i={},a="Version Upgrades",c={},d=[];function l(e){const t={a:"a",h1:"h1",header:"header",p:"p",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.header,{children:(0,r.jsx)(t.h1,{id:"version-upgrades",children:"Version Upgrades"})}),"\n",(0,r.jsxs)(t.p,{children:["Most version upgrades only require a redeployment of the Core container after pulling the latest version, and are fully backward compatible with the periphery clients, which may be updated later on as convenient. This is the default, and will be the case unless specifically mentioned in the ",(0,r.jsx)(t.a,{href:"https://github.com/moghtech/komodo/releases",children:"version release notes"}),"."]}),"\n",(0,r.jsx)(t.p,{children:"Some Core API upgrades may change behavior such as building / cloning, and require updating the Periphery binaries to match the Core version before this functionality can be restored. This will be specifically mentioned in the release notes."})]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>i,x:()=>a});var s=n(6540);const r={},o=s.createContext(r);function i(e){const t=s.useContext(o);return s.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-61
View File
@@ -1,61 +0,0 @@
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
* @license MIT */
/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
File diff suppressed because one or more lines are too long
+31
View File
@@ -0,0 +1,31 @@
{
"name": "@mbecker20/monitor-cli",
"version": "0.0.31",
"description": "A CLI to aid in the setup of monitor",
"author": "mbecker20",
"license": "GPL v3.0",
"bin": "cli.js",
"scripts": {
"start": "yarn build && build/cli.js",
"restart-default": "yarn build && build/cli.js --restart-default",
"build": "vite build && node post-build.mjs && chmod +x build/cli.js",
"update-version": "node update-version.mjs"
},
"dependencies": {
"ink": "^3.2.0",
"ink-link": "^2.0.0",
"ink-spinner": "^4.0.3",
"ink-text-input": "^4.0.3",
"jotai": "^1.6.1",
"meow": "^10.1.2",
"mongoose": "^6.2.7",
"react": "^17.0.2"
},
"devDependencies": {
"@monitor/types": "1.0.0",
"@types/node": "^17.0.21",
"@types/react": "^17.0.40",
"typescript": "^4.6.2",
"vite": "^2.8.6"
}
}
+22
View File
@@ -0,0 +1,22 @@
import { readFileSync, writeFileSync } from "fs";
const contents = readFileSync("build/cli.js").toString();
writeFileSync(
"build/cli.js",
"#!/usr/bin/env node\n" +
contents.replace(
`const meow = await Promise.resolve().then(function() {
return /* @__PURE__ */ _interopNamespace(require("meow"));
});`,
'const meow = await import("meow");'
)
);
const pkgjson = JSON.parse(readFileSync("package.json"));
delete pkgjson.devDependencies;
delete pkgjson.scripts;
// delete pkgjson.dependencies["@monitor/util"];
// pkgjson.bin = "cli.js";
writeFileSync("build/package.json", JSON.stringify(pkgjson, undefined, 2));
+32
View File
@@ -0,0 +1,32 @@
* intro
* is docker installed?
* starting core or periphery?
* core
* mongo -- should it be started?
* yes
* name, port, volume, restart
* no -- is it running locally? add as deployment?
* yes
* name, port, volume, restart
* no
* provide url
* registry -- should it be started?
* yes
* name, port, volume, restart
* no -- is it running locally? add as deployment?
* yes
* name, port, volume, restart
* no
* provide url
* monitor config
* name, secrets volume, use host network, port
* periphery
* install
+128
View File
@@ -0,0 +1,128 @@
import React, { ReactNode, useState } from "react";
import { Newline, render, Text, Box } from "ink";
import init from "./util/init";
import Intro from "./components/Intro";
import Docker from "./components/docker/Docker";
import IsPeriphery from "./components/IsPeriphery";
import Confirm from "./components/Confirm";
import { createUseConfig, createUseSequence } from "./util/state";
import { Config } from "./types";
import Mongo from "./components/deployment-config/Mongo";
import CoreOrPeriphery from "./components/core-or-periphery/CoreOrPeriphery";
import { bound } from "./util/helpers/general";
import Setup from "./components/Setup";
import Restart from "./components/Restart";
type Page = {
title: string;
view: ReactNode;
};
export const useMainSequence = createUseSequence();
export const useConfig = createUseConfig<Config>({});
init().then(({ flags, dockerInstalled }) => {
const App = () => {
const { current } = useMainSequence();
const [periphery, setPeriphery] = useState<boolean | undefined>(
flags.core ? false : flags.periphery ? true : undefined
);
if (flags.restart || flags.restartDefault) {
return (
<Box flexDirection="column">
<Newline />
<Box>
<Text color="blue" bold underline>
Monitor CLI{" "}
</Text>
<Box marginLeft={2}>
<Text color="gray">restart {`(1 of 1)`}</Text>
</Box>
</Box>
<Newline />
<Restart
useDefaults={flags.restartDefault ? true : false}
defaultMongoUrl={flags.mongoUrl}
defaultPullLatest={flags.pullLatest}
/>
</Box>
);
}
const corePages: Page[] = [
{
title: "mongo config",
view: <Mongo />,
},
{
title: "monitor core config",
view: <CoreOrPeriphery type="core" />,
},
];
const peripheryPages: Page[] = [
{
title: "periphery config",
view: <CoreOrPeriphery type="periphery" />,
},
];
const pages = [
{
title: "intro",
view: <Intro />,
},
dockerInstalled
? false
: {
title: "docker intro",
view: <Docker />,
},
{
title: "restart",
view: <Restart />,
},
!flags.core && !flags.periphery
? {
title: "core or periphery",
view: <IsPeriphery setPeriphery={setPeriphery} />,
}
: false,
periphery === true && peripheryPages,
periphery === false && corePages,
{
title: "confirm config",
view: <Confirm />,
},
{
title: "setup",
view: <Setup />,
},
]
.filter((val) => (val ? true : false))
.flat();
const { title, view } = pages[bound(current, 0, pages.length - 1)] as Page;
return (
<Box flexDirection="column">
<Newline />
<Box>
<Text color="blue" bold underline>
Monitor CLI{" "}
</Text>
<Box marginLeft={2}>
<Text color="gray">
{title} {`(${current + 1} of ${pages.length})`}
</Text>
</Box>
</Box>
<Newline />
{view}
</Box>
);
};
render(<App />);
});
+63
View File
@@ -0,0 +1,63 @@
import React, { Fragment } from "react";
import { useConfig, useMainSequence } from "../cli";
import EnterToContinue from "./util/EnterToContinue";
import { useEsc } from "../util/hooks";
import { Box, Newline, Text } from "ink";
import View from "./deployment-config/View";
import ViewCoreOrPeriphery from "./core-or-periphery/ViewCoreOrPeriphery";
const Confirm = () => {
const { config } = useConfig();
const { next, prev } = useMainSequence();
useEsc(prev);
return (
<Box flexDirection="column">
{config.mongo && (
<Fragment>
<Text color="cyan" bold>
mongo:
</Text>
<View url={config.mongo.url} config={config.mongo.startConfig} />
<Newline />
</Fragment>
)}
{/* {config.registry && (
<Fragment>
<Text color="cyan" bold>
registry:
</Text>
<View
url={config.registry.url!}
config={config.registry.startConfig}
/>
<Newline />
</Fragment>
)} */}
{config.core && (
<Fragment>
<Text color="cyan" bold>
monitor core:
</Text>
<ViewCoreOrPeriphery config={config.core} />
<Newline />
</Fragment>
)}
{config.periphery && (
<Fragment>
<Text color="cyan" bold>
monitor periphery:
</Text>
<ViewCoreOrPeriphery config={config.periphery} />
<Newline />
</Fragment>
)}
<EnterToContinue pressEnterTo="begin setup" onEnter={next} />
</Box>
);
};
export default Confirm;
+23
View File
@@ -0,0 +1,23 @@
import React from "react";
import { Box, Newline, Text } from "ink";
import EnterToContinue from "./util/EnterToContinue";
import { useMainSequence } from "../cli";
const Intro = () => {
const { next } = useMainSequence();
return (
<Box flexDirection="column">
<Text>
this is a CLI to setup{" "}
<Text color="cyan" bold>
monitor
</Text>
, a tool to manage application deployment.
</Text>
<Newline />
<EnterToContinue onEnter={next} />
</Box>
);
};
export default Intro;
+40
View File
@@ -0,0 +1,40 @@
import React, { useEffect } from "react";
import { Text } from "ink";
import LabelledSelector from "./util/LabelledSelector";
import { useConfig, useMainSequence } from "../cli";
import { useEsc } from "../util/hooks";
const IsPeriphery = ({
setPeriphery,
}: {
setPeriphery: (periphery: boolean) => void;
}) => {
const { next, prev } = useMainSequence();
const { setMany } = useConfig();
useEffect(() => {
setMany(
["core", undefined],
["periphery", undefined],
["mongo", undefined],
);
}, []);
useEsc(prev);
return (
<LabelledSelector
label={
<Text>
Are you setting up <Text color="cyan">monitor core</Text> or{" "}
<Text color="red">monitor periphery</Text>?
</Text>
}
items={["core", "periphery"]}
onSelect={(item) => {
setPeriphery(item === "periphery");
next();
}}
vertical
/>
);
};
export default IsPeriphery;
+185
View File
@@ -0,0 +1,185 @@
import React, { Fragment, useEffect } from "react";
import LabelledSelector from "./util/LabelledSelector";
import { useMainSequence } from "../cli";
import { useStore } from "../util/hooks";
import { Box, Newline, Text } from "ink";
import { Input } from "./util/Input";
import EnterToContinue from "./util/EnterToContinue";
import { CommandLogError } from "@monitor/types";
import { restart, RestartError } from "../util/helpers/restart";
import YesNo from "./util/YesNo";
type State = {
stage:
| "query"
| "mongo"
| "pullLatest"
| "confirm"
| "installing"
| "finished"
| "error";
pullLatest?: boolean;
mongoUrl?: string;
result?: CommandLogError;
error?: RestartError;
};
const DEPLOY_CORE_OR_PERIPHERY = "deploy monitor core or periphery";
const RESTART_CORE = "restart monitor core";
const Restart = ({
useDefaults,
defaultMongoUrl,
defaultPullLatest,
}: {
useDefaults?: boolean;
defaultMongoUrl?: string;
defaultPullLatest?: boolean;
}) => {
const { next, prev } = useMainSequence();
const [config, setConfig, setMany] = useStore<State>({
stage:
useDefaults
? "installing"
: defaultMongoUrl
? "pullLatest"
: "query",
mongoUrl: useDefaults
? "mongodb://127.0.0.1:27017/monitor"
: defaultMongoUrl,
pullLatest: useDefaults ? false : defaultPullLatest,
});
const { stage, mongoUrl, pullLatest, result, error } = config;
useEffect(() => {
if (stage === "installing") {
restart({ mongoUrl: mongoUrl!, pullLatest: pullLatest! }, (err) =>
setMany(["stage", "error"], ["error", err])
).then((success) => {
if (success) {
setMany(["stage", "finished"], ["result", success]);
}
});
} else if (stage === "finished" || stage === "error") {
process.exit();
}
}, [stage]);
if (stage === "query") {
return (
<LabelledSelector
label="What are you trying to do?"
items={[DEPLOY_CORE_OR_PERIPHERY, RESTART_CORE]}
onSelect={(option) => {
switch (option) {
case DEPLOY_CORE_OR_PERIPHERY:
next();
break;
case RESTART_CORE:
setConfig("stage", "mongo");
break;
}
}}
onEsc={prev}
vertical
/>
);
} else {
return (
<Box flexDirection="column">
{stage === "mongo" && (
<Text color="green">
mongo url:{" "}
<Text color="white">
<Input
initialValue={mongoUrl || "mongodb://127.0.0.1:27017/monitor"}
onSubmit={(mongoUrl) =>
setMany(["stage", "pullLatest"], ["mongoUrl", mongoUrl])
}
onEsc={() => setConfig("stage", "query")}
/>
</Text>
</Text>
)}
{mongoUrl && stage !== "mongo" && (
<Text color="green">
mongo url: <Text color="white">{mongoUrl}</Text>
</Text>
)}
{stage === "pullLatest" && (
<YesNo
label="pull latest core?"
onSelect={(res) => {
setMany(["stage", "confirm"], ["pullLatest", res === "yes"]);
}}
onEsc={() => setConfig("stage", "mongo")}
/>
)}
{pullLatest !== undefined && stage !== "pullLatest" && (
<Text color="green">
pull latest: <Text color="white">{pullLatest ? "yes" : "no"}</Text>
</Text>
)}
<Newline />
{stage === "confirm" && (
<EnterToContinue
onEnter={() => {
setConfig("stage", "installing");
}}
onEsc={() => setConfig("stage", "pullLatest")}
pressEnterTo="restart monitor"
/>
)}
{(stage === "installing" || stage === "error") && (
<Fragment>
<Text>restarting...</Text>
</Fragment>
)}
{result && (
<Fragment>
<Text color="green">finished restarting</Text>
<Newline />
<Box flexDirection="column" marginLeft={2}>
<Text color="green">
command: <Text color="white">{result.command}</Text>
</Text>
{result.log.stderr ? (
<Text color="red">
stderr: <Text color="white">{result.log.stderr}</Text>
</Text>
) : undefined}
{result.log.stdout ? (
<Text color="blue">
stdout: <Text color="white">{result.log.stdout}</Text>
</Text>
) : undefined}
</Box>
<Newline />
</Fragment>
)}
{error && (
<Fragment>
<Newline />
<Text color="red">error restarting</Text>
<Newline />
<Text>{error.message}</Text>
<Text>{error.error}</Text>
<Newline />
</Fragment>
)}
</Box>
);
}
};
export default Restart;
+166
View File
@@ -0,0 +1,166 @@
import React, { Fragment, useEffect, useState } from "react";
import { Box, Newline, Text } from "ink";
import { useConfig } from "../cli";
import deploy, { Stage, Update } from "../util/helpers/deploy";
import { Config } from "../types";
const Setup = () => {
const { config } = useConfig();
const [updates, setUpdates] = useState<Update[]>([getInitialUpdate(config)]);
const [error, setError] = useState<string>();
const [finished, setFinished] = useState(false);
useEffect(() => {
deploy(config, (update) =>
setUpdates((updates) => {
const newUpdates = [update, getNextUpdate(update)].filter(
(val) => val
) as Update[];
return [...updates, ...newUpdates];
})
)
.then(() => setFinished(true))
.catch((err) => setError(err));
}, []);
useEffect(() => {
if (finished) process.exit();
}, [finished]);
useEffect(() => {
if (error) process.exit();
}, [error]);
return (
<Box flexDirection="column">
<Text>
setting up{" "}
{config.core ? (
<Text color="cyan">monitor core</Text>
) : (
<Text color="red">monitor periphery</Text>
)}
...
</Text>
<Newline />
{updates.map(({ stage, result, description }, i) => (
<Fragment key={i}>
<Text>
{description}{" "}
<Text color="gray">
({getStageNumber(config, stage)} of {getTotalSteps(config)})
</Text>
</Text>
{result && (
<Box marginLeft={2} flexDirection="column">
<Text color="green">
command: <Text color="white">{result.command}</Text>
</Text>
{result.log.stderr ? (
<Text color="red">
stderr: <Text color="white">{result.log.stderr}</Text>
</Text>
) : undefined}
{result.log.stdout ? (
<Text color="green">
stdout: <Text color="white">{result.log.stdout}</Text>
</Text>
) : undefined}
</Box>
)}
</Fragment>
))}
{finished && (
<Fragment>
<Newline />
<Text>
<Text color={config.core ? "cyan" : "red"} bold>
{config.core ? "monitor core" : "monitor periphery"}
</Text>{" "}
setup <Text color="green">finished</Text>.
</Text>
</Fragment>
)}
{error && (
<Fragment>
<Newline />
<Text>
setup encountered an <Text color="red">error</Text>:
</Text>
<Box marginLeft={2}>
<Text>{error}</Text>
</Box>
<Newline />
<Text>
process{" "}
<Text color="red" bold>
exiting
</Text>
.
</Text>
</Fragment>
)}
<Newline />
</Box>
);
};
function getInitialUpdate(config: Config): Update {
if (config.core) {
if (config.mongo?.startConfig) {
return {
stage: "mongo",
description: "starting mongo",
};
} else {
return {
stage: "core",
description: "starting monitor core",
};
}
} else {
return {
stage: "periphery",
description: "starting monitor periphery",
};
}
}
function getNextUpdate({ stage }: Update): Update | undefined {
switch (stage) {
case "mongo":
return {
stage: "core",
description: "starting monitor core...",
};
case "core":
return {
stage: "docs",
description: "adding configurations to db...",
};
}
}
function getStageNumber(config: Config, stage: Stage) {
switch (stage) {
case "mongo":
return 1;
case "core":
return 1 + (config.mongo?.startConfig ? 1 : 0);
case "docs":
return 2 + (config.mongo?.startConfig ? 1 : 0);
case "periphery":
return 1;
}
}
function getTotalSteps(config: Config) {
if (config.periphery) {
return 1;
} else {
return 2 + (config.mongo?.startConfig ? 1 : 0);
}
}
export default Setup;
@@ -0,0 +1,222 @@
import React, { Fragment } from "react";
import { Box, Newline, Text } from "ink";
import { join, resolve } from "path";
import { useConfig, useMainSequence } from "../../cli";
import { useEsc, useStore } from "../../util/hooks";
import {
DEFAULT_PERIPHERY_PORT,
DEFAULT_PORT,
RESTART_MODES,
} from "../../config";
import EnterToContinue from "../util/EnterToContinue";
import { ControlledInput } from "../util/Input";
import NumberInput from "../util/NumberInput";
import { CoreOrPeripheryConfig } from "../../types";
import LabelledSelector from "../util/LabelledSelector";
import {
noTrailingSlash,
toDashedName,
trailingSlash,
} from "../../util/helpers/general";
type Stage =
| "name"
| "secret"
| "sysroot"
| "host"
| "port"
| "restart"
| "confirm";
const CoreOrPeriphery = ({ type }: { type: "core" | "periphery" }) => {
const { set } = useConfig();
const { next, prev } = useMainSequence();
const isCore = type === "core";
const [config, setConfig, setMany] = useStore<
Partial<CoreOrPeripheryConfig> & { stage: Stage }
>({
stage: "name",
name: isCore ? "monitor-core" : "monitor-periphery",
});
const { stage, name, secretVolume, host, port, restart, sysroot } = config;
useEsc(() => {
switch (stage) {
case "name":
prev();
break;
case "secret":
setConfig("stage", "name");
break;
case "sysroot":
setConfig("stage", "secret");
break;
case "host":
setConfig("stage", "sysroot");
break;
case "port":
setMany(["stage", isCore ? "host" : "sysroot"]);
break;
case "restart":
setMany(["stage", "port"]);
break;
case "confirm":
setMany(["stage", "restart"], ["restart", undefined]);
break;
}
});
return (
<Box flexDirection="column">
<Text color="green">
name:{" "}
<Text color="white">
{stage === "name" ? (
<ControlledInput
value={name!}
onChange={(name) => setConfig("name", name)}
onSubmit={(name) => {
setMany(["stage", "secret"], ["name", name]);
}}
/>
) : (
name
)}
</Text>
</Text>
{stage === "secret" && (
<Text color="green">
secrets folder:{" "}
<Text color="white">
<ControlledInput
value={secretVolume || join(resolve("."), "/secrets")}
onChange={(volume) => setConfig("secretVolume", volume)}
onSubmit={(volume) => {
setMany(["stage", "sysroot"], ["secretVolume", volume]);
}}
/>
</Text>
</Text>
)}
{(secretVolume || undefined) && stage !== "secret" && (
<Text color="green">
secrets folder: <Text color="white">{secretVolume}</Text>
</Text>
)}
{stage === "sysroot" && (
<Text color="green">
system root folder:{" "}
<Text color="white">
<ControlledInput
value={sysroot || join(resolve("."), "/monitor")}
onChange={(sysroot) => setConfig("sysroot", sysroot)}
onSubmit={(sysroot) => {
setMany(["stage", isCore ? "host" : "port"], ["sysroot", trailingSlash(sysroot)]);
}}
/>
</Text>
</Text>
)}
{sysroot && stage !== "sysroot" && (
<Text color="green">
system root: <Text color="white">{sysroot}</Text>
</Text>
)}
{stage === "host" && (
<Text color="green">
host address:{" "}
<Text color="white">
<ControlledInput
value={host || "http://localhost:9000"}
onChange={(host) => setConfig("host", host)}
onSubmit={(host) => {
setMany(["stage", "port"], ["host", noTrailingSlash(host)]);
}}
/>
</Text>
</Text>
)}
{host && stage !== "host" && (
<Text color="green">
host address: <Text color="white">{host}</Text>
</Text>
)}
{stage === "port" && (
<Text color="green">
port:{" "}
<Text color="white">
<NumberInput
initialValue={
port ||
(type === "core" ? DEFAULT_PORT : DEFAULT_PERIPHERY_PORT)
}
onSubmit={(port) => {
setMany(["stage", "restart"], ["port", port]);
}}
/>
</Text>
</Text>
)}
{port && stage !== "port" && (
<Text color="green">
port: <Text color="white">{port}</Text>
</Text>
)}
{stage === "restart" && (
<LabelledSelector
label="restart: "
items={RESTART_MODES}
onSelect={(restart) => {
setMany(
["stage", "confirm"],
[
"restart",
restart === "don't restart" ? "no" : toDashedName(restart),
]
);
}}
/>
)}
{restart && (
<Text color="green">
restart: <Text color="white">{restart}</Text>
</Text>
)}
{stage === "confirm" && (
<Fragment>
<Newline />
<EnterToContinue
onEnter={() => {
set(type, {
name: name!,
secretVolume: secretVolume!,
port: Number(port),
restart: restart!,
sysroot: sysroot!,
host,
});
next();
}}
/>
</Fragment>
)}
</Box>
);
};
export default CoreOrPeriphery;
@@ -0,0 +1,31 @@
import React from "react";
import { Box, Text } from "ink";
import { CoreOrPeripheryConfig } from "../../types";
const ViewCoreOrPeriphery = ({
config: { name, secretVolume, port, restart, sysroot },
}: {
config: CoreOrPeripheryConfig;
}) => {
return (
<Box flexDirection="column" marginLeft={2}>
<Text color="green">
name: <Text color="white">{name}</Text>
</Text>
<Text color="green">
secrets folder: <Text color="white">{secretVolume}</Text>
</Text>
<Text color="green">
system root: <Text color="white">{sysroot}</Text>
</Text>
<Text color="green">
port: <Text color="white">{port}</Text>
</Text>
<Text color="green">
restart: <Text color="white">{restart}</Text>
</Text>
</Box>
);
};
export default ViewCoreOrPeriphery;
@@ -0,0 +1,173 @@
import React, { Fragment } from "react";
import { Box, Newline, Text } from "ink";
import { useEsc, useStore } from "../../util/hooks";
import EnterToContinue from "../util/EnterToContinue";
import LabelledSelector from "../util/LabelledSelector";
import YesNo from "../util/YesNo";
import { toDashedName } from "../../util/helpers/general";
import { Input } from "../util/Input";
import NumberInput from "../util/NumberInput";
import { RESTART_MODES } from "../../config";
type DeploymentConfig = {
stage: "name" | "port" | "volume" | "restart" | "confirm";
name: string;
port?: number;
volume?: string | false;
restart?: string;
};
const DeploymentConfig = ({
deployment,
onFinish,
back,
}: {
deployment: "mongo-db" | "registry";
onFinish: (config: DeploymentConfig) => void;
back: () => void;
}) => {
const [config, setConfig, setMany] = useStore<DeploymentConfig>({
stage: "name",
name: deployment,
});
const { stage, name, port, volume, restart } = config;
useEsc(() => {
switch (stage) {
case "name":
back();
break;
case "port":
setConfig("stage", "name");
break;
case "volume":
if (volume) {
setConfig("volume", undefined);
} else {
setMany(["stage", "port"], ["volume", undefined]);
}
break;
case "restart":
setMany(
["stage", "volume"],
volume === false ? ["volume", undefined] : ["volume", volume]
);
break;
case "confirm":
setMany(["stage", "restart"], ["restart", undefined]);
break;
}
});
return (
<Box flexDirection="column">
<Text color="green">
name:{" "}
<Text color="white">
{stage === "name" ? (
<Input
initialValue={name}
onSubmit={(name) => {
setMany(["stage", "port"], ["name", name]);
}}
/>
) : (
name
)}
</Text>
</Text>
{stage === "port" && (
<Text color="green">
port:{" "}
<Text color="white">
<NumberInput
initialValue={port || (deployment === "mongo-db" ? 27017 : 5000)}
onSubmit={(port) => {
setMany(["stage", "volume"], ["port", port]);
}}
/>
</Text>
</Text>
)}
{port && stage !== "port" && (
<Text color="green">
port: <Text color="white">{port}</Text>
</Text>
)}
{stage === "volume" && volume === undefined && (
<YesNo
label={
<Text>
mount data on local filesystem? this is used to{" "}
<Text color="green">persist data</Text> between{" "}
<Text color="green">container restarts</Text>.
</Text>
}
onSelect={(use) => {
if (use === "yes") {
setConfig("volume", `~/${name}`);
} else {
setMany(["stage", "restart"], ["volume", false]);
}
}}
vertical
noYes
/>
)}
{volume !== undefined && (
<Text color="green">
mount folder:{" "}
<Text color="white">
{stage === "volume" ? (
<Input
initialValue={volume as string}
onSubmit={(volume) => {
setMany(["stage", "restart"], ["volume", volume]);
}}
/>
) : (
volume || "don't use"
)}
</Text>
</Text>
)}
{stage === "restart" && (
<LabelledSelector
label="restart: "
items={RESTART_MODES}
onSelect={(restart) => {
setMany(
["stage", "confirm"],
[
"restart",
restart === "don't restart" ? "no" : toDashedName(restart),
]
);
}}
/>
)}
{restart && (
<Text color="green">
restart: <Text color="white">{restart}</Text>
</Text>
)}
{stage === "confirm" && (
<Fragment>
<Newline />
<EnterToContinue onEnter={() => onFinish(config)} />
</Fragment>
)}
</Box>
);
};
export default DeploymentConfig;
@@ -0,0 +1,111 @@
import React from "react";
import { Box, Newline, Text } from "ink";
import { useConfig, useMainSequence } from "../../cli";
import YesNo from "../util/YesNo";
import DeploymentConfig from "./DeploymentConfig";
import EnterToContinue from "../util/EnterToContinue";
import { DEFAULT_MONGO_URL } from "../../config";
import { useEsc, useStore } from "../../util/hooks";
import { Input } from "../util/Input";
import { toDashedName } from "../../util/helpers/general";
type State = {
setup?: boolean;
mongoUrl: string;
confirm: boolean;
}
const Mongo = () => {
const { set } = useConfig();
const { next, prev } = useMainSequence();
const [state, setState, setMany] = useStore<State>({
mongoUrl: DEFAULT_MONGO_URL,
confirm: false,
})
const { setup, mongoUrl, confirm } = state;
useEsc(() => {
if (setup === false) {
if (confirm) {
setState("confirm", false);
} else {
setState("setup", undefined);
}
} else if (setup === undefined) {
prev();
}
})
if (setup === undefined) {
return (
<YesNo
label={
<Text>
do you need to set up{" "}
<Text color="cyan" bold>
mongo db
</Text>{" "}
locally?{" "}
</Text>
}
onSelect={(res) => setState("setup", res === "yes")}
vertical
/>
);
}
if (setup) {
return (
<DeploymentConfig
deployment="mongo-db"
back={() => setState("setup", undefined)}
onFinish={({ name, port, volume, restart }) => {
set("mongo", {
url: `mongodb://${toDashedName(name)}:${port}/monitor`,
startConfig: {
name,
port: port as number,
volume: volume as string | false,
restart: restart as string,
},
});
next();
}}
/>
);
} else {
if (confirm) {
return (
<Box flexDirection="column">
<Text color="green">
mongo url: <Text color="white">{mongoUrl}</Text>
</Text>
<Newline />
<EnterToContinue
onEnter={() => {
set("mongo", { url: mongoUrl });
next();
}}
/>
</Box>
);
} else {
return (
<Text color="green">
mongo url:{" "}
<Text color="white">
<Input
initialValue={mongoUrl}
onSubmit={(mongoUrl) => {
setMany(["mongoUrl", mongoUrl], ["confirm", true]);
}}
/>
</Text>
</Text>
);
}
}
};
export default Mongo;
@@ -0,0 +1,108 @@
// import React from "react";
// import { Box, Newline, Text } from "ink";
// import { useConfig, useMainSequence } from "../../cli";
// import YesNo from "../util/YesNo";
// import DeploymentConfig from "./DeploymentConfig";
// import EnterToContinue from "../util/EnterToContinue";
// import { DEFAULT_REGISTRY_URL } from "../../config";
// import { useEsc, useStore } from "../../util/hooks";
// import { Input } from "../util/Input";
// import { toDashedName } from "../../util/helpers/general";
// type State = {
// setup?: boolean;
// regUrl: string;
// confirm: boolean;
// };
// const Registry = () => {
// const { set } = useConfig();
// const { next, prev } = useMainSequence();
// const [state, setState, setMany] = useStore<State>({
// regUrl: DEFAULT_REGISTRY_URL,
// confirm: false,
// });
// const { setup, regUrl, confirm } = state;
// useEsc(() => {
// if (setup === false) {
// if (confirm) {
// setState("confirm", false);
// } else {
// setState("setup", undefined);
// }
// } else if (setup === undefined) {
// prev();
// }
// });
// if (setup === undefined) {
// return (
// <YesNo
// label={
// <Text>
// do you need to set up a{" "}
// <Text color="cyan" bold>
// docker registry
// </Text>{" "}
// locally?{" "}
// </Text>
// }
// onSelect={(res) => setState("setup", res === "yes")}
// vertical
// />
// );
// }
// if (setup) {
// return (
// <DeploymentConfig
// deployment="registry"
// back={() => setState("setup", undefined)}
// onFinish={({ name, port, volume, restart }) => {
// set("registry", {
// url: `http://${toDashedName(name)}:${port}/`,
// startConfig: {
// name,
// port: Number(port),
// volume: volume as string | false,
// restart: restart as string,
// },
// });
// next();
// }}
// />
// );
// } else {
// if (confirm) {
// return (
// <Box flexDirection="column">
// <Text color="green">
// registry url: <Text color="white">{regUrl}</Text>
// </Text>
// <Newline />
// <EnterToContinue
// onEnter={() => {
// set("registry", { url: regUrl });
// next();
// }}
// />
// </Box>
// );
// } else {
// return (
// <Text color="green">
// registry url:{" "}
// <Text color="white">
// <Input
// initialValue={regUrl}
// onSubmit={(regUrl) => setMany(["regUrl", regUrl], ["confirm", true])}
// />
// </Text>
// </Text>
// );
// }
// }
// };
// export default Registry;
@@ -0,0 +1,32 @@
import React, { Fragment } from "react";
import { Box, Text } from "ink";
import { StartConfig } from "../../types";
const View = ({ url, config }: { url: string, config?: StartConfig }) => {
const { name, port, volume, restart } = config || { name: "", port: "", volume: "", restart: "" };
return (
<Box flexDirection="column" marginLeft={2}>
<Text color="green">
url: <Text color="white">{url}</Text>
</Text>
{config && (
<Fragment>
<Text color="green">
name: <Text color="white">{name}</Text>
</Text>
<Text color="green">
port: <Text color="white">{port}</Text>
</Text>
<Text color="green">
mount folder: <Text color="white">{volume || "don't use"}</Text>
</Text>
<Text color="green">
restart: <Text color="white">{restart}</Text>
</Text>
</Fragment>
)}
</Box>
);
}
export default View;
+66
View File
@@ -0,0 +1,66 @@
import React, { Fragment, useEffect } from "react";
import { Newline, Text } from "ink";
import Link from "ink-link";
const Docker = () => {
useEffect(() => {
process.exit();
}, []);
// if (installDocker === undefined) {
// return (
// <YesNo
// label={
// <Text>
// Docker does not appear to be accessable. Would you like to{" "}
// <Text color="green">install docker</Text>? This will begin the{" "}
// <Text color="cyan" bold>
// Docker Install Helper
// </Text>
// . Docker is necessary to proceed.
// </Text>
// }
// onSelect={(res) => {
// setInstallDocker(res === "yes");
// }}
// vertical
// />
// );
// } else if (installDocker) {
// return <InstallDocker next={next} />;
// } else {
// return (
// <Fragment>
// <Text>
// install docker and restart the CLI to proceed. make sure that docker
// is accessable on the command line{" "}
// <Text color="green">without using sudo</Text>.
// </Text>
// <Newline />
// </Fragment>
// );
// }
return (
<Fragment>
<Text>
docker appears appears to be inaccessable.{" "}
<Link url="https://docs.docker.com/engine/install/">
<Text color="blue" bold>
install docker
</Text>
</Link>{" "}
and restart the CLI to proceed. make sure that docker is accessable on
the command line{" "}
<Link url="https://docs.docker.com/engine/install/linux-postinstall/">
<Text color="green" bold>
without using sudo
</Text>
</Link>
.
</Text>
<Newline />
</Fragment>
);
};
export default Docker;
+127
View File
@@ -0,0 +1,127 @@
import React, { Fragment, useState } from "react";
import { Box, Newline, Text } from "ink";
import YesNo from "../util/YesNo";
import { installDockerUbuntu, InstallLog } from "../../util/helpers/docker";
import { useEnter, useKey } from "../../util/hooks";
import Spinner from "ink-spinner";
const InstallDocker = ({ next }: { next: () => void }) => {
const [stage, setStage] = useState<
"sysCtlEnable" | "confirm" | "install" | "installing" | "finish" | "error"
>("sysCtlEnable");
const [sysCtlEnable, setSysCtlEnable] = useState<"yes" | "no">();
const [logs, setLogs] = useState<InstallLog[]>([]);
useEnter(async () => {
switch (stage) {
case "confirm":
setStage("installing");
const error = await installDockerUbuntu(
(log) => setLogs((logs) => [...logs, log]),
sysCtlEnable === "yes"
);
if (error) {
// there was some error
setStage("error");
} else {
setStage("finish");
}
break;
case "finish":
next();
break;
case "error":
setSysCtlEnable(undefined);
setStage("sysCtlEnable");
break;
}
});
useKey("leftArrow", () => {
switch (stage) {
case "confirm":
setSysCtlEnable(undefined);
setStage("sysCtlEnable");
break;
}
});
return (
<Box flexDirection="column">
<Text color="cyan" bold>
Docker Install Helper
</Text>
<Newline />
{stage === "sysCtlEnable" && sysCtlEnable === undefined && (
<YesNo
label="start docker on system start (boot)?"
labelColor="white"
onSelect={(res) => {
setSysCtlEnable(res);
setStage("confirm");
}}
vertical
/>
)}
{sysCtlEnable !== undefined && (
<Text color="green">
start on boot: <Text color="white">{sysCtlEnable}</Text>
</Text>
)}
<Newline />
{stage === "confirm" && (
<Text>
press <Text color="green">enter</Text> to install docker. you may have
to provide your password.
</Text>
)}
{(stage === "installing" || stage === "finish") && (
<Fragment>
{stage === "installing" && (
<Text>
<Text color="green">
<Spinner type="dots" />
</Text>{" "}
installing...
</Text>
)}
<Newline />
{logs.map(({ stage, log }) => {
<Fragment>
<Text color="cyan" bold>
{stage}
</Text>
<Text color="green">
command: <Text color="white">{log.command}</Text>
</Text>
{log.log.stdout ? (
<Text color="green">
stdout: <Text color="white">{log.log.stdout}</Text>
</Text>
) : undefined}
{log.log.stderr ? (
<Text color="red">
stderr: <Text color="white">{log.log.stderr}</Text>
</Text>
) : undefined}
<Newline />
</Fragment>;
})}
</Fragment>
)}
{stage === "finish" && (
<Text>
docker has finished installing. press <Text color="green">enter</Text>{" "}
to continue.
</Text>
)}
{stage === "error" && (
<Text>
there was an error during install. press{" "}
<Text color="green">enter</Text> to try again.
</Text>
)}
</Box>
);
};
export default InstallDocker;
@@ -0,0 +1,19 @@
import React from "react";
import { Text } from "ink";
import { useEnter, useEsc } from "../../util/hooks";
const EnterToContinue = ({ onEnter, pressEnterTo, onEsc }: { onEnter: () => void; pressEnterTo?: string; onEsc?: () => void; }) => {
useEnter(onEnter);
useEsc(() => onEsc && onEsc());
return (
<Text>
press{" "}
<Text color="green" bold>
enter
</Text>{" "}
to {pressEnterTo || "continue"}.
</Text>
);
};
export default EnterToContinue;
+42
View File
@@ -0,0 +1,42 @@
import React from "react";
import TextInput, { UncontrolledTextInput } from "ink-text-input";
import { useBlinker, useEsc } from "../../util/hooks";
export const Input = ({
initialValue,
onSubmit,
onEsc,
}: {
initialValue?: string;
onSubmit?: (val: string) => void;
onEsc?: () => void;
}) => {
useEsc(onEsc ? onEsc : () => {});
return (
<UncontrolledTextInput
initialValue={initialValue}
onSubmit={onSubmit}
/>
);
};
export const ControlledInput = ({
value,
onChange,
onSubmit,
onEsc,
}: {
value: string;
onChange: (val: string) => void;
onSubmit?: (val: string) => void;
onEsc?: () => void;
}) => {
useEsc(onEsc ? onEsc : () => {});
return (
<TextInput
value={value}
onChange={onChange}
onSubmit={onSubmit}
/>
);
};
@@ -0,0 +1,33 @@
import { Box, Newline, Text } from "ink";
import React, { ReactNode } from "react";
import Selector from "./Selector";
const LabelledSelector = ({
label,
items,
onSelect,
onEsc,
vertical,
labelColor = "white",
}: {
label: ReactNode;
labelColor?: "green" | "white";
items: string[];
onSelect?: (item: string, index: number) => void;
vertical?: boolean;
onEsc?: () => void;
}) => {
return (
<Box flexDirection={vertical ? "column" : "row"}>
{typeof label === "string" ? (
<Text color={labelColor}>{label} </Text>
) : (
label
)}
{vertical && <Newline />}
<Selector items={items} onSelect={onSelect} onEsc={onEsc} />
</Box>
);
};
export default LabelledSelector;
+41
View File
@@ -0,0 +1,41 @@
import React from "react";
import { Text } from "ink";
import TextInput from "ink-text-input";
import { useState } from "react";
import { useBlinker, useEsc } from "../../util/hooks";
const NumberInput = ({
initialValue,
onSubmit,
onEsc,
}: {
initialValue: number;
onSubmit?: (val: number) => void;
onEsc?: () => void;
}) => {
const [value, setValue] = useState(initialValue?.toString() || "");
const [error, setError] = useState(isNaN(Number(value)));
useEsc(onEsc ? onEsc : () => {});
return (
<Text>
<TextInput
value={value}
onChange={(val: string) => {
setError(isNaN(Number(val)));
setValue(val);
}}
onSubmit={(val: string) => {
const value = Number(val);
if (val) {
onSubmit && onSubmit(value);
} else {
setError(true);
}
}}
/>
{error && <Text color="gray"> (please enter a number)</Text>}
</Text>
);
};
export default NumberInput;
+34
View File
@@ -0,0 +1,34 @@
import React, { useState } from "react";
import { Box, Text, useInput } from "ink";
const Selector = (p: {
items: string[];
onSelect?: (item: string, i: number) => void;
onEsc?: () => void;
}) => {
const [highlighted, setHighlighted] = useState(0);
useInput((_, key) => {
if (key.upArrow) {
setHighlighted(Math.max(highlighted - 1, 0));
} else if (key.downArrow) {
setHighlighted(Math.min(highlighted + 1, p.items.length - 1));
} else if (key.return) {
if (p.onSelect) p.onSelect(p.items[highlighted]!, highlighted);
} else if (key.escape) {
if (p.onEsc) p.onEsc();
}
});
return (
<Box flexDirection="column">
{p.items.map((item, i) => {
return (
<Text key={i} color={i === highlighted ? "green" : "white"}>
{i === highlighted ? ">" : " "} {item}
</Text>
);
})}
</Box>
);
};
export default Selector;
+42
View File
@@ -0,0 +1,42 @@
import React, { ReactNode } from "react";
import LabelledSelector from "./LabelledSelector";
const YesNo = ({
label,
onYes,
onNo,
onSelect,
vertical,
labelColor,
noYes,
onEsc
}: {
label: ReactNode;
onYes?: () => void;
onNo?: () => void;
onSelect?: (res: "yes" | "no") => void;
vertical?: boolean;
labelColor?: "green" | "white";
noYes?: boolean;
onEsc?: () => void;
}) => {
return (
<LabelledSelector
label={label}
items={noYes ? ["no", "yes"] : ["yes", "no"]}
onSelect={(item) => {
if (item === "yes") {
onYes && onYes();
} else {
onNo && onNo();
}
onSelect && onSelect(item as "yes" | "no");
}}
vertical={vertical}
labelColor={labelColor}
onEsc={onEsc}
/>
);
};
export default YesNo;
+13
View File
@@ -0,0 +1,13 @@
export const DEFAULT_PORT = 9000;
export const DEFAULT_PERIPHERY_PORT = 8000;
export const DEFAULT_MONGO_URL = "mongodb://mongo-db:27017/monitor";
export const DEFAULT_REGISTRY_URL = "registry:5000/";
export const CORE_IMAGE = "mbecker2020/monitor-core";
export const PERIPHERY_IMAGE = "mbecker2020/monitor-periphery";
export const DOCKER_NETWORK = "monitor-network";
export const RESTART_MODES = [
"don't restart",
"unless stopped",
"on failure",
"always",
];
+34
View File
@@ -0,0 +1,34 @@
export type Config = {
core?: CoreOrPeripheryConfig;
periphery?: CoreOrPeripheryConfig;
mongo?: {
url: string;
startConfig?: StartConfig;
};
// registry?: {
// url: string;
// startConfig?: StartConfig;
// };
};
export type CoreOrPeripheryConfig = {
name: string;
secretVolume: string; // to mount secrets.json into the container
sysroot: string;
port: number;
restart: string;
host?: string;
};
export type StartConfig = {
// if this is attached, the cli will start container with this config and add
name: string;
port: number;
volume: string | false;
restart: string;
};
export type SetConfig = (
field: keyof Config,
val: Config[keyof Config]
) => void;
+47
View File
@@ -0,0 +1,47 @@
const getFlags = async () => {
const meow = await import("meow");
const cli = meow.default(
`
Usage
$ npx @mbecker20/monitor-cli
Options
--core, -c setup monitor core
--periphery, -p setup monitor periphery
--restart, -r restart monitor
--mongo-url the url of mongo used with monitor (used with restart)
--pull-latest whether to pull latest monitor core image (used with restart)
--restart-default restart monitor with defaults
Examples
$ npx @mbecker20/monitor-cli --core
`,
{
importMeta: import.meta,
flags: {
core: {
type: "boolean",
alias: "-c",
},
periphery: {
type: "boolean",
alias: "-p",
},
restart: {
type: "boolean",
alias: "-r",
},
mongoUrl: {
type: "string",
},
pullLatest: {
type: "boolean",
},
restartDefault: {
type: "boolean",
},
},
}
);
return cli.flags
};
export default getFlags;
+118
View File
@@ -0,0 +1,118 @@
import { CommandLogError } from "@monitor/types";
import {
CORE_IMAGE,
DEFAULT_PERIPHERY_PORT,
DEFAULT_PORT,
DOCKER_NETWORK,
PERIPHERY_IMAGE,
} from "../../config";
import { Config, StartConfig } from "../../types";
import { addInitialDocs } from "../mongoose/addInitialDocs";
import { deleteContainer } from "./docker";
import { execute } from "./execute";
import { noTrailingSlash, toDashedName, trailingSlash } from "./general";
export type Stage = "mongo" | "registry" | "core" | "periphery" | "docs";
export type Update = {
stage: Stage;
result?: CommandLogError;
description: string;
};
export default async function deploy(
config: Config,
onComplete: (update: Update) => void
) {
const { core, periphery, mongo } = config;
if (core) {
if (mongo) {
await createNetwork();
if (mongo.startConfig) {
const result = await deployMongo(mongo.startConfig);
onComplete({
stage: "mongo",
result,
description: "mongo started",
});
}
// if (registry.startConfig) {
// const result = await deployRegistry(registry.startConfig);
// onComplete({
// stage: "registry",
// result,
// description: "registry started",
// });
// }
const result = await deployCore(config);
onComplete({
stage: "core",
result,
description: "monitor core started",
});
await addInitialDocs(config);
onComplete({
stage: "docs",
description: "configurations added to db",
});
}
} else if (periphery) {
await deleteContainer(toDashedName(periphery.name));
const result = await deployPeriphery(config);
onComplete({
stage: "periphery",
result,
description: "monitor periphery started",
});
}
}
async function deployCore({ core, mongo }: Config) {
await execute("docker pull mbecker2020/monitor-core:latest");
const { name, secretVolume, port, restart, sysroot, host } = core!;
const nameConfig = `--name ${toDashedName(name)}`;
const volumes = `-v ${secretVolume}:/secrets -v /var/run/docker.sock:/var/run/docker.sock -v ${sysroot}:/monitor-root`;
const network = `-p ${port}:${DEFAULT_PORT} --network ${DOCKER_NETWORK}`;
const env = `-e MONGO_URL=${mongo?.url} -e SYSROOT=${trailingSlash(
core?.sysroot!
)} -e HOST=${noTrailingSlash(host!)}`;
const restartArg = `--restart ${restart}`;
const command = `docker run -d ${nameConfig} ${volumes} ${network} ${env} ${restartArg} ${CORE_IMAGE}`;
return await execute(command);
}
async function deployPeriphery({ periphery }: Config) {
await execute("docker pull mbecker2020/monitor-periphery:latest");
const { name, port, secretVolume, restart, sysroot } = periphery!;
const nameConfig = `--name ${toDashedName(name)}`;
const volume = `-v ${secretVolume}:/secrets -v /var/run/docker.sock:/var/run/docker.sock -v ${sysroot}:/monitor-root`;
const network = `-p ${port}:${DEFAULT_PERIPHERY_PORT}`;
const env = `-e SYSROOT=${trailingSlash(periphery?.sysroot!)}`;
const restartArg = `--restart ${restart}`;
const hostCommunication = "--add-host=host.docker.internal:host-gateway"
const command = `docker run -d ${nameConfig} ${volume} ${network} ${env} ${restartArg} ${hostCommunication} ${PERIPHERY_IMAGE}`;
return await execute(command);
}
async function deployMongo({ name, port, volume, restart }: StartConfig) {
const command = `docker run -d --name ${name} -p ${port}:27017${
volume ? ` -v ${volume}:/data/db` : ""
} --network ${DOCKER_NETWORK} --restart ${restart} mongo:latest`;
return await execute(command);
}
// async function deployRegistry({ name, port, volume, restart }: StartConfig) {
// const command = `docker run -d --name ${name} -p ${port}:5000${
// volume ? ` -v ${volume}:/var/lib/registry` : ""
// } --network ${DOCKER_NETWORK} --restart ${restart} registry:2`;
// return await execute(command);
// }
async function createNetwork() {
const command = `docker network create ${DOCKER_NETWORK}`;
return await execute(command);
}
+184
View File
@@ -0,0 +1,184 @@
import { CommandLogError, Conversion, DockerRunArgs, EnvironmentVar } from "@monitor/types";
import { execute } from "./execute";
export type InstallLog = {
stage: string;
log: CommandLogError;
};
export async function installDockerUbuntu(
onCommandEnd: (log: InstallLog) => void,
systemCtlEnable?: boolean
) {
const total = 6 + (systemCtlEnable ? 1 : 0);
const update = await execute("sudo apt-get update");
console.log(update);
onCommandEnd({
stage: `${
update.isError ? "error updating" : "updated"
} system (1 of ${total})`,
log: update,
});
if (update.isError) return true;
const installDeps = await execute(`sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release`);
console.log(installDeps);
onCommandEnd({
stage: `${
installDeps.isError ? "error installing" : "installed"
} dependencies (2 of ${total})`,
log: installDeps,
});
if (installDeps.isError) return true;
const addKey = await execute(
"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg"
);
console.log(addKey);
onCommandEnd({
stage: `${
addKey.isError ? "error adding" : "added"
} docker key (3 of ${total})`,
log: addKey,
});
if (addKey.isError) return true;
const setStableRepository = await execute(`echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null`);
console.log(setStableRepository);
onCommandEnd({
stage: `${
setStableRepository.isError ? "error setting" : "set"
} docker stable repository (4 of ${total})`,
log: setStableRepository,
});
if (setStableRepository.isError) return;
const installDocker = await execute(
"sudo apt-get udpate && sudo apt-get install docker-ce docker-ce-cli containerd.io -y"
);
console.log(installDocker);
onCommandEnd({
stage: `${
installDocker.isError ? "error installing" : "installed"
} docker (5 of ${total})`,
log: installDocker,
});
if (installDocker.isError) return true;
const addUser = await execute(
"sudo groupadd docker && sudo usermod -aG docker $USER && newgrp docker"
);
console.log(addUser)
onCommandEnd({
stage: `${
addUser.isError ? "error adding" : "added"
} user to docker user group (6 of ${total})`,
log: addUser,
});
if (addUser.isError) return true;
if (systemCtlEnable) {
const startOnBoot = await execute(
"sudo systemctl enable docker.service && sudo systemctl enable containerd.service"
);
console.log(startOnBoot);
onCommandEnd({
stage: `${
startOnBoot.isError ? "error configuring" : "configured"
} to start on boot (7 of ${total})`,
log: startOnBoot,
});
if (startOnBoot.isError) return true;
}
}
export async function isDockerInstalled() {
const res = await execute("docker ps");
return !res.isError;
}
export async function deleteContainer(containerName: string) {
return await execute(
`docker stop ${containerName} && docker container rm ${containerName}`
);
}
/* Docker Run for Deployments */
export async function dockerRun(
{
image,
ports,
environment,
network,
volumes,
restart,
postImage,
containerName,
containerUser,
}: DockerRunArgs
) {
const command =
`docker run -d` +
name(containerName) +
containerUserString(containerUser) +
portsString(ports) +
volsString(volumes) +
envString(environment) +
restartString(restart) +
networkString(network) +
` ${image}${postImage ? " " + postImage : ""}`;
return await execute(command);
}
function name(containerName?: string) {
return containerName ? ` --name ${containerName}` : "";
}
function portsString(ports?: Conversion[]) {
return ports && ports.length > 0
? ports
.map(({ local, container }) => ` -p ${local}:${container}`)
.reduce((prev, curr) => prev + curr)
: "";
}
function volsString(volumes?: Conversion[]) {
return volumes && volumes.length > 0
? volumes
.map(({ local, container }) => {
return ` -v ${local}:${container}`;
})
.reduce((prev, curr) => prev + curr)
: "";
}
function restartString(restart?: string) {
return restart
? ` --restart=${restart}${restart === "on-failure" ? ":10" : ""}`
: "";
}
function envString(environment?: EnvironmentVar[]) {
return environment && environment.length > 0
? environment
.map(({ variable, value }) => ` -e "${variable}=${value}"`)
.reduce((prev, curr) => prev + curr)
: "";
}
function networkString(network?: string) {
return network ? ` --network ${network}` : "";
}
function containerUserString(containerUser?: string) {
return containerUser && containerUser.length > 0
? ` -u ${containerUser}`
: "";
}
+25
View File
@@ -0,0 +1,25 @@
import { exec } from "child_process";
import { promisify } from "util";
import { CommandLogError } from "@monitor/types";
import { prettyStringify } from "./general";
export const pExec = promisify(exec);
export async function execute(
command: string,
commandForLog?: string
): Promise<CommandLogError> {
try {
return {
command,
log: await pExec(command),
isError: false,
};
} catch (err) {
return {
command: commandForLog || command,
log: { stderr: prettyStringify(err) },
isError: true,
};
}
}
+23
View File
@@ -0,0 +1,23 @@
export function toDashedName(name: string) {
return name.toLowerCase().replaceAll(" ", "-");
}
export function bound(num: number, min: number, max: number) {
return Math.min(max, Math.max(min, num));
}
export function prettyStringify(json: any): string {
return JSON.stringify(json, undefined, 2);
}
export function timestamp() {
return Math.floor(Date.now() / 1000);
}
export function trailingSlash(str: string) {
return str[str.length - 1] === "/" ? str : str + "/";
}
export function noTrailingSlash(str: string) {
return str[str.length - 1] === "/" ? str.slice(0, str.length - 1) : str;
}
+49
View File
@@ -0,0 +1,49 @@
import { getCoreDeployment } from "../mongoose/deployment";
import { deleteContainer, dockerRun } from "./docker";
import { execute } from "./execute";
import { prettyStringify } from "./general";
export type RestartError = {
message: string;
error: string;
}
export async function restart(
args: { mongoUrl: string, pullLatest: boolean },
onError: (err: RestartError) => void
) {
try {
if (args.pullLatest) {
try {
await execute("docker pull mbecker2020/monitor-core");
} catch (error) {
onError({
message: "failed to pull latest image",
error: prettyStringify(error),
});
}
}
const deployment = await getCoreDeployment(args);
if (deployment) {
try {
await deleteContainer(deployment.containerName!);
return await dockerRun(deployment);
} catch (error) {
onError({
message: "failed to restart container",
error: prettyStringify(error),
});
}
} else {
onError({
message: "could not find deployment at name",
error: "",
});
}
} catch (error) {
onError({
message: "failed to connect to mongo at url",
error: prettyStringify(error),
});
}
}
+55
View File
@@ -0,0 +1,55 @@
import { useInput, Key } from "ink";
import { useCallback, useEffect, useState } from "react";
export function useBlinker(interval = 750) {
const [on, setOn] = useState(false);
useEffect(() => {
const int = setInterval(() => {
setOn((on) => !on);
}, interval);
return () => clearInterval(int);
}, []);
return on;
}
export function useKey(key: keyof Key, callback: () => void) {
useInput((_, k) => {
if (k[key]) callback();
});
}
export function useEnter(onEnter: () => void) {
useKey("return", onEnter);
}
export function useEsc(onEsc: () => void) {
useKey("escape", onEsc);
}
export function useStore<T>(
init: T
): [
T,
(field: keyof T, val: T[keyof T]) => void,
(...updates: Array<[field: keyof T, val: T[keyof T]]>) => void
] {
const [store, setStore] = useState(init);
const set = useCallback((field: keyof T, val: T[keyof T]) => {
setStore((store) => ({ ...store, [field]: val }));
}, []);
const setMany = useCallback(
(...updates: Array<[field: keyof T, val: T[keyof T]]>) => {
setStore((store) =>
Object.assign(
{},
store,
...updates.map(([field, val]) => ({ [field]: val }))
)
);
},
[]
);
return [store, set, setMany];
}
+15
View File
@@ -0,0 +1,15 @@
import getFlags from "./flags";
import { isDockerInstalled } from "./helpers/docker";
// used to load async prerequisites
async function init() {
const flags = await getFlags();
const dockerInstalled = await isDockerInstalled();
return {
flags,
dockerInstalled
}
}
export default init;
+109
View File
@@ -0,0 +1,109 @@
import { Deployment, Update } from "@monitor/types";
import mongoose from "mongoose";
import { DEFAULT_PORT, DOCKER_NETWORK } from "../../config";
import { Config } from "../../types";
import { timestamp, toDashedName } from "../helpers/general";
import deploymentModel from "./deployment";
import serverModel from "./server";
import updateModel from "./update";
// import userModel from "./user";
export async function addInitialDocs({ core, mongo }: Config) {
await mongoose.connect(
mongo?.startConfig
? mongo!.url.replaceAll(toDashedName(mongo!.startConfig!.name), "127.0.0.1")
: mongo!.url
);
const servers = serverModel();
const deployments = deploymentModel();
const updates = updateModel();
// const users = userModel();
const coreServer = {
name: "core server",
address: "monitor core",
enabled: true,
isCore: true,
};
const coreServerID = (await servers.create(coreServer)).toObject()._id;
const coreDeployment: Deployment = {
name: core!.name,
isCore: true,
containerName: toDashedName(core!.name),
image: "mbecker2020/monitor-core",
restart: core?.restart,
volumes: [
{ local: core?.secretVolume!, container: "/secrets" },
{ local: "/var/run/docker.sock", container: "/var/run/docker.sock" },
{ local: core?.sysroot!, container: "/monitor-root" }
],
ports: [
{ local: core?.port.toString()!, container: DEFAULT_PORT.toString() },
],
environment: [
{ variable: "MONGO_URL", value: mongo!.url },
{ variable: "SYSROOT", value: core!.sysroot },
{ variable: "HOST", value: core!.host! }
],
network: DOCKER_NETWORK,
serverID: coreServerID,
owners: ["admin"],
};
await deployments.create(coreDeployment);
if (mongo?.startConfig) {
const mongoDeployment: Deployment = {
name: mongo.startConfig.name,
containerName: toDashedName(mongo.startConfig.name),
ports: [{ local: mongo.startConfig.port.toString(), container: "27017" }],
volumes: mongo.startConfig.volume
? [{ local: mongo.startConfig.volume, container: "/data/db" }]
: undefined,
restart: mongo.startConfig.restart,
image: "mongo",
network: DOCKER_NETWORK,
owners: ["admin"],
serverID: coreServerID,
};
await deployments.create(mongoDeployment);
}
// if (registry?.startConfig) {
// const registryDeployment: Deployment = {
// name: registry.startConfig.name,
// containerName: toDashedName(registry.startConfig.name),
// ports: [
// { local: registry.startConfig.port.toString(), container: "5000" },
// ],
// volumes: registry.startConfig.volume
// ? [
// {
// local: registry.startConfig.volume,
// container: "/var/lib/registry",
// },
// ]
// : undefined,
// restart: registry.startConfig.restart,
// image: "registry:2",
// network: DOCKER_NETWORK,
// serverID: coreServerID,
// owners: ["admin"],
// };
// await deployments.create(registryDeployment);
// }
const startupUpdate: Update = {
operation: "Startup",
command: "Start monitor",
log: {
stdout: "monitor started successfully",
},
timestamp: timestamp(),
note: "",
operator: "admin"
}
await updates.create(startupUpdate);
}
+53
View File
@@ -0,0 +1,53 @@
import { Deployment } from "@monitor/types";
import mongoose from "mongoose";
import { model, Schema } from "mongoose";
export default function deploymentModel() {
const Conversion = new Schema({
local: String,
container: String,
});
const EnvironmentVar = new Schema({
variable: String,
value: String,
});
const schema = new Schema<Deployment>({
name: { type: String, unique: true, index: true },
containerName: { type: String, unique: true, index: true }, // for auto pull of frontend repo as well
isCore: Boolean,
owners: { type: [String], default: [] },
serverID: { type: String, index: true },
buildID: { type: String, index: true }, // if deploying a monitor build
/* to create docker run command */
image: String, // used if deploying an external image (from docker hub)
ports: [Conversion],
volumes: [Conversion],
environment: [EnvironmentVar],
network: String,
restart: String,
postImage: String, // interpolated into run command after the image String
containerUser: String, // after -u in the run command
dockerAccount: String,
/* to manage repo for static frontend, mounted as a volume */
repo: String,
branch: String,
subfolder: String,
githubAccount: String,
containerMount: String, // the file path to mount repo on inside the container
repoMount: String,
});
return model("Deployment", schema)
}
export async function getCoreDeployment({ mongoUrl }: { mongoUrl: string }) {
await mongoose.connect(mongoUrl);
const deployments = deploymentModel();
return (await deployments.findOne({ isCore: true }).lean().exec()) as
| Deployment
| undefined;
}
+14
View File
@@ -0,0 +1,14 @@
import { Server } from "@monitor/types";
import { model, Schema } from "mongoose";
export default function serverModel() {
const schema = new Schema<Server>({
name: { type: String, unique: true },
address: String,
enabled: { type: Boolean, default: true },
isCore: Boolean,
owners: { type: [String], default: [] }
});
return model("Server", schema);
}
+24
View File
@@ -0,0 +1,24 @@
import { Update } from "@monitor/types";
import { model, Schema } from "mongoose";
export default function updateModel() {
const Log = new Schema({
stdout: String,
stderr: String,
});
const schema = new Schema<Update>({
buildID: { type: String, index: true },
deploymentID: { type: String, index: true },
serverID: { type: String, index: true },
operation: { type: String, index: true },
command: String,
log: Log,
timestamp: Number,
note: String,
isError: Boolean,
operator: { type: String, index: true }, // the userID or username
});
return model("Update", schema);
}
+14
View File
@@ -0,0 +1,14 @@
import { User } from "@monitor/types";
import { Schema, model } from "mongoose";
export default function userModel() {
const schema = new Schema<User>({
username: { type: String, index: true, required: true },
permissions: { type: Number, default: 0 },
password: String,
avatar: String,
githubID: { type: Number, index: true },
});
return model("User", schema);
}
+48
View File
@@ -0,0 +1,48 @@
import { atom, useAtom } from "jotai";
import { useCallback } from "react";
export function createUseConfig<T>(init: T) {
const configAtom = atom<T>(init);
return () => {
const [config, setConfig] = useAtom(configAtom);
const set = useCallback((field: keyof T, val: T[keyof T]) => {
setConfig((config) => ({ ...config, [field]: val }));
}, []);
const setMany = useCallback(
(...updates: Array<[field: keyof T, val: T[keyof T]]>) => {
setConfig((config) =>
Object.assign(
{},
config,
...updates.map(([field, val]) => ({ [field]: val }))
)
);
},
[]
);
return {
config: config as T,
set,
setMany
};
}
}
export function createUseSequence() {
const currentAtom = atom(0);
return () => {
const [current, set] = useAtom(currentAtom);
const next = useCallback(() => {
set((current) => current + 1);
}, []);
const prev = useCallback(() => {
set((current) => Math.max(current - 1, 0));
}, []);
return {
current,
next,
prev,
};
};
}
+20
View File
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"lib": [
"ESNext"
],
"module": "ESNext",
"jsx": "react",
"moduleResolution": "node",
"target": "ESNext",
"strict": true,
"esModuleInterop": true,
"allowJs": true,
"noImplicitAny": false,
"noEmit": true
},
"include": [
"src"
]
}
+16
View File
@@ -0,0 +1,16 @@
import { readFileSync, writeFileSync } from "fs";
const pkgjson = JSON.parse(readFileSync("package.json"));
const [major, minor, increment] = pkgjson.version
.split(".")
.map((item) => Number(item));
pkgjson.version = `${major}.${minor}.${increment + 1}`
writeFileSync(
"package.json",
JSON.stringify(pkgjson, undefined, 2)
);
console.log("version updated to", pkgjson.version);
+12
View File
@@ -0,0 +1,12 @@
import { defineConfig } from "vite";
export default defineConfig({
build: {
outDir: "build",
target: "node12",
ssr: true,
rollupOptions: {
input: "./src/cli.tsx",
},
},
});
+1
View File
@@ -0,0 +1 @@
frontend
+18
View File
@@ -0,0 +1,18 @@
FROM node:alpine
RUN apk update && apk add docker git openrc yarn python3 --no-cache
RUN addgroup root docker && rc-update add docker boot
WORKDIR /monitor
COPY ./build/package.json ./
RUN apk add --no-cache --virtual .gyp python3 make g++ \
&& npm i \
&& apk del .gyp
COPY ./build/main.js ./
COPY ./frontend /frontend
CMD node main.js
+43
View File
@@ -0,0 +1,43 @@
{
"name": "monitor-core",
"version": "1.0.0",
"main": "index.js",
"author": "mbecker20",
"license": "GPL v3.0",
"scripts": {
"start": "tsc && node build/main.js",
"build-copy-frontend": "cd ../frontend && yarn build && cd ../core && rm -r frontend && mkdir frontend && cp -a ../frontend/build/. ./frontend/",
"build": "vite build && node post-build.mjs && yarn build-copy-frontend && docker build -t mbecker2020/monitor-core .",
"push": "yarn build && docker push mbecker2020/monitor-core"
},
"devDependencies": {
"@monitor/types": "1.0.0",
"@swc/core": "^1.2.156",
"@types/bcrypt": "^5.0.0",
"@types/dockerode": "^3.3.3",
"@types/fs-extra": "^9.0.13",
"@types/ws": "^8.5.3",
"typescript": "^4.6.2",
"vite": "^2.8.6"
},
"dependencies": {
"@monitor/util": "1.0.0",
"@monitor/util-node": "1.0.0",
"@slack/web-api": "^6.7.1",
"axios": "^0.26.1",
"bcrypt": "^5.0.1",
"dockerode": "^3.3.1",
"fast-jwt": "^1.5.1",
"fastify": "^3.27.4",
"fastify-cors": "^6.0.3",
"fastify-helmet": "^7.0.1",
"fastify-jwt": "^4.1.3",
"fastify-oauth2": "^4.5.0",
"fastify-plugin": "^3.0.1",
"fastify-static": "^4.5.0",
"fastify-websocket": "^4.2.0",
"fs-extra": "^10.0.1",
"mongoose": "^6.2.6",
"node-os-utils": "^1.3.6"
}
}
+11
View File
@@ -0,0 +1,11 @@
import { readFileSync, writeFileSync } from "fs";
const raw = readFileSync("package.json");
const json = JSON.parse(raw);
delete json.scripts;
delete json.devDependencies;
delete json.dependencies["@monitor/util"];
delete json.dependencies["@monitor/util-node"];
writeFileSync("./build/package.json", JSON.stringify(json, undefined, 2));
+52
View File
@@ -0,0 +1,52 @@
import { CoreSecrets } from "@monitor/types";
import {
getBooleanFromEnv,
getNumberFromEnv,
getStringFromEnv,
readJSONFile,
} from "@monitor/util-node";
import { join } from "path";
export const CORE_SERVER_NAME = getStringFromEnv(
"CORE_SERVER_NAME",
"Monitor Core"
);
export let SECRETS: CoreSecrets = readJSONFile("/secrets/secrets.json");
export function refreshSecrets() {
SECRETS = readJSONFile("/secrets/secrets.json");
}
export const LOGGER = getBooleanFromEnv("LOGGER", false);
export const PORT = getNumberFromEnv("PORT", 9000);
export const HOST = getStringFromEnv("HOST", "http://localhost:" + PORT);
export const MONGO_URL = getStringFromEnv(
"MONGO_URL",
"mongodb://127.0.0.1:27017/monitor"
);
export const TOKEN_EXPIRES_IN = getStringFromEnv("TOKEN_EXPIRES_IN", "7d");
export const PASSWORD_SALT_ROUNDS = getNumberFromEnv("PASSWORD_SALT_ROUNDS", 8);
export const SYSROOT = getStringFromEnv("SYSROOT", "/home/ubuntu/"); // the root folder monitor has access to, prepends volumes mounted using useSysroot
export const ROOT = "/monitor-root/"; // the root folder in the container that SYSROOT is mounted on
export const DEPLOYDATA_ROOT = "deployments/";
export const BUILD_REPO_PATH = join(ROOT, "builds");
export const DEPLOYMENT_REPO_PATH = join(ROOT, "repos");
export const SYS_DEPLOYMENT_REPO_PATH = join(SYSROOT, "repos");
// export const REGISTRY_URL = getStringFromEnv("REGISTRY_URL", "localhost:5000/");
export const FRONTEND_PATH = getStringFromEnv("FRONTEND_PATH", "/frontend");
export const SYSTEM_OPERATOR = "Monitor";
export const PERMISSIONS_DENY_LOG = {
stderr: "Someone tried to access this route without appropriate permissions",
};
export const UPDATES_PER_REQUEST = getNumberFromEnv("UPDATES_PER_REQUEST", 10);
export const SERVER_CHECK_TIMEOUT = getNumberFromEnv(
"SERVER_CHECK_TIMEOUT",
1000
);
export const SERVER_STATS_INTERVAL = getNumberFromEnv("SERVER_STATS_INTERVAL_MINUTES", 5) * 60 * 1000; // 5 minute check default
export const CLEAR_ALREADY_ALERTED_INTERVAL = getNumberFromEnv("CLEAR_ALREADY_ALERTED_INTERVAL_HOUR", 24) * 60 * 60 * 1000; // 24 hour default clear interval
export const SLACK_CHANNEL = getStringFromEnv("SLACK_CHANNEL", "");
export const CPU_USAGE_NOTIFY_LIMIT = getNumberFromEnv("CPU_USAGE_NOTIFY_LIMIT", 50);
export const MEM_USAGE_NOTIFY_LIMIT = getNumberFromEnv("MEM_USAGE_NOTIFY_LIMIT", 75);
export const DISK_USAGE_NOTIFY_LIMIT = getNumberFromEnv("DISK_USAGE_NOTIFY_LIMIT", 75);
export const DAILY_UPDATE_UTC_HOUR = getNumberFromEnv("DAILY_UPDATE_UTC_HOUR", 14);
+51
View File
@@ -0,0 +1,51 @@
import fastify from "fastify";
import fastifyCors from "fastify-cors";
import fastifyHelmet from "fastify-helmet";
import { HOST, LOGGER, PORT } from "./config";
import auth from "./plugins/auth";
import db from "./plugins/db";
import ws from "./plugins/ws";
import docker from "./plugins/docker";
import frontend from "./plugins/frontend";
import actionStates from "./plugins/actionStates";
import routes from "./routes";
import slackNotifier from "./plugins/slackNotifier";
import statCollector from "./plugins/statRecorder";
async function main() {
const app = fastify({ logger: LOGGER });
if (HOST.includes("https")) {
app.register(fastifyHelmet, {
contentSecurityPolicy: {
useDefaults: true,
directives: {
"connect-src": ["'self'", HOST.replace("http", "ws") + "/ws"],
"img-src": ["'self'", "https: data:"],
},
},
});
}
app
.register(fastifyCors)
.register(db)
.register(docker)
.register(auth)
.register(ws)
.register(frontend)
.register(actionStates)
.register(slackNotifier)
.register(statCollector)
.register(routes);
app.listen(PORT, "0.0.0.0", async (err, address) => {
if (err) {
app.log.error(err);
process.exit(1);
}
if (!LOGGER) console.log(`monitor core listening at ${address}`);
});
}
main();

Some files were not shown because too many files have changed in this diff Show More