| Age | Commit message (Collapse) | Author |
|
In case we needs to add another parameter, which will do later, the
argument will be too long.
Using parameters is acceptable only for 2 to 3 arguments.
|
|
In the ExecResponse, store the event in the Output instead of message
data, so the server can iterate the Output directly and pass it to
WriteEvent directly.
The event ID now start at 1 with type "begin".
This is to minimize confusion when comparing empty Last-Event-ID from
client, which is equal to 0.
|
|
In the test for AwwanLocal, use buffer with lock, so each write and
read is safe.
In the httpServer, the test found data race during ExecuteTail when
accessing [ExecResponse.EndAt].
We fix it by locking the resource during call to end() and when
accessing the EndAt field.
|
|
The "awwan serve" command now can run based on socket activation under
systemd.
|
|
|
|
The "share" project has been moved to SourceHut with new name
"pakakeh.go".
|
|
Once the ExecResponse EndAt is not empty or event queue has been closed,
clear the map that store the execution response and context cancellation
to minimize resources usage.
|
|
The HTTP API for stopping execution have the following signature,
DELETE /awwan/api/execute?id=<string>
If the ID is exist, the execution will be cancelled and return HTTP
status 200 with the following body,
Content-Type: application/json
{
"code": 200,
}
Otherwise it will return HTTP status 404 with error message.
References: https://todo.sr.ht/~shulhan/awwan/9
|
|
Passing context allow the command Local or Play to be cancelled when
running in asynchronous mode, in this case when awwan run with WUI.
|
|
Previously, the regex does not contains "^" and "$" which makes
file like "multi-user.target.wants" considered as ".tar" file and being
excluded.
|
|
Better to fix and follow the reported warnings rather than adding
configuration file to add an exception.
|
|
Previously, the HTTP endpoint for "GET /awwan/api/fs" return the content
of files when the requested node is a directory.
This is cause unnecessary load because when requesting directory we
only need list of file names not the content.
This changes reduce the response by returning only list of node child
without its content, which require update on share module on [Node.JSON].
|
|
In "/awwan/api/execute/tail" SSE endpoint, in order for client to be able
to reconnect and start streaming from the last know output, we need to
send the ID for each message that we send.
The ID is the index of Output in slice.
If client does not send Last-Event-ID, we send all Output from beginning,
otherwise, we send only message start from index in Last-Event-ID.
|
|
The new API is "GET /awwan/api/execute/tail" that implement Server-sent
events, not a normal GET request.
Its accept the query parameter "id" with value is the execution ID
from "/awwan/api/execute".
Once called with valid ID, it will streaming the command output
to client.
By using this new API, the WUI can receive the output of command
immediately without waiting for all commands to be completed.
Implements: https://todo.sr.ht/~shulhan/awwan/5
Signed-off-by: Shulhan <ms@kilabit.info>
|
|
Previously, the Execute endpoint wait for command execution to finish.
In case the command takes longer than proxy or server write timeout, it
will return with an timeout error to client.
In this changes, we generate an execution ID for each request and return
it immediately.
The next commit will implement HTTP endpoint to fetch the latest status
and/or output by execution ID.
References: https://todo.sr.ht/~shulhan/awwan/5
|
|
Although log print to stderr, this allow user to filter between awwan
output and command output, for example by piping stderr to /dev/null
$ awwan env-get "key" dir/ 2>/dev/null
The output env-get is not poluted by other logs.
|
|
Previously, the ExecRequest from HTTP Execute endpoint changes the Script
value to the absolute script path in the system.
This changes fix this issue to minimize inconsistency between request
and response.
|
|
The HTTP server should excludes ".git" directory only, not the other
files, like .gitignore or .gitconfig.
|
|
When user run "awwan serve", using web-user interface, any request to
fetch the content of "awwan.key" and "awwan.pass" should not allowed for
security reason, in case user want to serve awwan with others.
|
|
|
|
|
|
Similar to the CLI, the HTTP API accept the path of vault file
and return the path to decrypted file.
|
|
In the right side of Save button we now have a button Encrypt that
allow user to Encrypt openend file.
This require the workspace has been setup with private key
(.ssh/awwan.key) and pass file (.ssh/awwan.pass).
|
|
Similar to the CLI, the HTTP API accept the path of file and return the
path to encrypted file.
|
|
On some application, like haproxy configuration, line-feed (LF or "\n")
are required, otherwise the application would not start.
|
|
The "-address" option allow defining the HTTP server address to serve
the web-user interface.
|
|
For each script execution, a file suffixed with ".log" will be created
in the same directory with the same name as script file.
For example, if the script is path is "a/b/c.aww" then the log file
would named "a/b/c.aww.log".
This is to provides history and audit in the future.
|
|
Previously, when the command execution failed, we check the error and
return it as HTTP status code 500.
In this way, user cannot view the log and actual error.
In this changes, if the command failed, we store the error in separate
field "Error" and return to the caller with HTTP status code 200.
|
|
Since we now have website, the directory name "_www" become misleading.
The actual website files is located under "_www/doc", the "_www" directory
is for web-user interface which includes documentation that has the
same content as our websites.
|
|
Previously, the HTTP API for deleting node only remove the file but
not the node in the memfs.
This changes remove the child node from memfs, so the next refresh on
directory will not contains the removed file.
|
|
By using "mlog.MultiLogger" every output or error can be written to
stdout/stderr and additional log writer that can collect both of them,
buffered and returned to the caller.
This changes simplify the HttpResponse to use only single output that
combine both stdout and stderr.
|
|
Those fields are used on each HTTP request to /awwan/api/execute, which
make them not safe if two or more requests processed at the same time.
|
|
All fields that use to serve HTTP API now moved inside one struct,
including memfsBase, bufout, and buferr.
|
|
|
|
We will move all fields related to HTTP server into one struct later.
|