Commit Graph

217 Commits

Author SHA1 Message Date
055fa43227 Create a new runner async after one gets claimed 2021-10-22 16:23:51 +02:00
34d4bb7ea0 Implement routes to list, get and delete execution environments
* #9 Implement routes to list, get and delete execution environments.
A refactoring was required to introduce the ExecutionEnvironment interface.

* Fix MR comments, linting issues and bug that lead to e2e test failure

* Add e2e tests

* Add unit tests
2021-10-21 10:33:52 +02:00
af506dd26f Fix Bug that only runner routes get registered with authorization. 2021-10-12 10:32:59 +02:00
9d7e59df36 Change authorization header key (#6)
* Change authorization header key

as the use of headers starting with X- has been deprecated in RFC6648.

* Update configuration.example.yaml

Co-authored-by: Sebastian Serth <MrSerth@users.noreply.github.com>
2021-10-04 12:23:41 +02:00
9b106f4cd8 Fix linting issues
An update of golangci-lint yielded new linting issues. This commit
fixes them.
2021-08-05 13:40:48 +02:00
c8c5357b8c Rename module for GitHub 2021-07-30 16:43:05 +02:00
36dc99f019 Don't embed the execution.Storer interface into a runner
Previously, the execution.Storer interface was embedded in the Runner interface.
However, this resulted in calls like runner.Add(...) to add an execution to the
store which is kind of ugly. Thus, we decided to add only the required functions to
the runner interface and make the execution.Storer a field of the implementation.
2021-07-30 14:28:06 +02:00
4ad470a5c4 Rename execution.Storage to Storer to follow Go convention
Interfaces should be named like someone actively doing a thing. Thus,
instead of Storage we use Storer.
2021-07-30 14:26:44 +02:00
bd14b1e181 Move execution storage to new package 2021-07-30 14:26:44 +02:00
c9d6cd5996 Move runner interactivity timer to own file
Previously, the interactivity timer was implemented in the same file
as the runner. This made the file long and the project structure more
complicated.
2021-07-29 13:30:46 +00:00
67ebdbd650 Add option to configure template job HCL file
Previously, the template job HCL file was hardcoded using go:embed
in the binary. However, this did not allow users running Poseidon
to change its content. Now, users can change the content of the
template job HCL file using the configuration option.
2021-07-29 11:54:36 +00:00
6a60b6cd89 Add config option to enable (m)TLS between Poseidon and Nomad 2021-07-29 09:43:21 +00:00
e2d71a11ad Avoid concurrent writes to the websocket connection
Previously, the server sometimes crashed due to concurrent writes
to the websocket connection. Now, we ensure that only one concurrent
function writes to the websocket at a time by enclosing the WriteMessage
function with a mutex.
2021-07-29 09:21:15 +00:00
8d24bda61a Send SIGQUIT when cancelling an execution
When the context passed to Nomad Allocation Exec is cancelled, the
process is not terminated. Instead, just the WebSocket connection is
closed. In order to terminate long-running processes, a special
character is injected into the standard input stream. This character is
parsed by the tty line discipline (tty has to be true). The line
discipline sends a SIGQUIT signal to the process, terminating it and
producing a core dump (in a file called 'core'). The SIGQUIT signal can
be caught but isn't by default, which is why the runner is destroyed if
the program does not terminate during a grace period after the signal
was sent.
2021-07-29 10:28:47 +02:00
3aa1227db6 Use authentication token from config for communication with Nomad 2021-07-27 11:35:55 +00:00
23b726cef9 Correct behavior when WebSocket closes. 2021-07-26 06:47:55 +00:00
8b26ecbe5f Restructure project
We previously didn't really had any structure in our project apart
from creating a new folder for each package in our project root.
Now that we have accumulated some packages, we use the well-known
Golang project layout in order to clearly communicate our intent
with packages. See https://github.com/golang-standards/project-layout
2021-07-21 12:55:35 +02:00