Commit Graph

276 Commits

Author SHA1 Message Date
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
Thales Macedo Garitezi d0c5de1da6
chore(config): move db configs under cluster/node keys 2022-05-26 14:02:22 -03:00
Shawn b9a9da3208 fix(relup): improve the error code and log messages 2022-05-25 10:58:06 +08:00
Shawn f036a946a8 fix: only support .tar.gz files when hot upgrade 2022-05-25 01:59:52 +08:00
Shawn b942fde836 fix: porting the install_upgrade.escript from v4.4 2022-05-24 15:05:08 +08:00
DDDHuang 809c0bede7 fix: check node name, regular expression 2022-05-19 09:52:00 +08:00
Zhongwen Deng 41268dba01 fix: can't get emqx's priv_dir when whitespace in install path 2022-05-05 15:59:14 +08:00
Thales Macedo Garitezi e59bea03ad
Merge pull request #7765 from thalesmg/node-dump-license-info
feat(node_dump): add license info to node_dump
2022-04-26 09:04:12 -03:00
Thales Macedo Garitezi 208cc0fad8
feat(node_dump): add license info to node_dump 2022-04-25 11:42:20 -03:00
Zaiming (Stone) Shi 12d7975c36
Merge pull request #7733 from thalesmg/fix-node-dump-root
fix(node_dump): define `RUNNER_ROOT_DIR` before sourcing vars
2022-04-23 10:56:24 +01:00
Shawn 7ee0887237 fix: ./bin/emqx_ctl status failed
The CLI emqx_ctl fails:

```
./bin/emqx_ctl status

Node not initialized?
Generated config file vm.*.args is not found for command 'ctl'
in config dir: /Users/liuxy/code/emqx50/_build/emqx/rel/emqx/-emqx_data_dir /Users/liuxy/code/emqx50/_build/emqx/rel/emqx/data --/configs
In case the file has been deleted while the node is running,
set environment variable 'EMQX_NODE__NAME' to continue
```
2022-04-23 15:07:58 +08:00
Thales Macedo Garitezi a6e458b23e
fix(node_dump): define `RUNNER_ROOT_DIR` before sourcing vars
`emqx_vars` requires `RUNNER_ROOT_DIR` to be defined before being
sourced.
2022-04-22 17:31:36 -03:00
Zaiming (Stone) Shi ce902b5405 refactor(bin/emqx): speed up boot
The main slow-down is the overheads of booting up beam with the
'start_clean' boot file (which loads all modules).

Prior to this change, beam is started multiple times in order to
resolve configuration values.

After this change:
* For boot commands such as 'start', 'console' and
  'foreground', it starts beam twice:
  - 1st is to check platform compatibility
  - 2nd is to resolve all configs required for boot in a batch
* For non-boot commands, such as 'ctl' and 'ping', it does not
  require to start beam for config resolution at all
2022-04-22 11:35:50 +02:00
Zaiming (Stone) Shi 6b0f56d4d6 fix(windows): start console mode in erl but not werl
otherwise there is no way to debug a boot
2022-04-22 08:21:07 +02:00
Zaiming (Stone) Shi 18cebd9be7 feat: parameterise console flavor
so we can start an Erlang console in a Elixir release
by: env EMQX_CONSOLE_FLAVOR=erl ./bin/emqx console
2022-04-13 23:29:17 +02:00
Zaiming (Stone) Shi 82ef4c87e5 fix(bin/emqx): configure mnesia dir in vm.args file 2022-04-13 21:55:05 +02:00
Zaiming (Stone) Shi 3c03c0cfc1 feat(bin/emqx): make possible to boot Erlang node from Elixir build 2022-04-13 21:55:05 +02:00
Zaiming (Stone) Shi 2dbc65cfe3 fix(bin/emqx): make possible to start in path with space 2022-04-13 21:55:05 +02:00
Zaiming (Stone) Shi 72405f977c refactor(bin/emqx): remove unnecessary intermediate env variables 2022-04-13 13:50:56 +02:00
Zaiming (Stone) Shi c8242816b0 refactor(bin/emqx): no need to template-render RUNNER_ROOT_DIR 2022-04-13 13:50:25 +02:00
Zaiming (Stone) Shi c62f7e5baa chore: fix typos in bin/emqx 2022-04-13 13:50:25 +02:00
Thales Macedo Garitezi b5ac56ba50
feat(db): check if OTP has mnesia_hook, otherwise fallback to mnesia
Adds a check to `bin/emqx` to see if the OTP version being used has
support for `mnesia_hook`, which is required by Mria for using the
RLOG backend.  If OTP is not compatible and the user tries to use
RLOG, a warning is printed during startup and the configuration falls
back to using the Mnesia backend.
2022-04-11 14:33:16 -03:00
Zaiming (Stone) Shi 32694e601a refactor: rename RUNNER_ETC_DIR to EMQX_ETC_DIR 2022-04-05 23:08:45 +02:00
Zaiming (Stone) Shi 822a4f9f73 feat: parameterise EMQX_ETC_DIR
both at build time and at runtime
2022-04-05 16:36:13 +02:00
Zaiming (Stone) Shi 122e75c0b4 feat(systemd): start EMQX under systemd in foreground mode 2022-03-11 13:34:54 +01:00
Zaiming (Stone) Shi 68fb80fc29 chore(bin/emqx): refine boot message 2022-03-04 21:02:54 +01:00
Zaiming (Stone) Shi 4e64010a3b build: more structured build info 2022-03-02 21:22:03 +01:00
Zaiming (Stone) Shi a9deb43f7e
Merge pull request #7160 from zmstone/fix-data-dir-for-windows
fix: get data_dir from config for windows
2022-02-28 15:12:16 +01:00
Zaiming (Stone) Shi 2285091585 fix: get data_dir from config for windows 2022-02-28 12:52:22 +01:00
Zaiming (Stone) Shi e22104476a fix(data_dir): get data_dir config in the right way
now data_dir config is respected by boot script as well as
EMQX application after booted
2022-02-28 09:59:56 +01:00
Zaiming (Stone) Shi 271fda3d66 fix(windows): deal with space in install path 2022-02-22 23:39:26 +01:00
Zaiming (Stone) Shi 88343df95a fix(windows): delete stale find functions
some of the find_ functions are generated from the old rebar template
which will never be used since we:

1. always release erts
2. always generate sys.config
3. always generate vm.args
2022-02-22 23:37:00 +01:00
Zaiming (Stone) Shi d9bb616574 fix(windows): attach remote_console 2022-02-22 22:33:46 +01:00
Zaiming (Stone) Shi 0fa7b4a7d4 fix(windows): wrong clean start boot file path 2022-02-22 22:33:46 +01:00
Zaiming (Stone) Shi 893b844444 feat(windows): simplify emqx_ctl for windows 2022-02-22 22:33:37 +01:00
Zaiming (Stone) Shi 5a0e3c1c7b fix(windows): fix boot in windows 2022-02-22 22:33:33 +01:00
ieQu1 bdcb37263b fix(node_dump): Don't collect information about modules 2022-02-21 18:30:08 +01:00
Zaiming (Stone) Shi 05af1874aa chore: ensure remsh prefix for remote nodes
for remsh prefixed nodes, ekka pick a random port to listen on
instead of following the conventional port mapping rule:
ekka listens on 4370 for emqx or emqx0 and 4371 for emqx1 and so on
2022-02-20 19:47:23 +01:00
Zaiming (Stone) Shi 2e94880bb6 docs: More EMQ X -> EMQX rename in descriptive strings 2022-02-15 22:39:11 +01:00
Ilya Averyanov 64c59b5469 feat(license): check license before node start 2022-02-11 11:49:29 +03:00
Thales Macedo Garitezi eea217093b
fix(mix): include `node_dump` in tgz and packages 2022-02-07 18:15:17 -03:00
Ilya Averyanov 17599432d1 feat(license): add license application 2022-02-07 19:05:47 +03:00
Thales Macedo Garitezi 1b3b2c0d03
feat: add eval-erl command to `bin/emqx`
This allows Erlang expressions to be evaluated easily even on nodes
running Elixir.
2022-02-04 16:53:27 -03:00
Thales Macedo Garitezi bd0d331b64
Merge pull request #6636 from emqx/elixir-packages-mkII
ci(mix): build emqx packages with elixir
2022-01-27 11:10:30 -03:00
Kian-Meng Ang fc92e4c8bf docs: fix typos 2022-01-27 12:29:38 +01:00
Thales Macedo Garitezi 03e0c5ef2a
fix(eval): use running node for rpc eval, not a fresh one
With the previous arguments, a fresh hidden node with the same name as
the expected running one was being started and commands were being run
there.  This caused commands like `ekka_cluster:info()` to report
seemingly weird results.
2022-01-26 16:59:48 -03:00
Zaiming (Stone) Shi 1abac892c9 refactor: install_upgrade script no need to re-pack
OTP release handler only works with .tar.gz
as a result, we had to unpack .zip and re-pack .tar.gz
just to make OTP happy.

Now since we will be building .tar.gz packages
there is no need for this re-pack step anymore
2022-01-13 18:54:01 +01:00
Zaiming (Stone) Shi a935dcc1f5
Merge pull request #6718 from zmstone/refactor-bin-emqx-help-info
refactor(bin/emqx): refine help info
2022-01-12 23:34:53 +01:00
Zaiming (Stone) Shi 38ee224fac refactor(bin/emqx): refine help info
* refine usage print
* deleted restart command, as it only works for daemon mode.
  e.g. if EMQ X is started in 'foreground' mode the 'restart'
  command will make it start in daemon mode
* some commands such as ertspath does not requre RPC
2022-01-12 23:33:59 +01:00
Zaiming (Stone) Shi 635b056e03 fix(bin/emqx): print usage when no command given 2022-01-12 08:18:44 +01:00
Zaiming (Stone) Shi af82f51333 chore: emqx stop prints ok after stop
This is to make it behave the same as older versions
2022-01-07 09:03:31 +01:00
Thales Macedo Garitezi b9494662ae
fix(ci): fix shellcheck file pattern
Since we started to use the portable shebang style for our scripts, we
need to update the pattern used to find scripts for Shellcheck to
check.
2022-01-05 11:34:04 -03:00
Zaiming (Stone) Shi eae2e3ad0c Merge remote-tracking branch 'origin/master' into merge-5.0-beta.3-to-master 2022-01-04 21:11:30 +01:00
Zaiming (Stone) Shi 320506957c refactor(bin/emqx): wait for up to 120 seconds by default 2022-01-04 17:28:53 +01:00
Zaiming (Stone) Shi 2898fa76e1 Merge remote-tracking branch 'origin/release-5.0-beta.3' into merge-5.0-beta.3-to-master 2022-01-03 11:39:06 +01:00