Commit Graph

230 Commits

Author SHA1 Message Date
Ivan Dyachkov aac41ba128 fix: emqx ctl crashed when $HOME/.erlang.cookie is not available
fixes #10142
2023-03-15 13:35:46 +01:00
Zaiming (Stone) Shi 4eb9a69df0 feat(bin/emqx): diagnose boot failure
Prior to this change, when EMQX daemon mode failed to start
it's not quite easy for users to understand what went wrong.
All the know is the node did not start in time
and then instructed to boot the node in 'console' mode wishing
for some logs.
However, the node might actuay be running, causing 'console' mode
to fail with a different reason.

With this change, after a filure of daemon mode boot,
we issue a diagnosis.
1. if node can not be found from ps -ef, instruct the user
   to find information in erlang.log.N
2. if the node is found running, but not responding to pings
   instruct the user to check if the node name is
   resolvable and reachable
3. if the node is responding to pings but emqx app is not
   running, then it's likely a bug. so the user is advised
   to report a github issue.
2023-03-02 14:46:09 +01:00
Zaiming (Stone) Shi c4c0c9cc7e fix(bin/emqx): no need to ping node before attach 2023-03-02 14:32:10 +01:00
Zaiming (Stone) Shi f48d054986 fix(bin/emqx): ensure SSL_DIST_OPTFILE is set for non-boot command 2023-02-28 20:47:05 +01:00
Zaiming (Stone) Shi f6cb5b607c fix(bin/emqx): do not check cookie when it's a boot command 2023-02-28 20:16:32 +01:00
Zaiming (Stone) Shi a638cc1d74 docs: add change logs 2023-02-24 09:11:45 +01:00
Zaiming (Stone) Shi 8d480a1dc9 fix(bin/emqx): fail fast if cookie is obviously wrong 2023-02-22 13:57:55 +01:00
Zaiming (Stone) Shi 6b81d9965f fix(bin/emqx): allow starting two nodes from the same installation
If more than one node is boot from the same root directory
try to find the node by node name set in EMQX_NODE_NAME
or EMQX_NODE__NAME environment variable
2023-02-16 14:35:50 +01:00
Zaiming (Stone) Shi 12199e7987 refactor(bin/emqx): check if node is already running with ps command 2023-02-13 22:59:54 +01:00
Zaiming (Stone) Shi ab63954ce7 refactor: check if node is already started before default-cookie warning 2023-02-13 22:35:01 +01:00
Zaiming (Stone) Shi e0709f7eae fix(bin/emqx): ensure protable dynamic libs loaded before call_hocon 2023-02-13 15:46:23 +01:00
Zaiming (Stone) Shi 936eab7fbe chore: refine error messages when node is not running 2023-02-13 15:06:32 +01:00
Zaiming (Stone) Shi be867b1303 refactor: read Erlang kernel app config 'net_ticktime' from ps -ef 2023-02-13 12:47:42 +01:00
Zaiming (Stone) Shi cc9ee34eff refactor: grep with --color=never 2023-02-13 12:17:25 +01:00
Zaiming (Stone) Shi d08eb01d90 refactor: read node name and cookie from ps -ef
instead of parsing the generated vm.args file,
because the file might have been deleted
2023-02-13 11:05:43 +01:00
Zaiming (Stone) Shi b6b9df06db fix(bin/emqx): drop remsh and escript from ps -ef outputs 2023-02-13 10:50:21 +01:00
Zaiming (Stone) Shi c6a78cbfda chore: refine a warning message about default erlang cookie 2023-02-04 07:56:29 +01:00
Zhongwen Deng f81a488010 chore: logwarn if dynlibs is missing 2023-02-02 15:17:51 +08:00
Zaiming (Stone) Shi e7b8df6ba9 chore(bin/emqx): hide upgrade/downgrade from usage info 2023-01-31 13:09:46 +01:00
Zaiming (Stone) Shi c228b84db6 fix(log): fail fast if emqx.conf is not found in EMQX_ETC_DIR
otherwise the call_hocon failure is not quite readable
2023-01-14 18:36:52 +01:00
Thales Macedo Garitezi a9d0143d5f chore(license): change `key` type to `binary()`
So that the `raw_default` field in the schema JSON renders properly.
2023-01-11 09:10:04 -03:00
Thales Macedo Garitezi 465e73cac0 feat: deny upgrades for now 2022-12-27 13:10:12 -03:00
Thales Macedo Garitezi 86a4010b8d refactor(review): use `lists:flatten/1` 2022-12-27 11:14:57 -03:00
Thales Macedo Garitezi 5428d46694 feat: log the upgrade script being used for visibility 2022-12-27 11:14:57 -03:00
Thales Macedo Garitezi 7c6bb63ce9 feat(upgrade): add forward version check for upgrade script
https://emqx.atlassian.net/browse/EMQX-6978

[Related EIP](c4864eeccb/active/0022-forward-check-install-upgrade-script.md)

Currently, when performing a hot upgrade, the scripts that are run are
those from the currently installed EMQX version. It has a validation
that prevents upgrade between different minor versions. If we want to
allow an upgrade from, say, 5.0.x to 5.1.y, then the scripts in
already released packages will deny such operation. Also, if an
upgrade installation script contains a bug in the current, it will
never be able to execute properly without manual patching.

By attempting to execute the scripts from the target version, we may
add fixes and new validations to new EMQX versions and have them
executed by older versions.
2022-12-23 17:50:33 -03:00
Ivan Dyachkov 4a9be95f6d chore: fix logging in bin/emqx on non-tty 2022-12-19 14:58:59 +01:00
Ivan Dyachkov e8073f9e7d chore: fix RUNNER_ROOT_DIR detection on MacOS 2022-12-19 13:07:18 +01:00
Zaiming (Stone) Shi 56066a03b5 Merge remote-tracking branch 'origin/release-50' into 1214-sync-master-upstreams 2022-12-14 20:04:20 +01:00
Zaiming (Stone) Shi 74ce4ec606 fix(bin/emqx): typo in bin/emqx usage info 2022-12-14 20:01:17 +01:00
Ivan Dyachkov ec826f03c9 chore: colorize warning and error logs 2022-12-07 14:42:09 +01:00
Ivan Dyachkov 9e1b3fb47e chore: remove exclamation marks around warngings in bin/emqx 2022-12-07 14:04:25 +01:00
Ivan Dyachkov 04d3385229 chore: ensure default stat on macos when resolving running root dir 2022-12-07 14:02:35 +01:00
firest c430218e26 chore: make remsh node name away from the atom DOS attack
The remsh node name is generated to be unique, this may cause atom leakage, so we need to change the generation rule to limit the total of these names
2022-11-17 16:41:26 +08:00
Ivan Dyachkov b3a7fd26dc chore: stat to resolve script dir on macos and realpath otherwise 2022-10-05 11:39:07 +02:00
Zaiming (Stone) Shi f272495b8e fix(bin/emqx): ensure log dir is created by runner user 2022-09-16 09:49:55 +08:00
Thales Macedo Garitezi d4416dc581 chore: drop support for license files (ee5.0)
Related issue: EMQX-7247

EMQX ee5.0 is to drop support for both the old license format (x509)
and for files containing the new format.
2022-09-14 09:44:59 -03:00
Ivan Dyachkov 7cfca31aaf build: sign binary files in macos package 2022-09-12 21:50:00 +02:00
Ivan Dyachkov bc850281f2 build: use realpath instead of readlink
realpath works the same way in GNU and BSD systems
2022-09-07 21:31:58 +02:00
Zaiming (Stone) Shi ac840e318e refactor(cookie): Warning message when boot with default Erlang cookie 2022-09-06 18:58:35 +02:00
Zaiming (Stone) Shi 809f2ede09 fix(bin/emqx): ensure no crash dump when checking compatibility 2022-08-11 22:05:03 +02:00
Thales Macedo Garitezi 80d35feb33 fix(license): change schema to allow updating license to different type
Before this change, if a license in `emqx.conf` was of type
`key`/`file` and then changed to the opposite type, such change would
be saved to `{cluster,local}-overrides.conf`.  When the node restarts
after that, the configs are merged naively and becomes invalid, as it
contains both the `key` and `file` keys, and crashes.
2022-07-28 17:29:59 -03:00
Chris 24f88679ae feat: Added emqx command to check configs 2022-07-25 11:01:08 +02:00
William Yang a6f14c255d feat: add emqx_cluster_rescue 2022-07-15 15:47:52 +02:00
Zhongwen Deng 0ee732c076 fix: typo error +ssl_dist_optfile to \-ssl_dist_optfile 2022-07-02 17:19:21 +08:00
Zaiming (Stone) Shi b3f16ccb36 fix: Erlang distribution over TLS 2022-06-28 21:49:02 +02:00
Zaiming (Stone) Shi 2457143645 fix(windows): log to console when running in console mode 2022-06-17 07:51:59 +02:00
Zaiming (Stone) Shi 41808fc2a2 chore: add a comment to describe why setting ESCRIPT_NAME 2022-06-11 14:41:01 +02:00
Zaiming (Stone) Shi 8151f79f45 fix(bin/emqx): turn off debug print when need to capture stderror 2022-05-31 16:31:16 +02:00
Zaiming (Stone) Shi c56fbb0d5d fix(emqx.cmd): write_ini should be done before invoking Erlang
Otherwise erl.exe may turn to C:\System Files to load dll modules
2022-05-31 15:03:31 +02:00
Thales Macedo Garitezi b1d3b9ba04
style: strange style forced by git? 2022-05-26 14:55:05 -03:00