preface


Sentry is an open source, real-time error reporting tool that supports front and back ends, other back end languages, and major frameworks. Since it is open source, we can build it on our own server. This article records the process of building and some problems encountered in the process of building. You can also follow this tutorial to build it again

The deployment environment


Ubuntu 16.04

The website provides two deployment modes

1, the docker

2、 python

Here I use the Docker way to install, relatively fast

Update the apt-get package (this may take some time)

apt-get update && apt-get upgrade
Copy the code

1. Install Docker


Wget - qO - https://get.docker.com/ | sh / / check to see if the docker successful installation docker - v / / docker version 18.09.5 prove docker installation is successfulCopy the code

Because docker images are in foreign countries, so the download will be slow, here with the Docker accelerator run the following command

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://4031ebb7.m.daocloud.io
Copy the code

2, installation,pip


Execute the following command to install (note that you need to install Python if you do not have it installed)

wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate # Download file

python get-pip.py # Install

pip -V # See PIP version
// pip 19.0.3 from /usr/local/ lib/python3.5 / dist - packages/PIP (python 3.5)Copy the code

3, installation,docker-compose


The PIP admin tool is used here to install Docker-Compose

Sudo PIP install docker-compose docker-compose --versionCopy the code

After these steps, you can start buildingsentry

4, buildsentry


First pull the Sentry from Github and run it

git clone https://github.com/getsentry/onpremise.git
Copy the code

When you pull it down, you go to the onpremise directory where you can see readme.md. Follow the instructions in this document to install it. (This document is pulled down at the time, if there is any update, the latest document will prevail.)

  1. docker volume create --name=sentry-data && docker volume create --name=sentry-postgres – Make our local database and sentry volumes Docker volumes have to be created manually, as they are declared as external to be more durable.
  2. cp -n .env.example .env – create env config file
  3. docker-compose build – Build and tag the Docker services
  4. docker-compose run --rm web config generate-secret-key – Generate a secret key. Add it to .env as SENTRY_SECRET_KEY.
  5. docker-compose run --rm web upgrade – Build the database. Use the interactive prompts to create a user account.
  6. docker-compose up -d – Lift all services (detached/background mode).
  7. Access your instance at localhost:9000!

5, practice


After the setup is complete, open the localhost:9000 port. The login page is displayed. Enter the email address and password set in the setup

Note !!!!

Enter the account password after login, will enter an initialization interface, to fill in the ROOT URL, if the completion of filling in click save has been prompted to save error, according to the following method to operate can be solved

Edit the file config.yml and add the following paragraph

auth.allow-registration: false
beacon.anonymous: true
mail.from: ""
mail.host: ""
mail.password: ""
mail.port: 465
mail.use-tls: true
mail.username: ""
system.admin-email: ""
system.url-prefix: ""
Copy the code

Then set the sentry version, and run the following command to change CONTAINER to the web name in your docker CONTAINER. You can use the docker ps command to see that my version is onpremise_web_1

docker exec CONTAINER sentry config set sentry:version-configured '9.1.0'
Copy the code

I got an error the first time I did it, so I’m just going to do it again

At this time, when you refresh the page, you may find that you still stay in the initial setting page. Generally, you wait for one or two hours and then refresh the page. I don’t know the specific reason, maybe it is because of the cache problem of Docker running?

After opening it, you can click on the upper right corner to add a new project, add Project, select the language or framework

6. Encountering problems

After downloading the relevant libraries in the client tutorial, you need to fill in DSN. In the project Settings, DSN is found to be empty and cannot be filled in. Then you look online and find that DSN consists of the following formats

http://pubilckey:secretkey@localhost:9000/<project>
Copy the code

Try to trigger an error after filling in this format to the client’s DSN, and you can see that the interface will display the specific error details

7, summary

After the construction, it was integrated into Vue and flask according to the tutorial. The effect was found to be good. After the error was triggered, you could see the detailed information of the error, the specific line, and the detailed information of the terminal that triggered the error. So you have to upload Sourcemap to see which component is wrong. I’m still working on that.