Install the Go agent

Install the Go agent on your system.


Quickstart

Installing the Sqreen Go agent enables you to monitor the security of your application and block attacks in real-time. Installing Go in your application takes less than a minute:

Standard Go application

1 - Download the Go agent and the SDK using go get:

go get github.com/sqreen/go-agent/...

2 - Import the package agent in the main package of your app:

import _ "github.com/sqreen/go-agent/agent"

3 - Signup to Sqreen to get a token for your app, and store it in the agent's configuration file sqreen.yaml:

token: "Your Token"
app_name: "Your App Name"

Find your organization token by going to Account Settings > Tokens in your Sqreen dashboard, or (https://my.sqreen.com/profile/organization/tokens). Your token is prefixed with org_.

To help Sqreen correctly identify the application when you use an organization token, you also need to set a unique application name.

4 - Install the middleware function for the web framework you use:

5 - Use the SDK package to integrate with Sqreen:

Automated integration

These extra software integration steps are required until we support automated software integration for Go. We are actively working on this key feature to bring you the best Sqreen experience. Feel free to contact us to know more.

Basic configuration

The previous installation steps store the configuration in the sqreen.yaml file containing your Sqreen token and your application name displayed in the dashboard.

Instead of using the Sqreen configuration file, you can also use the SQREEN_TOKEN and SQREEN_APP_NAME environment variables to set up your token and the application name

export SQREEN_TOKEN="your token"
export SQREEN_APP_NAME="Your App Name"

The Sqreen Go agent provides flexible configuration settings. Refer to Configuration of the Go agent for more detailed information.

Install the agent on non production environment

Typically you install the Sqreen agent in your production environment, but you can create several applications by specifying the environment in the application name.

# Set the Sqreen token and the app name, including the environment
cat > sqreen.yaml <<EOF
app_name: "foobar (production)"
token: "SQREEN_TOKEN"
EOF

Uninstall the agent

To uninstall the Sqreen agent, remove the package from your imported packages and dependencies.