Skip to content

sasjs servicepack

The sasjs servicepack command allows administrators to deploy the backend services for a SASjs app using a CI/CD framework of choice. Currently only the deploy action is supported, in future the export and create options will be made available. If you are waiting on these, please raise a github issue.

Prerequisites

Before using this command, you will need to install the SASJS CLI and add a deployment target.

Syntax

sasjs servicepack <action> [additional arguments]

Additional arguments may include:

  • --source (alias -s) - the source JSON file containin the services and folders. Used in the deploy action.
  • --target (alias -t) - the target environment in which to deploy the services. If not specified, default target will be used, mentioned in sasjsconfig.json. The target can exist either in the local project configuration or in the global .sasjsrc file.
  • -f - used to force a deploy, eg even if the folders / services already exist (they will then be overwritten)

Service Pack Structure

The service pack structure is designed to provide the bare minimum for defining remote services. It is normally created as part of the sasjs build comand when the target serverType is VIYA. For info, it looks like this:

{
 "members": [
  {
   "name": "services",
   "type": "folder",
   "members": [
    {
     "name": "admin",
     "type": "folder",
     "members": [
      {
       "name": "exportconfig",
       "type": "service",
       "code": "%put hello world;"
      }]
    }]
  }]
}

sasjs servicepack deploy

Used to deploy a servicepack to a Target. Note that the servicepack will be deployed to the appLoc defined in that target.

Syntax

sasjs servicepack deploy -s source.json -t target

Usage

# create minimal service pack
cat > ./servicepack.json <<'EOL'
{
 "members": [
  {
   "name": "services",
   "type": "folder",
   "members": [
    {
     "name": "public",
     "type": "folder",
     "members": [
      {
       "name": "hello",
       "type": "service",
       "code": "data _null_; file _webout; put 'Hello from SASjs';run;"
      }]
    }]
  }]
}
EOL

# deploy the service pack to the appLoc / server defined in the target (sasjs add)
sasjs servicepack deploy -s ./servicepack.json -t myTarget