Skip to main content

Prerequisites

Before installing the SCANOSS Go API, ensure the following components are already installed and operational on the target system.

Installation

Before starting the installation, ensure you have received a .tar.gz archive containing the following:
  • Installation scripts
  • API binary
  • Engine binary (optional)
Note: The Engine binary is optional if the SCANOSS Engine is already installed as a prerequisite (see above).

Create a Dedicated User

Create a system user under which the SCANOSS Go API service will run:
sudo useradd --system scanoss

Download the API

Download the latest release for your architecture (AMD64 or ARM64) from the SCANOSS Go API releases, or use the following commands:
mkdir api.go
curl -L https://api.github.com/repos/scanoss/api.go/tarball -o api.go.tar.gz
tar -xzvf api.go.tar.gz -C api.go --strip-components=1

Build the API Binary

Note: This step is only required if you are building from source rather than using a pre-built release binary.
Navigate to the source directory and build the binary for your architecture:
cd api.go
make build_amd   # For AMD64
# or
make build_arm   # For ARM64

Set Up the Environment and Install

Run the setup script included in the package:
cd scripts
./env-setup.sh

Start the Service

sudo systemctl start scanoss-go-api

Verify the Service

Confirm the service is running by checking the following endpoints:
curl -i -X GET http://localhost:5443/
curl -i -X GET http://localhost:5443/api/health
curl -i -X GET http://localhost:5443/api/metrics/all
View logs in real time:
tail -f /var/log/scanoss/api/scanoss-api-prod.log
Check the service status:
sudo systemctl status scanoss-go-api
Stop the service:
sudo systemctl stop scanoss-go-api

Configuration & Tuning

The behaviour of the SCANOSS Go API can be customised by modifying the configuration file located at:
/usr/local/etc/scanoss/api/app-config-prod.json

Default Configuration

{
  "App": {
    "Name": "SCANOSS API Server",
    "Port": "5443",
    "Addr": "",
    "Debug": false,
    "Trace": false,
    "Mode": "prod"
  },
  "Logging": {
    "DynamicLogging": false,
    "DynamicPort": "localhost:60085",
    "ConfigFile": ""
  },
  "Scanning": {
    "WfpLoc": "",
    "ScanBinary": "scanoss",
    "ScanDebug": false,
    "ScanFlags": 0,
    "ScanTimeout": 300,
    "WfpGrouping": 3,
    "Workers": 2,
    "TmpFileDelete": true,
    "KeepFailedWfps": true
  },
  "Tls": {
    "CertFile": "",
    "KeyFile": ""
  }
}

Configuration Parameters

Application Settings (App)

ParameterDescription
App.NameDisplay name for the API, shown on startup.
App.PortPort to which the service binds.
App.AddrHostname or IP address for binding. Leave blank to bind to all interfaces (0.0.0.0), allowing remote connections.
App.DebugEnables debug-level logging when set to true.
App.TraceEnables trace-level logging when set to true.
App.ModeLogging and behaviour mode. Accepted values: prod (production) or dev (development).

Logging Settings (Logging)

ParameterDescription
Logging.DynamicLoggingEnables dynamic log-level adjustment at runtime when set to true.
Logging.DynamicPortHost and port used for runtime log-level control.
Logging.ConfigFileOptional path to a Zap logging configuration file. If left blank, default logging settings are used.

Scanning Settings (Scanning)

WFP refers to Winnowing Fingerprint, the hashing method used by the SCANOSS Engine to fingerprint source files.
ParameterDescription
Scanning.WfpLocDirectory for temporary WFP files. Defaults to the system temporary directory if left blank.
Scanning.ScanBinaryName or absolute path of the SCANOSS Engine binary.
Scanning.ScanDebugEnables debug mode for scan operations when set to true.
Scanning.ScanFlagsDefault flags passed to the SCANOSS Engine. Set to 0 for no additional flags. Refer to the Engine documentation for valid values.
Scanning.ScanTimeoutTimeout in seconds for individual scan commands.
Scanning.WfpGroupingNumber of WFP requests batched per worker. Increase this value to reduce per-request overhead under high load.
Scanning.WorkersNumber of concurrent scan workers. Tune based on available CPU cores and expected request volume.
Scanning.TmpFileDeleteDeletes temporary WFP files after processing when set to true.
Scanning.KeepFailedWfpsRetains WFP files for failed scan operations when set to true. Useful for debugging.

TLS Settings (Tls)

ParameterDescription
Tls.CertFilePath to the TLS certificate file.
Tls.KeyFilePath to the private TLS key file.