Compare commits

..
383 Commits
Author SHA1 Message Date
Mr Chen 4617161f3d Merge pull request #803 from midoks/dev
0.18.4
2025-08-19 19:48:15 +08:00
dami ffed4f56bf 0.18.4 2025-08-19 19:47:20 +08:00
Mr Chen 19f9390020 Merge pull request #802 from midoks/dev
Update install_dev.sh
2025-08-19 19:17:58 +08:00
dami 10a4401259 Update install_dev.sh 2025-08-19 19:17:21 +08:00
Mr Chen ed7ab76cd6 Merge pull request #801 from midoks/dev
update
2025-08-19 19:13:59 +08:00
dami ccfe1bac74 update 2025-08-19 19:13:36 +08:00
Mr Chen 0c2071bc5d Merge pull request #800 from midoks/dev
修正acme安装
2025-08-19 19:11:14 +08:00
dami 2d503ab05a Update install.sh 2025-08-19 19:10:12 +08:00
dami 0f204b48dd Update README.md 2025-08-19 13:59:58 +08:00
dami ac586267c5 update 2025-08-19 01:03:40 +08:00
dami 897619f126 Update install.sh 2025-08-19 00:57:06 +08:00
dami 5fef08797d Update info.json 2025-08-19 00:56:31 +08:00
dami b43c3a7294 Update info.json 2025-08-19 00:55:28 +08:00
dami 423b145b7f Update install.sh 2025-08-19 00:54:47 +08:00
Mr Chen 93333a4915 Merge pull request #799 from midoks/dev
Update site.html
2025-08-19 00:28:04 +08:00
dami b3708abcb6 Update site.html 2025-08-19 00:27:38 +08:00
Mr Chen f8c2580773 Merge pull request #798 from midoks/dev
站点搜索,排序优化
2025-08-19 00:22:40 +08:00
dami 4609d5588d 站点排序优化 2025-08-19 00:21:52 +08:00
dami cbeb44779f Update public.js 2025-08-19 00:10:45 +08:00
dami 7c848aa372 Update sites.py 2025-08-19 00:10:40 +08:00
dami 015fca8145 update 2025-08-19 00:02:33 +08:00
dami 54cc5fbad5 Update sites.py 2025-08-18 23:41:06 +08:00
dami 66f66dd408 Update install.sh 2025-08-18 23:34:08 +08:00
Mr Chen 24de9d5988 Merge pull request #797 from midoks/dev
为国内安装优化发一个版本号
2025-08-18 23:26:38 +08:00
dami 7dc5fdc88e 为国内安装优化发一个版本号
可以选择代理
2025-08-18 23:26:07 +08:00
Mr Chen 2f912b4ddd Merge pull request #796 from midoks/dev
update
2025-08-18 22:41:37 +08:00
dami 0931cb9f9c update 2025-08-18 22:41:08 +08:00
dami bc98a80de6 Update mw.tpl 2025-08-18 22:40:32 +08:00
dami 9e3ad237b5 Update mw.tpl 2025-08-18 22:07:38 +08:00
Mr Chen 40a6ce7aa7 Merge pull request #795 from midoks/dev
国内安装支持多个代理选择
2025-08-18 21:59:21 +08:00
dami 85bedbf56b update 2025-08-18 21:48:27 +08:00
dami 5575710d7e Update update_dev.sh 2025-08-18 21:25:31 +08:00
dami df442f7fff update 2025-08-18 21:24:45 +08:00
dami 89e665b369 Update mw.tpl 2025-08-18 21:22:43 +08:00
dami 42f845a7e2 Update mw.tpl 2025-08-18 21:21:17 +08:00
dami a226bc9fbb update 2025-08-18 21:10:20 +08:00
dami b2f9935abb Update mw.tpl 2025-08-18 20:57:56 +08:00
dami d8a22ba5ee update 2025-08-18 20:36:17 +08:00
dami be09821778 Update mw.tpl 2025-08-18 20:35:33 +08:00
dami 4f0f440f2c update 2025-08-18 20:26:06 +08:00
dami 9cd46a7f9f Update update_dev.sh 2025-08-18 20:22:49 +08:00
dami 66c875584f Update update_dev.sh 2025-08-18 20:13:35 +08:00
dami f14d2fddc7 Update mw.tpl 2025-08-18 20:10:19 +08:00
dami fa2dda6ee4 Update README.md 2025-08-18 20:08:43 +08:00
dami 73c8117a67 Update README.md 2025-08-18 20:07:31 +08:00
dami 5f42e94da7 Update README.md 2025-08-18 20:05:56 +08:00
dami c31a95dd4b Update README.md 2025-08-18 20:03:30 +08:00
dami 19ec0ddcb9 Update mw.tpl 2025-08-18 20:00:41 +08:00
dami 5e24086476 Delete t.sh 2025-08-18 19:58:04 +08:00
dami 72934000b0 Update mw.tpl 2025-08-18 19:56:48 +08:00
dami 8a240e2c9c Update mw.tpl 2025-08-18 19:55:45 +08:00
dami 9f081359b0 Update mw.tpl 2025-08-18 19:54:17 +08:00
dami 679a1f0d05 Update mw.tpl 2025-08-18 19:53:43 +08:00
dami 4533e87bef Update mw.tpl 2025-08-18 19:50:29 +08:00
dami 47a60b41a8 up 2025-08-18 19:30:17 +08:00
dami b06100d0dc Update README.md 2025-08-18 19:07:07 +08:00
dami e5591cc59e Update install_dev.sh 2025-08-18 18:08:17 +08:00
dami 9831216ca4 Update install_dev.sh 2025-08-18 18:03:43 +08:00
dami 57e36c5fdb Update mw.tpl 2025-08-18 17:45:02 +08:00
dami 35904bd79d Update install_dev.sh 2025-08-18 17:41:12 +08:00
dami f16a2a7fec update 2025-08-18 17:37:33 +08:00
dami 0b4b8a62aa Update install_dev.sh 2025-08-18 17:16:29 +08:00
dami ca4fa30cdb Update install_dev.sh 2025-08-18 17:11:40 +08:00
dami 90c024dfe5 Update install_dev.sh 2025-08-18 17:05:35 +08:00
dami e634c44797 Update install_dev.sh 2025-08-18 17:04:58 +08:00
dami 8eea4072f6 Update install_dev.sh 2025-08-18 17:03:19 +08:00
dami a0886e1a3d Update install_dev.sh 2025-08-18 17:01:11 +08:00
dami b93d77c907 Update install_dev.sh 2025-08-18 16:35:00 +08:00
dami a148e27211 Update install_dev.sh 2025-08-18 16:33:57 +08:00
dami 3cd9b52d2a Update install_dev.sh 2025-08-18 16:30:13 +08:00
dami 37206916e4 Update install_dev.sh 2025-08-18 16:29:49 +08:00
dami d36d2fa4b4 Update install_dev.sh 2025-08-18 16:29:07 +08:00
dami 4591c9006b Update install_dev.sh 2025-08-18 16:28:23 +08:00
dami 5b4ceb49df Update install_dev.sh 2025-08-18 16:27:54 +08:00
dami ba937c1e77 update 2025-08-18 16:25:54 +08:00
dami 2b77254322 Update install_dev.sh 2025-08-18 16:22:57 +08:00
dami b27cb78f62 Update install_dev.sh 2025-08-18 16:21:26 +08:00
dami 106af5b177 Update install_dev.sh 2025-08-18 16:21:14 +08:00
dami 4b31160670 Update install_dev.sh 2025-08-18 16:19:48 +08:00
dami 0593be9928 Update install_dev.sh 2025-08-18 16:18:18 +08:00
dami 6602119ee7 Update install_dev.sh 2025-08-18 16:15:57 +08:00
dami 2943d1f1b7 Update install_dev.sh 2025-08-18 16:14:53 +08:00
dami 485ab6793c Update install_dev.sh 2025-08-18 16:13:35 +08:00
dami 164a450784 update 2025-08-18 16:10:14 +08:00
dami f12db7e55f Update install_dev.sh 2025-08-18 16:03:31 +08:00
dami 23e000afb3 Update install_dev.sh 2025-08-18 15:57:38 +08:00
dami 5c77dd91e7 Update nosql_mongodb.py 2025-08-17 17:25:34 +08:00
dami 1c4140daec Update nginx.conf 2025-08-11 17:48:18 +08:00
dami ad1035547d Update nginx.conf 2025-08-11 17:48:01 +08:00
dami e61be60f71 Update linux.conf 2025-08-11 17:11:38 +08:00
dami 9d6db1e847 Update nginx.conf 2025-08-11 17:06:29 +08:00
Mr Chen 76a417fee7 Merge pull request #794 from midoks/dev
数据展示插件及修复计划任务列表
2025-08-03 11:48:32 +08:00
dami 9e836148bb Update crontab.js 2025-08-03 11:44:35 +08:00
dami 8d32e404e7 Update crontab.js 2025-08-03 11:28:46 +08:00
dami fb3b0f0ae6 Update crontab.js 2025-08-03 11:21:50 +08:00
dami 6ad415fa5a Update index.py 2025-08-02 19:48:28 +08:00
dami 79d2cc26b0 Update index.py 2025-08-02 19:47:36 +08:00
dami df0ad48348 Update prometheus.js 2025-08-02 19:45:50 +08:00
dami b1024d1da1 Update index.html 2025-08-02 19:45:15 +08:00
dami 5db1ad1535 Update index.py 2025-08-02 19:44:26 +08:00
dami b45fef8b0b Update prometheus.service.tpl 2025-08-02 19:42:44 +08:00
dami 22d4a9a809 update 2025-08-02 19:37:00 +08:00
dami 0478356ea5 pdate 2025-08-02 19:34:25 +08:00
dami 45e35c4396 Update linux.sh 2025-08-02 19:27:59 +08:00
dami eb5079a5ef Update linux.sh 2025-08-02 19:26:38 +08:00
dami a62e01e02e Update install.sh 2025-08-02 19:24:35 +08:00
dami c58db08e5f update 2025-08-02 19:23:00 +08:00
dami 6476fe1d2c Update linux.sh 2025-08-02 19:22:30 +08:00
dami 8ea34d5736 prometheus 2025-08-02 19:22:14 +08:00
dami 4d4f43fa93 Update info.json 2025-08-02 19:07:39 +08:00
dami 3e7b2ee6c1 Update promtail-config.yaml 2025-08-02 17:02:52 +08:00
dami 0d16d3abf1 Update loki-config.yaml 2025-08-02 16:35:42 +08:00
dami 3923ea9dd6 Update promtail-config.yaml 2025-08-02 15:19:37 +08:00
dami e1292620c7 update 2025-08-02 15:08:50 +08:00
dami 4e2b2e1f54 Update promtail-config.yaml 2025-08-02 15:02:00 +08:00
dami fcf75b652c update 2025-08-02 14:57:53 +08:00
dami 9765b51969 Update linux.sh 2025-08-02 14:52:48 +08:00
dami 0769183f61 Update linux.sh 2025-08-02 14:52:39 +08:00
dami 845cc1a2ef Update linux.sh 2025-08-02 14:49:03 +08:00
dami 16a95c12b4 Update linux.sh 2025-08-02 14:45:04 +08:00
dami 0516aeb94f Update linux.sh 2025-08-02 14:43:19 +08:00
dami 6b92ecebf9 Update linux.sh 2025-08-02 14:37:48 +08:00
dami 9010c71051 Update linux.sh 2025-08-02 14:35:53 +08:00
dami fcca331224 Update index.py 2025-08-02 14:32:26 +08:00
dami e3a2f76f78 Update promtail.service.tpl 2025-08-02 14:25:27 +08:00
dami 7e221454a3 update 2025-08-02 14:24:40 +08:00
dami ebecffca03 Update linux.sh 2025-08-02 14:14:07 +08:00
dami 42f99fd7a2 update 2025-08-02 14:05:46 +08:00
dami b31ab0ae16 update 2025-08-02 13:56:29 +08:00
dami bec041aa01 Update linux.sh 2025-08-02 13:53:37 +08:00
dami 8ded811295 Update linux.sh 2025-08-02 13:51:17 +08:00
dami f1c0b9f1ed update 2025-08-02 13:49:07 +08:00
dami d32a371b3a Create loki-config.bak.yaml 2025-08-02 13:45:15 +08:00
dami c0860cd275 update 2025-08-02 13:34:50 +08:00
dami bfd125fc4f Update loki.service.tpl 2025-08-02 13:30:02 +08:00
dami a115ab28ba Update loki-config.yaml 2025-08-02 13:29:42 +08:00
dami d21b126401 update 2025-08-02 13:24:10 +08:00
dami 410bf03682 Update loki.service.tpl 2025-08-02 13:21:35 +08:00
dami 0a9f3de5c3 Update index.py 2025-08-02 13:18:47 +08:00
dami 0ecadb918b Update index.py 2025-08-02 13:16:43 +08:00
dami e90b055f12 Update loki.service.tpl 2025-08-02 13:14:13 +08:00
dami 02877dc23c Update index.py 2025-08-02 12:40:08 +08:00
dami e22439af4c update 2025-08-02 12:33:11 +08:00
dami 298c777971 update 2025-08-02 12:31:35 +08:00
dami 39cf12f51a Update linux.sh 2025-08-02 11:30:40 +08:00
dami 276bc480cf Update install.sh 2025-08-02 11:10:43 +08:00
dami f0b2820034 Update linux.sh 2025-08-02 11:08:32 +08:00
dami ba65103df4 Update index.py 2025-08-02 11:07:08 +08:00
dami ae64b70f10 Update linux.sh 2025-08-02 11:04:01 +08:00
dami 56ea2dd6f4 Update linux.sh 2025-08-02 11:02:31 +08:00
dami 1633b9fca7 Update install.sh 2025-08-02 00:04:26 +08:00
dami cb7a79953f update 2025-08-01 23:33:43 +08:00
dami 5c12d9d6a6 Update install.sh 2025-08-01 19:30:28 +08:00
dami 244ae40969 update 2025-08-01 19:27:48 +08:00
dami e2b7fec286 Update install.sh 2025-08-01 19:20:39 +08:00
dami 4cc2bc16c0 Update grafana.js 2025-08-01 19:19:29 +08:00
dami 24a4872058 Update index.py 2025-08-01 19:18:20 +08:00
dami 91a9788706 update 2025-08-01 19:17:14 +08:00
dami 2a6ef8853d update 2025-08-01 19:10:26 +08:00
dami 56358508c8 Update index.py 2025-08-01 18:57:27 +08:00
dami 976b94464e Update index.py 2025-08-01 18:57:05 +08:00
dami d166a0ccfb Update index.html 2025-08-01 18:55:32 +08:00
dami 7c5c389629 update 2025-08-01 18:54:20 +08:00
dami f447b527eb update 2025-08-01 18:52:52 +08:00
dami a251714989 Update install.sh 2025-08-01 18:50:28 +08:00
dami ea27f817e3 Update grafana.service.tpl 2025-08-01 18:48:58 +08:00
dami b6fb47fc16 update 2025-08-01 18:44:34 +08:00
dami fa540d516d Update install.sh 2025-08-01 18:37:17 +08:00
dami 4b068d2a52 Update grafana.service.tpl 2025-08-01 18:34:35 +08:00
dami 50f5289e2e Update grafana.service.tpl 2025-08-01 18:26:02 +08:00
dami 1ba20a4ea7 Update grafana.service.tpl 2025-08-01 18:20:55 +08:00
dami e18067b2f0 Update index.py 2025-08-01 18:18:04 +08:00
dami 025f19728f up 2025-08-01 18:14:54 +08:00
dami 248496021a up 2025-08-01 18:12:07 +08:00
dami d56a73f0f7 Update linux.sh 2025-08-01 17:50:09 +08:00
dami a2b68ebce1 Update grafana.js 2025-08-01 17:27:00 +08:00
dami 93b92f2b17 Update index.py 2025-08-01 17:26:02 +08:00
dami f5219bf79b Update index.py 2025-08-01 17:21:51 +08:00
dami cc1d99d9c9 Update index.py 2025-08-01 17:20:33 +08:00
dami f7101db942 Update linux.sh 2025-08-01 17:10:14 +08:00
dami 97ae9d17bf Update linux.sh 2025-08-01 17:08:06 +08:00
dami a5624e7e3c Update linux.sh 2025-08-01 17:04:34 +08:00
dami 0be42900c1 Update install.sh 2025-08-01 17:02:51 +08:00
dami 9722e1ca64 update 2025-08-01 17:02:31 +08:00
dami 63a20506a0 Update info.json 2025-08-01 16:58:28 +08:00
dami 9b334e416f update 2025-08-01 16:55:54 +08:00
dami 7805956cdf update 2025-07-30 15:33:03 +08:00
dami 04ffd0ad45 Update install.sh 2025-07-30 15:30:51 +08:00
dami f6e7055c2b Update info.json 2025-07-30 13:23:05 +08:00
dami 77167655e8 update 2025-07-30 13:22:42 +08:00
Mr Chen 24e2d0a3db Merge pull request #791 from midoks/dev
mysql强制修改密码
2025-07-27 17:20:18 +08:00
dami 29795074fe Update index.py 2025-07-27 17:17:17 +08:00
dami e017675b4d Update index.py 2025-07-27 17:14:19 +08:00
dami 74a9897deb Update index.py 2025-07-27 17:03:02 +08:00
dami f593e77d35 Update mysql.js 2025-07-27 17:01:36 +08:00
dami 8b9ab7f0b8 Update mysql.js 2025-07-27 17:00:45 +08:00
dami 02951833cc Update mysql.js 2025-07-27 16:58:53 +08:00
dami 08e300d065 Update index.py 2025-07-27 16:56:56 +08:00
dami 776e4c2418 Update index.py 2025-07-27 16:53:42 +08:00
dami cbe439815d Update index.py 2025-07-27 16:50:42 +08:00
dami 5c43222e4f Update index.py 2025-07-27 16:49:54 +08:00
dami a6fe7e2fe3 Update index.py 2025-07-27 16:49:17 +08:00
dami 6f6523836d Update index.py 2025-07-27 16:48:44 +08:00
dami 650a57350c Update index.py 2025-07-27 16:48:25 +08:00
dami 736b34e834 Update index.py 2025-07-27 16:45:55 +08:00
dami d29682fd19 Update index.py 2025-07-27 16:44:09 +08:00
dami 59c9058426 Update index.py 2025-07-27 16:43:26 +08:00
dami dbd32201c5 Update index.py 2025-07-27 16:40:56 +08:00
dami 55158a67fc Update index.py 2025-07-27 16:40:27 +08:00
dami 49dfe99a14 Update index.py 2025-07-27 16:23:53 +08:00
dami 165672f9fd Update index.py 2025-07-27 16:22:51 +08:00
dami 3bf03aa0b2 Update index.py 2025-07-27 16:20:49 +08:00
dami 8ccbe8e7a6 Update index.py 2025-07-27 16:17:02 +08:00
dami 1d54f90c95 Update index.py 2025-07-27 16:11:56 +08:00
dami 000de62093 Update index.py 2025-07-27 16:09:05 +08:00
dami 7ed82a796a Update install.sh 2025-07-27 16:07:50 +08:00
dami 4ad7e4c3f3 Update index.py 2025-07-27 16:07:41 +08:00
dami e1c17d8926 update 2025-07-27 15:58:59 +08:00
dami 47cc40d0dd Update index.py 2025-07-27 15:56:34 +08:00
dami 1a66d91885 Update mysql.js 2025-07-27 15:56:27 +08:00
dami 01fbe11831 Update orm.py 2025-07-27 15:41:28 +08:00
dami d834965d79 Update orm.py 2025-07-27 15:37:30 +08:00
dami b6eeb79500 Update README.md 2025-07-25 11:56:51 +08:00
dami 460d6c4e02 Update manticore.conf 2025-07-23 12:47:27 +08:00
dami c6089bd480 Update sphinx_make.py 2025-07-23 12:44:12 +08:00
dami 3d18d4bc6f Update manticore.conf 2025-07-23 12:41:07 +08:00
dami 61954b820f Update manticore.conf 2025-07-23 12:40:18 +08:00
dami dee67c6ea2 Update index.py 2025-07-23 12:31:19 +08:00
dami 2fdaf1d482 update 2025-07-23 12:30:24 +08:00
dami 8af986a4c5 Update sphinx_make.py 2025-07-23 12:18:29 +08:00
dami c3a13b66e6 Update index.py 2025-07-23 12:13:20 +08:00
Mr Chen 78111fd408 Merge pull request #788 from midoks/dev
manticoresearch插件配置优化
2025-07-23 12:05:04 +08:00
dami efeaa3f0b5 Update sphinx_make.py 2025-07-23 12:04:29 +08:00
dami aed5e1aa63 Update index.py 2025-07-23 11:58:35 +08:00
dami 44211065a0 Update index.py 2025-07-23 11:55:05 +08:00
dami 364d38cc05 Update install_dev.sh 2025-07-23 11:47:53 +08:00
dami b38bfd7ada Update index.py 2025-07-23 11:32:48 +08:00
dami f05efd1693 Update mw.tpl 2025-07-22 18:06:15 +08:00
dami c64b03135c Update alpine.sh 2025-07-22 17:56:07 +08:00
dami 860a50f025 Update update.sh 2025-07-22 17:54:47 +08:00
dami 5e9706ca23 Update install.sh 2025-07-22 17:54:35 +08:00
dami d3d23fe7b9 Update alpine.sh 2025-07-22 17:54:10 +08:00
dami af2aa2e083 Update alpine.sh 2025-07-22 17:44:34 +08:00
dami bb52b17a12 Update alpine.sh 2025-07-22 17:37:01 +08:00
dami 17c68cb9b7 Update alpine.sh 2025-07-22 17:36:31 +08:00
dami 5c3fe16e9c Update install_dev.sh 2025-07-22 17:30:21 +08:00
dami 81ce4e3445 Update alpine.sh 2025-07-22 17:27:45 +08:00
dami 9aaa5174bb Update update_dev.sh 2025-07-22 17:23:55 +08:00
dami 8d9c89d281 update 2025-07-22 17:20:56 +08:00
Mr Chen 62fa42f1ba Merge pull request #787 from midoks/dev
manticoresearch状态修复
2025-07-22 00:35:59 +08:00
dami 502cb1595f Update index.py 2025-07-22 00:33:13 +08:00
dami c1e358e9fd Update index.py 2025-07-22 00:33:01 +08:00
dami 7600ef1b30 Update index.html 2025-07-22 00:14:54 +08:00
dami b9057da526 Update index.py 2025-07-22 00:14:05 +08:00
dami 99e143b686 up 2025-07-22 00:10:10 +08:00
Mr Chen 0414f1f4de Merge pull request #786 from midoks/dev
增加插件manticoresearch
2025-07-21 21:28:24 +08:00
dami 80f651d17a Update index.py 2025-07-21 21:03:19 +08:00
dami 1a373eb876 Update install.sh 2025-07-21 21:01:09 +08:00
dami 5882b6b58e Update index.py 2025-07-21 20:49:12 +08:00
dami f876e56a2d Update install.sh 2025-07-21 20:34:21 +08:00
dami ac98ec92e4 Update tool_cron.py 2025-07-21 20:32:25 +08:00
dami 6cf6445c01 Update index.py 2025-07-21 20:31:00 +08:00
dami 062a6def14 Update tool_cron.py 2025-07-21 20:30:42 +08:00
dami 282a5451f8 Update index.py 2025-07-21 20:02:08 +08:00
dami b410f782e6 Update sphinx_make.py 2025-07-21 19:50:36 +08:00
dami f4d997957c Update index.py 2025-07-21 19:46:02 +08:00
dami 5551c7d341 Update discuz.conf 2025-07-21 19:43:28 +08:00
dami 642e028fca Update discuz.conf 2025-07-21 19:42:54 +08:00
dami ffe5cd21e5 Update index.py 2025-07-21 19:41:02 +08:00
dami 93679924f4 up 2025-07-21 19:25:59 +08:00
dami 212e3c1066 Update sphinx_make.py 2025-07-21 19:23:18 +08:00
dami ebd4baa6ff Update sphinx_make.py 2025-07-21 19:23:05 +08:00
dami 6d846144dc Update sphinx_make.py 2025-07-21 19:20:52 +08:00
dami e9767ee6c7 Update sphinx_make.py 2025-07-21 19:19:09 +08:00
dami b4a77f25f9 Update sphinx_make.py 2025-07-21 19:18:03 +08:00
dami 08098f48a0 Update sphinx_make.py 2025-07-21 19:17:11 +08:00
dami 478ebe95f0 Update discuz.conf 2025-07-21 19:14:27 +08:00
dami bc48b85478 up 2025-07-21 19:09:44 +08:00
dami a5f7610230 Update index.py 2025-07-21 19:06:31 +08:00
dami 98157bbc8b Update index.py 2025-07-21 19:05:34 +08:00
dami 4e0792b139 Update discuz.conf 2025-07-21 18:51:19 +08:00
dami a171970c96 Update index.py 2025-07-21 18:46:39 +08:00
dami 38490fd462 Create discuz.conf 2025-07-21 18:45:23 +08:00
dami b9726cc23f Update install.sh 2025-07-21 18:16:38 +08:00
dami e047696fba Update info.json 2025-07-21 18:13:24 +08:00
dami bea5a0896a Update install.sh 2025-07-21 18:12:18 +08:00
dami c15ddb64e8 Update install.sh 2025-07-21 18:07:18 +08:00
dami e4e3cbd68e update 2025-07-21 18:04:27 +08:00
dami fd8b27d3f1 Update install.sh 2025-07-21 17:58:53 +08:00
dami 497a1632c0 Update install.sh 2025-07-21 17:58:43 +08:00
dami 5e991a9708 Update manticore.conf 2025-07-21 17:55:46 +08:00
dami 0e49874d38 update 2025-07-21 17:55:36 +08:00
dami a93b99bca7 Update install.sh 2025-07-21 17:38:33 +08:00
dami 4d541c175c Update install.sh 2025-07-21 17:37:56 +08:00
dami 588de95004 Update install.sh 2025-07-21 17:34:06 +08:00
dami 8850d73ea3 Update install.sh 2025-07-21 17:33:38 +08:00
dami feca7c7d7c Update manticore.conf 2025-07-21 17:32:22 +08:00
dami 1507368ea7 Update index.py 2025-07-21 17:20:34 +08:00
dami ce74ec97fb Update index.py 2025-07-21 17:20:12 +08:00
dami 1fd5e2c3f6 update 2025-07-21 17:19:20 +08:00
dami 79e23fe0c7 Update index.py 2025-07-21 17:12:44 +08:00
dami ab0c62c73a Update index.py 2025-07-21 17:07:27 +08:00
dami e72de994ad up 2025-07-21 17:01:16 +08:00
dami 364a84cc6d Update manticoresearch.js 2025-07-21 16:58:56 +08:00
dami 40072c6423 Update index.py 2025-07-21 16:55:51 +08:00
dami 2d56f71588 Update index.py 2025-07-21 16:55:03 +08:00
dami d7a8b87473 Update index.py 2025-07-21 16:51:53 +08:00
dami 7c8c2c655c Update index.py 2025-07-21 16:50:31 +08:00
dami 8ea870b2a7 Update index.py 2025-07-21 16:49:59 +08:00
dami 7e1317a400 Update index.py 2025-07-21 16:49:26 +08:00
dami 6569a4af3b Update index.py 2025-07-21 16:47:40 +08:00
dami 31ee85a523 Update index.py 2025-07-21 16:44:48 +08:00
dami acf6384318 Update index.py 2025-07-21 16:44:29 +08:00
dami 539426d585 update 2025-07-21 16:43:51 +08:00
dami f8401414d3 update 2025-07-21 16:41:00 +08:00
dami e3cbdb9420 Update index.py 2025-07-21 16:35:23 +08:00
dami 823126dad6 update 2025-07-21 16:34:29 +08:00
dami 6d3c8d6679 Update install.sh 2025-07-21 16:33:13 +08:00
dami da2ee9c6f4 update 2025-07-21 16:32:02 +08:00
dami 0b4299d6c3 Update install.sh 2025-07-21 16:29:19 +08:00
dami 0830419658 Update install.sh 2025-07-21 16:28:51 +08:00
dami 85bfcd7447 manticoresearch初始化 2025-07-21 16:13:34 +08:00
dami 729b7e0bcc Update index.py 2025-07-21 16:08:23 +08:00
dami 4dbaf5d0f8 Update site.py 2025-07-20 23:19:38 +08:00
Mr Chen cbad208be6 Merge pull request #785 from midoks/dev
更友好的顶级域名识别
2025-07-20 22:16:11 +08:00
dami f7992d8eae Update site.py 2025-07-20 22:04:02 +08:00
dami 8c7c344ea9 update 2025-07-20 21:52:24 +08:00
Mr Chen 2a52aa61c1 Merge pull request #783 from midoks/dev
php版本更新
2025-07-20 17:05:30 +08:00
dami 8d06bd94b8 Update xdebug.sh 2025-07-20 17:02:27 +08:00
dami 8f53747515 Update swoole.sh 2025-07-20 17:02:16 +08:00
dami d7a997052d Update xhprof.sh 2025-07-20 16:30:42 +08:00
dami 324e98b639 Update xdebug.sh 2025-07-20 16:15:20 +08:00
dami 7aebb728f8 Update xdebug.sh 2025-07-20 16:13:04 +08:00
dami c386a2a57a Update xdebug.sh 2025-07-20 16:12:19 +08:00
dami 6e5c4917d9 Update event.sh 2025-07-20 16:07:37 +08:00
dami d5d9ae51c5 Update all_test.sh 2025-07-20 16:04:38 +08:00
dami ca39f0da3a Update all_test.sh 2025-07-20 15:59:53 +08:00
dami 41cdbb43fc Update swoole.sh 2025-07-20 15:53:41 +08:00
dami 6f3897886e Update swoole.sh 2025-07-20 15:50:55 +08:00
dami 6b1bfdfeca Update solr.sh 2025-07-20 15:48:49 +08:00
dami a07a37f256 Update solr.sh 2025-07-20 15:30:07 +08:00
dami 896512cf3e Update imagemagick.sh 2025-07-20 15:25:30 +08:00
dami 60602e68f5 Update mcrypt.sh 2025-07-20 15:19:47 +08:00
dami 7066eb2632 Update memcached.sh 2025-07-20 14:35:29 +08:00
dami ddfdebced2 up 2025-07-20 13:52:29 +08:00
dami 4913cc9ed6 update 2025-07-20 13:31:18 +08:00
dami 6427bb794d Update swoole.sh 2025-07-20 12:51:15 +08:00
dami 77bc7c85f8 Update swoole.sh 2025-07-20 12:50:46 +08:00
dami 54a90a2e99 Update swoole.sh 2025-07-20 12:46:17 +08:00
dami e4a9c32caa Update all_mac.sh 2025-07-20 12:28:37 +08:00
dami 13b9711d4a Update phplib.conf 2025-07-20 12:25:38 +08:00
dami af15d6a592 Update all_test.sh 2025-07-20 12:23:19 +08:00
dami 132580ea6c Update phplib.conf 2025-07-20 12:18:45 +08:00
dami 262ab0ab73 Update phplib.conf 2025-07-20 12:15:56 +08:00
dami 1e19d70fa1 Update phplib.conf 2025-07-20 12:13:07 +08:00
dami 48b8d530ca Update all_test.sh 2025-07-20 11:35:41 +08:00
dami 1f35c5b8fa Update install.sh 2025-07-20 11:26:12 +08:00
dami 574b87f5b5 update 2025-07-20 11:20:11 +08:00
dami 88be69ffc7 update 2025-07-20 11:19:14 +08:00
Mr Chen 87e49e3244 Merge pull request #782 from midoks/dev
mysql 配置回退
2025-07-20 11:06:02 +08:00
dami 4a392126cd update 2025-07-20 11:05:24 +08:00
dami c0489ebb44 Update info.json 2025-07-19 19:02:29 +08:00
dami ed65f63a37 Update index.py 2025-07-17 20:12:16 +08:00
Mr Chen 2b4ff60de0 Merge pull request #781 from midoks/dev
版本更新及细节优化
2025-07-17 18:04:06 +08:00
dami 8069bf51ab update 2025-07-17 17:37:57 +08:00
dami 369b53e2fd update 2025-07-17 11:19:33 +08:00
dami 1cf0c1636b update 2025-07-17 11:15:34 +08:00
dami 060fe39331 update 2025-07-17 11:13:19 +08:00
dami 8bec4058e2 Update info.json 2025-07-17 11:11:13 +08:00
Mr Chen 61d30d6f77 Merge pull request #780 from midoks/dev
Update index.py
2025-07-16 15:48:56 +08:00
dami 7daae8a129 Update index.py 2025-07-16 15:47:01 +08:00
Mr Chen ab2c9e450e Merge pull request #779 from midoks/dev
Dev
2025-07-16 15:34:06 +08:00
dami 24c269bf4c Update install.sh 2025-07-16 15:29:54 +08:00
dami 8f0c8fd800 Update install.sh 2025-07-16 15:29:21 +08:00
Mr Chen a0e29a2bc2 Merge pull request #778 from midoks/dev
0.18.2
2025-07-16 15:22:03 +08:00
dami 94cab2e71a update 2025-07-16 15:20:50 +08:00
dami 266b9fa5c2 up 2025-07-16 11:47:23 +08:00
Mr Chen 31de8edc4a Merge pull request #777 from midoks/dev
Update site_reflect.py
2025-07-15 18:30:26 +08:00
dami 1e59eda9a9 Update site_reflect.py 2025-07-15 18:23:40 +08:00
Mr Chen 36c3fcb395 Merge pull request #776 from midoks/dev
计划任务兼容性问题
2025-07-13 22:06:52 +08:00
dami ea8f0523d5 Update crontab.py 2025-07-13 21:34:46 +08:00
dami 71625b7c0e Update init_cron.py 2025-07-13 21:19:30 +08:00
dami 408a62c755 update 2025-07-13 10:58:05 +08:00
120 changed files with 6528 additions and 429 deletions
+23 -22
View File
@@ -36,7 +36,7 @@ Talk is cheap, show me the code. -- linus
```
- [兼容性测试报告](/compatibility.md)
- [常用命令说明](/cmd.md) [ mw default ] [ mw update_dev ]
- [常用命令说明](/cmd.md) [ mw default ] [ mw dev ]
### 特别赞助
@@ -45,7 +45,7 @@ Talk is cheap, show me the code. -- linus
### 主要插件介绍
* OpenResty - 轻量级,占有内存少,并发能力强。
* PHP[53-84] - PHP是世界上最好的编程语言。
* PHP[53-85] - PHP是世界上最好的编程语言。
* MySQL - 一种关系数据库管理系统。
* MariaDB - 是MySQL的一个重要分支。
* MySQL[community] - 一种关系数据库管理系统。
@@ -108,28 +108,22 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```
### 版本更新 0.18.0
### 版本更新 0.18.4
- 重新架构面板。
- PHP84正式版。
- 加入alist插件。
- 数据管理-常用命令。
- 插件读取优化(加入缓存+定时检查状态)。
- 恢复面板书签。
- 常规更新。
- 国内安装优化。
### JSDelivr安装地址
- 初始安装
```
curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash
bash <(curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh)
```
- 直接更新
```
curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/update.sh | bash
bash <(curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/update.sh)
```
- 卸载脚本
@@ -143,14 +137,15 @@ wget --no-check-certificate -O uninstall.sh https://cdn.jsdelivr.net/gh/midoks/m
- 初始安装
```
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh | bash
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/master/scripts/install.sh | bash
bash <(curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install.sh)
bash <(curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/master/scripts/install.sh)
```
- 直接更新
```
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
bash <(curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh)
```
- 卸载脚本
@@ -165,24 +160,30 @@ wget --no-check-certificate -O uninstall.sh https://raw.githubusercontent.com/mi
- 需已经安装mdserver-web
```
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/app.sh | bash
bash <(curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/app.sh)
```
### DEV使用
```
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
bash <(curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install.sh)
bash <(curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update.sh)
bash <(curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh)
bash <(curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh)
wget --no-check-certificate -O install.sh https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install.sh && bash install.sh
wget --no-check-certificate -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/uninstall.sh && bash uninstall.sh
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/debug.sh | bash
bash <(curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/debug.sh)
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/install_dev.sh | bash
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/update_dev.sh | bash
bash <(curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/install.sh)
bash <(curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/update.sh)
bash <(curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/install_dev.sh)
bash <(curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/update_dev.sh)
```
### 旧版安装/更新
@@ -199,7 +200,7 @@ cd /www/server/mdserver-web && rm -rf lib64
cd /www/server/mdserver-web && rm -rf bin
cd /www/server/mdserver-web && rm -rf include
mw update/mw update_dev
mw update/mw update_dev/mw dev
```
### 捐赠地址 USDT(TRC20)
+2
View File
@@ -89,6 +89,8 @@ def initConf():
"/var/log/messages.*",
"/var/log/debug.*",
"/var/log/syslog.*",
"/var/log/syslog",
"/var/log/mail.*",
"/var/log/btmp.*",
"/var/log/sa/sa*",
"/var/log/sysstat/sa*",
+1 -1
View File
@@ -170,7 +170,7 @@ class nosqlMongodb():
keys = ["bind_ip", "port"]
result['host'] = '127.0.0.1'
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
ip_re = re.search(rep, mgdb_content)
if ip_re:
result['port'] = int(ip_re.groups()[0].strip())
+1 -1
View File
@@ -4,5 +4,5 @@
### 安装
```
rm -rf /www/server/mdserver-web/plugins/dztasks && cd /www/server/mdserver-web/plugins && rm -rf dztasks && git clone https://github.com/mw-plugin/dztasks && cd dztasks && rm -rf .git && cd /www/server/mdserver-web/plugins/dztasks && bash install.sh install 1.1
rm -rf /www/server/mdserver-web/plugins/dztasks && cd /www/server/mdserver-web/plugins && rm -rf dztasks && git clone https://github.com/mw-plugin/dztasks && cd dztasks && rm -rf .git && cd /www/server/mdserver-web/plugins/dztasks && bash install.sh install 1.2
```
+28 -3
View File
@@ -275,14 +275,39 @@ def getDzPort():
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def homePage():
def getDzUsername():
file = getConf()
content = mw.readFile(file)
rep = r'user\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getDzPassword():
file = getConf()
content = mw.readFile(file)
rep = r'pass\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getHomePage():
http_port = getDzPort()
ip = mw.getLocalIp()
if mw.isAppleSystem():
ip = '127.0.0.1'
url = 'http://'+ip+":"+str(http_port)
# print(url)
return mw.returnJson(True, 'ok!', url)
return url
def homePage():
return mw.returnJson(True, 'ok!', getHomePage())
def runInfo():
data = {}
data['url'] = getHomePage()
data['user'] = getDzUsername()
data['pass'] = getDzPassword()
return mw.returnJson(True, 'ok!', data)
if __name__ == "__main__":
func = sys.argv[1]
+1 -1
View File
@@ -4,7 +4,7 @@
"name": "dztasks",
"title": "dztasks",
"shell": "install.sh",
"versions":["1.1"],
"versions":["1.2"],
"tip": "soft",
"checks": "server/dztasks",
"path": "server/dztasks",
+1 -1
View File
@@ -33,7 +33,7 @@ Install_App()
mkdir -p $serverPath/source/dztasks
mkdir -p $serverPath/dztasks
FILE_TGZ=dztasks_v${VERSION}_${DZ_NAME}_${DZ_ARCH_NAME}.tar.gz
FILE_TGZ=dztasks_${VERSION}_${DZ_NAME}_${DZ_ARCH_NAME}.tar.gz
DZ_DIR=$serverPath/source/dztasks
echo $FILE_TGZ
+37 -1
View File
@@ -60,11 +60,47 @@ function commonHomePage(){
});
}
function postCrossPort(data, url) {
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText);
}
};
xhr.send(data);
}
function dzLogin(){
zdPost('run_info', '', {}, function(data){
var rdata = $.parseJSON(data.data);
var info = rdata.data;
var post_url = info['url']+'/do_login';
$("#toSite").attr('action',post_url);
$("#username").val(info['user']);
$("#password").val(info['pass']);
layer.msg('正在打开dztasks',{icon:16,shade: [0.3, '#000'],time:2000});
setTimeout(function(){
$("#toSite").submit();
},2000);
});
}
function dzCommonFunc(){
var con = '';
con += '<hr/><p class="conf_p" style="text-align:center;">\
<button class="btn btn-default btn-sm" onclick="commonHomePage()">主页</button>\
<button class="btn btn-default btn-sm" onclick="commonHomePage()">主页</button> \
<button class="btn btn-default btn-sm" onclick="dzLogin()">直接登陆</button>\
</p>';
con += '<form id="toSite" action="" method="post" style="display: none;" target="_blank">\
<input type="text" name="username" id="username" value="">\
<input type="password" name="password" id="password" value="">\
</form>';
$(".soft-man-con").html(con);
}
+1 -1
View File
@@ -2,7 +2,7 @@
"ps": "Gitea是一个开源社区驱动的轻量级代码托管解决方案。",
"name": "gitea",
"title": "Gitea",
"versions": ["1.17.2","1.18.5","1.22.1"],
"versions": ["1.17.2","1.18.5","1.22.1","1.24.3"],
"tip": "soft",
"install_pre_inspection":false,
"uninstall_pre_inspection":true,
Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

+31
View File
@@ -0,0 +1,31 @@
<style>
.overflow_hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
</style>
<div class="bt-form">
<div class='plugin_version'></div>
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('grafana');">服务</p>
<p onclick="pluginInitD('grafana');">自启动</p>
<p onclick="gCommonFunc($('.plugin_version').attr('version'));">常用功能</p>
<p onclick="pluginConfig('grafana',$('.plugin_version').attr('version'),'conf');">配置</p>
<p onclick="pluginLogs('grafana','','run_log');">运行日志</p>
<p onclick="gReadme();">相关说明</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con" style="height: 520px; overflow: auto;"></div>
</div>
</div>
</div>
<script type="text/javascript">
$.getScript( "/plugins/file?name=grafana&f=js/grafana.js", function(){
pluginService('grafana', $('.plugin_version').attr('version'));
});
</script>
+235
View File
@@ -0,0 +1,235 @@
# coding:utf-8
import sys
import io
import os
import time
import re
web_dir = os.getcwd() + "/web"
if os.path.exists(web_dir):
sys.path.append(web_dir)
os.chdir(web_dir)
import core.mw as mw
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getPluginName():
return 'grafana'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getInitDFile():
current_os = mw.getOs()
if current_os == 'darwin':
return '/tmp/' + getPluginName()
if current_os.startswith('freebsd'):
return '/etc/rc.d/' + getPluginName()
return '/etc/init.d/' + getPluginName()
def getConf():
path = getServerDir() + "/conf/defaults.ini"
return path
def getInitDTpl():
path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl"
return path
def getArgs():
args = sys.argv[3:]
tmp = {}
args_len = len(args)
if args_len == 1:
t = args[0].strip('{').strip('}')
if t.strip() == '':
tmp = []
else:
t = t.split(':')
tmp[t[0]] = t[1]
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':')
tmp[t[0]] = t[1]
return tmp
def checkArgs(data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = r'pidfile\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def status():
cmd = "ps aux|grep grafana |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
data = mw.execShell(cmd)
if data[0] == '':
return 'stop'
return 'start'
def getInstallVerion():
version_pl = getServerDir() + "/version.pl"
version = mw.readFile(version_pl).strip()
return version
def contentReplace(content):
service_path = mw.getServerDir()
content = content.replace('{$ROOT_PATH}', mw.getFatherDir())
content = content.replace('{$SERVER_PATH}', service_path)
return content
def openPort():
try:
from utils.firewall import Firewall as MwFirewall
MwFirewall.instance().addAcceptPort('3000', 'grafana', 'port')
return port
except Exception as e:
return "Release failed {}".format(e)
return True
def initDreplace():
# 初始化OP配置
init_file = getServerDir() + '/init.pl'
if not os.path.exists(init_file):
openPort()
mw.writeFile(init_file, 'ok')
# systemd
systemDir = mw.systemdCfgDir()
systemService = systemDir + '/' + getPluginName() + '.service'
if os.path.exists(systemDir) and not os.path.exists(systemService):
systemServiceTpl = getPluginDir() + '/init.d/' + getPluginName() + '.service.tpl'
service_path = mw.getServerDir()
content = mw.readFile(systemServiceTpl)
content = content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(systemService, content)
mw.execShell('systemctl daemon-reload')
return True
def gOp(method):
initDreplace()
data = mw.execShell('systemctl ' + method + ' '+getPluginName())
mw.execShell('systemctl ' + method + ' '+getPluginName())
if data[1] == '':
return 'ok'
return data[1]
def start():
return gOp('start')
def stop():
return gOp('stop')
def restart():
return gOp('restart')
def reload():
return gOp('reload')
def initdStatus():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
shell_cmd = 'systemctl status grafana|grep loaded|grep "enabled;"'
data = mw.execShell(shell_cmd)
if data[0] == '':
return 'fail'
return 'ok'
def initdInstall():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
data = mw.execShell('systemctl enable grafana')
if data[1] != '':
return data[1]
return 'ok'
def initdUinstall():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
data = mw.execShell('systemctl disable grafana')
if data[1] != '':
return data[1]
return 'ok'
def runLog():
return getServerDir() + "/data/log/grafana.log"
def grafanaUrl():
ip = mw.getLocalIp()
return 'http://'+ip+':'+"3000"
def installPreInspection():
return 'ok'
def uninstallPreInspection():
return 'ok'
if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
print(status())
elif func == 'start':
print(start())
elif func == 'stop':
print(stop())
elif func == 'restart':
print(restart())
elif func == 'reload':
print(reload())
elif func == 'initd_status':
print(initdStatus())
elif func == 'initd_install':
print(initdInstall())
elif func == 'initd_uninstall':
print(initdUinstall())
elif func == 'install_pre_inspection':
print(installPreInspection())
elif func == 'uninstall_pre_inspection':
print(uninstallPreInspection())
elif func == 'conf':
print(getConf())
elif func == 'run_log':
print(runLog())
elif func == 'grafana_url':
print(grafanaUrl())
else:
print('error')
+17
View File
@@ -0,0 +1,17 @@
{
"sort": 7,
"ps": "Grafana是查询、可视化、警报观测平台",
"name": "grafana",
"title": "grafana",
"shell": "install.sh",
"versions":["12.1.0"],
"tip": "soft",
"checks": "server/grafana",
"path": "server/grafana",
"display": 1,
"author": "midoks",
"date": "2025-08-01",
"home": "https://grafana.com/grafana/download",
"type": 0,
"pid": "5"
}
@@ -0,0 +1,13 @@
[Unit]
Description=Grafana instance
Documentation=http://docs.grafana.org
After=network-online.target
[Service]
Type=simple
User=grafana
Group=grafana
Restart=on-failure
ExecStart={$SERVER_PATH}/bin/grafana server --config={$SERVER_PATH}/grafana/conf/defa.defaults --homepath={$SERVER_PATH}/grafana
[Install]
WantedBy=multi-user.target
+85
View File
@@ -0,0 +1,85 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
# https://www.cnblogs.com/n00dle/p/16916044.html
# cd /www/server/mdserver-web/plugins/grafana && /bin/bash install.sh install 12.1.0
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/grafana/index.py start
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
VERSION=$2
sysArch=`arch`
sysName=`uname`
echo "use system: ${sysName}"
OSNAME=`bash ${rootPath}/scripts/getos.sh`
if [ "" == "$OSNAME" ];then
OSNAME=`cat ${rootPath}/data/osname.pl`
fi
if [ "macos" == "$OSNAME" ];then
echo "不支持Macox"
exit
fi
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
if id grafana &> /dev/null ;then
echo "grafana uid is `id -u grafana`"
echo "grafana shell is `grep "^grafana:" /etc/passwd |cut -d':' -f7 `"
else
groupadd grafana
useradd -g grafana -s /bin/bash grafana
fi
Install_App()
{
echo '正在安装脚本文件...'
mkdir -p $serverPath/source/grafana
mkdir -p $serverPath/grafana
echo "${VERSION}" > $serverPath/grafana/version.pl
shell_file=${curPath}/versions/${VERSION}/linux.sh
if [ -f $shell_file ];then
bash -x $shell_file install ${VERSION}
else
echo '不支持...'
exit 1
fi
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/grafana/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/grafana/index.py initd_install
echo 'Grafana安装完成'
}
Uninstall_App()
{
shell_file=${curPath}/versions/${VERSION}/linux.sh
if [ -f $shell_file ];then
bash -x $shell_file uninstall ${VERSION}
fi
cd ${rootPath} && python3 ${rootPath}/plugins/grafana/index.py stop
cd ${rootPath} && python3 ${rootPath}/plugins/grafana/index.py initd_uninstall
rm -rf $serverPath/grafana
echo 'Grafana卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
+97
View File
@@ -0,0 +1,97 @@
function gPost(method, version, args,callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
var req_data = {};
req_data['name'] = 'grafana';
req_data['func'] = method;
req_data['version'] = version;
if (typeof(args) == 'string'){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/run', req_data, function(data) {
layer.close(loadT);
if (!data.status){
//错误展示10S
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function gPostCallbak(method, version, args,callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
var req_data = {};
req_data['name'] = 'grafana';
req_data['func'] = method;
args['version'] = version;
if (typeof(args) == 'string'){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/callback', req_data, function(data) {
layer.close(loadT);
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function gCommonFunc(){
var con = '<hr/><p class="conf_p" style="text-align:center;">\
<button id="grafana_url" class="btn btn-default btn-sm">获取连接地址</button>\
</p>';
$(".soft-man-con").html(con);
$('#grafana_url').click(function(){
gPost('grafana_url', '', {}, function(rdata){
layer.open({
title: "Grafana连接",
area: ['600px', '180px'],
type:1,
closeBtn: 1,
shadeClose: false,
btn:["复制","取消"],
content: '<div class="pd15">\
<div class="divtable">\
<pre class="layui-code">'+rdata.data+'</pre>\
</div>\
</div>',
success:function(){
copyText(rdata.data);
},
yes:function(){
copyText(rdata.data);
}
});
});
});
}
function gReadme(){
var readme = '<ul class="help-info-text c7">';
readme += '<li>初始化账户:admin/admin</li>';
readme += '<li>https://grafana.com/grafana/download</li>';
readme += '</ul>';
$('.soft-man-con').html(readme);
}
+61
View File
@@ -0,0 +1,61 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
VERSION=$2
sysArch=`arch`
sysName=`uname`
ARCH_NAME=amd64
if [ "$sysArch" == "arm64" ];then
ARCH_NAME=arm64
elif [ "$sysArch" == "x86_64" ]; then
ARCH_NAME=amd64
elif [ "$sysArch" == "aarch64" ]; then
ARCH_NAME=aarch64
fi
FILE_TGZ=grafana-${VERSION}.linux-${ARCH_NAME}.tar.gz
# 检查是否通
Install_App()
{
SourceDir=$serverPath/source/grafana
InstallDir=$serverPath/grafana
mkdir -p ${SourceDir}
mkdir -p ${InstallDir}
if [ ! -f ${SourceDir}/${FILE_TGZ} ];then
wget --no-check-certificate -O ${SourceDir}/${FILE_TGZ} https://dl.grafana.com/oss/release/${FILE_TGZ}
fi
if [ ! -d $InstallDir/bin/grafana ];then
cd ${SourceDir} && tar -zxvf ${FILE_TGZ}
cd ${SourceDir}/grafana-v*
cp -rf ./* $InstallDir
fi
chown -R grafana:grafana $InstallDir
}
Uninstall_App()
{
echo "卸载成功"
}
action=${1}
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
+69
View File
@@ -0,0 +1,69 @@
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: debug
grpc_server_max_concurrent_streams: 1000
common:
instance_addr: 127.0.0.1
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
query_range:
results_cache:
cache:
embedded_cache:
enabled: true
max_size_mb: 100
limits_config:
metric_aggregation_enabled: true
schema_config:
configs:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
pattern_ingester:
enabled: true
metric_aggregation:
loki_address: localhost:3100
ruler:
alertmanager_url: http://localhost:9093
frontend:
encoding: protobuf
query_engine:
# 新版本有效参数
max_concurrent: 20
timeout: 3m
# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/analytics/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
#analytics:max_query_lookback
# reporting_enabled: false
+64
View File
@@ -0,0 +1,64 @@
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: debug
grpc_server_max_concurrent_streams: 1000
common:
instance_addr: 127.0.0.1
path_prefix: {$APP_PATH}/loki
storage:
filesystem:
chunks_directory: {$APP_PATH}/loki/chunks
rules_directory: {$APP_PATH}/loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
query_range:
results_cache:
cache:
embedded_cache:
enabled: true
max_size_mb: 100
limits_config:
metric_aggregation_enabled: true
schema_config:
configs:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
pattern_ingester:
enabled: true
metric_aggregation:
loki_address: localhost:3100
ruler:
alertmanager_url: http://localhost:9093
frontend:
encoding: protobuf
# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/analytics/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
#analytics:
# reporting_enabled: false
+26
View File
@@ -0,0 +1,26 @@
server:
http_listen_port: 9080 #云服务器需开放9080端口
grpc_listen_port: 0
positions:
filename: {$APP_PATH}/positions.yaml #positions存放路径在promtail工具地址下
clients:
- url: http://127.0.0.1:3100/loki/api/v1/push #修改为loki服务器IP
scrape_configs:
- job_name: web
static_configs:
- targets:
- localhost
labels:
job: "web"
__path__: {$LOG_PATH}/web_nohup.out
- job_name: portal
static_configs:
- targets:
- localhost
labels:
job: "portal"
__path__: {$LOG_PATH}/portal_nohup.out
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

+31
View File
@@ -0,0 +1,31 @@
<style>
.overflow_hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
</style>
<div class="bt-form">
<div class='plugin_version'></div>
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('loki');">服务</p>
<p onclick="pluginInitD('loki');">自启动</p>
<!-- <p onclick="gCommonFunc($('.plugin_version').attr('version'));">常用功能</p> -->
<p onclick="pluginConfig('loki',$('.plugin_version').attr('version'),'conf');">Loki配置</p>
<p onclick="pluginConfig('loki',$('.plugin_version').attr('version'),'promtail_conf');">Promtail配置</p>
<p onclick="gReadme();">相关说明</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con" style="height: 520px; overflow: auto;"></div>
</div>
</div>
</div>
<script type="text/javascript">
$.getScript( "/plugins/file?name=loki&f=js/loki.js", function(){
pluginService('loki', $('.plugin_version').attr('version'));
});
</script>
+287
View File
@@ -0,0 +1,287 @@
# coding:utf-8
import sys
import io
import os
import time
import re
web_dir = os.getcwd() + "/web"
if os.path.exists(web_dir):
sys.path.append(web_dir)
os.chdir(web_dir)
import core.mw as mw
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getPluginName():
return 'loki'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getInitDFile():
current_os = mw.getOs()
if current_os == 'darwin':
return '/tmp/' + getPluginName()
if current_os.startswith('freebsd'):
return '/etc/rc.d/' + getPluginName()
return '/etc/init.d/' + getPluginName()
def getConf():
path = getServerDir() + "/conf/loki-config.yaml"
return path
def getPromtailConf():
path = getServerDir() + "/conf/promtail-config.yaml"
return path
def getConfTpl():
path = getPluginDir() + "/conf/loki-config.yaml"
return path
def getPromtailConfTpl():
path = getPluginDir() + "/conf/promtail-config.yaml"
return path
def getArgs():
args = sys.argv[3:]
tmp = {}
args_len = len(args)
if args_len == 1:
t = args[0].strip('{').strip('}')
if t.strip() == '':
tmp = []
else:
t = t.split(':')
tmp[t[0]] = t[1]
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':')
tmp[t[0]] = t[1]
return tmp
def checkArgs(data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = r'pidfile\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def status():
cmd = "ps aux|grep loki |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
data = mw.execShell(cmd)
if data[0] == '':
return 'stop'
return 'start'
def getInstallVerion():
version_pl = getServerDir() + "/version.pl"
version = mw.readFile(version_pl).strip()
return version
def contentReplace(content):
service_path = mw.getServerDir()
content = content.replace('{$ROOT_PATH}', mw.getFatherDir())
content = content.replace('{$SERVER_PATH}', service_path)
content = content.replace('{$APP_PATH}', service_path+"/loki")
content = content.replace('{$LOG_PATH}', service_path+"/loki/logs")
return content
# def openPort():
# try:
# from utils.firewall import Firewall as MwFirewall
# MwFirewall.instance().addAcceptPort('3000', 'grafana', 'port')
# return port
# except Exception as e:
# return "Release failed {}".format(e)
# return True
def initDreplace():
# 初始化OP配置
init_file = getServerDir() + '/init.pl'
if not os.path.exists(init_file):
# openPort()
mw.writeFile(init_file, 'ok')
conf_dir = getServerDir()+'/conf'
if not os.path.exists(conf_dir):
mw.execShell('mkdir -p ' + conf_dir)
file_tpl = getConfTpl()
dst_file = getConf()
if not os.path.exists(dst_file):
content = mw.readFile(file_tpl)
content = contentReplace(content)
mw.writeFile(dst_file, content)
file_tpl = getPromtailConfTpl()
dst_file = getPromtailConf()
if not os.path.exists(dst_file):
content = mw.readFile(file_tpl)
content = contentReplace(content)
mw.writeFile(dst_file, content)
# systemd
systemDir = mw.systemdCfgDir()
systemService = systemDir + '/' + getPluginName() + '.service'
if os.path.exists(systemDir) and not os.path.exists(systemService):
systemServiceTpl = getPluginDir() + '/init.d/' + getPluginName() + '.service.tpl'
service_path = mw.getServerDir()
content = mw.readFile(systemServiceTpl)
content = content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(systemService, content)
mw.execShell('systemctl daemon-reload')
# systemd
systemDir = mw.systemdCfgDir()
systemService = systemDir + '/promtail.service'
if os.path.exists(systemDir) and not os.path.exists(systemService):
systemServiceTpl = getPluginDir() + '/init.d/promtail.service.tpl'
service_path = mw.getServerDir()
content = mw.readFile(systemServiceTpl)
content = content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(systemService, content)
mw.execShell('systemctl daemon-reload')
return True
def gOp(method):
initDreplace()
data = mw.execShell('systemctl ' + method + ' '+getPluginName())
if data[1] != '':
return data[1]
data = mw.execShell('systemctl ' + method + ' promtail')
if data[1] != '':
return data[1]
return 'ok'
def start():
return gOp('start')
def stop():
return gOp('stop')
def restart():
return gOp('restart')
def reload():
return gOp('reload')
def initdStatus():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
shell_cmd = 'systemctl status loki|grep loaded|grep "enabled;"'
data = mw.execShell(shell_cmd)
if data[0] == '':
return 'fail'
shell_cmd = 'systemctl status promtail|grep loaded|grep "enabled;"'
data = mw.execShell(shell_cmd)
if data[0] == '':
return 'fail'
return 'ok'
def initdInstall():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
data = mw.execShell('systemctl enable loki')
if data[1] != '':
return data[1]
data = mw.execShell('systemctl enable promtail')
if data[1] != '':
return data[1]
return 'ok'
def initdUinstall():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
data = mw.execShell('systemctl disable loki')
if data[1] != '':
return data[1]
data = mw.execShell('systemctl enable promtail')
if data[1] != '':
return data[1]
return 'ok'
def grafanaUrl():
ip = mw.getLocalIp()
return 'http://'+ip+':'+"3100"
def installPreInspection():
return 'ok'
def uninstallPreInspection():
return 'ok'
if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
print(status())
elif func == 'start':
print(start())
elif func == 'stop':
print(stop())
elif func == 'restart':
print(restart())
elif func == 'reload':
print(reload())
elif func == 'initd_status':
print(initdStatus())
elif func == 'initd_install':
print(initdInstall())
elif func == 'initd_uninstall':
print(initdUinstall())
elif func == 'install_pre_inspection':
print(installPreInspection())
elif func == 'uninstall_pre_inspection':
print(uninstallPreInspection())
elif func == 'conf':
print(getConf())
elif func == 'promtail_conf':
print(getPromtailConf())
elif func == 'grafana_url':
print(grafanaUrl())
else:
print('error')
+17
View File
@@ -0,0 +1,17 @@
{
"sort": 7,
"ps": "Grafana/Loki是一个日志聚合系统",
"name": "loki",
"title": "loki",
"shell": "install.sh",
"versions":["3.5.3"],
"tip": "soft",
"checks": "server/loki",
"path": "server/loki",
"display": 1,
"author": "midoks",
"date": "2025-08-02",
"home": "https://github.com/grafana/loki",
"type": 0,
"pid": "5"
}
+10
View File
@@ -0,0 +1,10 @@
[Unit]
Description=Loki Log Aggregation System
After=network.target
[Service]
ExecStart={$SERVER_PATH}/loki/bin/loki -config.file={$SERVER_PATH}/loki/conf/loki-config.yaml
Restart=always
[Install]
WantedBy=multi-user.target
+10
View File
@@ -0,0 +1,10 @@
[Unit]
Description=Promtail System
After=network.target
[Service]
ExecStart={$SERVER_PATH}/loki/bin/promtail -config.file={$SERVER_PATH}/loki/conf/promtail-config.yaml
Restart=always
[Install]
WantedBy=multi-user.target
+84
View File
@@ -0,0 +1,84 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
# https://www.cnblogs.com/n00dle/p/16916044.html
# cd /www/server/mdserver-web/plugins/loki && /bin/bash install.sh install 3.5.3
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/loki/index.py start
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
VERSION=$2
sysArch=`arch`
sysName=`uname`
echo "use system: ${sysName}"
OSNAME=`bash ${rootPath}/scripts/getos.sh`
if [ "" == "$OSNAME" ];then
OSNAME=`cat ${rootPath}/data/osname.pl`
fi
if [ "macos" == "$OSNAME" ];then
echo "不支持Macox"
exit
fi
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
# if id grafana &> /dev/null ;then
# echo "grafana uid is `id -u grafana`"
# echo "grafana shell is `grep "^grafana:" /etc/passwd |cut -d':' -f7 `"
# else
# groupadd grafana
# useradd -g grafana -s /bin/bash grafana
# fi
Install_App()
{
echo '正在安装脚本文件...'
mkdir -p $serverPath/source/grafana
mkdir -p $serverPath/loki
echo "${VERSION}" > $serverPath/loki/version.pl
shell_file=${curPath}/versions/${VERSION}/linux.sh
if [ -f $shell_file ];then
bash -x $shell_file install ${VERSION}
else
echo '不支持...'
exit 1
fi
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/loki/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/loki/index.py initd_install
echo 'Grafana/Loki安装完成'
}
Uninstall_App()
{
shell_file=${curPath}/versions/${VERSION}/linux.sh
if [ -f $shell_file ];then
bash -x $shell_file uninstall ${VERSION}
fi
cd ${rootPath} && python3 ${rootPath}/plugins/loki/index.py stop
cd ${rootPath} && python3 ${rootPath}/plugins/loki/index.py initd_uninstall
rm -rf $serverPath/loki
echo 'Grafana/Loki卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
+96
View File
@@ -0,0 +1,96 @@
function gPost(method, version, args,callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
var req_data = {};
req_data['name'] = 'loki';
req_data['func'] = method;
req_data['version'] = version;
if (typeof(args) == 'string'){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/run', req_data, function(data) {
layer.close(loadT);
if (!data.status){
//错误展示10S
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function gPostCallbak(method, version, args,callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
var req_data = {};
req_data['name'] = 'loki';
req_data['func'] = method;
args['version'] = version;
if (typeof(args) == 'string'){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/callback', req_data, function(data) {
layer.close(loadT);
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function gCommonFunc(){
var con = '<hr/><p class="conf_p" style="text-align:center;">\
<button id="grafana_url" class="btn btn-default btn-sm">获取连接地址</button>\
</p>';
$(".soft-man-con").html(con);
$('#grafana_url').click(function(){
gPost('grafana_url', '', {}, function(rdata){
layer.open({
title: "Grafana连接",
area: ['600px', '180px'],
type:1,
closeBtn: 1,
shadeClose: false,
btn:["复制","取消"],
content: '<div class="pd15">\
<div class="divtable">\
<pre class="layui-code">'+rdata.data+'</pre>\
</div>\
</div>',
success:function(){
copyText(rdata.data);
},
yes:function(){
copyText(rdata.data);
}
});
});
});
}
function gReadme(){
var readme = '<ul class="help-info-text c7">';
readme += '<li>https://github.com/grafana/loki</li>';
readme += '</ul>';
$('.soft-man-con').html(readme);
}
+84
View File
@@ -0,0 +1,84 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
VERSION=$2
sysArch=`arch`
sysName=`uname`
ARCH_NAME=amd64
if [ "$sysArch" == "arm64" ];then
ARCH_NAME=arm64
elif [ "$sysArch" == "x86_64" ]; then
ARCH_NAME=amd64
elif [ "$sysArch" == "aarch64" ]; then
ARCH_NAME=aarch64
fi
FILE_TGZ=loki-linux-${ARCH_NAME}.zip
PT_FILE_TGZ=promtail-linux-${ARCH_NAME}.zip
# 检查是否通
Install_App()
{
SourceDir=$serverPath/source/grafana
InstallDir=$serverPath/loki
mkdir -p ${SourceDir}
mkdir -p ${InstallDir}
mkdir -p ${InstallDir}/bin
mkdir -p ${InstallDir}/logs
mkdir -p ${InstallDir}/data/{chunks,rules,boltdb-shipper-active,boltdb-shipper-cache}
if [ ! -f ${SourceDir}/${FILE_TGZ} ];then
wget --no-check-certificate -O ${SourceDir}/${FILE_TGZ} https://github.com/grafana/loki/releases/download/v${VERSION}/${FILE_TGZ}
fi
if [ ! -f ${SourceDir}/${PT_FILE_TGZ} ];then
wget --no-check-certificate -O ${SourceDir}/${PT_FILE_TGZ} https://github.com/grafana/loki/releases/download/v${VERSION}/${PT_FILE_TGZ}
fi
if [ ! -f $InstallDir/bin/loki ];then
cd ${SourceDir} && unzip ${FILE_TGZ}
cp -rf ./loki-linux-${ARCH_NAME} ${InstallDir}/bin/loki
rm -rf ./loki-linux-${ARCH_NAME}
fi
if [ ! -f $InstallDir/bin/promtail ];then
cd ${SourceDir} && unzip ${PT_FILE_TGZ}
cp -rf ./promtail-linux-${ARCH_NAME} ${InstallDir}/bin/promtail
rm -rf ./promtail-linux-${ARCH_NAME}
fi
}
Uninstall_App()
{
echo "卸载成功"
}
# StandardOutput=syslog
# StandardError=syslog
# SyslogIdentifier=loki
# # 资源限制 (根据服务器配置调整)
# MemoryLimit=1G
# CPUQuota=200%
curl -v -H "Content-Type: application/json" -XPOST "http://localhost:3100/loki/api/v1/push" \
-d "{\"streams\": [{\"stream\": {\"test\": \"test\"}, \"values\": [[\"$timestamp\", \"test message\"]]}]}"
action=${1}
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
@@ -0,0 +1,471 @@
# coding:utf-8
import sys
import io
import os
import time
import subprocess
import re
import json
web_dir = os.getcwd() + "/web"
if os.path.exists(web_dir):
sys.path.append(web_dir)
os.chdir(web_dir)
import core.mw as mw
def getServerDir():
return mw.getServerDir() + '/mysql'
def getPluginDir():
return mw.getPluginDir() + '/mysql'
def getConf():
path = getServerDir() + '/etc/my.cnf'
return path
def getDbPort():
file = getConf()
content = mw.readFile(file)
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getSocketFile():
file = getConf()
content = mw.readFile(file)
rep = r'socket\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def pSqliteDb(dbname='databases'):
file = getServerDir() + '/mysql.db'
name = 'mysql'
conn = mw.M(dbname).dbPos(getServerDir(), name)
return conn
def pMysqlDb():
# pymysql
db = mw.getMyORM()
db.setPort(getDbPort())
db.setSocket(getSocketFile())
# db.setCharset("utf8")
db.setPwd(pSqliteDb('config').where('id=?', (1,)).getField('mysql_root'))
return db
class sphinxMake():
pdb = None
psdb = None
pkey_name_cache = {}
delta = 'sph_counter'
ver = ''
def __init__(self):
self.pdb = pMysqlDb()
def setDeltaName(self, name):
self.delta = name
return True
def setVersion(self, ver):
self.ver = ver
def createSql(self, db):
conf = '''
CREATE TABLE IF NOT EXISTS `{$DB_NAME}`.`{$TABLE_NAME}` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`table` varchar(200) NOT NULL,
`max_id` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `table_uniq` (`table`),
KEY `table` (`table`)
) ENGINE=InnoDB AUTO_INCREMENT=1 CHARSET=utf8mb4;
'''
conf = conf.replace("{$TABLE_NAME}", self.delta)
conf = conf.replace("{$DB_NAME}", db)
return conf
def eqVerField(self, field):
if field == 'sql_attr_timestamp':
return 'attr_bigint'
if field == 'sql_attr_bigint':
return 'attr_bigint'
if field == 'sql_attr_float':
return 'attr_float'
if field == 'sql_field_string':
return 'field_string'
return field
def pathVerName(self):
ver = self.ver.replace(".1",'')
# if float(ver) >= 3.6:
# return 'datadir'
return 'path'
def getTablePk(self, db, table):
key = db+'_'+table
if key in self.pkey_name_cache:
return self.pkey_name_cache[key]
# SHOW INDEX FROM bbs.bbs_ucenter_vars WHERE Key_name = 'PRIMARY'
pkey_sql = "SHOW INDEX FROM {}.{} WHERE Key_name = 'PRIMARY';".format(db,table,);
pkey_data = self.pdb.query(pkey_sql)
# print(db, table)
# print(pkey_data)
key = ''
if len(pkey_data) == 1:
pkey_name = pkey_data[0]['Column_name']
sql = "select COLUMN_NAME,DATA_TYPE from information_schema.COLUMNS where `TABLE_SCHEMA`='{}' and `TABLE_NAME` = '{}' and `COLUMN_NAME`='{}';"
sql = sql.format(db,table,pkey_name,)
# print(sql)
fields = self.pdb.query(sql)
if len(fields) == 1:
# print(fields[0]['DATA_TYPE'])
if mw.inArray(['bigint','smallint','tinyint','int','mediumint'], fields[0]['DATA_TYPE']):
key = pkey_name
return key
def getTableFieldStr(self, db, table):
sql = "select COLUMN_NAME,DATA_TYPE from information_schema.COLUMNS where `TABLE_SCHEMA`='{}' and `TABLE_NAME` = '{}';"
sql = sql.format(db,table,)
fields = self.pdb.query(sql)
field_str = ''
for x in range(len(fields)):
field_str += '`'+fields[x]['COLUMN_NAME']+'`,'
field_str = field_str.strip(',')
return field_str
def makeSphinxHeader(self):
conf = '''
indexer {
mem_limit = 1G
}
searchd
{
listen = 127.0.0.1:9322
listen = 127.0.0.1:9326:mysql
listen = 127.0.0.1:9328:http
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
pid_file = /var/run/manticore/searchd.pid
}
'''
conf = conf.replace("{$server_dir}", mw.getServerDir())
return conf
def makeSphinxDbSourceRangeSql(self, db, table):
pkey_name = self.getTablePk(db,table)
sql = "SELECT min("+pkey_name+"), max("+pkey_name+") FROM "+table
return sql
def makeSphinxDbSourceQuerySql(self, db, table):
pkey_name = self.getTablePk(db,table)
field_str = self.getTableFieldStr(db,table)
# print(field_str)
if pkey_name == 'id':
sql = "SELECT " + field_str + " FROM " + table + " where id >= $start AND id <= $end"
else:
sql = "SELECT `"+pkey_name+'` as `id`,' + field_str + " FROM " + table + " where "+pkey_name+" >= $start AND "+pkey_name+" <= $end"
return sql
def makeSphinxDbSourceDeltaRange(self, db, table):
pkey_name = self.getTablePk(db,table)
conf = "SELECT (SELECT max_id FROM `{$SPH_TABLE}` where `table`='{$TABLE_NAME}') as min, (SELECT max({$PK_NAME}) FROM {$TABLE_NAME}) as max"
conf = conf.replace("{$DB_NAME}", db)
conf = conf.replace("{$TABLE_NAME}", table)
conf = conf.replace("{$SPH_TABLE}", self.delta)
conf = conf.replace("{$PK_NAME}", pkey_name)
return conf
def makeSphinxDbSourcePost(self, db, table):
pkey_name = self.getTablePk(db,table)
conf = "sql_query_post = UPDATE {$SPH_TABLE} SET max_id=(SELECT MAX({$PK_NAME}) FROM {$TABLE_NAME}) where `table`='{$TABLE_NAME}'"
# conf = "REPLACE INTO {$SPH_TABLE} (`table`,`max_id`) VALUES ('{$TABLE_NAME}',(SELECT MAX({$PK_NAME}) FROM {$TABLE_NAME}))"
conf = conf.replace("{$DB_NAME}", db)
conf = conf.replace("{$TABLE_NAME}", table)
conf = conf.replace("{$SPH_TABLE}", self.delta)
conf = conf.replace("{$PK_NAME}", pkey_name)
return conf
def makeSphinxDbSourceDelta(self, db, table):
conf = '''
source {$DB_NAME}_{$TABLE_NAME}_delta:{$DB_NAME}_{$TABLE_NAME}
{
sql_query_pre = SET NAMES utf8
sql_query_range = {$DELTA_RANGE}
sql_query = {$DELTA_QUERY}
{$DELTA_UPDATE}
{$SPH_FIELD}
}
index {$DB_NAME}_{$TABLE_NAME}_delta:{$DB_NAME}_{$TABLE_NAME}
{
source = {$DB_NAME}_{$TABLE_NAME}_delta
{$PATH_NAME} = {$server_dir}/manticoresearch/index/db/{$DB_NAME}.{$TABLE_NAME}/delta
html_strip = 1
ngram_len = 1
{$SPH_FIELD_INDEX}
}
''';
conf = conf.replace("{$server_dir}", mw.getServerDir())
conf = conf.replace("{$PATH_NAME}", self.pathVerName())
conf = conf.replace("{$DB_NAME}", db)
conf = conf.replace("{$TABLE_NAME}", table)
delta_range = self.makeSphinxDbSourceDeltaRange(db, table)
conf = conf.replace("{$DELTA_RANGE}", delta_range)
delta_query = self.makeSphinxDbSourceQuerySql(db, table)
conf = conf.replace("{$DELTA_QUERY}", delta_query)
delta_update = self.makeSphinxDbSourcePost(db, table)
conf = conf.replace("{$DELTA_UPDATE}", delta_update)
sph_field = self.makeSqlToSphinxTable(db, table)
conf = self.makeSphinxDbFieldRepalce(conf, sph_field)
return conf;
def makeSphinxDbSource(self, db, table, create_sphinx_table = False):
db_info = pSqliteDb('databases').field('username,password').where('name=?', (db,)).find()
port = getDbPort()
conf = '''
source {$DB_NAME}_{$TABLE_NAME}
{
type = mysql
sql_host = 127.0.0.1
sql_user = {$DB_USER}
sql_pass = {$DB_PASS}
sql_db = {$DB_NAME}
sql_port = {$DB_PORT}
sql_query_pre = SET NAMES utf8
{$UPDATE}
sql_query_range = {$DB_RANGE_SQL}
sql_range_step = 1000
sql_query = {$DB_QUERY_SQL}
{$SPH_FIELD}
}
index {$DB_NAME}_{$TABLE_NAME}
{
source = {$DB_NAME}_{$TABLE_NAME}
{$PATH_NAME} = {$server_dir}/manticoresearch/index/db/{$DB_NAME}.{$TABLE_NAME}/index
ngram_len = 1
{$SPH_FIELD_INDEX}
}
'''
conf = conf.replace("{$server_dir}", mw.getServerDir())
conf = conf.replace("{$PATH_NAME}", self.pathVerName())
conf = conf.replace("{$DB_NAME}", db)
conf = conf.replace("{$TABLE_NAME}", table)
conf = conf.replace("{$DB_USER}", db_info['username'])
conf = conf.replace("{$DB_PASS}", db_info['password'])
conf = conf.replace("{$DB_PORT}", port)
range_sql = self.makeSphinxDbSourceRangeSql(db, table)
conf = conf.replace("{$DB_RANGE_SQL}", range_sql)
query_sql = self.makeSphinxDbSourceQuerySql(db, table)
conf = conf.replace("{$DB_QUERY_SQL}", query_sql)
sph_field = self.makeSqlToSphinxTable(db, table)
# conf = conf.replace("{$SPH_FIELD}", sph_field)
conf = self.makeSphinxDbFieldRepalce(conf, sph_field)
if create_sphinx_table:
update = self.makeSphinxDbSourcePost(db, table)
conf = conf.replace("{$UPDATE}", update)
else:
conf = conf.replace("{$UPDATE}", '')
if create_sphinx_table:
sph_sql = self.createSql(db)
self.pdb.query(sph_sql)
sql_find = "select * from {}.{} where `table`='{}'".format(db,self.delta,table)
find_data = self.pdb.query(sql_find)
if len(find_data) == 0:
insert_sql = "insert into `{}`.`{}`(`table`,`max_id`) values ('{}',{}) ".format(db,self.delta,table,0)
# print(insert_sql)
self.pdb.execute(insert_sql)
conf += self.makeSphinxDbSourceDelta(db,table)
# print(ver)
# print(conf)
return conf
def makeSphinxDbFieldRepalce(self, content, sph_field):
content = content.replace("{$SPH_FIELD}", '')
content = content.replace("{$SPH_FIELD_INDEX}", '')
return content
def makeSqlToSphinxDb(self, db, table = [], is_delta = False):
conf = ''
for tn in table:
pkey_name = self.getTablePk(db,tn)
if pkey_name == '':
continue
conf += self.makeSphinxDbSource(db, tn,is_delta)
if len(table) == 0:
tables = self.pdb.query("show tables in "+ db)
for x in range(len(tables)):
key = 'Tables_in_'+db
table_name = tables[x][key]
pkey_name = self.getTablePk(db, table_name, is_delta)
if pkey_name == '':
continue
if self.makeSqlToSphinxTableIsHaveFulltext(db, table_name):
conf += self.makeSphinxDbSource(db, table_name)
return conf
def makeSqlToSphinxTableIsHaveFulltext(self, db, table):
sql = "select COLUMN_NAME,DATA_TYPE from information_schema.COLUMNS where `TABLE_SCHEMA`='{}' and `TABLE_NAME` = '{}';"
sql = sql.format(db,table,)
cols = self.pdb.query(sql)
cols_len = len(cols)
for x in range(cols_len):
data_type = cols[x]['DATA_TYPE']
column_name = cols[x]['COLUMN_NAME']
if mw.inArray(['varchar'], data_type):
return True
if mw.inArray(['text','mediumtext','tinytext','longtext'], data_type):
return True
return False
def makeSqlToSphinxTable(self,db,table):
pkey_name = self.getTablePk(db,table)
sql = "select COLUMN_NAME,DATA_TYPE from information_schema.COLUMNS where `TABLE_SCHEMA`='{}' and `TABLE_NAME` = '{}';"
sql = sql.format(db,table,)
cols = self.pdb.query(sql)
cols_len = len(cols)
conf = ''
run_pos = 0
for x in range(cols_len):
data_type = cols[x]['DATA_TYPE']
column_name = cols[x]['COLUMN_NAME']
# print(column_name+":"+data_type)
# if mw.inArray(['tinyint'], data_type):
# conf += 'sql_attr_bool = '+ column_name + "\n"
if pkey_name == column_name:
# run_pos += 1
# conf += '\tsql_attr_bigint = '+column_name+"\n"
continue
if mw.inArray(['enum'], data_type):
run_pos += 1
conf += '\t'+self.eqVerField('sql_attr_string')+' = '+ column_name + "\n"
continue
if mw.inArray(['decimal'], data_type):
run_pos += 1
conf += '\t'+self.eqVerField('sql_attr_float')+' = '+ column_name + "\n"
continue
if mw.inArray(['bigint','smallint','tinyint','int','mediumint'], data_type):
run_pos += 1
conf += '\t'+self.eqVerField('sql_attr_bigint')+' = '+ column_name + "\n"
continue
if mw.inArray(['float'], data_type):
run_pos += 1
conf += '\t'+self.eqVerField('sql_attr_float')+' = '+ column_name + "\n"
continue
if mw.inArray(['char'], data_type):
conf += '\t'+self.eqVerField('sql_attr_string')+' = '+ column_name + "\n"
continue
if mw.inArray(['varchar'], data_type):
run_pos += 1
conf += '\t'+self.eqVerField('sql_field_string')+' = '+ column_name + "\n"
continue
if mw.inArray(['text','mediumtext','tinytext','longtext'], data_type):
run_pos += 1
conf += '\t'+self.eqVerField('sql_field_string')+' = '+ column_name + "\n"
continue
if mw.inArray(['datetime','date'], data_type):
run_pos += 1
conf += '\t'+self.eqVerField('sql_attr_timestamp')+' = '+ column_name + "\n"
continue
return conf
def checkDbName(self, db):
filter_db = ['information_schema','performance_schema','sys','mysql']
if db in filter_db:
return False
return True
def makeSqlToSphinx(self, db, tables = [], is_delta = False):
conf = ''
conf += self.makeSphinxHeader()
conf += self.makeSqlToSphinxDb(db, tables, is_delta)
return conf
def makeSqlToSphinxAll(self):
filter_db = ['information_schema','performance_schema','sys','mysql']
dblist = self.pdb.query('show databases')
conf = ''
conf += self.makeSphinxHeader()
# conf += makeSqlToSphinxDb(pdb, 'bbs')
for x in range(len(dblist)):
dbname = dblist[x]['Database']
if mw.inArray(filter_db, dbname):
continue
conf += self.makeSqlToSphinxDb(dbname)
return conf
File diff suppressed because it is too large Load Diff
+27
View File
@@ -0,0 +1,27 @@
indexer {
mem_limit = 1G
}
searchd {
listen = 127.0.0.1:9322
listen = 127.0.0.1:9326:mysql
listen = 127.0.0.1:9328:http
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
pid_file = /var/run/manticore/searchd.pid
data_dir = /var/lib/manticore
workers = threads
binlog_path = /var/lib/manticore
max_children = 1000
max_matches = 1000000
}
index mydocs
{
type = rt
path = /usr/share/doc/manticore/README.Debian
rt_field = title
rt_attr_json = j
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

+36
View File
@@ -0,0 +1,36 @@
<style>
#table xm-select{
min-height: 30px;
line-height: 30px;
}
#table xm-select *{
font-size: 12px;
}
</style>
<div class="bt-form">
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('manticoresearch');">服务</p>
<p onclick="pluginInitD('manticoresearch');">自启动</p>
<p onclick="pluginConfigTpl('manticoresearch','', 'conf','config_tpl','read_config_tpl',tryRebuildIndex);">配置修改</p>
<p onclick="pluginLogs('manticoresearch','','run_log',30);">运行日志</p>
<p onclick="pluginLogs('manticoresearch','','query_log', 30);">查询日志</p>
<p onclick="mcsRunStatus();">运行状态</p>
<p onclick="mcsCommonFunc();">常用功能</p>
<p onclick="mcsReadme();">说明</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con" style="height:425px;overflow: auto;"></div>
</div>
</div>
</div>
<script type="text/javascript">
resetPluginWinHeight(500);
$.getScript( "/plugins/file?name=manticoresearch&f=js/manticoresearch.js", function(){
pluginService('manticoresearch');
});
</script>
+507
View File
@@ -0,0 +1,507 @@
# coding:utf-8
import sys
import io
import os
import time
import re
import string
import subprocess
web_dir = os.getcwd() + "/web"
if os.path.exists(web_dir):
sys.path.append(web_dir)
os.chdir(web_dir)
import core.mw as mw
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getPluginName():
return 'manticoresearch'
def getSeName():
return 'manticore'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
sys.path.append(getPluginDir() +"/class")
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getInitDFile():
if app_debug:
return '/tmp/' + getPluginName()
return '/etc/init.d/' + getPluginName()
def getConfTpl():
path = getPluginDir() + "/conf/manticore.conf"
return path
def getConf():
path = "/etc/manticoresearch/manticore.conf"
return path
def getInitDTpl():
path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl"
return path
def getArgs():
args = sys.argv[2:]
tmp = {}
args_len = len(args)
if args_len == 1:
t = args[0].strip('{').strip('}')
t = t.split(':')
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':')
tmp[t[0]] = t[1]
return tmp
def checkArgs(data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def configTpl():
path = getPluginDir() + '/tpl'
pathFile = os.listdir(path)
tmp = []
for one in pathFile:
file = path + '/' + one
tmp.append(file)
return mw.getJson(tmp)
def readConfigTpl():
args = getArgs()
data = checkArgs(args, ['file'])
if not data[0]:
return data[1]
content = mw.readFile(args['file'])
content = contentReplace(content)
return mw.returnJson(True, 'ok', content)
def contentReplace(content):
service_path = mw.getServerDir()
content = content.replace('{$ROOT_PATH}', mw.getFatherDir())
content = content.replace('{$SERVER_PATH}', service_path)
content = content.replace('{$SERVER_APP}', service_path + '/'+getPluginName())
return content
def status():
cmd = "ps -ef|grep manticore |grep -v grep | grep -v mdserver-web | awk '{print $2}'"
data = mw.execShell(cmd)
# print(data)
if data[0] == '':
return 'stop'
return 'start'
def mkdirAll():
content = mw.readFile(getConf())
rep = r'path\s*=\s*(.*)'
p = re.compile(rep)
tmp = p.findall(content)
for x in tmp:
if x.find('binlog') != -1:
mw.execShell('mkdir -p ' + x)
else:
mw.execShell('mkdir -p ' + os.path.dirname(x))
mw.execShell("chown -R manticore:manticore "+x)
def isInitFile():
path = getServerDir() + '/init.pl'
if os.path.exists(path):
return True
mw.writeFile(path, 'ok')
return False
def initDreplace():
dirs_list = [
"/var/log/manticore",
"/var/run/manticore",
"/var/lib/manticore"
]
for d in dirs_list:
if not os.path.exists(d):
mw.execShell('mkdir -p ' + d)
mw.execShell("chown -R manticore:manticore /var/run/manticore")
# config replace
conf_bin = getConf()
if not os.path.exists(conf_bin) or not isInitFile():
conf_content = mw.readFile(getConfTpl())
conf_content = contentReplace(conf_content)
mw.writeFile(getConf(), conf_content)
mkdirAll()
return "ok"
def checkIndexSph():
content = mw.readFile(getConf())
rep = r'path\s*=\s*(.*)'
p = re.compile(rep)
tmp = p.findall(content)
for x in tmp:
if x.find('binlog') != -1:
continue
else:
p = x + '.sph'
if os.path.exists(p):
return False
return True
def mcsOp(method):
initDreplace()
data = mw.execShell('systemctl ' + method + ' ' + getSeName())
if data[1] == '':
return 'ok'
return 'fail'
def start():
import tool_cron
tool_cron.createBgTask()
return mcsOp('start')
def stop():
import tool_cron
tool_cron.removeBgTask()
return mcsOp('stop')
def restart():
return mcsOp('restart')
def reload():
return mcsOp('restart')
def rebuild():
cmd = 'indexer --all --rotate'
data = mw.execShell(cmd)
if data[0].find('successfully')<0:
return data[0].replace("\n","<br/>")
return 'ok'
def initdStatus():
service_name = getSeName()
shell_cmd = 'systemctl status '+service_name+' | grep loaded | grep "enabled;"'
data = mw.execShell(shell_cmd)
if data[0] == '':
return 'fail'
return 'ok'
def initdInstall():
service_name = getSeName()
mw.execShell('systemctl enable '+service_name)
return 'ok'
def initdUinstall():
service_name = getSeName()
mw.execShell('systemctl disable '+service_name)
return 'ok'
def runLog():
path = getConf()
content = mw.readFile(path)
rep = r'log\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0]
def getMainPort():
path = getConf()
content = mw.readFile(path)
rep = r'listen\s*=\s*(.*)'
conf = re.search(rep, content)
port_line = conf.groups()[0]
return port_line.split(":")[1]
def getMysqlPort():
path = getConf()
content = mw.readFile(path)
rep = r'listen\s*=\s*(.*):mysql'
conf = re.search(rep, content)
port_line = conf.groups()[0]
return port_line.split(":")[1]
def getHttpPort():
path = getConf()
content = mw.readFile(path)
rep = r'listen\s*=\s*(.*):http'
conf = re.search(rep, content)
port_line = conf.groups()[0]
return port_line.split(":")[1]
def queryLog():
path = getConf()
content = mw.readFile(path)
rep = r'query_log\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0]
def runStatus():
s = status()
if s != 'start':
return mw.returnJson(False, '没有启动程序')
sys.path.append(getPluginDir() + "/class")
import sphinxapi
sh = sphinxapi.SphinxClient()
port = getMainPort()
sh.SetServer('127.0.0.1', port)
info_status = sh.Status()
if info_status is None:
return mw.returnJson(False,'无法获取运行状态!')
rData = {}
for x in range(len(info_status)):
rData[info_status[x][0]] = info_status[x][1]
return mw.returnJson(True, 'ok', rData)
def runStatusTest():
s = status()
if s != 'start':
return mw.returnJson(False, '没有启动程序')
sys.path.append(getPluginDir() + "/class")
import sphinxapi
sh = sphinxapi.SphinxClient()
port = getMainPort()
sh.SetServer('127.0.0.1', port)
info_status = sh.Status()
rData = {}
for x in range(len(info_status)):
rData[info_status[x][0]] = info_status[x][1]
return mw.returnJson(True, 'ok', rData)
def sphinxConfParse():
file = getConf()
bin_dir = getServerDir()
content = mw.readFile(file)
rep = r'index\s(.*)'
sindex = re.findall(rep, content)
indexlen = len(sindex)
cmd = {}
cmd['cmd'] = "indexer -c " + getConf()
cmd['index'] = []
cmd_index = []
cmd_delta = []
if indexlen > 0:
for x in range(indexlen):
name = sindex[x].strip()
if name == '':
continue
if name.find(':') != -1:
cmd_delta.append(name.strip())
else:
cmd_index.append(name.strip())
# print(cmd_index)
# print(cmd_delta)
for ci in cmd_index:
val = {}
val['index'] = ci
for cd in cmd_delta:
cd = cd.replace(" ", '')
if cd.find(":"+ci) > -1:
val['delta'] = cd.split(":")[0].strip()
break
cmd['index'].append(val)
return cmd
def sphinxCmd():
data = sphinxConfParse()
if 'index' in data:
return mw.returnJson(True, 'ok', data)
else:
return mw.returnJson(False, 'no index')
def makeDbToSphinxTest():
conf_file = getConf()
import sphinx_make
sph_make = sphinx_make.sphinxMake()
conf = sph_make.makeSqlToSphinxAll()
mw.writeFile(conf_file,conf)
print(conf)
# makeSqlToSphinxTable()
return True
def makeDbToSphinx():
args = getArgs()
check = checkArgs(args, ['db','tables','is_delta','is_cover'])
if not check[0]:
return check[1]
db = args['db']
tables = args['tables']
is_delta = args['is_delta']
is_cover = args['is_cover']
if is_cover != 'yes':
return mw.returnJson(False,'暂时仅支持覆盖!')
sph_file = getConf()
import sphinx_make
sph_make = sphinx_make.sphinxMake()
version_pl = getServerDir() + "/version.pl"
if os.path.exists(version_pl):
version = mw.readFile(version_pl).strip()
sph_make.setVersion(version)
if not sph_make.checkDbName(db):
return mw.returnJson(False,'保留数据库名称,不可用!')
is_delta_bool = False
if is_delta == 'yes':
is_delta_bool = True
if is_cover == 'yes':
tables = tables.split(',')
content = sph_make.makeSqlToSphinx(db, tables, is_delta_bool)
mw.writeFile(sph_file,content)
mkdirAll()
return mw.returnJson(True,'设置成功!')
return mw.returnJson(True,'测试中')
# 全量更新
def updateAll():
data = sphinxConfParse()
cmd = data['cmd']
if not 'index' in data:
return '无更新'
index = data['index']
for x in range(len(index)):
cmd_index = cmd + ' ' + index[x]['index'] + ' --rotate'
print(cmd_index)
os.system(cmd_index)
return ''
#增量更新
def updateDelta():
data = sphinxConfParse()
cmd = data['cmd']
if not 'index' in data:
return '无更新'
index = data['index']
for x in range(len(index)):
if 'delta' in index[x]:
cmd_index = cmd + ' ' + index[x]['delta'] + ' --rotate'
print(cmd_index)
os.system(cmd_index)
cmd_index_merge = cmd + ' --merge ' + index[x]['index'] + ' ' + index[x]['delta'] + ' --rotate'
print(cmd_index_merge)
os.system(cmd_index_merge)
else:
print(index[x]['index'],'no delta')
return ''
def installPreInspection(version):
if mw.isAppleSystem():
return '不支持mac系统'
return 'ok'
if __name__ == "__main__":
version = "3.1.1"
version_pl = getServerDir() + "/version.pl"
if os.path.exists(version_pl):
version = mw.readFile(version_pl).strip()
func = sys.argv[1]
if func == 'status':
print(status())
elif func == 'start':
print(start())
elif func == 'stop':
print(stop())
elif func == 'restart':
print(restart())
elif func == 'reload':
print(reload())
elif func == 'rebuild':
print(rebuild())
elif func == 'initd_status':
print(initdStatus())
elif func == 'initd_install':
print(initdInstall())
elif func == 'initd_uninstall':
print(initdUinstall())
elif func == 'install_pre_inspection':
print(installPreInspection(version))
elif func == 'conf':
print(getConf())
elif func == 'config_tpl':
print(configTpl())
elif func == 'read_config_tpl':
print(readConfigTpl())
elif func == 'run_log':
print(runLog())
elif func == 'query_log':
print(queryLog())
elif func == 'run_status':
print(runStatus())
elif func == 'run_status_test':
print(runStatusTest())
elif func == 'sphinx_cmd':
print(sphinxCmd())
elif func == 'db_to_sphinx':
print(makeDbToSphinx())
elif func == 'update_all':
print(updateAll())
elif func == 'update_delta':
print(updateDelta())
else:
print('error')
+19
View File
@@ -0,0 +1,19 @@
{
"sort": 7,
"ps": "SphinxSearch项目演变而来,专注于提升搜索效率与扩展性",
"name": "manticoresearch",
"title": "manticoresearch",
"shell": "install.sh",
"versions":["7.4.6"],
"tip": "soft",
"install_pre_inspection":true,
"checks": "server/manticoresearch",
"path": "server/manticoresearch",
"display": 1,
"author": "manticoresoftware",
"date": "2025-07-21",
"home": "https://github.com/manticoresoftware/manticoresearch/",
"doc1": "https://manual.manticoresearch.com/Introduction",
"type": 0,
"pid": "2"
}
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
sysArch=`arch`
# cd /www/server/mdserver-web/plugins/manticoresearch && bash install.sh install 7.4.6
# cd /www/server/mdserver-web && python3 plugins/manticoresearch/index.py run_status_test
# systemctl status manticore
# systemctl restart manticore
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
ACTION=$1
VERSION=$2
which apt
if [ "$?" == "0" ];then
sh -x $curPath/versions/apt/install.sh $1 $2
fi
which yum
if [ "$?" == "0" ];then
sh -x $curPath/versions/yum/install.sh $1 $2
fi
+310
View File
@@ -0,0 +1,310 @@
function spPostMin(method, args, callback){
var req_data = {};
req_data['name'] = 'manticoresearch';
req_data['func'] = method;
if (typeof(args) != 'undefined' && args!=''){
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/run', req_data, function(data) {
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function myPost(method, args, callback, title){
var _args = null;
if (typeof(args) == 'string'){
_args = JSON.stringify(toArrayObject(args));
} else {
_args = JSON.stringify(args);
}
var _title = '正在获取...';
if (typeof(title) != 'undefined'){
_title = title;
}
$.post('/plugins/run', {name:'mysql', func:method, args:_args}, function(data) {
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function spPost(method, args, callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
spPostMin(method,args,function(data){
layer.close(loadT);
if(typeof(callback) == 'function'){
callback(data);
}
});
}
function mcsCommonFunc(){
var con = '<button class="btn btn-default btn-sm" onclick="confirmRebuildIndex();">重建索引</button>';
con += '&nbsp;&nbsp; <button class="btn btn-default btn-sm" onclick="autoMakeConf();">自动创建配置</button>';
$(".soft-man-con").html(con);
}
function autoMakeConf(){
var xm_db_list;
var con = '<ul class="help-info-text c7">';
con += '<li style="color:red;">如果数据量比较大,第一次启动会失败!(可通过手动建立索引)</li>';
con += '<li style="color:red;">以下内容,需手动加入计划任务。</li>';
layer.open({
type: 1,
area: ['380px','350px'],
title: '自动创建配置',
closeBtn: 1,
shift: 5,
shadeClose: true,
btn:["提交","关闭"],
content: "<form class='bt-form pd20'>\
<div class='line'>\
<span class='tname'>选择数据库</span>\
<div class='info-r'>\
<select class='bt-input-text mr5' name='dbname' style='width:100%'>\
<option value=''>无</option>\
</select>\
</div>\
</div>\
<div class='line'>\
<span class='tname'>选择表</span>\
<div class='info-r'>\
<div id='table'></div>\
</div>\
</div>\
<div class='line'>\
<span class='tname'>是否增量</span>\
<div class='info-r'>\
<select class='bt-input-text mr5' name='is_delta' style='width:100px'>\
<option value='no'>否</option>\
<option value='yes'>是</option>\
</select>\
</div>\
</div>\
<div class='line'>\
<span class='tname'>是否覆盖配置</span>\
<div class='info-r'>\
<select class='bt-input-text mr5' name='is_cover' style='width:100px'>\
<option value='yes'>是</option>\
<option value='no'>否</option>\
</select>\
</div>\
</div>\
<ul class='help-info-text c7'>\
<li style='color:red;'>具体配置,仍须手动修改!!!</li>\
<li style='color:red;'>增量索引,需要有更新权限,主从分离时,需要主库配置</li>\
</ul>\
</form>\
",
success:function(l,i){
$(l).find('.layui-layer-content').css('overflow','visible');
xm_db_list = xmSelect.render({
el: '#table',
repeat: false,
toolbar: {show: true},
data: [],
});
myPost('get_db_list', {"page":1,"page_size":20}, function(data){
var rdata = $.parseJSON(data.data);
var dblist = rdata.data;
var db_html = '';
for (var i = 0; i < dblist.length; i++) {
db_html += "<option value='"+dblist[i]['name']+"'>"+dblist[i]['name']+"</option>";
}
if (dblist.length > 0){
initDbSelect(dblist[0]['name']);
}
$('select[name="dbname"]').html(db_html);
});
$('select[name="dbname"]').change(function(){
var db = $('select[name="dbname"]').val();
initDbSelect(db);
});
},
yes:function(index){
var args = {}
args['db'] = $('select[name="dbname"]').val();
args['is_delta'] = $('select[name="is_delta"]').val();
args['is_cover'] = $('select[name="is_cover"]').val();
args['tables'] = xm_db_list.getValue('value').join(',');
// console.log(args);
spPost('db_to_sphinx', args, function(rdata){
var rdata = $.parseJSON(rdata.data);
// console.log(rdata);
showMsg(rdata.msg,function(){
if (rdata.status){
layer.close(index);
confirmRebuildIndex();
}
},{icon: rdata.status ? 1 : 2}, 2000);
});
}
});
function initDbSelect(db){
if (db == ''){
return;
}
getDbInfo(db, function(rdata){
var rdata = $.parseJSON(rdata.data);
var tables = rdata.tables;
var idx_db = [];
for (var i = 0; i < tables.length; i++) {
var t = {};
t['name'] = tables[i]['table_name'];
t['value'] = tables[i]['table_name'];
idx_db.push(t);
}
xm_db_list = xmSelect.render({el: '#table', filterable: true,repeat: false,toolbar: {show: true},data: idx_db,});
});
}
function getDbInfo(db_name, callback){
myPost('get_db_info', {name:db_name}, function(data){
callback(data);
});
}
}
function rebuildIndex(){
spPost('rebuild', '', function(data){
if (data.data == 'ok'){
layer.msg('重建成功!',{icon:1,time:2000,shade: [0.3, '#000']});
} else {
layer.msg(data.data,{icon:2,time:10000,shade: [0.3, '#000']});
}
});
}
function confirmRebuildIndex(){
layer.confirm("是否重建索引?", {icon:3,closeBtn: 1} , function(){
rebuildIndex();
});
}
function tryRebuildIndex(){
layer.confirm("修改配置后,是否尝试重建索引!", {icon:3,closeBtn: 1} , function(){
rebuildIndex();
});
}
function secToTime(s) {
var t;
if(s > -1){
var hour = Math.floor(s/3600);
var min = Math.floor(s/60) % 60;
var sec = s % 60;
if(hour < 10) {
t = '0'+ hour + ":";
} else {
t = hour + ":";
}
if(min < 10){t += "0";}
t += min + ":";
if(sec < 10){t += "0";}
t += sec.toFixed(2);
}
return t;
}
function mcsRunStatus(){
spPost('run_status', '', function(data){
var rdata = $.parseJSON(data.data);
if (!rdata['status']){
layer.msg(rdata['msg'],{icon:2,time:2000,shade: [0.3, '#000']});
return;
}
var idata = rdata.data;
var tbody = '';
for (var i in idata) {
tbody += '<tr><th>'+i+'</th><td>' + idata[i] + '</td><td colspan="2">'+i+'</td></tr>';
}
var con = '<div class="divtable"><table class="table table-hover table-bordered" style="margin-bottom:10px;background-color:#fafafa">\
<tbody>\
<tr><th>运行时间</th><td>' + secToTime(idata.uptime) + '</td><th>每秒查询</th><td>' + parseInt(parseInt(idata.queries) / parseInt(idata.uptime)) + '</td></tr>\
<tr><th>总连接次数</th><td>' + idata.connections + '</td><th>work_queue_length</th><td>' +idata.work_queue_length + '</td></tr>\
<tr><th>agent_connect</th><td>' + idata.agent_connect+ '</td><th>workers_active</th><td>' + idata.workers_active + '</td></tr>\
<tr><th>agent_retry</th><td>' + idata.agent_retry + '</td><th>workers_total</th><td>' + idata.workers_total + '</td></tr>\
</tbody>\
</table>\
<table class="table table-hover table-bordered">\
<thead style="display:none;"><th></th><th></th><th></th><th></th></thead>\
<tbody>\
'+tbody+'\
<tbody>\
</table>\
</div>';
$(".soft-man-con").html(con);
});
}
function mcsReadme(){
spPost('sphinx_cmd', '', function(data){
var rdata = $.parseJSON(data.data);
if (!rdata['status']){
layer.msg(rdata['msg'],{icon:2,time:2000,shade: [0.3, '#000']});
return;
}
// console.log(rdata['data']);
var con = '<ul class="help-info-text c7">';
con += '<li style="color:red;">如果数据量比较大,第一次启动会失败!(可通过手动建立索引)</li>';
con += '<li style="color:red;">以下内容,需手动加入计划任务。</li>';
con += '<li>全量:' + rdata['data']['cmd'] + ' --all --rotate</li>';
//主索引
for (var i = 0; i < rdata['data']['index'].length; i++) {
var index_kv = rdata['data']['index'][i];
var index = index_kv['index'];
// console.log(index);
con += '<li>主索引 :' + rdata['data']['cmd'] + ' '+ index +' --rotate</li>';
if (typeof(index_kv['delta']) != 'undefined'){
var delta = index_kv['delta'];
con += '<li>增量索引 :' + rdata['data']['cmd'] + ' '+ delta +' --rotate</li>';
con += '<li>合并索引 :' + rdata['data']['cmd'] + ' --merge '+ index + ' ' + delta +' --rotate</li>';
}
}
con += '</ul>';
$(".soft-man-con").html(con);
});
}
+211
View File
@@ -0,0 +1,211 @@
# coding:utf-8
import sys
import io
import os
import time
import json
web_dir = os.getcwd() + "/web"
if os.path.exists(web_dir):
sys.path.append(web_dir)
os.chdir(web_dir)
import core.mw as mw
from utils.crontab import crontab as MwCrontab
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getPluginName():
return 'manticoresearch'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getTaskConf():
conf = getServerDir() + "/cron_config.json"
return conf
def getTaskDeltaConf():
conf = getServerDir() + "/cron_delta_config.json"
return conf
def getConfigData():
conf = getTaskConf()
if os.path.exists(conf):
return json.loads(mw.readFile(getTaskConf()))
return {
"task_id": -1,
"period": "day-n",
"where1": "1",
"hour": "0",
"minute": "15",
}
def getConfigDeltaData():
conf = getTaskDeltaConf()
if os.path.exists(conf):
return json.loads(mw.readFile(getTaskDeltaConf()))
return {
"task_id": -1,
"period": "minute-n",
"where1": "3",
"hour": "0",
"minute": "0",
}
def createBgTask():
removeBgTask()
removeDeltaBgTask()
createBgTaskByName(getPluginName())
createBgTaskDeltaByName(getPluginName())
return True
def createBgTaskByName(name):
args = getConfigData()
_name = "[勿删]全量更新[" + name + "]"
res = mw.M("crontab").field("id, name").where("name=?", (_name,)).find()
if res:
return True
if "task_id" in args and args["task_id"] > 0:
res = mw.M("crontab").field("id, name").where("id=?", (args["task_id"],)).find()
if res and res["id"] == args["task_id"]:
print("计划任务已经存在!")
return True
mw_dir = mw.getPanelDir()
cmd = '''
mw_dir=%s
rname=%s
plugin_path=%s
script_path=%s
logs_file=$plugin_path/${rname}.log
''' % (mw_dir, name, getServerDir(), getPluginDir())
cmd += 'echo "★【`date +"%Y-%m-%d %H:%M:%S"`】 STSRT★" >> $logs_file' + "\n"
cmd += 'echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" >> $logs_file' + "\n"
cmd += 'echo "python3 $script_path/index.py update_all"' + "\n"
cmd += 'cd $mw_dir && python3 $script_path/index.py update_all' + "\n"
cmd += 'echo "【`date +"%Y-%m-%d %H:%M:%S"`】 END★" >> $logs_file' + "\n"
cmd += 'echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" >> $logs_file' + "\n"
params = {
'name': _name,
'type': args['period'],
'week': "",
'where1': args['where1'],
'hour': args['hour'],
'minute': args['minute'],
'save': "",
'backup_to': "",
'stype': "toShell",
'sname': '',
'sbody': cmd,
'url_address': '',
}
task_id = MwCrontab.instance().add(params)
if task_id > 0:
args["task_id"] = task_id
args["name"] = name
mw.writeFile(getTaskConf(), json.dumps(args))
def createBgTaskDeltaByName(name):
args = getConfigDeltaData()
_name = "[勿删]增量更新[" + name + "]"
res = mw.M("crontab").field("id, name").where("name=?", (_name,)).find()
if res:
return True
if "task_id" in args and args["task_id"] > 0:
res = mw.M("crontab").field("id, name").where("id=?", (args["task_id"],)).find()
if res and res["id"] == args["task_id"]:
print("计划任务已经存在!")
return True
mw_dir = mw.getPanelDir()
cmd = '''
mw_dir=%s
rname=%s
plugin_path=%s
script_path=%s
logs_file=$plugin_path/${rname}.log
''' % (mw_dir, name, getServerDir(), getPluginDir())
cmd += 'echo "★【`date +"%Y-%m-%d %H:%M:%S"`】 STSRT★" >> $logs_file' + "\n"
cmd += 'echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" >> $logs_file' + "\n"
cmd += 'echo "python3 $script_path/index.py update_delta"' + "\n"
cmd += 'cd $mw_dir && python3 $script_path/index.py update_delta' + "\n"
cmd += 'echo "【`date +"%Y-%m-%d %H:%M:%S"`】 END★" >> $logs_file' + "\n"
cmd += 'echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" >> $logs_file' + "\n"
params = {
'name': _name,
'type': args['period'],
'week': "",
'where1': args['where1'],
'hour': args['hour'],
'minute': args['minute'],
'save': "",
'backup_to': "",
'stype': "toShell",
'sname': '',
'sbody': cmd,
'url_address': '',
}
task_id = MwCrontab.instance().add(params)
if task_id > 0:
args["task_id"] = task_id
args["name"] = name
mw.writeFile(getTaskConf(), json.dumps(args))
def removeBgTask():
cfg = getConfigData()
if "task_id" in cfg and cfg["task_id"] > 0:
res = mw.M("crontab").field("id, name").where(
"id=?", (cfg["task_id"],)).find()
if res and res["id"] == cfg["task_id"]:
data = MwCrontab.instance().delete(cfg["task_id"])
if data[0]:
cfg["task_id"] = -1
mw.writeFile(getTaskConf(), json.dumps(cfg))
return True
return False
def removeDeltaBgTask():
cfg = getConfigDeltaData()
if "task_id" in cfg and cfg["task_id"] > 0:
res = mw.M("crontab").field("id, name").where(
"id=?", (cfg["task_id"],)).find()
if res and res["id"] == cfg["task_id"]:
data = MwCrontab.instance().delete(cfg["task_id"])
if data[0]:
cfg["task_id"] = -1
mw.writeFile(getTaskDeltaConf(), json.dumps(cfg))
return True
return False
if __name__ == "__main__":
if len(sys.argv) > 1:
action = sys.argv[1]
if action == "remove":
removeBgTask()
removeDeltaBgTask()
elif action == "add":
createBgTask()
+107
View File
@@ -0,0 +1,107 @@
#
# Discuz manticore Config File
#
searchd {
listen = 127.0.0.1:9322
listen = 127.0.0.1:9326:mysql
listen = 127.0.0.1:9328:http
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
pid_file = /var/run/manticore/searchd.pid
#data_dir = /var/lib/manticore
}
source pre_forum_thread
{
type = mysql
sql_host = 127.0.0.1
sql_user = bbs
sql_pass = bbs
sql_db = bbs
sql_port = 3306
sql_query_pre = SET NAMES UTF8
sql_query_pre = REPLACE INTO bbs_common_sphinxcounter SELECT 1, MAX(tid) FROM bbs_forum_thread
sql_query = SELECT t.tid as id,t.tid,t.subject,t.digest,t.displayorder,t.authorid,t.lastpost,t.special \
FROM bbs_forum_thread AS t WHERE t.tid>=$start AND t.tid<=$end
sql_query_range = SELECT (SELECT MIN(tid) FROM bbs_forum_thread),maxid FROM bbs_common_sphinxcounter WHERE indexid=1
sql_range_step = 5000
sql_attr_uint = tid
sql_attr_uint = digest
sql_attr_uint = displayorder
sql_attr_uint = authorid
sql_attr_uint = special
sql_attr_timestamp =lastpost
}
index pre_forum_thread
{
source = pre_forum_thread
path = {$SERVER_APP}/index/db/pre_forum_thread/index
min_word_len = 2
html_strip = 1
ngram_len = 1
}
# threads_minute
source pre_forum_thread_minute : pre_forum_thread
{
sql_query_pre = SET NAMES UTF8
sql_query_range = SELECT maxid-1,(SELECT MAX(tid) FROM bbs_forum_thread) FROM bbs_common_sphinxcounter WHERE indexid=1
}
# threads_minute
index pre_forum_thread_minute : pre_forum_thread
{
source = pre_forum_thread_minute
path = {$SERVER_APP}/index/db/pre_forum_thread/pre_forum_thread_minute
}
#posts
source pre_forum_post : pre_forum_thread
{
type = mysql
sql_query_pre = SET NAMES UTF8
sql_query_pre = REPLACE INTO bbs_common_sphinxcounter SELECT 2, MAX(pid) FROM bbs_forum_post
sql_query = SELECT p.pid AS id,p.tid,p.subject,p.message,t.digest,t.displayorder,t.authorid,t.lastpost,t.special \
FROM bbs_forum_post AS p LEFT JOIN bbs_forum_thread AS t USING(tid) where p.pid >=$start and p.pid <=$end \
AND p.first=1
sql_query_range = SELECT (SELECT MIN(pid) FROM bbs_forum_post),maxid FROM bbs_common_sphinxcounter WHERE indexid=2
sql_range_step = 5000
sql_attr_uint = tid
sql_attr_uint = digest
sql_attr_uint= displayorder
sql_attr_uint = authorid
sql_attr_uint = special
sql_attr_timestamp = lastpost
}
#posts
index pre_forum_post
{
source = pre_forum_post
path = {$SERVER_APP}/index/db/pre_forum_thread/pre_forum_post
min_word_len = 2
html_strip = 1
ngram_len = 1
}
#pre_forum_post_minute
source pre_forum_post_minute : pre_forum_post
{
sql_query_pre = SET NAMES UTF8
sql_query_range = SELECT maxid-1,(SELECT MAX(pid) FROM bbs_forum_post) FROM bbs_common_sphinxcounter WHERE indexid=2
}
#pre_forum_post_minute
index pre_forum_post_minute : pre_forum_post
{
source = pre_forum_thread
path = {$SERVER_APP}/index/db/pre_forum_thread/pre_forum_post_minute
}
+9
View File
@@ -0,0 +1,9 @@
searchd {
listen = 127.0.0.1:9322
listen = 127.0.0.1:9326:mysql
listen = 127.0.0.1:9328:http
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
pid_file = /var/run/manticore/searchd.pid
data_dir = /var/lib/manticore
}
+71
View File
@@ -0,0 +1,71 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
sysArch=`arch`
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
VERSION=$2
Install_App()
{
echo '正在安装manticoresearch...'
mkdir -p $serverPath/manticoresearch
MC_DIR=${serverPath}/source/manticoresearch
mkdir -p $MC_DIR
wget --no-check-certificate -O $MC_DIR/manticore-repo.noarch.deb https://repo.manticoresearch.com/manticore-repo.noarch.deb
dpkg -i $MC_DIR/manticore-repo.noarch.deb
apt update -y
apt -y install manticore manticore-extra
echo "${VERSION}" > $serverPath/manticoresearch/version.pl
cd ${rootPath} && python3 plugins/manticoresearch/index.py start ${VERSION}
cd ${rootPath} && python3 plugins/manticoresearch/index.py initd_install ${VERSION}
if [ -d ${MC_DIR} ];then
rm -rf ${MC_DIR}
fi
}
Uninstall_App()
{
cd ${rootPath} && python3 plugins/manticoresearch/index.py stop ${VERSION}
cd ${rootPath} && python3 plugins/manticoresearch/index.py initd_uninstall ${VERSION}
apt -y remove manticore manticore-extra
apt -y autoremove
if [ -d $serverPath/manticoresearch ];then
rm -rf $serverPath/manticoresearch
fi
if [ -f /usr/lib/systemd/system/manticore.service ] || [ -f /lib/systemd/system/manticore.service ];then
systemctl stop manticore
systemctl disable manticore
rm -rf /usr/lib/systemd/system/manticore.service
rm -rf /lib/systemd/system/manticore.service
systemctl daemon-reload
fi
echo "卸载manticoresearch成功"
}
action=$1
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
+67
View File
@@ -0,0 +1,67 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
sysArch=`arch`
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
VERSION=$2
Install_App()
{
echo '正在安装manticoresearch...'
mkdir -p $serverPath/manticoresearch
MC_DIR=${serverPath}/source/manticoresearch
mkdir -p $MC_DIR
yum install -y https://repo.manticoresearch.com/manticore-repo.noarch.rpm
yum install -y manticore manticore-extra
echo "${VERSION}" > $serverPath/manticoresearch/version.pl
if [ -d ${MC_DIR} ];then
rm -rf ${MC_DIR}
fi
cd ${rootPath} && python3 plugins/manticoresearch/index.py start ${VERSION}
cd ${rootPath} && python3 plugins/manticoresearch/index.py initd_install ${VERSION}
}
Uninstall_App()
{
yum -y remove manticore manticore-extra
if [ -d $serverPath/manticoresearch ];then
rm -rf $serverPath/manticoresearch
fi
if [ -f /usr/lib/systemd/system/manticore.service ] || [ -f /lib/systemd/system/manticore.service ];then
systemctl stop manticore
systemctl disable manticore
rm -rf /usr/lib/systemd/system/manticore.service
rm -rf /lib/systemd/system/manticore.service
systemctl daemon-reload
fi
cd ${rootPath} && python3 plugins/manticoresearch/index.py stop ${VERSION}
cd ${rootPath} && python3 plugins/manticoresearch/index.py initd_uninstall ${VERSION}
echo "卸载manticoresearch成功"
}
action=$1
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
+2 -2
View File
@@ -8,7 +8,7 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sys_os=`uname`
VERSION=1.6.38
VERSION=1.6.39
echo $sys_os
@@ -18,7 +18,7 @@ Install_mem(){
echo '正在安装脚本文件...'
if [ ! -f $serverPath/source/memcached.tar.gz ];then
wget --no-check-certificate -O $serverPath/source/memcached/memcached.tar.gz https://www.memcached.org/files/memcached-${VERSION}.tar.gz
wget --no-check-certificate -O $serverPath/source/memcached/memcached.tar.gz https://www.memcached.org/files/memcached-${VERSION}.tar.gz
fi
cd $serverPath/source/memcached && tar -zxvf memcached.tar.gz
+1 -1
View File
@@ -10,7 +10,7 @@ serverPath=$(dirname "$rootPath")
sysArch=`arch`
sysName=`uname`
# systemctl status mtg
# cd /www/server/mdserver-web && python3 plugins/mtproxy/index.py url
# cd /www/server/mdserver-web/plugins/mtproxy && /bin/bash install.sh install 1.0
+1 -1
View File
@@ -85,7 +85,7 @@ innodb_lock_wait_timeout = 120
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_file_per_table=1
innodb_file_per_table = 1
binlog_expire_logs_seconds=604800
secure-file-priv={$SERVER_APP_PATH}/tmp
+1 -1
View File
@@ -85,7 +85,7 @@ innodb_lock_wait_timeout = 120
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_file_per_table=1
innodb_file_per_table = 1
binlog_expire_logs_seconds=604800
secure-file-priv={$SERVER_APP_PATH}/tmp
+1 -1
View File
@@ -85,7 +85,7 @@ innodb_lock_wait_timeout = 120
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_file_per_table=1
innodb_file_per_table = 1
binlog_expire_logs_seconds=604800
secure-file-priv={$SERVER_APP_PATH}/tmp
+70 -6
View File
@@ -1283,6 +1283,8 @@ def getDbBackupList():
rr = []
for x in range(0, len(r)):
p = bkDir + '/' + r[x]
if not os.path.exists(p):
continue
data = {}
data['name'] = r[x]
@@ -1477,27 +1479,90 @@ def syncToDatabases():
msg = mw.getInfo('本次共同步了{1}个数据库!', (str(n),))
return mw.returnJson(True, msg)
def adjust_password_policy(version):
if version.startswith("8."):
serverdir = getServerDir()
mw.execShell(serverdir+f"/bin/mysql -u root -e \"SET GLOBAL validate_password.policy=LOW;\"")
mw.execShell(serverdir+f"/bin/mysql -u root -e \"SET GLOBAL validate_password.length=4;\"")
def setRootPwdForce(new_password,version=''):
# stop(version)
# | awk '{print $2}'| xargs kill
data = mw.execShell("ps -ef|grep mysql|grep -v plugins |grep -v grep | awk '{print $2}'| xargs kill")
# print(data)
time.sleep(1)
serverdir = getServerDir()
# 启动安全模式
cmd_msafe = serverdir+"/bin/mysqld_safe --skip-grant-tables --skip-networking"
# print("cmd_msafe",cmd_msafe)
subprocess.Popen(cmd_msafe, stdout=subprocess.PIPE, shell=True,bufsize=4096, stderr=subprocess.PIPE)
# 等待MySQL安全模式启动...
time.sleep(5)
if version.startswith("5.5") or version.startswith("5.6"):
cmd_mod_root = serverdir+f"/bin/mysql -u root -e \"UPDATE mysql.user SET Password=PASSWORD('{new_password}') WHERE user='root'; FLUSH PRIVILEGES;\""
data = mw.execShell(cmd_mod_root)
# print("修改root密码", cmd_mod_root)
# print(data)
else:
cmd_clear_root = serverdir+"/bin/mysql -u root -e \"UPDATE mysql.user SET authentication_string = '' WHERE user = 'root'; FLUSH PRIVILEGES;\""
data = mw.execShell(cmd_clear_root)
# print(cmd_clear_root,"清空root密码",data)
data = mw.execShell("ps -ef|grep mysql|grep -v plugins |grep -v grep | awk '{print $2}'| xargs kill")
# print("停止安全模式",data)
# 正常启动MySQL
start(version)
time.sleep(5)
if not version.startswith("5.5") and not version.startswith("5.6"):
# 针对MySQL 8.0+调整密码策略
if version.startswith("8."):
adjust_password_policy(version)
# 设置新密码
cmd_newpass = serverdir+f"/bin/mysql -u root -e \"ALTER USER 'root'@'localhost' IDENTIFIED BY '{new_password}'; FLUSH PRIVILEGES;\""
data = mw.execShell(cmd_newpass)
# print("新密码",cmd_newpass)
# print(data)
# 验证密码
cmd = serverdir+f"/bin/mysql -u root -p'{new_password}' -e 'SHOW DATABASES;'"
data = mw.execShell(cmd)
if data[1] == '':
return True
return False
def setRootPwd(version=''):
args = getArgs()
data = checkArgs(args, ['password'])
if not data[0]:
return data[1]
password = args['password']
#强制修改
force = 0
if 'force' in args and args['force'] == '1':
force = 1
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,))
return mw.returnJson(True, '【强制本地记录】数据库root密码修改成功(立马检查)!')
if 'force' in args and args['force'] == '2':
force = 2
ok = setRootPwdForce(password,version)
password = args['password']
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,))
if ok and version.startswith("8"):
pdb = pMysqlDb()
pdb.query("SET GLOBAL validate_password.policy=MEDIUM;")
return mw.returnJson(True, '【强制】数据库root密码修改成功!')
try:
pdb = pMysqlDb()
result = pdb.query("show databases")
isError = isSqlError(result)
if isError != None:
if force == 1:
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,))
return mw.returnJson(True, '【强制修改】数据库root密码修改成功(不意为成功连接数据)!')
return isError
if version.find('5.7') > -1 or version.find('8.0') > -1:
@@ -3031,7 +3096,6 @@ def deleteSlaveFunc(sign = ''):
db = pMysqlDb()
slave_name = getSlaveName()
if sign != '':
sign = args['sign']
db.query("stop {} for channel '{}'".format(slave_name,sign))
db.query("reset {} all for channel '{}'".format(slave_name, sign))
else:
+1
View File
@@ -12,6 +12,7 @@ export PATH
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql/index.py init_slave_status
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql/index.py install_pre_inspection
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql/index.py set_slave_status {"close":"change"}
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql/index.py set_root_pwd {"password":"root","force":"2"}
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
+20 -4
View File
@@ -535,16 +535,16 @@ function setRootPwd(type, pwd){
var index = layer.open({
type: 1,
area: '500px',
area: '800px',
title: '修改数据库密码',
closeBtn: 1,
shift: 5,
btn:["提交", "关闭", "复制ROOT密码", "强制修改"],
btn:["提交", "关闭", "复制ROOT密码", "修改本地ROOT记录", "强改ROOT密码"],
shadeClose: true,
content: "<form class='bt-form pd20' id='mod_pwd'>\
<div class='line'>\
<span class='tname'>root密码</span>\
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' />\
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:630px' value='"+pwd+"' />\
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span>\
</div>\
</div>\
@@ -565,7 +565,7 @@ function setRootPwd(type, pwd){
return false;
},
btn4:function(layerIndex){
layer.confirm('强制修改,是为了在重建时使用,确定强制?', {
layer.confirm('修改本地ROOT记录,确定修改?', {
btn: ['确定', '取消']
}, function(index, layero){
layer.close(index);
@@ -579,6 +579,22 @@ function setRootPwd(type, pwd){
});
});
return false;
},
btn5:function(layerIndex){
layer.confirm('强制修改MySQL密码,确定强制? (比较耗时)', {
btn: ['确定', '取消']
}, function(index, layero){
layer.close(index);
var password = $("#MyPassword").val();
myPost('set_root_pwd', {password:password,force:'2'}, function(data){
var rdata = $.parseJSON(data.data);
showMsg(rdata.msg,function(){
layer.close(layerIndex);
dbList();
},{icon: rdata.status ? 1 : 2});
});
});
return false;
}
});
}
+7 -2
View File
@@ -11,6 +11,9 @@ events
use {$EVENT_MODEL};
worker_connections 51200;
multi_accept on;
# file/video close the mutex lock when under high load
# accept_mutex off;
}
http
@@ -32,14 +35,16 @@ http
client_body_buffer_size 50m;
client_max_body_size 50m;
# video big file opt
# aio threads;
directio 4m;
output_buffers 16 512k;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
+1 -1
View File
@@ -5,7 +5,7 @@
"name": "php-apt",
"title": "PHP[APT]",
"coexist": true,
"versions": ["56","70","71","72","73","74","80","81","82","83","84"],
"versions": ["56","70","71","72","73","74","80","81","82","83","84", "85"],
"install_pre_inspection":true,
"tip": "soft",
"checks": "server/php-apt/VERSION",
+2 -2
View File
@@ -57,10 +57,10 @@ if [ ! -f /etc/apt/sources.list.d/php.list ] && [ "$OSNAME" == "debian" ];then
apt install -y apt-transport-https lsb-release ca-certificates curl
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ];then
curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://mirror.sjtu.edu.cn/sury/php/apt.gpg
curl -o /usr/share/keyrings/deb.sury.org-php.gpg https://mirror.sjtu.edu.cn/sury/php/apt.gpg
sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://mirror.sjtu.edu.cn/sury/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
else
curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
curl -o /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
fi
apt update -y
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
#获取信息和版本
# bash /www/server/mdsever-web/scripts/getos.sh
bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
version=8.5
PHP_VER=85
Install_php()
{
#------------------------ install start ------------------------------------#
apt -y install php${version} php${version}-fpm php${version}-dev
if [ "$?" == "0" ];then
mkdir -p $serverPath/php-apt/${PHP_VER}
fi
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
#------------------------ uninstall start ------------------------------------#
apt -y remove php${version} php${version}-*
rm -rf $serverPath/php-apt/${PHP_VER}
echo "卸载php-${version}..."
#------------------------ uninstall start ------------------------------------#
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi
+1
View File
@@ -9,6 +9,7 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
# cd /www/server/mdserver-web/plugins/php-apt/versions && /bin/bash all_test.sh
# cd /www/server/mdserver-web/plugins/php-apt && bash install.sh install 85
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php-apt/index.py start 5.6
+2 -2
View File
@@ -5,8 +5,8 @@
"name": "php",
"title": "PHP",
"coexist": true,
"versions": ["53","54","55","56","70","71","72","73","74","80","81","82","83","84"],
"updates": ["5.3.29","5.4.45","5.6.36","7.0.30","7.1.33","7.2.32","7.3.20","7.4.30","8.0.30","8.1.29","8.2.27","8.3.15","8.4.2"],
"versions": ["53","54","55","56","70","71","72","73","74","80","81","82","83","84","85"],
"updates": ["5.3.29","5.4.45","5.6.36","7.0.30","7.1.33","7.2.32","7.3.20","7.4.30","8.0.30","8.1.29","8.2.27","8.3.15","8.4.2","8.5.0"],
"tip": "soft",
"install_pre_inspection":true,
"checks": "server/php/VERSION/bin/php",
+2
View File
@@ -8,6 +8,8 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sysName=`uname`
# https://www.php.net/releases
if id www &> /dev/null ;then
echo "www uid is `id -u www`"
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
+2 -2
View File
@@ -9,9 +9,9 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
version=8.1.32
version=8.1.33
PHP_VER=81
md5_file_ok=c582ac682a280bbc69bc2186c21eb7e3313cc73099be61a6bc1d2cd337cbf383
md5_file_ok=9db83bf4590375562bc1a10b353cccbcf9fcfc56c58b7c8fb814e6865bb928d1
Install_php()
{
#------------------------ install start ------------------------------------#
+2 -2
View File
@@ -9,9 +9,9 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
version=8.2.28
version=8.2.29
PHP_VER=82
md5_file_ok=af8c9153153a7f489153b7a74f2f29a5ee36f5cb2c6c6929c98411a577e89c91
md5_file_ok=475f991afd2d5b901fb410be407d929bc00c46285d3f439a02c59e8b6fe3589c
Install_php()
{
#------------------------ install start ------------------------------------#
+2 -2
View File
@@ -9,9 +9,9 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
version=8.3.21
version=8.3.23
PHP_VER=83
md5_file_ok=4dfb329f209a552c3716394fc123bb62e80a468b55ce27fc8cb0fd5f30b9dcd6
md5_file_ok=08be64700f703bca6ff1284bf1fdaffa37ae1b9734b6559f8350248e8960a6db
Install_php()
{
#------------------------ install start ------------------------------------#
+2 -2
View File
@@ -9,9 +9,9 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
version=8.4.7
version=8.4.10
PHP_VER=84
md5_file_ok=e29f4c23be2816ed005aa3f06bbb8eae0f22cc133863862e893515fc841e65e3
md5_file_ok=14983a9ef8800e6bc2d920739fd386054402f7976ca9cd7f711509496f0d2632
Install_php()
{
#------------------------ install start ------------------------------------#
+174
View File
@@ -0,0 +1,174 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH=$PATH:/opt/homebrew/bin
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
version=8.5.0beta1
PHP_VER=85
# md5_file_ok=14983a9ef8800e6bc2d920739fd386054402f7976ca9cd7f711509496f0d2632
Install_php()
{
#------------------------ install start ------------------------------------#
echo "安装php-${version} ..."
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
# redat ge 8
which yum
if [ "$?" == "0" ];then
cd ${rootPath}/plugins/php/lib && /bin/bash oniguruma.sh
fi
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# # ----------------------------------------------------------------------- #
# # 中国优化安装
# cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
# LOCAL_ADDR=common
# if [ ! -z "$cn" ];then
# LOCAL_ADDR=cn
# fi
# if [ "$LOCAL_ADDR" == "cn" ];then
# if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
# wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.nju.edu.cn/php/php-${version}.tar.xz
# fi
# fi
# # ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
# wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://downloads.php.net/~edorian/php-${version}.tar.xz
fi
#检测文件是否损坏.
# if [ -f $sourcePath/php/php-${version}.tar.xz ];then
# md5_file=`sha256sum $sourcePath/php/php-${version}.tar.xz | awk '{print $1}'`
# if [ "${md5_file}" != "${md5_file_ok}" ]; then
# echo "PHP${version} 下载文件不完整,重新安装"
# rm -rf $sourcePath/php/php-${version}.tar.xz
# fi
# fi
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
fi
cd $sourcePath/php/php${PHP_VER}
OPTIONS='--without-iconv'
# if [ $sysName == 'Darwin' ]; then
# OPTIONS="${OPTIONS} --with-curl"
# fi
argon_version=`pkg-config libargon2 --modversion`
if [ "$?" == "0" ];then
OPTIONS="${OPTIONS} --with-password-argon2"
fi
IS_64BIT=`getconf LONG_BIT`
if [ "$IS_64BIT" == "64" ];then
OPTIONS="${OPTIONS} --with-libdir=lib64"
fi
# ----- cpu start ------
if [ -z "${cpuCore}" ]; then
cpuCore="1"
fi
if [ -f /proc/cpuinfo ];then
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
fi
MEM_INFO=$(which free > /dev/null && free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
cpuCore="${MEM_INFO}"
fi
else
cpuCore="1"
fi
if [ "$cpuCore" -gt "2" ];then
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
else
cpuCore="1"
fi
# ----- cpu end ------
# OPTIONS="${OPTIONS} --enable-debug"
# OPTIONS="${OPTIONS} --enable-dtrace"
if [ "$sysName" == "Darwin" ];then
BREW_DIR=`which brew`
BREW_DIR=${BREW_DIR/\/bin\/brew/}
LIB_DEPEND_DIR=`brew info openssl | grep ${BREW_DIR}/Cellar/openssl | cut -d \ -f 1 | awk 'END {print}'`
OPTIONS="$OPTIONS --with-openssl=$(brew --prefix openssl)"
export PKG_CONFIG_PATH=$LIB_DEPEND_DIR/lib/pkgconfig
export OPENSSL_CFLAGS="-I${LIB_DEPEND_DIR}/include"
export OPENSSL_LIBS="-L/${LIB_DEPEND_DIR}/lib -lssl -lcrypto -lz"
else
cd ${rootPath}/plugins/php/lib && /bin/bash openssl_30.sh
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$serverPath/lib/openssl30/lib/pkgconfig
OPTIONS="$OPTIONS --with-openssl"
fi
echo "$sourcePath/php/php${PHP_VER}"
if [ ! -d $serverPath/php/${PHP_VER} ];then
cd $sourcePath/php/php${PHP_VER}
# ./buildconf --force
./configure \
--prefix=$serverPath/php/${PHP_VER} \
--exec-prefix=$serverPath/php/${PHP_VER} \
--with-config-file-path=$serverPath/php/${PHP_VER}/etc \
--enable-mysqlnd \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysqlnd-ssl \
--enable-mbstring \
--enable-ftp \
--enable-sockets \
--enable-simplexml \
--enable-soap \
--enable-posix \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm
make clean && make -j${cpuCore} && make install && make clean
# rm -rf $sourcePath/php/php${PHP_VER}
fi
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
$serverPath/php/init.d/php${PHP_VER} stop
rm -rf $serverPath/php/${PHP_VER}
echo "卸载php-${version}..."
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi
+2 -2
View File
@@ -30,7 +30,7 @@ ROOT_DIR=$(cd "$(dirname "$0")"; pwd)
# echo "php${PHP_VER} -- end"
PHP_VER_LIST=(54 55 56 70 71 72 73 74 80 81 82 83 84)
PHP_VER_LIST=(54 55 56 70 71 72 73 74 80 81 82 83 84 85)
# PHP_VER_LIST=(81)
for PHP_VER in ${PHP_VER_LIST[@]}; do
echo "php${PHP_VER} -- start"
@@ -41,7 +41,7 @@ for PHP_VER in ${PHP_VER_LIST[@]}; do
done
cd $DIR
PHP_VER_LIST=(54 55 56 70 71 72 73 74 80 81 82 83 84)
PHP_VER_LIST=(54 55 56 70 71 72 73 74 80 81 82 83 84 85)
# yar
PHP_EXT_LIST=(ZendGuardLoader pdo mysqlnd sqlite3 openssl opcache mcrypt fileinfo \
exif gd intl pcntl memcache memcached redis imagemagick xdebug \
+4 -4
View File
@@ -28,7 +28,7 @@ ROOT_DIR=$(cd "$(dirname "$0")"; pwd)
# echo "php${PHP_VER} -- end"
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82 83 84)
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82 83 84 85)
# PHP_VER_LIST=(81)
for PHP_VER in ${PHP_VER_LIST[@]}; do
echo "php${PHP_VER} -- start"
@@ -39,11 +39,11 @@ for PHP_VER in ${PHP_VER_LIST[@]}; do
done
cd $DIR
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82 83 84)
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82 83 84 85)
# yar
PHP_EXT_LIST=(ZendGuardLoader pdo mysqlnd sqlite3 openssl opcache mcrypt fileinfo \
exif gd intl pcntl memcache memcached redis imagemagick xdebug \
swoole yac apc mongo mongodb solr seaslog mbstring iconv event)
exif gd intl pcntl memcache memcached redis xdebug \
swoole yac apc mongo mongodb seaslog mbstring iconv event)
for PHP_VER in ${PHP_VER_LIST[@]}; do
echo "php${PHP_VER} -- start"
+2 -2
View File
@@ -15,7 +15,7 @@ actionType=$1
version=$2
LIBNAME=event
LIBV=3.1.3
LIBV=3.1.4
if [ "$version" -lt "55" ];then
@@ -24,7 +24,7 @@ if [ "$version" -lt "55" ];then
fi
if [ "$version" -lt "83" ];then
LIBV=3.0.8
LIBV=3.1.4
fi
LIB_PATH_NAME=lib/php
+1 -1
View File
@@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
SYS_ARCH=`arch`
LIBNAME=imagick
LIBV=3.7.0
LIBV=3.8.0
sysName=`uname`
actionType=$1
version=$2
+1 -1
View File
@@ -21,7 +21,7 @@ if [ "$version" -lt "72" ];then
exit 1
fi
if [ "$version" == "84" ];then
if [ "$version" -ge "84" ];then
LIBV=1.0.7
echo "not need"
exit 1
+1 -1
View File
@@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
SYS_ARCH=`arch`
LIBNAME=memcached
LIBV=3.2.0
LIBV=3.3.0
sysName=`uname`
actionType=$1
version=$2
+4 -4
View File
@@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
SYS_ARCH=`arch`
LIBNAME=solr
LIBV=2.7.0
LIBV=2.8.1
sysName=`uname`
actionType=$1
version=$2
@@ -101,6 +101,9 @@ Uninstall_lib()
echo "php$version 未安装,请选择其它版本!"
return
fi
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
extFile=$extDir${LIBNAME}.so
if [ ! -f "$extFile" ];then
@@ -108,9 +111,6 @@ Uninstall_lib()
echo "php-$vphp not install ${LIBNAME}, Plese select other version!"
return
fi
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
rm -f $extFile
cd ${curPath} && bash ${rootPath}/plugins/php/versions/lib.sh $version restart
+10 -3
View File
@@ -17,16 +17,23 @@ version=$2
LIBNAME=swoole
LIBV=5.1.6
if [ "$version" == "85" ];then
echo "not need"
exit 1
fi
if [ "$version" -lt "70" ];then
LIBV=1.10.1
elif [ "$version" == "70" ];then
LIBV=4.3.0
elif [ "$version" == "71" ];then
LIBV=4.5.2
elif [ "$version" == "72" ] || [ "$version" == "73" ] || [ "$version" == "74" ];then
elif [ "$version" -le "74" ];then
LIBV=4.8.10
elif [ "$version" -gt "74" ];then
LIBV=5.1.6
elif [ "$version" -lt "80" ];then
LIBV=6.0.2
elif [ "$version" -gt "80" ];then
LIBV=6.0.2
else
echo 'other?'
exit 0
+9 -3
View File
@@ -12,21 +12,27 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
SYS_ARCH=`arch`
LIBNAME=xdebug
LIBV=3.1.5
LIBV=3.4.5
sysName=`uname`
actionType=$1
version=$2
if [ "$version" == "85" ];then
echo "not need"
exit 1
fi
if [ "$version" -lt "70" ];then
LIBV=2.2.7
fi
if [ "$version" -eq "70" ] || [ "$version" -eq "71" ];then
if [ "$version" -le "80" ];then
LIBV=2.7.0
fi
if [ "$version" -gt "80" ];then
LIBV=3.3.2
LIBV=3.4.5
fi
LIB_PATH_NAME=lib/php
+1 -1
View File
@@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
SYS_ARCH=`arch`
LIBNAME=xhprof
LIBV=2.3.7
LIBV=2.3.10
sysName=`uname`
actionType=$1
version=$2
+74 -33
View File
@@ -78,7 +78,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "加密库",
"msg": "Sodium加密库的包装器",
@@ -97,7 +98,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "压缩",
"msg": "压缩算法",
@@ -116,7 +118,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "运算库",
"msg": "一个开源的数学运算库",
@@ -139,7 +142,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "缓存器",
"msg": "用于加速PHP脚本!",
@@ -163,7 +167,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "SSL",
@@ -180,7 +185,9 @@
"80",
"81",
"82",
"83"
"83",
"84",
"85"
],
"type": "通用扩展",
"msg": "加密软件",
@@ -201,7 +208,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "轻型目录访问协议",
@@ -236,7 +244,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "高精度计算!",
@@ -260,7 +269,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "缓存器",
"msg": "用于信号控制!",
@@ -284,7 +294,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "编码转换!",
@@ -306,7 +317,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "用于FILE!",
@@ -327,7 +339,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "提供到libevent库的接口",
@@ -349,7 +362,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "用于图像文件格式!",
@@ -368,7 +382,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "序列化扩展!",
@@ -392,7 +407,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "国际化与本地化!",
@@ -416,7 +432,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "通用GD库!",
@@ -440,7 +457,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "通用网络",
@@ -464,7 +482,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "提供国际化支持",
@@ -479,7 +498,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "命令行的支持",
@@ -525,7 +545,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "缓存器",
"msg": "强大的内容缓存器,支持集群",
@@ -549,7 +570,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "缓存器",
"msg": "更强大的内容缓存器,支持集群",
@@ -598,7 +620,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "比GD更强大的图形库",
@@ -620,7 +643,9 @@
"80",
"81",
"82",
"83"
"83",
"84",
"85"
],
"type": "调试器",
"msg": "不多说,不了解的不要安装",
@@ -643,7 +668,9 @@
"80",
"81",
"82",
"83"
"83",
"84",
"85"
],
"type": "性能分析",
"msg": "不多说,不了解的不要安装!",
@@ -665,7 +692,8 @@
"80",
"81",
"82",
"83"
"83",
"84"
],
"type": "通用扩展",
"msg": "异步、并行、高性能网络通信引擎",
@@ -689,7 +717,11 @@
"73",
"74",
"80",
"81"
"81",
"82",
"83",
"84",
"85"
],
"type": "框架",
"msg": "Phalcon是一个全栈PHP框架。",
@@ -728,7 +760,9 @@
"80",
"81",
"82",
"83"
"83",
"84",
"85"
],
"type": "通用扩展",
"msg": "YAML-1.1解析器和发射器",
@@ -762,7 +796,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "通用扩展",
"msg": "Mongodb数据库连接驱动",
@@ -781,7 +816,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "缓存器",
"msg": "高性能无锁共享内存Cache",
@@ -803,7 +839,9 @@
"80",
"81",
"82",
"83"
"83",
"84",
"85"
],
"type": "大数据",
"msg": "SOLR全文搜索服务",
@@ -826,7 +864,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "日志",
"msg": "SeasLog高性能日志记录",
@@ -850,7 +889,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "压缩",
"msg": "压缩组件",
@@ -874,7 +914,8 @@
"81",
"82",
"83",
"84"
"84",
"85"
],
"type": "压缩",
"msg": "压缩组件",
+1 -1
View File
@@ -12,7 +12,7 @@ sysName=`uname`
postgreDir=${serverPath}/source/postgresql
VERSION=14.12
VERSION=14.18
# su - postgres -c "/www/server/postgresql/bin/pg_ctl start -D /www/server/postgresql/data"
+1 -1
View File
@@ -11,7 +11,7 @@ serverPath=$(dirname "$rootPath")
sysName=`uname`
postgreDir=${serverPath}/source/postgresql
VERSION=15.7
VERSION=15.13
# su - postgres -c "/www/server/postgresql/bin/pg_ctl start -D /www/server/postgresql/data"
+1 -1
View File
@@ -12,7 +12,7 @@ sysName=`uname`
postgreDir=${serverPath}/source/postgresql
VERSION=16.4
VERSION=16.9
# su - postgres -c "/www/server/postgresql/bin/pg_ctl start -D /www/server/postgresql/data"
+1 -1
View File
@@ -12,7 +12,7 @@ sysName=`uname`
postgreDir=${serverPath}/source/postgresql
VERSION=17.2
VERSION=17.5
# su - postgres -c "/www/server/postgresql/bin/pg_ctl start -D /www/server/postgresql/data"
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

+30
View File
@@ -0,0 +1,30 @@
<style>
.overflow_hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
</style>
<div class="bt-form">
<div class='plugin_version'></div>
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('prometheus');">服务</p>
<p onclick="pluginInitD('prometheus');">自启动</p>
<p onclick="gCommonFunc($('.plugin_version').attr('version'));">常用功能</p>
<p onclick="pluginConfig('prometheus',$('.plugin_version').attr('version'),'conf');">配置</p>
<p onclick="gReadme();">相关说明</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con" style="height: 520px; overflow: auto;"></div>
</div>
</div>
</div>
<script type="text/javascript">
$.getScript( "/plugins/file?name=prometheus&f=js/prometheus.js", function(){
pluginService('prometheus', $('.plugin_version').attr('version'));
});
</script>
+230
View File
@@ -0,0 +1,230 @@
# coding:utf-8
import sys
import io
import os
import time
import re
web_dir = os.getcwd() + "/web"
if os.path.exists(web_dir):
sys.path.append(web_dir)
os.chdir(web_dir)
import core.mw as mw
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getPluginName():
return 'prometheus'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getInitDFile():
current_os = mw.getOs()
if current_os == 'darwin':
return '/tmp/' + getPluginName()
if current_os.startswith('freebsd'):
return '/etc/rc.d/' + getPluginName()
return '/etc/init.d/' + getPluginName()
def getConf():
path = getServerDir() + "/prometheus.yml"
return path
def getInitDTpl():
path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl"
return path
def getArgs():
args = sys.argv[3:]
tmp = {}
args_len = len(args)
if args_len == 1:
t = args[0].strip('{').strip('}')
if t.strip() == '':
tmp = []
else:
t = t.split(':')
tmp[t[0]] = t[1]
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':')
tmp[t[0]] = t[1]
return tmp
def checkArgs(data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def getPidFile():
file = getConf()
content = mw.readFile(file)
rep = r'pidfile\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def status():
cmd = "ps aux|grep prometheus |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
data = mw.execShell(cmd)
if data[0] == '':
return 'stop'
return 'start'
def getInstallVerion():
version_pl = getServerDir() + "/version.pl"
version = mw.readFile(version_pl).strip()
return version
def contentReplace(content):
service_path = mw.getServerDir()
content = content.replace('{$ROOT_PATH}', mw.getFatherDir())
content = content.replace('{$SERVER_PATH}', service_path)
return content
def openPort():
try:
from utils.firewall import Firewall as MwFirewall
MwFirewall.instance().addAcceptPort('3000', 'prometheus', 'port')
return port
except Exception as e:
return "Release failed {}".format(e)
return True
def initDreplace():
# 初始化OP配置
init_file = getServerDir() + '/init.pl'
if not os.path.exists(init_file):
# openPort()
mw.writeFile(init_file, 'ok')
# systemd
systemDir = mw.systemdCfgDir()
systemService = systemDir + '/' + getPluginName() + '.service'
if os.path.exists(systemDir) and not os.path.exists(systemService):
systemServiceTpl = getPluginDir() + '/init.d/' + getPluginName() + '.service.tpl'
service_path = mw.getServerDir()
content = mw.readFile(systemServiceTpl)
content = content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(systemService, content)
mw.execShell('systemctl daemon-reload')
return True
def gOp(method):
initDreplace()
data = mw.execShell('systemctl ' + method + ' '+getPluginName())
mw.execShell('systemctl ' + method + ' '+getPluginName())
if data[1] == '':
return 'ok'
return data[1]
def start():
return gOp('start')
def stop():
return gOp('stop')
def restart():
return gOp('restart')
def reload():
return gOp('reload')
def initdStatus():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
shell_cmd = 'systemctl status prometheus|grep loaded|grep "enabled;"'
data = mw.execShell(shell_cmd)
if data[0] == '':
return 'fail'
return 'ok'
def initdInstall():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
data = mw.execShell('systemctl enable prometheus')
if data[1] != '':
return data[1]
return 'ok'
def initdUinstall():
current_os = mw.getOs()
if current_os == 'darwin':
return "Apple Computer does not support"
data = mw.execShell('systemctl disable prometheus')
if data[1] != '':
return data[1]
return 'ok'
def prometheusUrl():
ip = mw.getLocalIp()
return 'http://'+ip+':'+"9090"
def installPreInspection():
return 'ok'
def uninstallPreInspection():
return 'ok'
if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
print(status())
elif func == 'start':
print(start())
elif func == 'stop':
print(stop())
elif func == 'restart':
print(restart())
elif func == 'reload':
print(reload())
elif func == 'initd_status':
print(initdStatus())
elif func == 'initd_install':
print(initdInstall())
elif func == 'initd_uninstall':
print(initdUinstall())
elif func == 'install_pre_inspection':
print(installPreInspection())
elif func == 'uninstall_pre_inspection':
print(uninstallPreInspection())
elif func == 'conf':
print(getConf())
elif func == 'prometheus_url':
print(prometheusUrl())
else:
print('error')
+17
View File
@@ -0,0 +1,17 @@
{
"sort": 7,
"ps": "监控系统与时间序列数据库",
"name": "prometheus",
"title": "prometheus",
"shell": "install.sh",
"versions":["3.5.0"],
"tip": "soft",
"checks": "server/prometheus",
"path": "server/prometheus",
"display": 1,
"author": "midoks",
"date": "2025-08-02",
"home": "https://prometheus.io/download/",
"type": 0,
"pid": "5"
}
@@ -0,0 +1,18 @@
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/docs/introduction/overview/
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecReload=/bin/kill -HUP $MAINPID
ExecStart={$SERVER_PATH}/prometheus/prometheus \
--config.file={$SERVER_PATH}/prometheus/prometheus.yml \
--storage.tsdb.path={$SERVER_PATH}/prometheus/data \
--web.console.templates={$SERVER_PATH}/prometheus/consoles \
--web.console.libraries={$SERVER_PATH}/prometheus/console_libraries \
--web.listen-address=0.0.0.0:9090
SyslogIdentifier=prometheus
Restart=always
[Install]
WantedBy=multi-user.target
+85
View File
@@ -0,0 +1,85 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
# https://www.cnblogs.com/n00dle/p/16916044.html
# cd /www/server/mdserver-web/plugins/prometheus && /bin/bash install.sh install 3.5.0
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/prometheus/index.py start
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
VERSION=$2
sysArch=`arch`
sysName=`uname`
echo "use system: ${sysName}"
OSNAME=`bash ${rootPath}/scripts/getos.sh`
if [ "" == "$OSNAME" ];then
OSNAME=`cat ${rootPath}/data/osname.pl`
fi
if [ "macos" == "$OSNAME" ];then
echo "不支持Macox"
exit
fi
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
# if id prometheus &> /dev/null ;then
# echo "prometheus uid is `id -u prometheus`"
# echo "prometheus shell is `grep "^prometheus:" /etc/passwd |cut -d':' -f7 `"
# else
# groupadd prometheus
# useradd -g prometheus -s /bin/bash prometheus
# fi
Install_App()
{
echo '正在安装脚本文件...'
mkdir -p $serverPath/source/prometheus
mkdir -p $serverPath/prometheus
echo "${VERSION}" > $serverPath/prometheus/version.pl
shell_file=${curPath}/versions/${VERSION}/linux.sh
if [ -f $shell_file ];then
bash -x $shell_file install ${VERSION}
else
echo '不支持...'
exit 1
fi
#初始化
cd ${rootPath} && python3 ${rootPath}/plugins/prometheus/index.py start
cd ${rootPath} && python3 ${rootPath}/plugins/prometheus/index.py initd_install
echo 'Prometheus安装完成'
}
Uninstall_App()
{
shell_file=${curPath}/versions/${VERSION}/linux.sh
if [ -f $shell_file ];then
bash -x $shell_file uninstall ${VERSION}
fi
cd ${rootPath} && python3 ${rootPath}/plugins/prometheus/index.py stop
cd ${rootPath} && python3 ${rootPath}/plugins/prometheus/index.py initd_uninstall
rm -rf $serverPath/prometheus
echo 'Prometheus卸载完成'
}
action=$1
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
+96
View File
@@ -0,0 +1,96 @@
function gPost(method, version, args,callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
var req_data = {};
req_data['name'] = 'prometheus';
req_data['func'] = method;
req_data['version'] = version;
if (typeof(args) == 'string'){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/run', req_data, function(data) {
layer.close(loadT);
if (!data.status){
//错误展示10S
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function gPostCallbak(method, version, args,callback){
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
var req_data = {};
req_data['name'] = 'prometheus';
req_data['func'] = method;
args['version'] = version;
if (typeof(args) == 'string'){
req_data['args'] = JSON.stringify(toArrayObject(args));
} else {
req_data['args'] = JSON.stringify(args);
}
$.post('/plugins/callback', req_data, function(data) {
layer.close(loadT);
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
if(typeof(callback) == 'function'){
callback(data);
}
},'json');
}
function gCommonFunc(){
var con = '<hr/><p class="conf_p" style="text-align:center;">\
<button id="prometheus_url" class="btn btn-default btn-sm">获取连接地址</button>\
</p>';
$(".soft-man-con").html(con);
$('#prometheus_url').click(function(){
gPost('prometheus_url', '', {}, function(rdata){
layer.open({
title: "prometheus连接",
area: ['600px', '180px'],
type:1,
closeBtn: 1,
shadeClose: false,
btn:["复制","取消"],
content: '<div class="pd15">\
<div class="divtable">\
<pre class="layui-code">'+rdata.data+'</pre>\
</div>\
</div>',
success:function(){
copyText(rdata.data);
},
yes:function(){
copyText(rdata.data);
}
});
});
});
}
function gReadme(){
var readme = '<ul class="help-info-text c7">';
readme += '<li>https://prometheus.io/download</li>';
readme += '</ul>';
$('.soft-man-con').html(readme);
}
@@ -0,0 +1,61 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
VERSION=$2
sysArch=`arch`
sysName=`uname`
ARCH_NAME=amd64
if [ "$sysArch" == "arm64" ];then
ARCH_NAME=arm64
elif [ "$sysArch" == "x86_64" ]; then
ARCH_NAME=amd64
elif [ "$sysArch" == "aarch64" ]; then
ARCH_NAME=aarch64
fi
FILE_TGZ=prometheus-${VERSION}.linux-${ARCH_NAME}.tar.gz
# 检查是否通
Install_App()
{
SourceDir=$serverPath/source/prometheus
InstallDir=$serverPath/prometheus
mkdir -p ${SourceDir}
mkdir -p ${InstallDir}/bin
if [ ! -f ${SourceDir}/${FILE_TGZ} ];then
wget --no-check-certificate -O ${SourceDir}/${FILE_TGZ} https://github.com/prometheus/prometheus/releases/download/v${VERSION}/${FILE_TGZ}
fi
if [ ! -d $InstallDir/bin/prometheus ];then
cd ${SourceDir} && tar -zxvf ${FILE_TGZ}
cd ${SourceDir}/prometheus-${VERSION}.linux-${ARCH_NAME}
cp -rf ./* $InstallDir
fi
}
Uninstall_App()
{
echo "卸载成功"
}
action=${1}
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
+1 -1
View File
@@ -4,7 +4,7 @@
"name": "redis",
"title": "Redis",
"shell": "install.sh",
"versions":["4.0.14","5.0.14","6.0.20","6.2.16","7.0.15","7.2.8", "7.4.3", "8.0.1"],
"versions":["4.0.14","5.0.14","6.0.20","6.2.16","7.0.15","7.2.9", "7.4.5", "8.0.3", "8.2.0"],
"tip": "soft",
"checks": "server/redis",
"path": "server/redis",
+1 -1
View File
@@ -30,7 +30,7 @@ Install_App()
REDIS_DIR=$serverPath/source/redis
if [ ! -f $REDIS_DIR/${FILE_TGZ} ];then
wget -O $REDIS_DIR/${FILE_TGZ} http://download.redis.io/releases/${FILE_TGZ}
wget --no-check-certificate -O $REDIS_DIR/${FILE_TGZ} https://download.redis.io/releases/${FILE_TGZ}
fi
cd $REDIS_DIR && tar -zxvf ${FILE_TGZ}
+8 -4
View File
@@ -9,8 +9,12 @@ import re
import json
sys.path.append(os.getcwd() + "/class/core")
import mw
web_dir = os.getcwd() + "/web"
if os.path.exists(web_dir):
sys.path.append(web_dir)
os.chdir(web_dir)
import core.mw as mw
def getServerDir():
@@ -26,14 +30,14 @@ def getConf():
def getDbPort():
file = getConf()
content = mw.readFile(file)
rep = 'port\s*=\s*(.*)'
rep = r'port\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
def getSocketFile():
file = getConf()
content = mw.readFile(file)
rep = 'socket\s*=\s*(.*)'
rep = r'socket\s*=\s*(.*)'
tmp = re.search(rep, content)
return tmp.groups()[0].strip()
+3 -2
View File
@@ -100,7 +100,7 @@ def contentReplace(content):
service_path = mw.getServerDir()
content = content.replace('{$ROOT_PATH}', mw.getFatherDir())
content = content.replace('{$SERVER_PATH}', service_path)
content = content.replace('{$SERVER_APP}', service_path + '/sphinx')
content = content.replace('{$SERVER_APP}', service_path + '/'+getPluginName())
return content
@@ -183,7 +183,7 @@ def sphOp(method):
file = initDreplace()
if not mw.isAppleSystem():
data = mw.execShell('systemctl ' + method + ' sphinx')
data = mw.execShell('systemctl ' + method + ' ' + getPluginName())
if data[1] == '':
return 'ok'
return 'fail'
@@ -385,6 +385,7 @@ def makeDbToSphinx():
tables = tables.split(',')
content = sph_make.makeSqlToSphinx(db, tables, is_delta_bool)
mw.writeFile(sph_file,content)
mkdirAll()
return mw.returnJson(True,'设置成功!')
return mw.returnJson(True,'测试中')
+1 -1
View File
@@ -4,7 +4,7 @@
"name": "sphinx",
"title": "sphinx",
"shell": "install.sh",
"versions":["3.1.1","3.2.1","3.3.1","3.4.1","3.5.1","3.6.1","3.7.1"],
"versions":["3.1.1","3.2.1","3.3.1","3.4.1","3.5.1","3.6.1","3.7.1","3.8.1"],
"tip": "soft",
"install_pre_inspection":true,
"checks": "server/sphinx",
+2
View File
@@ -57,6 +57,8 @@ elif [ "$VERSION" == "3.6.1" ]; then
VERSION_NUM=${VERSION}-c9dbeda
elif [ "$VERSION" == "3.7.1" ]; then
VERSION_NUM=${VERSION}-da9f8a4
elif [ "$VERSION" == "3.8.1" ]; then
VERSION_NUM=${VERSION}-d25e0bb
fi
# echo $VERSION_NUM
+6
View File
@@ -34,6 +34,12 @@ net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024 65001
# vm opt
vm.dirty_ratio = 40
vm.dirty_background_ratio = 10
vm.swappiness = 10
vm.vfs_cache_pressure = 500
vm.overcommit_memory=1
vm.max_map_count = 262144
+1 -6
View File
@@ -44,7 +44,6 @@ def send_msg(bot, tag='ad', trigger_time=300):
lock_data[tag] = {'do_time': time.time()}
mw.writeFile(lock_file, json.dumps(lock_data))
# 信号只在一个周期内执行一次|end
keyboard = [
[
types.InlineKeyboardButton(
@@ -54,10 +53,6 @@ def send_msg(bot, tag='ad', trigger_time=300):
types.InlineKeyboardButton(
text="18+资源采集", url='https://ckzy1.com')
],
[
types.InlineKeyboardButton(
text="桃花资源采集🚀 ", url='https://thzy.me')
],
[
types.InlineKeyboardButton(
text="代付-代实名-备案域名-国际云服务器", url='https://t.me/gjgzs2022')
@@ -80,7 +75,7 @@ def send_msg(bot, tag='ad', trigger_time=300):
types.InlineKeyboardButton(
text="@ME", url='tg://user?id=5568699210'),
types.InlineKeyboardButton(
text="200rmb/月", url='tg://user?id=5568699210')
text="300rmb/月", url='tg://user?id=5568699210')
]
]
markup = types.InlineKeyboardMarkup(keyboard)
@@ -56,7 +56,6 @@ def send_msg(bot, tag='ad', trigger_time=300):
# https://t.me/gjgzs2022 | 22/m | @GJ_gzs
# 实名认证/过人脸🕵️‍♀️各种账号处理✅ | 30/m| next,12/30 | @nngzs
# 桃花资源采集| 13/m| next,7/13 | @xiaolizi1122
# 18+资源采集| 4/m | next,1/14 | @liuxingyu123
keyboard = [
[
@@ -67,10 +66,6 @@ def send_msg(bot, tag='ad', trigger_time=300):
types.InlineKeyboardButton(
text="18+资源采集", url='https://ckzy1.com')
],
[
types.InlineKeyboardButton(
text="桃花资源采集🚀 ", url='https://thzy.me')
],
[
types.InlineKeyboardButton(
text="代付-代实名-备案域名-国际云服务器", url='https://t.me/gjgzs2022')
@@ -93,7 +88,7 @@ def send_msg(bot, tag='ad', trigger_time=300):
types.InlineKeyboardButton(
text="@ME", url='tg://user?id=5568699210'),
types.InlineKeyboardButton(
text="200RMB/月", url='tg://user?id=5568699210')
text="300RMB/月", url='tg://user?id=5568699210')
]
]
markup = types.InlineKeyboardMarkup(keyboard)
+1 -1
View File
@@ -4,7 +4,7 @@
"name": "valkey",
"title": "valkey",
"shell": "install.sh",
"versions":["8.0.1"],
"versions":["8.0.1","8.1.3"],
"tip": "soft",
"checks": "server/valkey",
"path": "server/valkey",
+2 -2
View File
@@ -117,7 +117,7 @@ Install_App()
# 缓存数据
GEO_VERSION=$(get_latest_release "P3TERX/GeoLite.mmdb")
if [ ! -f $serverPath/source/webstats/GeoLite2-City.mmdb ];then
if [ ! -s $serverPath/source/webstats/GeoLite2-City.mmdb ];then
if [ "$LOCAL_ADDR" == "cn" ];then
wget --no-check-certificate -O $serverPath/source/webstats/GeoLite2-City.mmdb https://dl.midoks.icu/soft/webstats/GeoLite2-City.mmdb
else
@@ -125,7 +125,7 @@ Install_App()
fi
fi
if [ -f $serverPath/source/webstats/GeoLite2-City.mmdb ];then
if [ -s $serverPath/source/webstats/GeoLite2-City.mmdb ];then
cp -rf $serverPath/source/webstats/GeoLite2-City.mmdb $serverPath/webstats/GeoLite2-City.mmdb
fi
+1
View File
@@ -36,6 +36,7 @@ pillow
Jinja2>=2.11.2
PyMySQL>=1.0.2
whitenoise==5.3.0
tldextract
pyotp
pytz
supervisor
+141 -61
View File
@@ -53,6 +53,9 @@ mw_start_panel()
echo -e ".\c"
sleep 0.5
isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
if [[ "$isStart" == "" ]];then
isStart=$(ps -ef|grep python3|grep mdserver-web|grep app:app|awk '{print $2}'|xargs)
fi
let n+=1
if [ $n -gt 60 ];then
break;
@@ -240,23 +243,140 @@ error_logs()
tail -n 100 ${PANEL_DIR}/logs/panel_error.log
}
# 00----00----00----00----00----00----00----00----00----00----00----00----00----00
function AutoSizeStr(){
NAME_STR=$1
NAME_NUM=$2
NAME_STR_LEN=`echo "$NAME_STR" | wc -L`
NAME_NUM_LEN=`echo "$NAME_NUM" | wc -L`
fix_len=35
remaining_len=`expr $fix_len - $NAME_STR_LEN - $NAME_NUM_LEN`
FIX_SPACE=' '
for ((ass_i=1;ass_i<=$remaining_len;ass_i++))
do
FIX_SPACE="$FIX_SPACE "
done
echo -e " ❖ ${1}${FIX_SPACE}${2})"
}
function ChooseProxyURL(){
clear
echo -e '+---------------------------------------------------+'
echo -e '| |'
echo -e '| ============================================= |'
echo -e '| |'
echo -e '| 欢迎使用 Linux 一键安装mdserver-web面板源码 |'
echo -e '| |'
echo -e '| ============================================= |'
echo -e '| |'
echo -e '+---------------------------------------------------+'
echo -e ''
echo -e '#####################################################'
echo -e ''
echo -e ' 提供以下国内代理地址可供选择: '
echo -e ''
echo -e '#####################################################'
echo -e ''
cm_i=0
for V in ${SOURCE_LIST_KEY[@]}; do
num=`expr $cm_i + 1`
AutoSizeStr "${V}" "$num"
cm_i=`expr $cm_i + 1`
done
echo -e ''
echo -e '#####################################################'
echo -e ''
echo -e " 系统时间 ${BLUE}$(date "+%Y-%m-%d %H:%M:%S")${PLAIN}"
echo -e ''
echo -e '#####################################################'
CHOICE_A=$(echo -e "\n${BOLD}└─ 请选择并输入你想使用的代理地址 [ 1-${SOURCE_LIST_LEN} ]:${PLAIN}")
read -p "${CHOICE_A}" INPUT
# echo $INPUT
if [ "$INPUT" == "" ];then
INPUT=1
TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
echo -e "\n默认选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
fi
if [ "$INPUT" -lt "0" ];then
INPUT=1
TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
echo -e "\n低于边界错误!选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
sleep 2s
fi
if [ "$INPUT" -gt "${SOURCE_LIST_LEN}" ];then
INPUT=${SOURCE_LIST_LEN}
TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
echo -e "\n超出边界错误!选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
sleep 2s
fi
INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$INPUT]}
HTTP_PREFIX=${PROXY_URL[$INPUT_KEY]}
}
mw_common_proxy(){
HTTP_PREFIX="https://"
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" != "common" ];then
# https://github.akams.cn
declare -A PROXY_URL
PROXY_URL["gh_proxy_com"]="https://gh-proxy.com/"
PROXY_URL["github_do"]="https://github.do/"
PROXY_URL["gh_llkk_cc"]="https://gh.llkk.cc/https://"
PROXY_URL["gh_felicity_ac_cn"]="https://gh.felicity.ac.cn/https://"
PROXY_URL["ghfast_top"]="https://ghfast.top/"
PROXY_URL["ghproxy_net"]="https://ghproxy.net/"
PROXY_URL["gh_927223_xyz"]="https://gh.927223.xyz/https://"
PROXY_URL["gh_proxy_net"]="https://gh-proxy.net/"
PROXY_URL["source"]="https://"
SOURCE_LIST_KEY_SORT_TMP=$(echo ${!PROXY_URL[@]} | tr ' ' '\n' | sort -n)
SOURCE_LIST_KEY=(${SOURCE_LIST_KEY_SORT_TMP//'\n'/})
SOURCE_LIST_LEN=${#PROXY_URL[*]}
fi
if [ "$LOCAL_ADDR" != "common" ];then
ChooseProxyURL
if [ "$HTTP_PREFIX" != "https://" ];then
DOMAIN=`echo $HTTP_PREFIX | sed 's|https://||g'`
DOMAIN=`echo $DOMAIN | sed 's|/||g'`
ping -c 3 $DOMAIN > /dev/null 2>&1
if [ "$?" != "0" ];then
echo "无效代理地址:${HTTP_PREFIX}"
exit
fi
fi
fi
}
mw_install(){
if [ -f ${PANEL_DIR}/task.py ];then
echo "与后续版本差异太大,不再提供更新"
exit 0
fi
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "common" ];then
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh | bash
else
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/install.sh | bash
fi
mw_common_proxy
echo "bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh")"
bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh")
}
mw_update()
@@ -266,17 +386,9 @@ mw_update()
exit 0
fi
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "common" ];then
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
else
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/update.sh | bash
fi
mw_common_proxy
echo "bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh")"
bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh")
}
mw_update_dev()
@@ -285,18 +397,11 @@ mw_update_dev()
echo "与后续版本差异太大,不再提供更新"
exit 0
fi
mw_common_proxy
echo "bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh")"
bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh")
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "common" ];then
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
else
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/update_dev.sh | bash
fi
cd ${PANEL_DIR}
}
@@ -306,17 +411,10 @@ mw_update_venv()
rm -rf ${PANEL_DIR}/lib64
rm -rf ${PANEL_DIR}/lib
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
LOCAL_ADDR=cn
fi
mw_common_proxy
echo "bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh")"
bash <(curl -fsSL "${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh")
if [ "$LOCAL_ADDR" == "common" ];then
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
else
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/dev/scripts/update_dev.sh | bash
fi
cd ${PANEL_DIR}
}
@@ -377,24 +475,6 @@ mw_debug(){
gunicorn -b :$port -k eventlet -w 1 app:app
}
function AutoSizeStr(){
NAME_STR=$1
NAME_NUM=$2
NAME_STR_LEN=`echo "$NAME_STR" | wc -L`
NAME_NUM_LEN=`echo "$NAME_NUM" | wc -L`
fix_len=35
remaining_len=`expr $fix_len - $NAME_STR_LEN - $NAME_NUM_LEN`
FIX_SPACE=' '
for ((ass_i=1;ass_i<=$remaining_len;ass_i++))
do
FIX_SPACE="$FIX_SPACE "
done
echo -e " ❖ ${1}${FIX_SPACE}${2})"
}
mw_connect_mysql(){
# choose mysql login
+151 -43
View File
@@ -1,6 +1,20 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
RED='\033[31m'
GREEN='\033[32m'
YELLOW='\033[33m'
BLUE='\033[34m'
PLAIN='\033[0m'
BOLD='\033[1m'
SUCCESS='[\033[32mOK\033[0m]'
COMPLETE='[\033[32mDONE\033[0m]'
WARN='[\033[33mWARN\033[0m]'
ERROR='[\033[31mERROR\033[0m]'
WORKING='[\033[34m*\033[0m]'
# LANG=en_US.UTF-8
is64bit=`getconf LONG_BIT`
@@ -12,9 +26,128 @@ if [ -f /www/server/mdserver-web/tools.py ];then
fi
LOG_FILE=/var/log/mw-install.log
{
HTTP_PREFIX="https://"
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" != "common" ];then
declare -A PROXY_URL
PROXY_URL["gh_proxy_com"]="https://gh-proxy.com/"
PROXY_URL["github_do"]="https://github.do/"
PROXY_URL["gh_llkk_cc"]="https://gh.llkk.cc/https://"
PROXY_URL["gh_felicity_ac_cn"]="https://gh.felicity.ac.cn/https://"
PROXY_URL["ghfast_top"]="https://ghfast.top/"
PROXY_URL["ghproxy_net"]="https://ghproxy.net/"
PROXY_URL["gh_927223_xyz"]="https://gh.927223.xyz/https://"
PROXY_URL["gh_proxy_net"]="https://gh-proxy.net/"
PROXY_URL["source"]="https://"
SOURCE_LIST_KEY_SORT_TMP=$(echo ${!PROXY_URL[@]} | tr ' ' '\n' | sort -n)
SOURCE_LIST_KEY=(${SOURCE_LIST_KEY_SORT_TMP//'\n'/})
SOURCE_LIST_LEN=${#PROXY_URL[*]}
fi
function AutoSizeStr(){
NAME_STR=$1
NAME_NUM=$2
NAME_STR_LEN=`echo "$NAME_STR" | wc -L`
NAME_NUM_LEN=`echo "$NAME_NUM" | wc -L`
fix_len=35
remaining_len=`expr $fix_len - $NAME_STR_LEN - $NAME_NUM_LEN`
FIX_SPACE=' '
for ((ass_i=1;ass_i<=$remaining_len;ass_i++))
do
FIX_SPACE="$FIX_SPACE "
done
echo -e " ❖ ${1}${FIX_SPACE}${2})"
}
function ChooseProxyURL(){
clear
echo -e '+---------------------------------------------------+'
echo -e '| |'
echo -e '| ============================================= |'
echo -e '| |'
echo -e '| 欢迎使用 Linux 一键安装mdserver-web面板源码 |'
echo -e '| |'
echo -e '| ============================================= |'
echo -e '| |'
echo -e '+---------------------------------------------------+'
echo -e ''
echo -e '#####################################################'
echo -e ''
echo -e ' 提供以下国内代理地址可供选择: '
echo -e ''
echo -e '#####################################################'
echo -e ''
cm_i=0
for V in ${SOURCE_LIST_KEY[@]}; do
num=`expr $cm_i + 1`
AutoSizeStr "${V}" "$num"
cm_i=`expr $cm_i + 1`
done
echo -e ''
echo -e '#####################################################'
echo -e ''
echo -e " 系统时间 ${BLUE}$(date "+%Y-%m-%d %H:%M:%S")${PLAIN}"
echo -e ''
echo -e '#####################################################'
CHOICE_A=$(echo -e "\n${BOLD}└─ 请选择并输入你想使用的代理地址 [ 1-${SOURCE_LIST_LEN} ]:${PLAIN}")
read -p "${CHOICE_A}" INPUT
# echo $INPUT
if [ "$INPUT" == "" ];then
INPUT=1
TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
echo -e "\n默认选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
fi
if [ "$INPUT" -lt "0" ];then
INPUT=1
TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
echo -e "\n低于边界错误!选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
sleep 2s
fi
if [ "$INPUT" -gt "${SOURCE_LIST_LEN}" ];then
INPUT=${SOURCE_LIST_LEN}
TMP_INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
echo -e "\n超出边界错误!选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
sleep 2s
fi
INPUT=`expr $INPUT - 1`
INPUT_KEY=${SOURCE_LIST_KEY[$INPUT]}
HTTP_PREFIX=${PROXY_URL[$INPUT_KEY]}
}
if [ "$LOCAL_ADDR" != "common" ];then
ChooseProxyURL
if [ "$HTTP_PREFIX" != "https://" ];then
DOMAIN=`echo $HTTP_PREFIX | sed 's|https://||g'`
DOMAIN=`echo $DOMAIN | sed 's|/||g'`
ping -c 3 $DOMAIN > /dev/null 2>&1
if [ "$?" != "0" ];then
echo "无效代理地址:${DOMAIN}"
exit
fi
fi
fi
if [ -f /etc/motd ];then
echo "welcome to mdserver-web panel" > /etc/motd
fi
@@ -62,6 +195,11 @@ elif grep -Eqi "Ubuntu" /etc/issue || grep -Eqi "Ubuntu" /etc/os-release; then
OSNAME='ubuntu'
# apt update -y
apt install -y wget curl zip unzip tar cron
elif grep -Eqi "Alpine" /etc/issue || grep -Eqi "Alpine" /etc/*-release; then
OSNAME='alpine'
apk update
apk add devscripts -force-broken-world
apk add wget zip unzip tar -force-broken-world
else
OSNAME='unknow'
fi
@@ -71,24 +209,8 @@ if [ "$EUID" -ne 0 ] && [ "$OSNAME" != "macos" ];then
exit
fi
# HTTP_PREFIX="https://"
# LOCAL_ADDR=common
# ping -c 1 github.com > /dev/null 2>&1
# if [ "$?" != "0" ];then
# LOCAL_ADDR=cn
# HTTP_PREFIX="https://mirror.ghproxy.com/"
# fi
HTTP_PREFIX="https://"
LOCAL_ADDR=common
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
LOCAL_ADDR=cn
HTTP_PREFIX="https://mirror.ghproxy.com/"
fi
echo "local:${LOCAL_ADDR}"
echo "LOCAL:${LOCAL_ADDR}"
echo "OSNAME:${OSNAME}"
if [ $OSNAME != "macos" ];then
if id www &> /dev/null ;then
@@ -104,44 +226,30 @@ if [ $OSNAME != "macos" ];then
mkdir -p /www/backup/database
mkdir -p /www/backup/site
# https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh
if [ ! -d /www/server/mdserver-web ];then
if [ "$LOCAL_ADDR" == "common" ];then
curl --insecure -sSLo /tmp/master.zip ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/heads/master.zip
cd /tmp && unzip /tmp/master.zip
mv -f /tmp/mdserver-web-master /www/server/mdserver-web
rm -rf /tmp/master.zip
rm -rf /tmp/mdserver-web-master
else
# curl --insecure -sSLo /tmp/master.zip https://code.midoks.icu/midoks/mdserver-web/archive/master.zip
wget --no-check-certificate -O /tmp/master.zip https://code.midoks.icu/midoks/mdserver-web/archive/master.zip
cd /tmp && unzip /tmp/master.zip
mv -f /tmp/mdserver-web /www/server/mdserver-web
rm -rf /tmp/master.zip
rm -rf /tmp/mdserver-web
fi
curl --insecure -sSLo /tmp/master.tar.gz ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/heads/master.tar.gz
cd /tmp && tar -zxvf /tmp/master.tar.gz
mv -f /tmp/mdserver-web-master /www/server/mdserver-web
rm -rf /tmp/master.tar.gz
rm -rf /tmp/mdserver-web-master
fi
# install acme.sh
if [ ! -d /root/.acme.sh ];then
if [ "$LOCAL_ADDR" != "common" ];then
curl --insecure -sSLo /tmp/acme.tar.gz https://gitee.com/neilpang/acme.sh/repository/archive/master.tar.gz
tar xvzf /tmp/acme.tar.gz -C /tmp
curl --insecure -sSLo /tmp/acme.sh-master.tar.gz ${HTTP_PREFIX}github.com/acmesh-official/acme.sh/archive/refs/heads/master.tar.gz
tar xvzf /tmp/acme.sh-master.tar.gz -C /tmp
cd /tmp/acme.sh-master
bash acme.sh install
fi
if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
else
curl -fsSL https://get.acme.sh | bash
fi
fi
fi
echo "use system version: ${OSNAME}"
if [ "${OSNAME}" == "macos" ];then
curl --insecure -fsSL https://code.midoks.icu/midoks/mdserver-web/raw/branch/master/scripts/install/macos.sh | bash
curl --insecure -fsSL ${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/refs/heads/dev/scripts/install/macos.sh | bash
else
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
fi

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