From 580b599d736a643ac6efa5d5d14139897f79f5aa Mon Sep 17 00:00:00 2001 From: Miguel Angel Date: Thu, 18 Dec 2025 10:31:17 -0400 Subject: [PATCH 1/4] feat: enhance build script executors command to support additional build arguments for docker --- .../Console/Commands/BuildScriptExecutors.php | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/ProcessMaker/Console/Commands/BuildScriptExecutors.php b/ProcessMaker/Console/Commands/BuildScriptExecutors.php index 6b745fcb9e..70fda659eb 100644 --- a/ProcessMaker/Console/Commands/BuildScriptExecutors.php +++ b/ProcessMaker/Console/Commands/BuildScriptExecutors.php @@ -18,7 +18,11 @@ class BuildScriptExecutors extends Command * * @var string */ - protected $signature = 'processmaker:build-script-executor {lang} {user?} {--rebuild}'; + protected $signature = 'processmaker:build-script-executor + {lang : The ID or language of the script executor} + {user? : The user ID to send the broadcast event to} + {--rebuild : Rebuild the docker image} + {--build-args= : The build arguments for the docker build command}'; /** * The console command description. @@ -159,6 +163,12 @@ public function buildExecutor() $command = Docker::command() . " build --build-arg SDK_DIR=./sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}"; + $buildArgs = $this->getBuildArgs(); + + foreach ($buildArgs as $buildArg) { + $command .= ' ' . $buildArg; + } + $this->execCommand($command); $isNayra = $scriptExecutor->language === Base::NAYRA_LANG; @@ -167,6 +177,29 @@ public function buildExecutor() } } + /** + * Get the build arguments for the docker build command. + * + * @return array + * - '--build-arg =' + */ + public function getBuildArgs(): array + { + $args = $this->option('build-args'); + + if ($args) { + $buildArgs = []; + + foreach (explode(',', $args) as $arg) { + $buildArgs[] = '--build-arg ' . $arg; + } + + return $buildArgs; + } + + return []; + } + public function getDockerfileContent(ScriptExecutor $scriptExecutor): string { $lang = $scriptExecutor->language; From cdd76fc089e5db7bbe41e6eb2b4a5eb1d427d73b Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 13 Jan 2026 19:05:37 -0400 Subject: [PATCH 2/4] refactor: Made nayra port configurable --- ProcessMaker/Models/ScriptDockerNayraTrait.php | 12 +++++++++--- config/app.php | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ProcessMaker/Models/ScriptDockerNayraTrait.php b/ProcessMaker/Models/ScriptDockerNayraTrait.php index 83c38bcc55..da586c5bd3 100644 --- a/ProcessMaker/Models/ScriptDockerNayraTrait.php +++ b/ProcessMaker/Models/ScriptDockerNayraTrait.php @@ -23,7 +23,6 @@ trait ScriptDockerNayraTrait { private $schema = 'http'; - public static $nayraPort = 8080; /** * Execute the script task using Nayra Docker. @@ -82,7 +81,7 @@ public function handleNayraDocker(string $code, array $data, array $config, $tim private function getNayraInstanceUrl() { $servers = self::getNayraAddresses(); - return $this->schema . '://' . $servers[0] . ':' . static::$nayraPort; + return $this->schema . '://' . $servers[0] . ':' . $this->getNayraPort(); } private function getDockerLogs($instanceName) @@ -135,7 +134,9 @@ private function bringUpNayra($restart = false) exec($docker . " stop {$instanceName}_nayra 2>&1 || true"); exec($docker . " rm {$instanceName}_nayra 2>&1 || true"); exec( - $docker . ' run -d --name ' . $instanceName . '_nayra ' + $docker . ' run -d --name ' + . '-p ' . $this->getNayraPort() . ':8080 ' + . $instanceName . '_nayra ' . (config('app.nayra_docker_network') ? '--network=' . config('app.nayra_docker_network') . ' ' : '') @@ -322,4 +323,9 @@ public static function initNayraPhpUnitTest() } } } + + private function getNayraPort() + { + return config('app.nayra_port', 8080); + } } diff --git a/config/app.php b/config/app.php index 6745518567..aa82ceab5d 100644 --- a/config/app.php +++ b/config/app.php @@ -257,6 +257,7 @@ 'force_https' => env('FORCE_HTTPS', true), 'nayra_docker_network' => env('NAYRA_DOCKER_NETWORK', 'host'), + 'nayra_port' => env('NAYRA_PORT', 8080), // Process Request security log rate limit: 1 per day (86400 seconds) 'process_request_errors_rate_limit' => env('PROCESS_REQUEST_ERRORS_RATE_LIMIT', 1), From 9f17f51700a75e624ebadee8b281dfc0bd4758d7 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 13 Jan 2026 19:36:21 -0400 Subject: [PATCH 3/4] Fix port mapping --- ProcessMaker/Models/ScriptDockerNayraTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ProcessMaker/Models/ScriptDockerNayraTrait.php b/ProcessMaker/Models/ScriptDockerNayraTrait.php index da586c5bd3..7f40955429 100644 --- a/ProcessMaker/Models/ScriptDockerNayraTrait.php +++ b/ProcessMaker/Models/ScriptDockerNayraTrait.php @@ -134,9 +134,9 @@ private function bringUpNayra($restart = false) exec($docker . " stop {$instanceName}_nayra 2>&1 || true"); exec($docker . " rm {$instanceName}_nayra 2>&1 || true"); exec( - $docker . ' run -d --name ' - . '-p ' . $this->getNayraPort() . ':8080 ' - . $instanceName . '_nayra ' + $docker . ' run -d ' + . ($this->getNayraPort() !== 8080 ? '-p ' . $this->getNayraPort() . ':8080 ' : '') + . '--name ' . $instanceName . '_nayra ' . (config('app.nayra_docker_network') ? '--network=' . config('app.nayra_docker_network') . ' ' : '') From bb21d76b47d7253d6c06b28b58a4234f04408059 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 13 Jan 2026 20:18:36 -0400 Subject: [PATCH 4/4] Enable port mapping for host network --- ProcessMaker/Models/ScriptDockerNayraTrait.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ProcessMaker/Models/ScriptDockerNayraTrait.php b/ProcessMaker/Models/ScriptDockerNayraTrait.php index 7f40955429..8a2aa83625 100644 --- a/ProcessMaker/Models/ScriptDockerNayraTrait.php +++ b/ProcessMaker/Models/ScriptDockerNayraTrait.php @@ -130,12 +130,13 @@ private function bringUpNayra($restart = false) if ($status) { $this->bringUpNayraContainer(); } else { - + $isHost = config('app.nayra_docker_network') === 'host'; + $portMapping = $isHost ? '-e PORT=' . $this->getNayraPort() . ' ' : '-p ' . $this->getNayraPort() . ':8080 '; exec($docker . " stop {$instanceName}_nayra 2>&1 || true"); exec($docker . " rm {$instanceName}_nayra 2>&1 || true"); exec( $docker . ' run -d ' - . ($this->getNayraPort() !== 8080 ? '-p ' . $this->getNayraPort() . ':8080 ' : '') + . ($this->getNayraPort() !== 8080 ? $portMapping : '') . '--name ' . $instanceName . '_nayra ' . (config('app.nayra_docker_network') ? '--network=' . config('app.nayra_docker_network') . ' '