This guide will walk you through installing, configuring, and managing workflows using the Command Line Interface (CLI). It covers the full process, from installation to controlling and configuring workflows.
First, set up the CLI along with the core extensions. Make sure your system has Go 1.23 or a later version installed.
To download the source code, run the following command in your terminal:
git clone https://github.com/siyul-park/uniflow
Navigate to the downloaded folder:
cd uniflow
To install the required dependencies and build the project, run the following commands:
make init
make build
After the build completes, the executable files will be available in the dist
folder.
Settings can be modified using the .uniflow.toml
file or system environment variables. The key configuration options are:
TOML Key | Environment Variable Key | Example |
---|---|---|
database.url |
DATABASE_URL |
mem:// or mongodb:// |
database.name |
DATABASE_NAME |
- |
collection.charts |
COLLECTION_CHARTS |
charts |
collection.specs |
COLLECTION_SPECS |
nodes |
collection.secrets |
COLLECTION_SECRETS |
secrets |
If you are using MongoDB, enable Change Streams to track resource changes in real time. This requires setting up a replica set.
To run a basic HTTP request handler example using ping.yaml:
- kind: listener
name: listener
protocol: http
port: 8000
ports:
out:
- name: router
port: in
- kind: router
name: router
routes:
- method: GET
path: /ping
port: out[0]
ports:
out[0]:
- name: pong
port: in
- kind: snippet
name: pong
language: text
code: pong
To start the workflow, run:
uniflow start --from-specs example/ping.yaml
Verify it's running by calling the HTTP endpoint:
curl localhost:8000/ping
pong#
uniflow
is primarily used to start and manage the runtime environment.
The start
command executes all node specifications in the specified namespace. If no namespace is provided, the default namespace (default
) is used.
./dist/uniflow start --namespace default
If the namespace is empty, you can provide an initial node specification using the --from-specs
flag:
./dist/uniflow start --namespace default --from-specs examples/specs.yaml
You can specify an initial secrets file with the --from-secrets
flag:
./dist/uniflow start --namespace default --from-secrets examples/secrets.yaml
Charts can be initialized using the --from-charts
flag:
./dist/uniflow start --namespace default --from-charts examples/charts.yaml
uniflowctl
is a command used to manage resources within a namespace.
The apply
command applies the contents of a specified file to the namespace. If no namespace is specified, the default
namespace is used.
./dist/uniflowctl apply nodes --namespace default --filename examples/specs.yaml
To apply secrets:
./dist/uniflowctl apply secrets --namespace default --filename examples/secrets.yaml
To apply charts:
./dist/uniflowctl apply charts --namespace default --filename examples/charts.yaml
The delete
command removes all resources defined in the specified file. If no namespace is specified, the default
namespace is used.
./dist/uniflowctl delete nodes --namespace default --filename examples/specs.yaml
To delete secrets:
./dist/uniflowctl delete secrets --namespace default --filename examples/secrets.yaml
To delete charts:
./dist/uniflowctl delete charts --namespace default --filename examples/charts.yaml
The get
command retrieves all resources in the specified namespace. If no namespace is specified, the default
namespace is used.
./dist/uniflowctl get nodes --namespace default
To retrieve secrets:
./dist/uniflowctl get secrets --namespace default
To retrieve charts:
./dist/uniflowctl get charts --namespace default
To modify node specifications via the HTTP API, set up workflows accordingly. You can use the syscall
node provided in
the core extensions:
kind: syscall
opcode: specs.create # or specs.read, specs.update, specs.delete
Refer to the workflow examples to get started. If needed, you can add authentication and authorization processes. These runtime control workflows are typically defined in the system
namespace.