Suite CLI¶
The ITsynch Suite includes a CLI called suite
that is mainly used for
development and deployment purposes. The CLI is developed using the Suite
Framework itself and is located in the Suite monorepo.
It is available by default on the devcontainer and activated deployment
environment and can be invoked using the suite
program:
Global arguments¶
--log-level
All commands support configuring the log level which allows you to drill down into what the CLI is doing under the hood.Verbose
gives you everything.Information
is the default. We recommend usingDebug
for initial troubleshooting.
Manifests¶
In order to simplify the monorepo management and improve DevEx, several YAML Manifests files have been introduced. The Suite CLI supports scaffolding and interacting with these manifests.
Application Manifest¶
The Application Manifest is a deployable workload which is described inside an
application.yaml
file. Currently, dotnet
and angular
applications are
supported.
YAML | |
---|---|
-
The
metadata.name
will be used to conventionally determine several things like container image names, kubernetes service names, etc. -
The
spec.destination
determines where this service should be deployed. Usuallyhub
andsatellite
but others could be used as well. The CLI does not restrict this field to any values, these act similar to labels/annotations. - The
spec.build
determines how this application should be built. These allows configuring several stuff depending on the application kind.
Application Processors¶
The Suite CLI supports several processors for applications. These processors all
support a --from
argument which tells it where to recursively discover
Application Manifests from.
For example, for building container images:
Bash | |
---|---|
For example, for generating database scripts:
GraphQL Fusion Schema¶
In GraphQL Fusion, each backend service needs to generate its GraphQL Schema and a Sub Graph Package for each gateway they publish to. The Sub Graph Package includes the backend's schema, configuration file, and extension file for the target gateway.
The CLI supports generating the GraphQL schema and Sub Graph Package for applications, particularly for backend services.
We can then invoke the CLI to generate the schema and sub graph. The below
command outputs a schema.graphql
and a test-app-bff.fsp
file for each
gateway inside the application's directory.
Note
An application can publish to multiple gateways each one having multiple extension files.
Bash | |
---|---|
For applications that do not publish to any gateway and simply need their schema generated (for validation purposes, etc):
YAML | |
---|---|
GraphQL Fusion Gateway Package¶
For gateways / backends for frontends we need to generate the Fusion Gateway Package, which composes all sub graphs that publish to this gateway in a single package for the gateway to use.
The BFF manifest is quite simple since there's an inversion of control where each backend configures which gateway it publishes to. We only need to configure the ServiceKind to let the CLI know that this dotnet application is actually a BFF.
YAML | |
---|---|
In order to generate the gateway.fgp
file that is needed for fusion, we can
run the below command:
Bash | |
---|---|
This command will build the schema for each subgraph publishing to this gateway,
and will the compose all sub graphs into the gateway.fgp
file which is
required on runtime by Fusion.
Environment Manifest¶
An Environment consists of several applications that need to be deployed several Destinations. File system discovery is used to retrieve the list of applications. Filters can then be applied to select specific applications.
The Environment contains a list of Destinations where such Applications need to be deployed. In order to map which applications should be deployed to which environment, the applications specify the target destination group, and each destination specifies to which group it belongs to.
YAML | |
---|---|
Bash | |
---|---|
The command will generate the files to kickstart an environment from scratch
using the provided environment.yaml
file.
Text Only | |
---|---|
database
: SQL scripts to be run to create the DB structure.deployment
: k8s deployment manifestsmigrations-tail.yaml
latest migration name/id for each application
suite environment update
does the below:
Database Scripts / Migrations¶
When updating an environment we need to generate the DB scripts for each
application by executing dotnet ef migration script <args>
. For a fresh
environment, that works ok. For updating an environment, we need to execute it
providing using the from
argument to tell it from which migration to generate
the script. This generates only the updating sql statements from migration A to
B. Each application has a different migration name, hence we cannot execute it
using a single migration name.
The migrations-tail.yaml
is generated when an environment is updated. It
contains a map of each application to it's latest migration. When updating an
environment from an existing version, this file will be used to obtain the
latest migration for each application in order to generate the script diff.