Commit graph

400 commits

Author SHA1 Message Date
Matthew Wild
e39d14c8e8 prosodyctl: Fix spacing in warning message 2025-04-01 14:38:37 +01:00
Matthew Wild
2fef4f5d9c prosodyctl: Fix check for whether to show init system warning
Overlooked from testing.
2025-02-06 15:43:23 +00:00
Matthew Wild
0a93dccaa9 prosodyctl: Further deprecate start/stop/restart commands when installed
Despite the warning we introduced, many people continue to try using
prosodyctl to manage Prosody in the presence of systemctl (e.g. #1688).

Also, despite the warning, prosodyctl proceeded with the operation. This means
the commands could be invoked by accident, and cause a situation that is hard
to recover from (needing to manually track down stray processes).

This commit disables all the problematic commands by default, but this can
still be overridden using --force or via a config option.

We only perform this check when we believe Prosody has been "installed" for
system-wide use (i.e. running it from a source directory is still supported).
2025-02-06 14:51:31 +00:00
Matthew Wild
08d69fb759 prosodyctl: reload: Assume reload-via-socket if any arguments passed 2025-02-06 14:47:45 +00:00
Matthew Wild
24d50902bd prosodyctl: Fix luacheck warning 2025-02-06 14:46:36 +00:00
Matthew Wild
3e23058a2d prosodyctl: reload: Remove redundant require 2025-02-06 14:45:56 +00:00
Matthew Wild
60460d4d22 prosodyctl: stop: Fix detection of whether Prosody is running 2025-02-06 14:35:29 +00:00
Matthew Wild
b3d9577ceb prosodyctl: reload: Fix detection of whether prosody is running
isrunning() returns two values (success, status) and we were only checking the
first one.
2025-02-06 14:34:47 +00:00
Matthew Wild
f2e87307a4 prosodyctl: reload: use admin socket to issue reload command, if available 2025-02-06 14:24:16 +00:00
Kim Alvefur
7288595789 prosodyctl: Hide the 'lua_paths' command from default command listing
All commands are called with a '-h' argument, but this one doesn't have
that. Since it's meant to be machine readable, hiding it seems
marginally more sensible than implementing '-h'.
2025-01-08 22:46:21 +01:00
Matthew Wild
26eeda9ed6 prosodyctl: Add lua_paths command to print the LUA_PATH and LUA_CPATH used
This can be useful to run scripts and stuff with access to the same Lua paths
as Prosody uses.
2025-01-08 20:37:35 +00:00
Matthew Wild
d2b632dffc prosodyctl: 'about' becomes 'version -v', 'version' prints only version
The 'about' command remains for backwards compatibility, but hidden.
2025-01-08 20:35:05 +00:00
Kim Alvefur
83e27a61c8 prosodyctl: Remove unused import
Leftover after 854df134274f
2025-01-08 08:52:50 +01:00
Matthew Wild
fbb3a116db prosodyctl: deluser: Use user:delete() shell command for implementation 2025-01-07 19:28:06 +00:00
Matthew Wild
8e73190353 prosodyctl: passwd: Use user:password() shell command for implementation 2025-01-07 19:25:35 +00:00
Matthew Wild
a1fda1fd1a prosodyctl: adduser: use shell user:create() to provide the implementation
This allows user creation to happen inside the running Prosody process, which
improves a number of things - such as executing event handlers for user
creation, fixing issues and race conditions with some storage drivers, etc.

The intent is to do the same for the other prosodyctl commands, but this is
the first proof of concept for the approach.
2025-01-07 18:47:24 +00:00
Kim Alvefur
a7bbeac47e prosodyctl: Add experimental way to reload specific modules directly
Mostly thinking out loud about how various actions may use the shell

This enables the following sequence of commands:

	prosodyctl install mod_example
	prosodyctl reload mod_example

which is simpler than

	prosodyctl shell module reload example
2023-06-25 17:34:13 +02:00
Matthew Wild
b6ca51db43 Merge 0.12->trunk 2023-04-07 16:00:23 +01:00
Matthew Wild
6d8647b333 prosodyctl: Fix using variable content in a format string
This broke if the error message contained a format specified such as '%s'.
2023-04-07 15:54:59 +01:00
Kim Alvefur
435e008568 util.startup: Close state on exit to ensure GC finalizers are called
Ensures a last round of garbage collection and that finalizers are
called. Fixes things like proper closing of SQLite3 state.

There are more calls to os.exit() but most of them exit with an error or
in a case where a final GC sweep might not matter as much.

It would be nice if this was the default.

Calling util.statup.exit() everywhere may be sensible, but would be more
involved, requiring imports everywhere.
2023-01-22 14:45:47 +01:00
Kim Alvefur
03299ee37d prosodyctl: Pass server when listing (outdated) plugins (fix #1738)
Needed since it checks the manifest of the repository and most likely
defaults to luarocks.org unless specified
2022-04-05 14:27:37 +02:00
Kim Alvefur
c50c315705 prosodyctl about: Report version of lua-readline
Good to know since it affects how well the shell works
2022-03-27 14:05:56 +02:00
Kim Alvefur
9c63ae60fd executables: Prefix module imports with prosody namespace 2023-03-17 16:29:54 +01:00
Kim Alvefur
763a2bb0ed executables: Invoke loader to allow mixing of old and new import style
Now both require"util.foo" and require"prosody.util.foo" should be
equivalent.
2023-03-17 16:29:07 +01:00
Kim Alvefur
9228a851bc Merge 0.12->trunk 2023-01-22 15:43:44 +01:00
Kim Alvefur
5251c9b686 compat: Remove handling of Lua 5.1 location of 'unpack' function 2022-07-11 19:07:38 +02:00
Kim Alvefur
8ee6441fc5 executables: Reject Lua 5.1 early
Prevents attempting to load libraries that may no longer be found and
crashing with a traceback.

Platforms like Debian where multiple Lua versions can be installed at
the same time and 'lua' pointing to one of the installed interpreters
via symlinks, there's the possibility that prosody/prosodyctl may be
invoked with Lua 5.1, which will no longer have any of the rest of
Prosody libraries available to be require(), and thus would immediately
fail with an unfriendly traceback.

Checking and aborting early with a friendlier message and reference to
more information is better.

Part of #1600
2022-07-02 17:27:39 +02:00
Kim Alvefur
ebcb37baa4 prosodyctl: Restore 'list --outdated'
Parsing --flags puts it into 'opts', so --outdated wasn't passed to
luarocks, breaking that functionality
2022-02-17 01:39:35 +01:00
Kim Alvefur
cf575b27fe prosodyctl: Allow passing server on command line with --server
Because why not I guess. This mirrors the corresponding luarocks command
2022-02-04 19:04:32 +01:00
Kim Alvefur
3e66b4e091 prosodyctl: Allow install plugin via explicit path or URL
This way you don't need to set the server URL in the config to use this,
you could just ^C^V an install line from a web page that says

	prosodyctl install https://modules.example.com/mod_example.src.rock

Drop the help message in this case since it'll be all messed up by being
given an URL or rock filename.
2022-02-04 19:03:02 +01:00
Kim Alvefur
d57bd7a33c prosodyctl: Return success status code from --help
Only when the help is shown because of invalid arguments should a
non-zero status code be returned to indicate a problem.
2022-02-04 19:01:34 +01:00
Kim Alvefur
f75d9d7ed8 prosodyctl: Use argument parsing library to parse --help, -h, -?
Reads nicer, but adds more code. Can always be reverted later I suppose.
2022-02-04 18:56:01 +01:00
Kim Alvefur
a7f535e0cf prosodyctl: Hide process management commands when init system should be used instead 2021-12-21 14:23:09 +01:00
Kim Alvefur
ff688f28ea prosodyctl: Reorder help sections
By how old the commands are?
Or how disruptive the changes are?
Or just by what feels best?
2021-12-21 13:11:41 +01:00
Kim Alvefur
4dbcac1633 prosodyctl: Fix weird indentation 2021-11-06 18:45:44 +01:00
Kim Alvefur
da8329037d Merge 0.11->trunk 2021-09-20 15:51:43 +02:00
Kim Alvefur
8fe336b4a1 prosodyctl: Fix later import of LuaFileSystem
lfs or WHAT

How did this even happen?
2021-09-11 22:26:50 +02:00
Kim Alvefur
13c5a2359d prosodyctl: Add 'limits' to known globals to warn about misplacing it
It will do nothing in a VirtualHost section for example.
2021-05-27 12:35:55 +02:00
Matthew Wild
3fd3d2cd99 prosodyctl about: Report libexpat version if known 2021-05-11 14:15:22 +01:00
Matthew Wild
e9b383cdb2 prosodyctl: check config: Add 'gc' to list of global options 2021-04-30 21:20:14 +01:00
Matthew Wild
75a1867ca5 prosodyctl: Fix some luacheck warnings 2020-01-23 21:59:13 +00:00
Matthew Wild
23470dd8de Log warning when using prosodyctl start/stop/restart 2020-01-23 21:43:36 +00:00
Kim Alvefur
941b35fe8a prosodyctl: Print a blank line to improve spacing and readability 2019-12-31 02:50:25 +01:00
Kim Alvefur
a7809d953e prosodyctl check: Warn about conflict between mod_pep and mod_pep_simple
Related #1483
2019-12-31 02:48:49 +01:00
Kim Alvefur
79f35dccf0 prosodyctl: Add a note about checking the order of listed commands
Should Plugin really be first? What order makes the most sense?
2021-07-15 00:38:27 +02:00
Kim Alvefur
994bc597d2 prosodyctl: Add cert to command listing
This hides a whole bunch of subcommands tho, maybe those should be
explicitly listed?
2021-07-15 00:37:47 +02:00
Kim Alvefur
f04f06dec5 prosodyctl: Add 'shell' to command listing 2021-07-15 00:35:57 +02:00
Kim Alvefur
5d8bae3294 prosodyctl: Add 'check' to command listing (fixes #1622)
Along with infrastructure for the other commands that live in external
modules.
2021-05-30 12:27:12 +02:00
Kim Alvefur
a7fef46789 prosodyctl: Reorganize help / command list 2021-01-22 00:11:39 +01:00
Kim Alvefur
8164b92989 prosodyctl: Report OpenSSL version 2021-05-12 01:11:42 +02:00