Skip to content

Commit 07269df

Browse files
authored
Merge pull request #2 from ProcessMaker/feature/1
Allow for docker customization
2 parents e8a6dcb + 54c28b0 commit 07269df

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sdk

Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,3 @@ RUN apt-get update && apt-get install -y git-core
88

99
COPY /src /opt/executor
1010
WORKDIR /opt/executor
11-
RUN if [ ! -d "sdk-java" ]; then git clone --depth 1 https://github.com/ProcessMaker/sdk-java.git; fi
12-
WORKDIR /opt/executor/sdk-java
13-
RUN mvn clean install
14-
WORKDIR /opt/executor

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "processmaker/docker-executor-java",
33
"friendly_name": "Java Docker Executor",
44
"description": "Java script executor for processmaker 4",
5-
"version": "0.0.1",
5+
"version": "1.0.0",
66
"minimum-stability": "dev",
77
"autoload": {
88
"psr-4": {

src/DockerExecutorJavaServiceProvider.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
use ProcessMaker\Traits\PluginServiceProviderTrait;
77
use ProcessMaker\Package\Packages\Events\PackageEvent;
88
use ProcessMaker\Package\WebEntry\Listeners\PackageListener;
9+
use ProcessMaker\Models\ScriptExecutor;
910

1011
class DockerExecutorJavaServiceProvider extends ServiceProvider
1112
{
1213
use PluginServiceProviderTrait;
1314

14-
const version = '0.0.1'; // Required for PluginServiceProviderTrait
15+
const version = '1.0.0'; // Required for PluginServiceProviderTrait
1516

1617
public function register()
1718
{
@@ -28,19 +29,37 @@ public function register()
2829
public function boot()
2930
{
3031
\Artisan::command('docker-executor-java:install', function () {
31-
// nothing to do here
32+
$scriptExecutor = ScriptExecutor::install([
33+
'language' => 'java',
34+
'title' => 'Java Executor',
35+
'description' => 'Default Java Executor',
36+
]);
37+
38+
// Build the instance image. This is the same as if you were to build it from the admin UI
39+
\Artisan::call('processmaker:build-script-executor java');
40+
41+
// Restart the workers so they know about the new supported language
42+
\Artisan::call('horizon:terminate');
3243
});
3344

3445
$config = [
3546
'name' => 'Java',
3647
'runner' => 'JavaRunner',
3748
'mime_type' => 'application/java',
38-
'image' => env('SCRIPTS_JAVA_IMAGE', 'processmaker4/executor-java'),
3949
'options' => [
4050
'invokerPackage' => "ProcessMaker_Client",
4151
'modelPackage' => "ProcessMaker_Model",
4252
'apiPackage' => "ProcessMaker_Api",
43-
]
53+
],
54+
'init_dockerfile' => [
55+
"ARG SDK_DIR",
56+
'COPY $SDK_DIR /opt/executor/sdk-java',
57+
'WORKDIR /opt/executor/sdk-java',
58+
'RUN mvn clean install',
59+
'WORKDIR /opt/executor',
60+
],
61+
'package_path' => __DIR__ . '/..',
62+
'package_version' => self::version,
4463
];
4564
config(['script-runners.java' => $config]);
4665

src/ProcessMaker.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class ProcessMaker {
1111
public static ApiClient api() {
1212
String baseApiUrl = System.getenv("API_HOST");
1313
String v3Token = System.getenv("API_TOKEN");
14+
String verifySsl = System.getenv("API_SSL_VERIFY");
1415
int connectTimeout = 60000;
1516
int readTimeout = 120000;
1617

@@ -22,6 +23,11 @@ public static ApiClient api() {
2223
}
2324
client.setConnectTimeout(connectTimeout);
2425
client.setDebugging(false);
26+
27+
if (verifySsl.equals("0")) {
28+
client.setVerifyingSsl(false);
29+
}
30+
2531
return client;
2632
}
2733

0 commit comments

Comments
 (0)