Commit Graph

43 Commits

Author SHA1 Message Date
Maximilian Paß
3469d0ce77 Specify http not found exit code
by replacing it with StatusGone (410) for a missing runner and StatusFailedDependency (424) for missing or not accessible files.
2022-10-05 12:11:47 +01:00
Maximilian Paß
fc77f11d4d Enquote file path for shell execution.
Also, fix json of 500 response.
2022-10-05 12:11:47 +01:00
Maximilian Paß
152b77afe5 Add listing of runners file system. 2022-10-05 12:11:47 +01:00
Maximilian Paß
c7ee7c1e25 Remove superfluous response.WriteHeader call
as the Write of the responseWriter automatically sends also the Header.
2022-10-05 12:11:47 +01:00
Maximilian Paß
f2b25566dd #136 Copy files back from Nomad runner. 2022-10-05 12:11:47 +01:00
Sebastian Serth
1a5a49d7c8 Explicitly switch user for code execution.
Co-authored-by: Maximilian Pass <maximilian.pass@student.hpi.uni-potsdam.de>
2022-09-24 23:09:23 +02:00
Maximilian Paß
d10b31a1fb Remove static (nil) return value. 2022-08-01 11:24:56 +02:00
Maximilian Paß
498e8f5ff5 #110 Refactor influxdb monitoring
to use it as singleton.
This enables the possibility to monitor processes that are independent of an incoming request.
2022-07-01 15:29:31 +02:00
Maximilian Paß
203d5a3a4f #155 refactor and synchronise writing to CodeOcean. (#174)
* #155 refactor and synchronise writing to CodeOcean.

* Reduce complexity of input parsing.

* Update typo in internal/api/ws/codeocean_writer.go

Co-authored-by: Sebastian Serth <MrSerth@users.noreply.github.com>
2022-06-26 20:19:23 +02:00
Maximilian Paß
3afe8ddb66 #155 Enable stopping of the CodeOcean WebSocket read independently of writing to CodeOcean. 2022-06-21 12:13:33 +02:00
Maximilian Paß
3d1ed7cb0f #155 Minimise timing issues with websocket close. 2022-06-21 12:13:33 +02:00
Maximilian Paß
79dc3a94da #155 Add log statement for further investigations (#164) 2022-06-12 11:10:57 +02:00
Maximilian Paß
ecce3c294f #155 Add log statement for further investigations 2022-06-09 22:34:43 +02:00
Maximilian Paß
1e59c1146e Fix CodeQL log injection warning
by removing newlines from logged user input.
2022-06-07 17:21:05 +02:00
Maximilian Paß
25f92e5f94 Add environment specific data to the influxdb data. 2022-04-18 13:17:49 +02:00
Maximilian Paß
eabe3a1b27 Add the Environment ID to the influxdb data.
Also move the interface of an execution environment into its own file, execution_environment.go.
2022-04-18 13:17:49 +02:00
Maximilian Paß
8feffdae3a Add initial structure of influxdb monitoring. 2022-04-18 13:17:49 +02:00
Sebastian Serth
e4ebb5b384 Add trace statements for WebSocket messages
* With `logger.level: TRACE`, the content of WebSocket messages is logged
  together with the corresponding timestamp.
* The input is not further sanitized as this log level
  is not intended for production use.
2022-04-15 12:39:03 +02:00
Maximilian Paß
6123d20525 Implement core functionality of AWS integration 2022-02-28 14:54:40 +01:00
Maximilian Paß
dd41e0d5c4 Generate structures for an AWS environment and runner 2022-02-28 14:54:40 +01:00
Maximilian Paß
0ef5a4e39f Make Execution Environment interface Nomad independent 2022-02-28 14:54:40 +01:00
Maximilian Paß
ba43f667c2 Add architecture for multiple managers
using the chain of responsibility pattern.
2022-02-28 14:54:40 +01:00
Maximilian Paß
d57a0c07b8 Implement review suggestions 2021-12-22 17:30:16 +01:00
Maximilian Paß
2f5b30702a Fix early write
Because some clients fail receiving a response before the body is sent entirely. See https://github.com/openHPI/poseidon/issues/54
2021-12-16 23:44:13 +01:00
Maximilian Paß
f3929cbf50 Fix webSocket error
that was introduced by closing the WebSocket connection without stopping the inputLoop.
2021-12-16 15:05:47 +01:00
Maximilian Paß
feefe2c1ed Fix third goroutine leak and refactor proxy cancellation.
Fix goroutine leak in the Read function of the codeOceanToRawReader: Blocking Select statement.
2021-12-14 13:24:53 +01:00
Maximilian Paß
c565ca217e Fix goroutine leak when reading the client WebSocket 2021-12-14 13:24:53 +01:00
Maximilian Paß
e95e07e426 Catch the client connection "Close normal" error
* Catch the client connection "Close normal" error

* Reduce cognitive complexity of the input read loop
2021-12-09 10:02:26 +01:00
Maximilian Paß
1de559cebc Add statistics route for execution environments
* Add statistics route for execution environments

* Add maximum to port api definition

Co-authored-by: Sebastian Serth <MrSerth@users.noreply.github.com>
2021-12-08 12:08:22 +01:00
Maximilian Paß
a6eaa45097 Stop stdout & stderr after timeout
Co-authored-by: Sebastian Serth <MrSerth@users.noreply.github.com>
2021-11-25 21:08:56 +01:00
Maximilian Paß
0d7e07eae0 Add route for version information 2021-11-25 19:49:58 +01:00
Maximilian Paß
dcc869cd94 Fix after updating golangci-lint
v1.43
2021-11-10 13:11:38 +01:00
Maximilian Paß
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
Maximilian Paß
af506dd26f Fix Bug that only runner routes get registered with authorization. 2021-10-12 10:32:59 +02:00
Maximilian Paß
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
Maximilian Paß
c8c5357b8c Rename module for GitHub 2021-07-30 16:43:05 +02:00
sirkrypt0
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
sirkrypt0
bd14b1e181 Move execution storage to new package 2021-07-30 14:26:44 +02:00
Jan-Eric Hellenberg
6a60b6cd89 Add config option to enable (m)TLS between Poseidon and Nomad 2021-07-29 09:43:21 +00:00
sirkrypt0
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
Konrad Hanff
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
Konrad Hanff
23b726cef9 Correct behavior when WebSocket closes. 2021-07-26 06:47:55 +00:00
sirkrypt0
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