You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-73Lines changed: 23 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This is the code of the **Executor** component of the project **Progressor - The
6
6
7
7
These instructions are written for *Ubuntu* 16.04 LTS.
8
8
9
-
The goal is to install the Executor in `/opt/Executor/` and run it as a Docker container.
9
+
The goal is to install the **Executor** in `/opt/Executor/` and run it as a Docker container.
10
10
11
11
### Server Setup
12
12
@@ -33,105 +33,55 @@ The goal is to install the Executor in `/opt/Executor/` and run it as a Docker c
33
33
environment=KOTLIN_HOME="/kotlinc"
34
34
```
35
35
36
+
* If you need to override the default settings, please refer to the detailed [configuration information](doc/ExecutorConfig.md).
37
+
36
38
1. Make *Supervisor* start when the server boots: `sudo systemctl enable supervisor`
37
39
1. Start the service by executing `sudo service supervisor start`
38
40
1. Reload *Supervisor* configuration by running `sudo supervisorctl reread`
39
41
1. and `sudo supervisorctl update`
40
42
41
43
### Uploading the Executor JAR and Building the Docker Image
42
44
43
-
1. If you built the Executor jar from this repo, rename it to `ProgressorExecutor.jar` and upload it to your server in `/opt/Executor/`, otherwise download the pre-compiled one:
45
+
1. If you built the **Executor** *JAR* from this repo, rename it to `ProgressorExecutor.jar` and upload it to your server in `/opt/Executor/`, otherwise download the pre-compiled one:
1. If you modified the [*Dockerfile*](src/main/docker/Dockerfile), upload it to your server in `/opt/Executor/`, otherwise download the pre-compiled one:
1. On the server, still in `/opt/Executor`, build the *Docker* image used by the Executor by running `docker build -t progressor/executor .`
51
+
1. On the server, still in `/opt/Executor`, build the *Docker* image used by the **Executor** by running `docker build -t progressor/executor .`
50
52
51
-
The *Executor* will use this image to create one container per request.
53
+
The **Executor** will use this image to create one container per request.
52
54
After the request has been processed, the container is stopped and immediately deleted.
53
55
54
56
That way we make sure the different requests never interfere with each other.
55
57
56
-
# Building the Executor from source
57
-
## Maven
58
+
### Building the Executor From Source
58
59
59
60
This repository contains a [*Maven*](https://maven.apache.org/) project created using [*IntelliJ IDEA*](https://www.jetbrains.com/idea/).
60
61
61
-
Executor won't work properly if Apache Thrift files have not been generated. Luckily, Maven generates these files for us when you build the project, so before you run the Executor run it as a Maven build: *mvn -clean -package*
[*Docker*](https://www.docker.com/) is active by default on Linux distributions. On Windows it is deactivated by default, since you're not able to use the Executor with *Docker* on Windows.
79
-
The created *Docker* image Tag is named `progressor/executor`.
80
-
If you decide not to use *Docker*, use the following `-docker false`.
81
-
82
-
Be aware that not using *Docker* requires you to install all the compilers of the languages you want to support on your server.
83
-
If you use *Docker* you need to install the compilers in your *Docker* image. To do that, you need to adjust the Dockerfile and rebuild your image.
84
-
85
-
# Programming Languages
86
-
87
-
The **Executor** currently supports five programming languages.
88
-
89
-
To use the languages, the following compilers (and other tools) need to be installed and available in the **PATH**.
90
-
91
-
1. *Java*: `javac` and `java`
92
-
1. *C/C++*: `g++`
93
-
1. *C#*: `csc` (Windows) or `msc` (Linux)
94
-
1. *Kotlin*: `kotlinc` and `kotlin`
95
-
1. *Python*: `python` (Windows)
96
-
97
-
As already mentioned, if you are using *Docker* these compilers need to be installed inside the *Docker* image via the Dockerfile.
98
-
Java is the only exception, since it is needed inside the *Docker* image as well as on the server to run the executor.
99
-
100
-
### Java
101
-
102
-
Support for *Java SE* version 8 is required.
103
-
104
-
The *Java Developer Toolkit* (JDK) can be downloaded from the [official *Oracle* downloads page](http://www.oracle.com/technetwork/java/javase/downloads/).
105
-
106
-
### C/C++
107
-
108
-
This projects targets the [*GNU Compiler Collection* (GCC)](https://gcc.gnu.org/).
109
-
Support for *C++11* is required.
62
+
*Maven* can easily be [downloaded](https://maven.apache.org/download.cgi) and [installed](https://maven.apache.org/install.html) on any platform.
63
+
But it is also included in many IDEs like [*IntelliJ IDEA*](https://www.jetbrains.com/idea/), [*NetBeans*](https://netbeans.org/) and others.
110
64
111
-
* For Linux, install *g++* using `apt-get install g++`
112
-
* For Windows, the following packages are available:
113
-
* [*MinGW*](http://www.mingw.org/), which can be downloaded from [*sourceforge*](https://sourceforge.net/projects/mingw/files/).
114
-
* A [x64 version](http://mingw-w64.org/) is available on a [dedicated site](http://mingw-w64.org/doku.php/download/win-builds).
115
-
* [*Cygwin*](http://sourceware.org/cygwin/), which can be downloaded from their home page.
65
+
The dependencies are outlined in a [separate document](doc/ExecutorDependencies.md).
116
66
117
-
### C# #
67
+
You can build the project by executing `mvn clean package -Dmaven.test.skip=true` which will create the executable `target/ProgressorExecutor-1.0-jar-with-dependencies.jar`.
118
68
119
-
* On Windows, the C# compiler is already included in most recent Windows operatiog systems. Make sure that the *PATH* environment variable is set to `C:\WINDOWS\Microsoft.NET\Framework\v[your version number]\csc.exe.`
120
-
* If this directory does not exist, you can download the [*.NET Core*](https://www.microsoft.com/net/download)
121
-
* On Linux, [*Mono*](http://www.mono-project.com/) can be downloaded on their [download page](http://www.mono-project.com/download/).
69
+
This statement will do the following:
122
70
123
-
#### Kotlin
71
+
1. It will clean the workspace and remove any files left over from previous builds.
72
+
1. It will generate *Java*-specific [*Apache Thrift*](https://thrift.apache.org/) code based on the language-independent interface definition in `src/main/thrift/executor.thrift`.
73
+
1. It will skip the tests as you may not have properly set up your development machine to test all supported programming languages.
74
+
1. It will build the application.
75
+
1. It will generate two *JAR* files: one slim version (without the dependencies included) and one with all the dependencies included which you can then copy and use wherever you like.
124
76
125
-
For [*Kotlin*](http://kotlinlang.org/), a [stand-alone compiler](http://kotlinlang.org/docs/tutorials/command-line.html) can be downloaded from [*GitHub*](https://github.com/JetBrains/kotlin/releases/latest).
77
+
## Introduction
126
78
127
-
### Python
79
+
The **Executor** is a *Java* application that receives requests from the **Progressor** web application using *Apache Thrift*.
128
80
129
-
* On Linux, Python 3 install using *apt-get install python3*
130
-
* On Windows, download [*Python 3*](https://www.python.org/downloads/release/python-351/) and install it.
81
+
The actual application logic is completely separated from the *Apache Thrift* layer and has its own public API that can be used to [extend](doc/ExecutorConfig.md#extensibility) the **Executor**.
The **Executor** uses a [ServiceLoader](http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html) to load the different code executors at runtime.
85
+
Additionally, the project contains two abstract classes that can be reused to easily implement a new programming language.
135
86
136
-
New languages can be supported by simply implementing the service *ch.bfh.progressor.executor.api.CodeExecutor* and making it discoverable by the **Executor**.
137
-
Additional information can be found in the [Java SE API Specification](http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html).
The **Executor** accepts a number of command-line arguments:
6
+
7
+
*`-p port` or `-port port` will override the default port (9001).
8
+
*`-c [false|no]` or `-cleanup [false|no]` will prevent temporary files (e.g. generated code files, compiled executables or *Docker* containers) from being deleted.
9
+
*`-d [true|yes]` or `-docker [true|yes]` has no effect because because cleanup is enabled by default.
10
+
*`-d [false|no]` or `-docker [false|no]` will disable *Docker* support on Linux.
11
+
*`-d [true|yes]` or `-docker [true|yes]` has no effect because because *Docker* is enabled by default on Linux.
12
+
If invoked on Windows, the application will abort because this feature is not yet supported.
13
+
*`-t [true|yes]` or `-test [true|yes]` will run a test client instead of the server (request handler).
14
+
*`-t [false|no]` or `-test [false|no]` has no effect because server is the standard mode.
15
+
*`-h hostname` or `-host hostname` can be used to test an instance different from the local one.
16
+
17
+
## Extensibility
18
+
19
+
The **Executor** uses a [ServiceLoader](http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html) to load the different code executors at runtime.
20
+
21
+
New languages can be supported by simply implementing the service *ch.bfh.progressor.executor.api.CodeExecutor* and making it discoverable by the **Executor**.
22
+
Additional information can be found in the [Java SE API Specification](http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html).
1.*Kotlin*: `kotlinc` and `kotlin` (these scripts are actually simulated until a security issue can be solved with *Java 9*)
38
+
1.*VB.NET*: `vbc` (Windows) or `vbnc` and `mono` (Linux)
39
+
40
+
As already mentioned, if you are using *Docker* these compilers need to be installed inside the *Docker* image via the *Dockerfile*.
41
+
Java is the only exception, since it is needed inside the *Docker* image as well as on the server to run the **Executor**.
42
+
43
+
### Java
44
+
45
+
Support for *Java 8* is required.
46
+
47
+
The *Java Developer Toolkit* (JDK) can be downloaded from the [official *Oracle* downloads page](http://www.oracle.com/technetwork/java/javase/downloads/).
48
+
49
+
### C/C++
50
+
51
+
This projects targets the [*GNU Compiler Collection* (GCC)](https://gcc.gnu.org/).
52
+
Support for *C++11* is required.
53
+
54
+
* For Linux, install *g++* using `apt-get install g++`
55
+
* For Windows, the following packages are available:
56
+
*[*MinGW*](http://www.mingw.org/), which can be downloaded from [*sourceforge*](https://sourceforge.net/projects/mingw/files/).
57
+
* A [x64 version](http://mingw-w64.org/) is available on a [dedicated site](http://mingw-w64.org/doku.php/download/win-builds).
58
+
*[*Cygwin*](http://sourceware.org/cygwin/), which can be downloaded from their home page.
59
+
60
+
### C# #
61
+
62
+
* On Windows, the C# compiler is already included in most recent Windows operating systems. Make sure that the *PATH* environment variable is set to `C:\WINDOWS\Microsoft.NET\Framework\v[your version number]\csc.exe.`
63
+
* If this directory does not exist, you can download the [*.NET Core*](https://www.microsoft.com/net/download).
64
+
* On Linux, [*Mono*](http://www.mono-project.com/) can be downloaded on their [download page](http://www.mono-project.com/download/).
65
+
66
+
### Python
67
+
68
+
* On Linux, Python 3 install using *apt-get install python3*
69
+
* On Windows, download [*Python 3*](https://www.python.org/downloads/release/python-351/) and install it.
70
+
71
+
### JavaScript
72
+
73
+
Install [Node.js](https://nodejs.org/) version *6.x.x* as any version below will not fully comply with *ES6*.
74
+
75
+
### PHP
76
+
77
+
Install [PHP](http://php.net/downloads.php) ([Windows](http://windows.php.net/download#php-7.0)) version 7.x.x.
78
+
79
+
### Kotlin
80
+
81
+
For [*Kotlin*](http://kotlinlang.org/), a [stand-alone compiler](http://kotlinlang.org/docs/tutorials/command-line.html) can be downloaded from [*GitHub*](https://github.com/JetBrains/kotlin/releases/latest).
82
+
83
+
### VB.NET
84
+
85
+
* On Windows, the VB.NET compiler is already included in most recent Windows operating systems. Make sure that the *PATH* environment variable is set to `C:\WINDOWS\Microsoft.NET\Framework\v[your version number]\vbc.exe.`
86
+
* If this directory does not exist, you can download the [*.NET Core*](https://www.microsoft.com/net/download).
87
+
* On Linux, [*Mono*](http://www.mono-project.com/) can be downloaded on their [download page](http://www.mono-project.com/download/).
0 commit comments