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:

Option Alias Description
--source -s The JSON file holding the services and folders to deploy. Required.
--force -f Deploy even where folders and services already exist, overwriting them.
--target -t The target to deploy to. Defaults to defaultTarget in sasjsconfig.json, then the global .sasjsrc.

Note

sasjs servicepack deploys to SAS Viya targets only; on any other server type the command stops with an error.

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