Developer Guide
Running SSH commands on a server
First things first, let's define what is a CoolifyTask
. It's a command (or multiple) that runs over SSH on a server, and that is tracked/monitored. This means it has a status, it has output (we can show it in real-time), and we can know all of this in a persisted Activity
. It's a table for storing activity logs, and we use it in the workflow. It also has schemaless attributes, that might vary depending on the ActivityType.
Helpers:
remoteProcess
: Async "CoolifyTask" that will run in the Queue- Arguments:
- "ArrayOfCommands"
string[]
- A
Server
: Target where the commands will be run - (optional 1) Any
Model
to be theActivity->performedOn
- (optional 2) Type: 'Deployment' and value forTypeUuid
- "ArrayOfCommands"
- Arguments:
instantRemoteProcess
: Immediately run command underProcess::run
and return the ouput.- Arguments:
- "ArrayOfCommands"
string[]
- A
Server
: Target where the commands will be run
- "ArrayOfCommands"
- Note:
Pest Arch
must ensure this helper is just called when running in a queue.
- Arguments:
Understanding Coolify Task
app/Data/CoolifyTaskArgs.php
The parameters to execute a CoolifyTask, organized in a DTO.app/Actions/CoolifyTask/PrepareCoolifyTask.php
This is where a Coolify Task gets started, with its arguments, and an Activity is created to further monitor/trace.app/Jobs/CoolifyTask.php
This runs in a queue worker, by using a persistedActivity
with everything needed to run.app/Actions/CoolifyTask/RunRemoteProcess.php
The actual execution, and Activity updates, so that any monitoring/tracing gets updated.