Commit Graph

45 Commits

Author SHA1 Message Date
Ingo Oppermann
d59158de03 Allow hard and soft limiting a process
A hard limit will kill the process as soon as either CPU or memory
consumption are above a defined limit for a certain amount of time.

A soft limit will throttle the CPU usage if above a defined limit and
kill the process if memory consumption is above a defined limit. The
soft limit can be enabled/disabled on demand.

The default is hard limit.
2023-04-26 16:01:50 +02:00
Ingo Oppermann
9b17ab2b29 Add global limits in config, fix not using process limits 2023-04-25 21:49:55 +02:00
Ingo Oppermann
b70382c40b Expose resource usage in process state 2023-04-25 16:20:59 +02:00
Ingo Oppermann
3a1825cf61 Expose resource usage in report history 2023-04-25 15:55:32 +02:00
Ingo Oppermann
c1bbb4065c Merge branch 'dev' into vod 2023-04-24 12:16:52 +02:00
Ingo Oppermann
317d6eb4d9 Add updated_at field in process infos 2023-04-24 12:05:01 +02:00
Ingo Oppermann
6ddd58a124 Preserve process log history when updating a process 2023-04-24 11:59:09 +02:00
Ingo Oppermann
76abf5474f Fix compilation error 2023-04-13 15:43:59 +02:00
Ingo Oppermann
b96672e308 Forward keyframe and extradata_bytes counter to API 2023-04-11 08:59:24 +02:00
Ingo Oppermann
0a3117bbd0 Add log_patterns to process config
log_patterns allow to filter the FFmpeg log messages based on regular
expressions. Each entry of log_patterns is interpreted as regular
expression and matched against every non-progress log line emitted from
FFmpeg. All matching lines are returned in the matches array of the
report.
2023-03-27 15:50:25 +02:00
Ingo Oppermann
99c571d623 Add event filter support 2023-03-23 14:50:59 +01:00
Ingo Oppermann
b63b23527b Add scheduler and timeout to processes
The scheduler allows to define when a process should run. It can be either
a timestamp in RFC3339 format or a crontab expression. If a scheduler is
given, reconnect and the reconnect delay will only apply to processes that
exited as failed.

The timeout allows to define when a process should be gracefully stopped.
It is measured from the actual start of that process including all reconnects
due to failures. If the process finished regularly, the timeout will be
reset.
2023-03-21 14:51:43 +01:00
Ingo Oppermann
1d298038dd Add date of when a process exited in report history 2023-03-14 15:10:06 +01:00
Ingo Oppermann
175cfc2324 Fix using prefix syntax for filesystem operations 2023-03-03 16:18:46 +01:00
Ingo Oppermann
eb3f396793 Remove debug printf, add tests 2023-03-02 21:04:37 +01:00
Ingo Oppermann
0dedcddece Add process report API 2023-03-02 11:15:57 +01:00
Ingo Oppermann
cceb39192a Fix receiving proper current command args, simplifying retrieval of last log line 2023-03-01 20:13:49 +01:00
Ingo Oppermann
3151670829 Add descriptions to functions 2023-03-01 15:48:52 +01:00
Ingo Oppermann
86b3c053f1 Add exit state and last progress data to process report history 2023-03-01 15:28:28 +01:00
Ingo Oppermann
3cad139952 Create directories for output files to be written on disk 2023-03-01 11:08:20 +01:00
Ingo Oppermann
be718eac0a Add support for date placeholder in process config
Because it doesn't make sense to replace the date placeholder at
process creation, it has to be replaced at every start of the process.

On process creation only the static placeholders (such as process ID)
are replaced. Dynamic placeholders (so far only "date") are not
replaced. On process start, a callback has been introduced that gives
the chance to change the command line. This is the point where
the restreamer replaces the date placeholders.
2023-02-28 17:46:08 +01:00
Ingo Oppermann
2a3288ffd0 Use abstract filesystem for stores 2023-02-01 16:09:20 +01:00
Ingo Oppermann
f519acfd71 Add S3 storage support 2023-01-31 14:45:58 +01:00
Ingo Oppermann
b2cd8f7133 Allow probe with individual timeout 2023-01-23 17:09:55 +01:00
Ingo Oppermann
505fbff03f Add tests 2023-01-23 11:42:17 +01:00
Ingo Oppermann
0147651de6 Extend placeholders
1. Allow variables in placeholders for parameter values, e.g.
   {rtmp,name=$processid}. The variable starts with a $ letter.
   The recognized variables are provided with the Replace func.

2. The template func recieves the process config and the name of
   the section where this placeholder is located, i.e. "global",
   "input", or "output".
2023-01-20 13:38:33 +01:00
Ingo Oppermann
dfc81ac38f Add ffmpeg migration tool, annotate process config with ffmpeg version constraint 2022-11-02 22:02:39 +01:00
Ingo Oppermann
54dd24a5c0 Fix API metadata endpoint responses 2022-09-29 10:44:21 +02:00
Ingo Oppermann
f1141d1ad9 Fix assigning cleanup rules for diskfs 2022-08-26 08:17:17 +03:00
Ingo Oppermann
45fa1c4498 Fix intersection of search results 2022-08-19 12:37:53 +03:00
Ingo Oppermann
0febae3242 Return number of purged files 2022-08-18 12:00:37 +03:00
Ingo Oppermann
50deaef4d3 Wait for process to exit when stopping
If a process has some cleanup with purge-on-delete defined, the purge
has to wait until the process actually exited. Otherwise it may happen
that the process got the signal, files are purged, but the process is
still writing some files in order to exit cleanly. This would lead to
some artefacts left on the filesystem.
2022-08-17 15:13:17 +03:00
Ingo Oppermann
3e7b1751d5 Add process id and reference glob pattern matching
For the API endpoint /v3/process two new query parameter are introduced
in order to list only processes that match a pattern for the id and the
reference: idpattern and refpattern. The pattern is a glob pattern. If
patterns for both are given, the results will be intersected. If you use
other query parameters such as id or reference, they will be applied
after the result of the pattern matching.
2022-08-17 07:55:44 +03:00
Ingo Oppermann
4a1131b7c8 Fix segfault on stopping an invalid process 2022-07-08 19:48:09 +02:00
Ingo Oppermann
fe420ebe28 Return empty state and report if process is invalid 2022-07-08 10:07:56 +02:00
Ingo Oppermann
337e0040c2 Fix input and output validation with tee outputs 2022-07-07 15:45:24 +02:00
Ingo Oppermann
971b8337fe Add new placeholders and parameters for placeholder 2022-07-06 19:51:47 +02:00
Ingo Oppermann
a2898061b0 Add optional escape character to process placeholder
If a value for a placeholder needs escaping, add the character to
escape with an "^" to the name of the placeholder, e.g. {memfs^:}.
This will escape all occurences of ":" in the value for {memfs}
with a "\".
2022-07-04 20:20:15 +02:00
Ingo Oppermann
dfcecf737a Fix validating a tee muxer address with only one output 2022-07-01 16:35:47 +02:00
Ingo Oppermann
07e72cb25c Fix wrong return status for process update 2022-07-01 16:25:52 +02:00
Ingo Oppermann
1931782638 Fix output address validation for tee outputs 2022-06-30 21:07:53 +02:00
Ingo Oppermann
1cf1b7772f Add UpdateProcess function
If PUT /process/:id is called in order to replace an existing
process config with an invalid process config, the existing
process was deleted and an 409 was returned. A subsequent GET on
the previous process would then return a 404, which is not
what you expect. The previous process needs to stay in place.
2022-06-30 19:54:25 +02:00
Jan Stabenow
eb1cc37456 Add GoSRT & improvements (repo-merge)
Commits (Ingo Oppermann):
- Add experimental SRT connection stats and logs
- Hide /config/reload endpoint in reade-only mode
- Add SRT server
- Create v16 in go.mod
- Fix data races, tests, lint, and update dependencies
- Add trailing slash for routed directories (datarhei/restreamer#340)
- Allow relative URLs in content in static routes

Co-Authored-By: Ingo Oppermann <57445+ioppermann@users.noreply.github.com>
2022-06-23 22:13:58 +02:00
Jan Stabenow
9746248c10 Add v16.8.0 2022-06-03 17:21:52 +02:00
Jan Stabenow
9c0b535199 Add v16.7.2 2022-05-13 19:26:45 +02:00