Sentry deployment and use

Requirements

  • The Docker 19.03.6 +
  • Compose 1.28.0 +
  • 4 CPU Cores
  • 8 GB RAM
  • 20 GB Free Disk Space

directory

  1. documents
  2. Installation in a centos environment
  3. Installation in Windows
  4. Vue integration
  5. Applets integration

documents

Sentry installation and deployment

Install and deploy Sentry on Windows


Installation in a centos environment

  1. Yum upgrade the docker installation mode
  2. Install the PYTHon3 installation mode
  3. Get the latest Sentry code from Github.
  4. Go to onpremise and run the install.sh script.
  5. Run docker-compose up -d to start the Sentry access

http://127.0.0.1:9000

git clone https://github.com/getsentry/onpremise.git
cd onpremise
./install.sh
docker-compose up -d
Copy the code

You can configure email for the first time


Installation in Windows

The overall process

  • Python3 installation
  • Install Docker Desktop for Windows
  • The hyper – v
  • Turn on WSL (Windows Subsystem for Linux)/WSL upgrade/Windows Ubuntu setup
  • Ubuntu installation docker
  • Pull the Sentry initialization project and install it

Python3 installation

Python3 installation method

Install Docker Desktop for Windows

Download address

After startup, you can view the installation status through docker Version

The hyper – v

Windows10 home edition does not have hyper-v, if any skip

Installation method

Enable WSL (Windows Subsystem for Linux)/WSL upgrade to WSL2

Go to Start -> Settings -> Apps -> Apps and Features to find programs and features

Check hyper-V and the Windows subsystem for Linux

After the reboot, open the Windows store and search for Linux to select and install Ubuntu 18.04LTS

Use the administrator to open Powershell and type

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Copy the code

Restart powerShell and enter WSL-l to view the installed subsystems

Enter WSL –set-version Ubuntu-18.04 2 Upgrade WSL to WSL2. Wait a few minutes and then enter WSL-L-v to check the version

WSL --set-version Ubuntu-18.04 2 Wsl-l-vCopy the code

Ubuntu installation docker

1. sudo apt-get -y install apt-transport-https ca-certificates curl

2. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

3. sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

4. sudo apt-get update

5. sudo apt-get -y install docker-ce-cli
Copy the code

Connect docker in Ubuntu to Docker Desktop for Windows

Open Expose Daemon on TCP ://localhost:2375 without TLS in docker Desktop Settings

Use the following command in Ubuntu

sudo docker ps

unset DOCKER_HOST 

vi ~/.bashrc
Copy the code

Add a line below:

export DOCKER_HOST='unix:///var/run/docker.sock'
Copy the code

Then enter docker version to check the connection result. If the following two pieces of information appear, the connection is successful

Client: Docker Engine - Community
 Version:           20.10.11
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        dea9396
 Built:             Thu Nov 18 00:37:08 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.10
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       e2f740d
  Built:            Mon Oct 25 07:41:30 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Copy the code

Pull the Sentry initialization project and install it

1. Pull code: sentry Download address such as d/work/sentry

2. Use Ubuntu to open the project location on Windows. The Windows disk is mounted under MNT

CD/CD MNT /d/work/sentry Enter the project execution./install.sh At the end of the execution will cause you to create an admin account

Error: Python3.8 is not stuck at the end of execution. Sh –no-user-prompt. Docker-compose run –rm web upgrade create an admin account

Start run docker-compose up -d

Go to http://localhost:9000/


Vue integration

1. Enter admin and create a vue project.

Sentry.init({ Vue, dsn: "http://9ae29221c20347b0a018d87732f6ec2f@localhost:9000/2", release: process.env.RELEASEVERSION, integrations: [ new Integrations.BrowserTracing({ routingInstrumentation: Sentry.vueRouterInstrumentation(router), tracingOrigins: ["localhost", "my-site-url.com", /^\//],}),], tracesSampleRate: 1.0, initialScope: {user: {id: 42, email: "[email protected]"}, } }); InitialScope: data to be set to the initialScope. The initial scope can be defined as an object or callback function release: the version number of the release (custom)Copy the code

Other parameters are described as follows: Address

2. Upload source-map (locate to the actual location of the code)

Plugin: NPM i@sentry /webpack-plugin

(If the installation fails, change to CNPM to install)

Vue.config.js introduces plug-ins

  configureWebpack: config => {
    return {
      plugins: [new SentryPlugin({
      release: process.env.RELEASEVERSION,
      include: "./dist",
    })]
    }
  },
Copy the code

Note: The release version of sentry. init must be the same as the release version configured by configureWebpack, otherwise the issue will be submitted to the wrong version

Common problems during installation

  • Docker installation is too slow. Solution: Switch Ali mirror
  • Sentry execution./install.sh may report a syntax error if the Python environment is 3.8 or higher. Change. / install. Sh — — no – user – prompt

Applets integration

Sentry has no official API to provide for small programs. A third-party library can be used to monitor exceptions on the small program. sentry-mina

npm install sentry-mina --save
Copy the code